Merge pull request 'Added logic in name plate panel of panel box validation' (#994) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 15s
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 15s
Reviewed-on: #994
This commit was merged in pull request #994.
This commit is contained in:
@@ -1179,16 +1179,6 @@ class PanelBoxValidationResource extends Resource
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!preg_match('/^\d+\/\d+\/\d+\/\d+$/', $state)) {
|
|
||||||
Notification::make()
|
|
||||||
->title('Invalid QR Format')
|
|
||||||
->body('Expected format: plantcode/itemcode/yearmm/serialnumber')
|
|
||||||
->danger()
|
|
||||||
->send();
|
|
||||||
$set('pack_slip_panel_qr', null);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$parts = explode('/', $state);
|
$parts = explode('/', $state);
|
||||||
|
|
||||||
if (count($parts) < 3) {
|
if (count($parts) < 3) {
|
||||||
@@ -1264,18 +1254,22 @@ class PanelBoxValidationResource extends Resource
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!preg_match('/^\d+\/\d+\/\d+\/\d+$/', $state)) {
|
$parts = explode('/', $state);
|
||||||
|
|
||||||
|
if (count($parts) < 3) {
|
||||||
|
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title('Invalid QR Format')
|
->title('Invalid QR Format')
|
||||||
->body('Expected format: plantcode/itemcode/yearmm/serialnumber')
|
->body('Expected format: plantcode/itemcode/yearmm/serialnumber (Or) plantcode/panelboxcode/serialnumber')
|
||||||
->danger()
|
->danger()
|
||||||
->send();
|
->send();
|
||||||
$set('serial_number_panel_qr', null);
|
$set('item_id', null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$parts = explode('/', $state);
|
$extracted = trim(implode('/', array_slice($parts, 2)));
|
||||||
$extracted = trim(end($parts));
|
|
||||||
|
$expected = $get('serial_number');
|
||||||
|
|
||||||
if ($extracted == '') {
|
if ($extracted == '') {
|
||||||
$set('namePlatePanelError', "SerialNumber cant't be empty!");
|
$set('namePlatePanelError', "SerialNumber cant't be empty!");
|
||||||
@@ -1294,13 +1288,13 @@ class PanelBoxValidationResource extends Resource
|
|||||||
$set('namePlatePanelError', null);
|
$set('namePlatePanelError', null);
|
||||||
$set('name_plate_panel_qr', $extracted);
|
$set('name_plate_panel_qr', $extracted);
|
||||||
$set('name_plate_panel', '1');
|
$set('name_plate_panel', '1');
|
||||||
$panelParts = array_map('trim', explode('/', $state));
|
$panelParts = explode('/', $state);
|
||||||
|
|
||||||
if (count($panelParts) != 4) {
|
if (count($panelParts) < 3) {
|
||||||
|
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title('Invalid QR Format')
|
->title('Invalid QR Format')
|
||||||
->body('Expected format: plantcode/itemcode/yearmm/serialnumber')
|
->body('Expected format: plantcode/itemcode/yearmm/serialnumber (Or) plantcode/panelboxcode/serialnumber')
|
||||||
->danger()
|
->danger()
|
||||||
->send();
|
->send();
|
||||||
$set('item_id', null);
|
$set('item_id', null);
|
||||||
@@ -1309,9 +1303,7 @@ class PanelBoxValidationResource extends Resource
|
|||||||
|
|
||||||
$supplier = $panelParts[0];
|
$supplier = $panelParts[0];
|
||||||
$panelBoxCode = $panelParts[1];
|
$panelBoxCode = $panelParts[1];
|
||||||
$yearMonth = $panelParts[2];
|
$panelBoxSerialNo = implode('/', array_slice($panelParts, 2));
|
||||||
$serialNumber = $panelParts[3];
|
|
||||||
$panelBoxSerialNo = $yearMonth . $serialNumber;
|
|
||||||
|
|
||||||
$set('panel_box_supplier', $supplier);
|
$set('panel_box_supplier', $supplier);
|
||||||
$set('panel_box_serial_number', $panelBoxSerialNo);
|
$set('panel_box_serial_number', $panelBoxSerialNo);
|
||||||
|
|||||||
Reference in New Issue
Block a user