Updated item code validation logic to allow alpha numeric #1482

Merged
jothi merged 1 commits from ranjith-dev into master 2026-11-19 14:10:15 +00:00

View File

@@ -17,7 +17,6 @@ use Filament\Actions\Imports\Importer;
use Filament\Actions\Imports\Models\Import; use Filament\Actions\Imports\Models\Import;
use Filament\Facades\Filament; use Filament\Facades\Filament;
use Str; use Str;
use Illuminate\Support\Facades\Log;
class ProductionPlanImporter extends Importer class ProductionPlanImporter extends Importer
{ {
@@ -138,7 +137,7 @@ class ProductionPlanImporter extends Importer
$warnMsg[] = 'Plant not found'; $warnMsg[] = 'Plant not found';
} }
if (Str::length($itemCod) < 6 || ! is_numeric($itemCod)) { if (Str::length($itemCod) < 6 || ! ctype_alnum($itemCod)) {
$warnMsg[] = 'Invalid item code found'; $warnMsg[] = 'Invalid item code found';
} else { } else {
$item = Item::where('code', $itemCod)->first(); $item = Item::where('code', $itemCod)->first();
@@ -154,8 +153,7 @@ class ProductionPlanImporter extends Importer
if (! $itemAgaPlant) { if (! $itemAgaPlant) {
$warnMsg[] = 'Item not found against plant code'; $warnMsg[] = 'Item not found against plant code';
} } else {
else {
$line = $itemAgaPlant->line_id; $line = $itemAgaPlant->line_id;
if (! $line) { if (! $line) {
@@ -207,7 +205,6 @@ class ProductionPlanImporter extends Importer
throw new RowImportFailedException(implode(', ', $warnMsg)); throw new RowImportFailedException(implode(', ', $warnMsg));
} }
$recordDate = now(); $recordDate = now();
$month = $recordDate->month; $month = $recordDate->month;
$year = $recordDate->year; $year = $recordDate->year;
@@ -346,9 +343,6 @@ class ProductionPlanImporter extends Importer
} }
// ..Working Logic // ..Working Logic
// $recordDate = now(); // $recordDate = now();