diff --git a/app/Filament/Imports/ReworkLocatorInvoiceValidationImporter.php b/app/Filament/Imports/ReworkLocatorInvoiceValidationImporter.php index 0d139a9..b365952 100644 --- a/app/Filament/Imports/ReworkLocatorInvoiceValidationImporter.php +++ b/app/Filament/Imports/ReworkLocatorInvoiceValidationImporter.php @@ -213,27 +213,24 @@ class ReworkLocatorInvoiceValidationImporter extends Importer $warnMsg[] = "Invalid 'Scanned DateTime' format. Expected DD-MM-YYYY HH:MM:SS"; } - if (Str::length($updatedAt) > 0) - { - foreach ($formats as $format) { - try { - $uDateTime = Carbon::createFromFormat($format, $updatedAt); - break; - } catch (\Exception $e) { - // Optionally collect warning messages - // $warnMsg[] = "Date format mismatch with format: $format"; - } + foreach ($formats as $format) { + try { + $uDateTime = Carbon::createFromFormat($format, $updatedAt); + break; + } catch (\Exception $e) { + // Optionally collect warning messages + // $warnMsg[] = "Date format mismatch with format: $format"; } + } - if (!isset($uDateTime)) { - $warnMsg[] = "Invalid 'Updated DateTime' format. Expected DD-MM-YYYY HH:MM:SS"; - } - else - { - if (isset($cDateTime) && isset($uDateTime)) { - if ($cDateTime->greaterThan($uDateTime)) { - $warnMsg[] = "'Created DataTime' is greater than 'Updated DateTime'."; - } + if (!isset($uDateTime)) { + $warnMsg[] = "Invalid 'Updated DateTime' format. Expected DD-MM-YYYY HH:MM:SS"; + } + else + { + if (isset($cDateTime) && isset($uDateTime)) { + if ($cDateTime->greaterThan($uDateTime)) { + $warnMsg[] = "'Created DataTime' is greater than 'Updated DateTime'."; } } } @@ -280,9 +277,9 @@ class ReworkLocatorInvoiceValidationImporter extends Importer 'scanned_status' => $scannedStat, 'upload_status' => $uploadStat, 'created_at' => $cDateTime->format('Y-m-d H:i:s'), - 'scanned_at' => (Str::length($scannedAt) > 0) ? $sDateTime->format('Y-m-d H:i:s') : null, - 'updated_at' => (Str::length($updatedAt) > 0) ? $uDateTime->format('Y-m-d H:i:s') : null, - 'reworked_at' => (Str::length($reworkedAt) > 0) ? $rDateTime->format('Y-m-d H:i:s') : null, + 'scanned_at' => $sDateTime->format('Y-m-d H:i:s'), + 'updated_at' => $uDateTime->format('Y-m-d H:i:s'), + 'reworked_at' => $rDateTime->format('Y-m-d H:i:s'), 'created_by' => $createdBy, 'scanned_by' => $scannedBy, 'updated_by' => $updatedBy,