Fix checking for battery conflicts. Add list of compatible batteries for vehicle. #197

This commit is contained in:
Korina Cordero 2019-04-03 02:14:26 +00:00
parent b0386c4758
commit 3af6d6b7e8

View file

@ -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,
];
}
}