Added skip plant if not exist on user importer page
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
This commit is contained in:
@@ -18,7 +18,7 @@ class UserImporter extends Importer
|
|||||||
public static function getColumns(): array
|
public static function getColumns(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
ImportColumn::make('plant')
|
ImportColumn::make('plant_id')
|
||||||
->requiredMapping()
|
->requiredMapping()
|
||||||
->exampleHeader('Plant Code')
|
->exampleHeader('Plant Code')
|
||||||
->example('1000')
|
->example('1000')
|
||||||
@@ -54,10 +54,13 @@ class UserImporter extends Importer
|
|||||||
public function resolveRecord(): ?User
|
public function resolveRecord(): ?User
|
||||||
{
|
{
|
||||||
$warnMsg = [];
|
$warnMsg = [];
|
||||||
$plantCod = $this->data['plant'];
|
$plantCod = $this->data['plant_id'];
|
||||||
$plant = null;
|
$plant = null;
|
||||||
if (Str::length($plantCod) < 4 || ! is_numeric($plantCod) || ! preg_match('/^[1-9]\d{3,}$/', $plantCod)) {
|
if (Str::length($plantCod) > 0 && (Str::length($plantCod) < 4 || ! is_numeric($plantCod) || ! preg_match('/^[1-9]\d{3,}$/', $plantCod))) {
|
||||||
$warnMsg[] = 'Invalid plant code found!';
|
$warnMsg[] = 'Invalid plant code found!';
|
||||||
|
} elseif (Str::length($plantCod) <= 0) {
|
||||||
|
$plant = null;
|
||||||
|
$plantCod = null;
|
||||||
} else {
|
} else {
|
||||||
$plant = Plant::where('code', $plantCod)->first();
|
$plant = Plant::where('code', $plantCod)->first();
|
||||||
if (! $plant) {
|
if (! $plant) {
|
||||||
|
|||||||
Reference in New Issue
Block a user