Add support for has_motolite and flag_coolant in change service rider api call

This commit is contained in:
root 2018-09-08 19:28:15 +08:00
parent aca818a96a
commit d84a156a02

View file

@ -410,6 +410,7 @@ class RAPIController extends Controller
// TODO: load the actual // TODO: load the actual
'has_warranty_doc' => false, 'has_warranty_doc' => false,
'flag_coolant' => $jo->hasCoolant(), 'flag_coolant' => $jo->hasCoolant(),
'has_motolite' => $cv->hasMotoliteBattery(),
] ]
]; ];
} }
@ -780,9 +781,20 @@ class RAPIController extends Controller
$jo->setORNum($or_num); $jo->setORNum($or_num);
// coolant // coolant
$flag_coolant = $req->request->get('flag_coolant', 0); $flag_coolant = $req->request->get('flag_coolant', 'false');
if ($flag_coolant) if ($flag_coolant == 'true')
$jo->setHasCoolant($flag_coolant); $jo->setHasCoolant(true);
else
$jo->setHasCoolant(false);
// has motolite battery
$cv = $jo->getCustomerVehicle();
$has_motolite = $req->request->get('has_motolite', 0);
if ($has_motolite)
$cv->setHasMotoliteBattery(true);
else
$cv->setHasMotoliteBattery(false);
$em->persist($cv);
// check battery id // check battery id
$batt_id = $req->request->get('batt_id', null); $batt_id = $req->request->get('batt_id', null);
@ -815,7 +827,7 @@ class RAPIController extends Controller
// generate new invoice // generate new invoice
$crit = new InvoiceCriteria(); $crit = new InvoiceCriteria();
$crit->setServiceType($stype_id); $crit->setServiceType($stype_id);
$crit->setCustomerVehicle($jo->getCustomerVehicle()); $crit->setCustomerVehicle($cv);
$crit->setHasCoolant($jo->hasCoolant()); $crit->setHasCoolant($jo->hasCoolant());
if ($promo != null) if ($promo != null)