Merge pull request 'Updated plant code length should be 4 to 7' (#561) from ranjith-dev into master
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled

Reviewed-on: #561
This commit was merged in pull request #561.
This commit is contained in:
2026-04-30 10:15:01 +00:00
5 changed files with 13 additions and 7 deletions

View File

@@ -66,7 +66,7 @@ class PlantImporter extends Importer
$warnMsg[] = 'Code should contain only numeric values!';
} elseif (Str::length($code) < 4 || Str::length($code) > 7) {
$warnMsg[] = 'Code must be between 4 and 7 digits only!';
} elseif (! preg_match('/^[1-9]\d{6,}$/', $code)) {
} elseif (! preg_match('/^[1-9]\d{3,6}$/', $code)) {
$warnMsg[] = 'Invalid plant code found!';
}
if ($name == null || $name == '' || ! $name) {

View File

@@ -127,7 +127,7 @@ class ProcessOrderImporter extends Importer
if ($plantCod == null || $plantCod == '') {
$warnMsg[] = "Plant code can't be empty!";
} elseif (Str::length($plantCod) < 4 || ! is_numeric($plantCod) || ! preg_match('/^[1-9]\d{3,}$/', $plantCod)) {
} elseif (Str::length($plantCod) < 4 || ! is_numeric($plantCod) || ! preg_match('/^[1-9]\d{3,6}$/', $plantCod)) {
$warnMsg[] = 'Invalid plant code found';
}
if ($iCode == null || $iCode == '') {

View File

@@ -100,7 +100,7 @@ class ProductionOrderImporter extends Importer
$warnMsg[] = 'Plant code should contain only numeric values!';
} elseif (Str::length($plantCod) < 4 || Str::length($plantCod) > 7) {
$warnMsg[] = 'Plant code must be between 4 and 7 digits only!';
} elseif (! preg_match('/^[1-9]\d{6,}$/', $plantCod)) {
} elseif (! preg_match('/^[1-9]\d{3,6}$/', $plantCod)) {
$warnMsg[] = 'Invalid plant code found!';
}

View File

@@ -182,8 +182,14 @@ class StickerMasterImporter extends Importer
$createdBy = Filament::auth()->user()->name;
$updatedBy = Filament::auth()->user()->name;
if (Str::length($plantCod) < 4 || ! is_numeric($plantCod) || ! preg_match('/^[1-9]\d{3,}$/', $plantCod)) {
$warnMsg[] = 'Invalid plant code found';
if ($plantCod == null || $plantCod == '') {
$warnMsg[] = "Plant code can't be empty!";
} elseif (! is_numeric($plantCod)) {
$warnMsg[] = 'Plant code should contain only numeric values!';
} elseif (Str::length($plantCod) < 4 || Str::length($plantCod) > 7) {
$warnMsg[] = 'Plant code must be between 4 and 7 digits only!';
} elseif (! preg_match('/^[1-9]\d{3,6}$/', $plantCod)) {
$warnMsg[] = 'Invalid plant code found!';
} else {
$plant = Plant::where('code', $plantCod)->first();
}

View File

@@ -58,7 +58,7 @@ class StickerMasterController extends Controller
'status_code' => 'ERROR',
'status_description' => 'Plant code must be between 4 and 7 digits only!',
], 400);
} elseif (! preg_match('/^[1-9]\d{3,}$/', $plantCode)) {
} elseif (! preg_match('/^[1-9]\d{3,6}$/', $plantCode)) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => 'Invalid plant code found!',
@@ -190,7 +190,7 @@ class StickerMasterController extends Controller
'status_code' => 'ERROR',
'status_description' => 'Plant code must be between 4 and 7 digits only!',
], 400);
} elseif (! preg_match('/^[1-9]\d{3,}$/', $plantCode)) {
} elseif (! preg_match('/^[1-9]\d{3,6}$/', $plantCode)) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => 'Invalid plant code found!',