Add checking if serial exists. #288
This commit is contained in:
parent
9c9018171e
commit
bc74339fbf
1 changed files with 11 additions and 1 deletions
|
|
@ -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();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue