From 2cec2cb8225e1b4a7be7480db1805d1688f0152c Mon Sep 17 00:00:00 2001 From: dhanabalan Date: Sat, 19 Apr 2025 19:24:15 +0530 Subject: [PATCH] Double scanning issue updation --- .../Pages/CreateInvoiceValidation.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/app/Filament/Resources/InvoiceValidationResource/Pages/CreateInvoiceValidation.php b/app/Filament/Resources/InvoiceValidationResource/Pages/CreateInvoiceValidation.php index 4bfc814c0..5d18f9a2b 100644 --- a/app/Filament/Resources/InvoiceValidationResource/Pages/CreateInvoiceValidation.php +++ b/app/Filament/Resources/InvoiceValidationResource/Pages/CreateInvoiceValidation.php @@ -1024,8 +1024,9 @@ class CreateInvoiceValidation extends CreateRecord } } - public function processSerialNumber($serialNumber) + public function processSerialNumber($serNo) { + $serialNumber = null; $plantId = $this->form->getState()['plant_id']; $this->plantId = $plantId; $invoiceNumber = $this->form->getState()['invoice_number']; @@ -1104,7 +1105,7 @@ class CreateInvoiceValidation extends CreateRecord $itemCode = ''; $batchNumber = ''; - if (preg_match($pattern1, $serialNumber, $matches)) { + if (preg_match($pattern1, $serNo, $matches)) { $itemCode = $matches['item_code']; $this->currentItemCode = $itemCode; $batchNumber = $matches['batch_number']; @@ -1144,7 +1145,7 @@ class CreateInvoiceValidation extends CreateRecord ]); return; } - } elseif (preg_match($pattern2, $serialNumber, $matches)) { + } elseif (preg_match($pattern2, $serNo, $matches)) { $itemCode = $matches['item_code']; $this->currentItemCode = $itemCode; $batchNumber = null; // batch_number not present in this pattern @@ -1187,6 +1188,7 @@ class CreateInvoiceValidation extends CreateRecord } else { $itemCode = null; $batchNumber = null; + $serNo = null; $serialNumber = null; Notification::make() @@ -1412,7 +1414,7 @@ class CreateInvoiceValidation extends CreateRecord $this->dispatch( 'refreshInvoiceData', invoiceNumber: $invoiceNumber, plantId: $plantId); } - if (!preg_match('/^([a-zA-Z0-9]{6,})\|([a-zA-Z0-9]{8,})(?:\/[MmPpCc])?$/', $serialNumber, $matches)) { + if (!preg_match('/^([a-zA-Z0-9]{6,})\|([a-zA-Z0-9]{8,})(?:\/[MmPpCc])?$/', $serNo, $matches)) { Notification::make() ->danger() ->title('Invalid Serial QR Format') @@ -1429,7 +1431,7 @@ class CreateInvoiceValidation extends CreateRecord return; } - if (preg_match('/^([a-zA-Z0-9]+)\|([a-zA-Z0-9]+(?:\/[MmPpCc]?)?)$/', $serialNumber, $matches)) + if (preg_match('/^([a-zA-Z0-9]+)\|([a-zA-Z0-9]+(?:\/[MmPpCc]?)?)$/', $serNo, $matches)) { $itemCode = $matches[1]; $serialNumber = $matches[2];