From 43435c911553ee8f7f4c20a45e2c3af23df29fc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CVeLiTi=E2=80=9D?= <“info@veliti.nl”> Date: Mon, 15 Apr 2024 09:29:29 +0200 Subject: [PATCH] ProductrowID for service koffer --- api/v0/post/application.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/api/v0/post/application.php b/api/v0/post/application.php index 6052da7..20e25bc 100644 --- a/api/v0/post/application.php +++ b/api/v0/post/application.php @@ -63,9 +63,16 @@ if (!empty($post_content['sn']) && !empty($post_content['testdetails'])) { $input_type = $post_content['type']; $testdetails = json_encode($post_content['testdetails']); $serial = $post_content['sn']; - $productrowid = (isset($post_content['testdetails']['logdetails']['PN']) && (!empty($post_content['testdetails']['logdetails']['PN']) || $post_content['testdetails']['logdetails']['PN'] != ''))? $post_content['testdetails']['logdetails']['PN'] : 0; //default product for equipment create + //$productrowid = (isset($post_content['testdetails']['logdetails']['PN']) && (!empty($post_content['testdetails']['logdetails']['PN']) || $post_content['testdetails']['logdetails']['PN'] != ''))? $post_content['testdetails']['logdetails']['PN'] : 0; //default product for equipment create $sn_service = $post_content['testdetails']['external_device_sn'] ?? ''; + //GET PRODUCT ROWID FOR EQUIPMENT CREATE + if (isset($post_content['testdetails']['logdetails']['PN']) && (!empty($post_content['testdetails']['logdetails']['PN']) || $post_content['testdetails']['logdetails']['PN'] != '')){ + $pn2 = preg_replace("/[^0-9]/","",$post_content['testdetails']['logdetails']['PN']); + $productrowid = ltrim($pn2, "0"); + } else { + $productrowid = 0; //default product for equipment create + } // +++++++++++++++++++++++++++++++++++++++++++++++++++++++ // Define action based on historytype // +++++++++++++++++++++++++++++++++++++++++++++++++++++++