Updated created_by and updated_by column value passing logic
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
This commit is contained in:
@@ -216,18 +216,18 @@ class MotorTestingMasterImporter extends Importer
|
|||||||
->label('Plant Code')
|
->label('Plant Code')
|
||||||
->relationship(resolveUsing: 'code')
|
->relationship(resolveUsing: 'code')
|
||||||
->rules(['required']),
|
->rules(['required']),
|
||||||
ImportColumn::make('created_by')
|
// ImportColumn::make('created_by')
|
||||||
->requiredMapping()
|
// ->requiredMapping()
|
||||||
->exampleHeader('Created By')
|
// ->exampleHeader('Created By')
|
||||||
->example([Filament::auth()->user()->name, Filament::auth()->user()->name, Filament::auth()->user()->name])
|
// ->example([Filament::auth()->user()->name, Filament::auth()->user()->name, Filament::auth()->user()->name])
|
||||||
->label('Created By')
|
// ->label('Created By')
|
||||||
->rules(['required']),
|
// ->rules(['required']),
|
||||||
ImportColumn::make('updated_by')
|
// ImportColumn::make('updated_by')
|
||||||
->requiredMapping()
|
// ->requiredMapping()
|
||||||
->exampleHeader('Updated By')
|
// ->exampleHeader('Updated By')
|
||||||
->example([Filament::auth()->user()->name, Filament::auth()->user()->name, Filament::auth()->user()->name])
|
// ->example([Filament::auth()->user()->name, Filament::auth()->user()->name, Filament::auth()->user()->name])
|
||||||
->label('Updated By')
|
// ->label('Updated By')
|
||||||
->rules(['required']),
|
// ->rules(['required']),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -266,8 +266,8 @@ class MotorTestingMasterImporter extends Importer
|
|||||||
$noloadPowUl = trim($this->data['noload_pow_ul']);
|
$noloadPowUl = trim($this->data['noload_pow_ul']);
|
||||||
$noloadSpdLl = trim($this->data['noload_spd_ll']);
|
$noloadSpdLl = trim($this->data['noload_spd_ll']);
|
||||||
$noloadSpdUl = trim($this->data['noload_spd_ul']);
|
$noloadSpdUl = trim($this->data['noload_spd_ul']);
|
||||||
$createdBy = trim($this->data['created_by']);
|
$createdBy = Filament::auth()->user()->name;
|
||||||
$updatedBy = trim($this->data['updated_by']);
|
$updatedBy = Filament::auth()->user()->name;
|
||||||
|
|
||||||
$plant = null;
|
$plant = null;
|
||||||
if (Str::length($plantCod) < 4 || ! is_numeric($plantCod) || ! preg_match('/^[1-9]\d{3,}$/', $plantCod)) {
|
if (Str::length($plantCod) < 4 || ! is_numeric($plantCod) || ! preg_match('/^[1-9]\d{3,}$/', $plantCod)) {
|
||||||
@@ -387,19 +387,8 @@ class MotorTestingMasterImporter extends Importer
|
|||||||
$created = $oldCode->created_by ? User::where('name', $oldCode->created_by)->first() : null;
|
$created = $oldCode->created_by ? User::where('name', $oldCode->created_by)->first() : null;
|
||||||
if (! $created) {
|
if (! $created) {
|
||||||
$warnMsg[] = 'Created by not found on update';
|
$warnMsg[] = 'Created by not found on update';
|
||||||
}
|
} else {
|
||||||
$updated = User::where('name', $updatedBy)->first();
|
$createdBy = $created->name;
|
||||||
if (! $updated) {
|
|
||||||
$warnMsg[] = 'Updated by not found on update';
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$created = User::where('name', $createdBy)->first();
|
|
||||||
if (! $created) {
|
|
||||||
$warnMsg[] = 'Created by not found';
|
|
||||||
}
|
|
||||||
$updated = User::where('name', $updatedBy)->first();
|
|
||||||
if (! $updated) {
|
|
||||||
$warnMsg[] = 'Updated by not found';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -444,8 +433,8 @@ class MotorTestingMasterImporter extends Importer
|
|||||||
'noload_pow_ul' => $noloadPowUl,
|
'noload_pow_ul' => $noloadPowUl,
|
||||||
'noload_spd_ll' => $noloadSpdLl,
|
'noload_spd_ll' => $noloadSpdLl,
|
||||||
'noload_spd_ul' => $noloadSpdUl,
|
'noload_spd_ul' => $noloadSpdUl,
|
||||||
'created_by' => $created->name,
|
'created_by' => $createdBy,
|
||||||
'updated_by' => $updated->name,
|
'updated_by' => $updatedBy,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user