removed unwanted logic in panel box validation #774
@@ -296,10 +296,17 @@ class PanelBoxValidationResource extends Resource
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$parts = explode('/', $state);
|
// $parts = explode('/', $state);
|
||||||
|
|
||||||
$itemCode = trim($parts[1] ?? ''); // item code
|
// $itemCode = trim($parts[1] ?? ''); // item code
|
||||||
$serialNumber = trim($parts[2] ?? ''); // serial number
|
// $serialNumber = trim($parts[2] ?? ''); // serial number
|
||||||
|
|
||||||
|
$parts = array_map('trim', explode('/', $state));
|
||||||
|
|
||||||
|
$serialNumber = end($parts); // last part
|
||||||
|
|
||||||
|
// item code depends on format
|
||||||
|
$itemCode = $parts[1] ?? '';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Store serial number before resetting fields
|
// Store serial number before resetting fields
|
||||||
@@ -324,31 +331,35 @@ class PanelBoxValidationResource extends Resource
|
|||||||
$set('validation1_image_url', null);
|
$set('validation1_image_url', null);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
} elseif ($serialNumber == '') {
|
}
|
||||||
$set('validationError', 'Waiting for full QR scan...');
|
//elseif ($serialNumber == '') {
|
||||||
|
// $set('validationError', 'Waiting for full QR scan...');
|
||||||
|
|
||||||
return;
|
// return;
|
||||||
} elseif (strlen($serialNumber) < 9) {
|
// } elseif (strlen($serialNumber) < 9) {
|
||||||
$set('validationError', 'Serial Number must be at least 9 digits.');
|
// $set('validationError', 'Serial Number must be at least 9 digits.');
|
||||||
$set('part_validation_type', null);
|
// $set('part_validation_type', null);
|
||||||
$set('show_validation_image', false);
|
// $set('show_validation_image', false);
|
||||||
$set('part_validation_type_options', []);
|
// $set('part_validation_type_options', []);
|
||||||
$set('validation1_image_url', null);
|
// $set('validation1_image_url', null);
|
||||||
|
|
||||||
return;
|
// return;
|
||||||
} elseif (! ctype_alnum($serialNumber)) {
|
// } elseif (! ctype_alnum($serialNumber)) {
|
||||||
$set('validationError', 'Serial Number should contain alpha-numeric values.');
|
// $set('validationError', 'Serial Number should contain alpha-numeric values.');
|
||||||
$set('item_id', null);
|
// $set('item_id', null);
|
||||||
$set('part_validation_type', null);
|
// $set('part_validation_type', null);
|
||||||
$set('show_validation_image', false);
|
// $set('show_validation_image', false);
|
||||||
$set('part_validation_type_options', []);
|
// $set('part_validation_type_options', []);
|
||||||
$set('validation1_image_url', null);
|
// $set('validation1_image_url', null);
|
||||||
|
|
||||||
return;
|
// return;
|
||||||
} else {
|
// }
|
||||||
|
|
||||||
|
else {
|
||||||
$set('validationError', null);
|
$set('validationError', null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$plantId = $get('plant_id'); // Get selected plant
|
$plantId = $get('plant_id'); // Get selected plant
|
||||||
|
|
||||||
if (! $plantId) {
|
if (! $plantId) {
|
||||||
|
|||||||
Reference in New Issue
Block a user