diff --git a/src/Controller/WarrantyController.php b/src/Controller/WarrantyController.php index 1d23bc9b..4da828c6 100644 --- a/src/Controller/WarrantyController.php +++ b/src/Controller/WarrantyController.php @@ -531,6 +531,7 @@ class WarrantyController extends Controller foreach($warr_results as $warr) { // check if details are complete + //error_log('Updating warranty with serial number ' . $serial . ' and plate number ' . $plate_number); if (empty($warr->getFirstName())) { if (!empty($first_name)) @@ -604,7 +605,16 @@ class WarrantyController extends Controller } else { - // what if serial exists but plate number is different? + // TODO: what if serial exists but plate number is different? + // check if just the serial exists + // if warranty exists, ignore for now + $w_results = $em->getRepository(Warranty::class)->findBy(['serial' => $serial]); + if (!empty($w_results)) + { + continue; + } + + //error_log('Adding warranty with serial number ' . $serial . ' and plate number ' . $plate_number); // new warranty $warranty = new Warranty();