Fix checking for battery conflicts. Add list of compatible batteries for vehicle. #197
This commit is contained in:
parent
b0386c4758
commit
3af6d6b7e8
1 changed files with 18 additions and 4 deletions
|
|
@ -328,18 +328,32 @@ class ReportController extends BaseController
|
|||
{
|
||||
$batt_id = $item->getBattery()->getID();
|
||||
$vehicle_id = $jo->getCustomerVehicle()->getVehicle()->getID();
|
||||
if (isset($comp_matrix[$batt_id][$vehicle_id]))
|
||||
// if (!isset($comp_matrix[$batt_id][$vehicle_id]) && !$comp_matrix[$batt_id][$vehicle_id])
|
||||
if (isset($comp_matrix[$batt_id][$vehicle_id]) && $comp_matrix[$batt_id][$vehicle_id])
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
// get the compatible batteries for the customer vehicle
|
||||
$batteries = [];
|
||||
foreach($jo->getCustomerVehicle()->getVehicle()->getBatteries() as $comp_batt)
|
||||
{
|
||||
$batteries[] = [
|
||||
'id' => $comp_batt->getID(),
|
||||
'mfg_name' => $comp_batt->getManufacturer()->getName(),
|
||||
'model_name' => $comp_batt->getModel()->getName(),
|
||||
'size_name' => $comp_batt->getSize()->getName(),
|
||||
];
|
||||
}
|
||||
$results[] = [
|
||||
'jo_id' => $jo->getID(),
|
||||
'jo_date_create' => $jo->getDateCreate(),
|
||||
'cus_vehicle_manufacturer' => $jo->getCustomerVehicle()->getVehicle()->getManufacturer()->getName(),
|
||||
'cus_vehicle_make' => $jo->getCustomerVehicle()->getVehicle()->getMake(),
|
||||
'cus_vehicle_model' => $jo->getCustomerVehicle()->getModelYear(),
|
||||
'battery_model_ordered' => $item->getBattery()->getModel()->getName(),
|
||||
'battery_model_ordered' => $item->getBattery()->getModel()->getName(),
|
||||
'battery_size_ordered' => $item->getBattery()->getSize()->getName(),
|
||||
'compatible_batt' => $jo->getCustomerVehicle()->getVehicle()->getBatteries(),
|
||||
'compatible_batt' => $batteries,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue