From 0d60fe1a9d3e574bd6b9cbf471bd50650d008868 Mon Sep 17 00:00:00 2001 From: Korina Cordero Date: Mon, 18 Nov 2019 04:42:55 +0000 Subject: [PATCH] Add reason for invalid warranty. #258 --- src/Controller/WarrantyController.php | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/Controller/WarrantyController.php b/src/Controller/WarrantyController.php index 9385d157..ede93334 100644 --- a/src/Controller/WarrantyController.php +++ b/src/Controller/WarrantyController.php @@ -26,6 +26,11 @@ use Catalyst\MenuBundle\Annotation\Menu; class WarrantyController extends Controller { + const PURCHASE_DATE_EMPTY = 'Purchase date missing.'; + const PLATE_NUM_EMPTY = 'Plate number missing.'; + const SERIAL_EMPTY = 'Serial number missing.'; + const PURCHASE_DATE_INVALID = 'Invalid purchase date.'; + /** * @Menu(selected="warranty_list") */ @@ -398,6 +403,7 @@ class WarrantyController extends Controller 'Application Type ID', 'Battery ID', 'Ownership Type', + 'Reason Warranty Not Added', ]); foreach ($inv_entries as $row) { @@ -477,6 +483,19 @@ class WarrantyController extends Controller empty($serial) || ($date_purchase == false)) { + $reason = ''; + if (empty($plate_number)) + $reason = $reason . self::PLATE_NUM_EMPTY . ' '; + if (empty($serial)) + $reason = $reason . self::SERIAL_EMPTY . ' '; + if (empty($purchase_date)) + $reason = $reason . self::PURCHASE_DATE_EMPTY . ' '; + else + { + if ($date_purchase == false) + $reason = $reason . self::PURCHASE_DATE_INVALID . ' '; + } + // add to invalid_entries $invalid_entries[] = [ 'owner_first_name' => $first_name, @@ -496,7 +515,8 @@ class WarrantyController extends Controller 'distributor_address' => trim($fields[14]), 'application_type_id' => trim($fields[15]), 'battery_id' => $battery_id, - 'ownership_typ' => trim($fields[17]), + 'ownership_type' => trim($fields[17]), + 'reason' => $reason, ]; } else