Merge branch '247-warranty-data-fixes-for-android' into 'master'
Add null checks and set to '' for json data #247 Closes #247 See merge request jankstudio/resq!291
This commit is contained in:
commit
4d06e17fc7
1 changed files with 8 additions and 5 deletions
|
|
@ -701,11 +701,11 @@ class APIController extends Controller
|
|||
$cvs = $cust->getVehicles();
|
||||
foreach ($cvs as $cv)
|
||||
{
|
||||
$battery_id = null;
|
||||
$battery_id = '';
|
||||
if ($cv->getCurrentBattery() != null)
|
||||
$battery_id = $cv->getCurrentBattery()->getID();
|
||||
|
||||
$wty_ex = null;
|
||||
$wty_ex = '';
|
||||
if ($cv->getWarrantyExpiration() != null)
|
||||
$wty_ex = $cv->getWarrantyExpiration()->format('Y-m-d');
|
||||
|
||||
|
|
@ -721,7 +721,7 @@ class APIController extends Controller
|
|||
'color' => $cv->getColor(),
|
||||
'condition' => $cv->getStatusCondition(),
|
||||
'fuel_type' => $cv->getFuelType(),
|
||||
'wty_code' => $cv->getWarrantyCode(),
|
||||
'wty_code' => $cv->getWarrantyCode() ?? $cv->getWarrantyCode() : '',
|
||||
'wty_expire' => $wty_ex,
|
||||
'curr_batt_id' => $battery_id,
|
||||
'is_motolite' => $cv->hasMotoliteBattery() ? 1 : 0,
|
||||
|
|
@ -1950,12 +1950,15 @@ class APIController extends Controller
|
|||
if (!(is_null($warranty->getBatteryModel()))) {
|
||||
$batt_model = $warranty->getBatteryModel()->getName();
|
||||
}
|
||||
|
||||
if (!(is_null($warranty->getBatterySize()))) {
|
||||
$batt_size = $warranty->getBatterySize()->getName();
|
||||
}
|
||||
|
||||
if (!(is_null($warranty->getSAPBattery()))) {
|
||||
$sap_batt = $warranty->getSAPBattery()->getID();
|
||||
}
|
||||
|
||||
if (!(is_null($warranty->getDateClaim()))) {
|
||||
$claim_date = $warranty->getDateClaim()->format("d M Y");
|
||||
}
|
||||
|
|
@ -1965,7 +1968,7 @@ class APIController extends Controller
|
|||
|
||||
$warr[] = [
|
||||
'id' => $warranty->getID(),
|
||||
'serial' => $warranty->getSerial(),
|
||||
'serial' => $warranty->getSerial() ?? $warranty->getSerial() : '',
|
||||
'warranty_class' => $warranty->getWarrantyClass(),
|
||||
'plate_number' => $warranty->getPlateNumber(),
|
||||
'first_name' => $warranty->getFirstName(),
|
||||
|
|
@ -1979,7 +1982,7 @@ class APIController extends Controller
|
|||
'date_purchase' => $warranty->getDatePurchase()->format("d M Y"),
|
||||
'date_expire' => $expiry_date,
|
||||
'date_claim' => $claim_date,
|
||||
'claim_from' => $warranty->getClaimedFrom(),
|
||||
'claim_from' => $warranty->getClaimedFrom() ?? $warranty->getClaimedFrom() : '',
|
||||
'is_activated' => $warranty->isActivated() ? 1 : 0,
|
||||
];
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue