Updated validation on import rework data
This commit is contained in:
@@ -213,27 +213,24 @@ class ReworkLocatorInvoiceValidationImporter extends Importer
|
|||||||
$warnMsg[] = "Invalid 'Scanned DateTime' format. Expected DD-MM-YYYY HH:MM:SS";
|
$warnMsg[] = "Invalid 'Scanned DateTime' format. Expected DD-MM-YYYY HH:MM:SS";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Str::length($updatedAt) > 0)
|
foreach ($formats as $format) {
|
||||||
{
|
try {
|
||||||
foreach ($formats as $format) {
|
$uDateTime = Carbon::createFromFormat($format, $updatedAt);
|
||||||
try {
|
break;
|
||||||
$uDateTime = Carbon::createFromFormat($format, $updatedAt);
|
} catch (\Exception $e) {
|
||||||
break;
|
// Optionally collect warning messages
|
||||||
} catch (\Exception $e) {
|
// $warnMsg[] = "Date format mismatch with format: $format";
|
||||||
// Optionally collect warning messages
|
|
||||||
// $warnMsg[] = "Date format mismatch with format: $format";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!isset($uDateTime)) {
|
if (!isset($uDateTime)) {
|
||||||
$warnMsg[] = "Invalid 'Updated DateTime' format. Expected DD-MM-YYYY HH:MM:SS";
|
$warnMsg[] = "Invalid 'Updated DateTime' format. Expected DD-MM-YYYY HH:MM:SS";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (isset($cDateTime) && isset($uDateTime)) {
|
if (isset($cDateTime) && isset($uDateTime)) {
|
||||||
if ($cDateTime->greaterThan($uDateTime)) {
|
if ($cDateTime->greaterThan($uDateTime)) {
|
||||||
$warnMsg[] = "'Created DataTime' is greater than 'Updated DateTime'.";
|
$warnMsg[] = "'Created DataTime' is greater than 'Updated DateTime'.";
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -280,9 +277,9 @@ class ReworkLocatorInvoiceValidationImporter extends Importer
|
|||||||
'scanned_status' => $scannedStat,
|
'scanned_status' => $scannedStat,
|
||||||
'upload_status' => $uploadStat,
|
'upload_status' => $uploadStat,
|
||||||
'created_at' => $cDateTime->format('Y-m-d H:i:s'),
|
'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,
|
'scanned_at' => $sDateTime->format('Y-m-d H:i:s'),
|
||||||
'updated_at' => (Str::length($updatedAt) > 0) ? $uDateTime->format('Y-m-d H:i:s') : null,
|
'updated_at' => $uDateTime->format('Y-m-d H:i:s'),
|
||||||
'reworked_at' => (Str::length($reworkedAt) > 0) ? $rDateTime->format('Y-m-d H:i:s') : null,
|
'reworked_at' => $rDateTime->format('Y-m-d H:i:s'),
|
||||||
'created_by' => $createdBy,
|
'created_by' => $createdBy,
|
||||||
'scanned_by' => $scannedBy,
|
'scanned_by' => $scannedBy,
|
||||||
'updated_by' => $updatedBy,
|
'updated_by' => $updatedBy,
|
||||||
|
|||||||
Reference in New Issue
Block a user