Add battery to criteria for battery replacement warranty. #803
This commit is contained in:
parent
4b5ad97225
commit
2f9ee4ec67
3 changed files with 9 additions and 16 deletions
|
|
@ -690,7 +690,8 @@ class JobOrderController extends ApiController
|
||||||
if (!empty($trade_in_type) && !empty($trade_in_batt)) {
|
if (!empty($trade_in_type) && !empty($trade_in_batt)) {
|
||||||
$ti_batt_obj = $this->em->getRepository(Battery::class)->find($trade_in_batt);
|
$ti_batt_obj = $this->em->getRepository(Battery::class)->find($trade_in_batt);
|
||||||
if (!empty($ti_batt_obj)) {
|
if (!empty($ti_batt_obj)) {
|
||||||
$icrit->addEntry($ti_batt_obj, $trade_in_type, 1);
|
$battery_size = $ti_batt_obj->getSize();
|
||||||
|
$icrit->addTradeInEntry($battery_size, $trade_in_type, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1124,7 +1125,8 @@ class JobOrderController extends ApiController
|
||||||
if (!empty($trade_in_type) && !empty($trade_in_batt)) {
|
if (!empty($trade_in_type) && !empty($trade_in_batt)) {
|
||||||
$ti_batt_obj = $this->em->getRepository(Battery::class)->find($trade_in_batt);
|
$ti_batt_obj = $this->em->getRepository(Battery::class)->find($trade_in_batt);
|
||||||
if (!empty($ti_batt_obj)) {
|
if (!empty($ti_batt_obj)) {
|
||||||
$icrit->addEntry($ti_batt_obj, $trade_in_type, 1);
|
$battery_size = $ti_batt_obj->getSize();
|
||||||
|
$icrit->addTradeInEntry($battery_size, $trade_in_type, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -117,15 +117,13 @@ class BatteryReplacementWarranty implements InvoiceRuleInterface
|
||||||
if ($qty < 1)
|
if ($qty < 1)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// if this is a trade in, add trade in
|
if (empty($item['trade_in']))
|
||||||
if (!empty($item['trade_in']) && TradeInType::validate($item['trade_in']))
|
{
|
||||||
$trade_in = $item['trade_in'];
|
|
||||||
else
|
|
||||||
$trade_in = null;
|
$trade_in = null;
|
||||||
|
|
||||||
$criteria->addEntry($battery, $trade_in, $qty);
|
$criteria->addEntry($battery, $trade_in, $qty);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -116,13 +116,6 @@ class BatterySales implements InvoiceRuleInterface
|
||||||
if ($qty < 1)
|
if ($qty < 1)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// if this is a trade in, add trade in
|
|
||||||
/*
|
|
||||||
if (!empty($item['trade_in']) && TradeInType::validate($item['trade_in']))
|
|
||||||
$trade_in = $item['trade_in'];
|
|
||||||
else
|
|
||||||
$trade_in = null; */
|
|
||||||
|
|
||||||
if (empty($item['trade_in']))
|
if (empty($item['trade_in']))
|
||||||
{
|
{
|
||||||
$trade_in = null;
|
$trade_in = null;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue