Add checking if serial exists. #288

This commit is contained in:
Korina Cordero 2019-12-16 06:18:37 +00:00
parent 9c9018171e
commit bc74339fbf

View file

@ -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();