Improve error messages for clarity and consistency in InvoiceOutValidationResource
This commit is contained in:
@@ -308,7 +308,7 @@ class InvoiceOutValidationResource extends Resource
|
||||
}
|
||||
}
|
||||
|
||||
$errorMsg = 'Duplicate Document Number found in Uploaded File:<br>';
|
||||
$errorMsg = 'Duplicate Document Number found in Uploaded File :<br>';
|
||||
|
||||
foreach ($duplicateGroupedByPlantQr as $plantCode => $qrCodes) {
|
||||
$uniqueQrCodes = array_unique($qrCodes);
|
||||
@@ -394,12 +394,12 @@ class InvoiceOutValidationResource extends Resource
|
||||
$scannedBy = trim($row[4]);
|
||||
|
||||
if (empty($qrcode)) {
|
||||
throw new \Exception("Missing QR Code");
|
||||
throw new \Exception("Row '{$rowNumber}' Missing QR Code");
|
||||
}
|
||||
|
||||
$plant = Plant::where('code', $plantCode)->first();
|
||||
if (!$plant) {
|
||||
throw new \Exception("Invalid plant code: {$plantCode}");
|
||||
throw new \Exception("Invalid plant code : '{$plantCode}'");
|
||||
}
|
||||
|
||||
$formattedDate = null;
|
||||
@@ -416,7 +416,7 @@ class InvoiceOutValidationResource extends Resource
|
||||
->format('Y-m-d H:i:s');
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
throw new \Exception("Invalid date format: {$scannedAt}");
|
||||
throw new \Exception("Invalid date format : '{$scannedAt}'");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -456,12 +456,11 @@ class InvoiceOutValidationResource extends Resource
|
||||
}
|
||||
|
||||
$successCount++;
|
||||
|
||||
} catch (\Exception $e) {
|
||||
$failedRecords[] = [
|
||||
'row' => $rowNumber,
|
||||
'qrcode' => $qrcode ?? null,
|
||||
'error' => $e->getMessage(),
|
||||
'error' => $e->getMessage()
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user