Treat blank serial as null to avoid unique exception in db #270
This commit is contained in:
parent
e4b8e44b06
commit
8e3df8f1c4
2 changed files with 6 additions and 3 deletions
|
|
@ -149,7 +149,7 @@ class Warranty
|
||||||
return $this->id;
|
return $this->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setSerial($serial)
|
public function setSerial($serial = null)
|
||||||
{
|
{
|
||||||
$this->serial = $serial;
|
$this->serial = $serial;
|
||||||
return $this;
|
return $this;
|
||||||
|
|
|
||||||
|
|
@ -73,8 +73,11 @@ class WarrantyHandler
|
||||||
}
|
}
|
||||||
|
|
||||||
// set and save values
|
// set and save values
|
||||||
$warranty->setSerial($serial)
|
if (trim($serial) == '')
|
||||||
->setPlateNumber($plate_number)
|
$warranty->setSerial(null);
|
||||||
|
else
|
||||||
|
$warranty->setSerial($serial);
|
||||||
|
$warranty->setPlateNumber($plate_number)
|
||||||
->setFirstName($first_name)
|
->setFirstName($first_name)
|
||||||
->setLastName($last_name)
|
->setLastName($last_name)
|
||||||
->setMobileNumber($mobile_number)
|
->setMobileNumber($mobile_number)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue