Resolve "RESQ 2: Fix display of discount type" #1680
1 changed files with 6 additions and 4 deletions
|
|
@ -192,12 +192,11 @@ class InvoiceManager implements InvoiceGeneratorInterface
|
|||
|
||||
$invoice_items = [];
|
||||
$data = [];
|
||||
$promo = null;
|
||||
foreach ($this->available_rules as $rule)
|
||||
{
|
||||
$items = $rule->compute($criteria, $total);
|
||||
|
||||
$promo = null;
|
||||
|
||||
if (count($items) > 0)
|
||||
{
|
||||
foreach ($items as $item)
|
||||
|
|
@ -210,7 +209,6 @@ class InvoiceManager implements InvoiceGeneratorInterface
|
|||
if (isset($item['battery']))
|
||||
$battery = $item['battery'];
|
||||
|
||||
$promo = null;
|
||||
if (isset($item['promo']))
|
||||
$promo = $item['promo'];
|
||||
|
||||
|
|
@ -219,13 +217,13 @@ class InvoiceManager implements InvoiceGeneratorInterface
|
|||
'quantity' => $quantity,
|
||||
'price' => $price,
|
||||
'battery' => $battery,
|
||||
'promo' => $promo,
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// also need to return the total and the promo
|
||||
// promo is set per invoice, not per item
|
||||
$data[] = [
|
||||
'promo' => $promo,
|
||||
'invoice_items' => $invoice_items,
|
||||
|
|
@ -254,8 +252,12 @@ class InvoiceManager implements InvoiceGeneratorInterface
|
|||
|
||||
// check if promo is set
|
||||
if (isset($data['promo']))
|
||||
{
|
||||
$promo = $data['promo'];
|
||||
|
||||
$invoice->setPromo($promo);
|
||||
}
|
||||
|
||||
foreach ($invoice_items as $item)
|
||||
{
|
||||
$invoice_item = new InvoiceItem();
|
||||
|
|
|
|||
Loading…
Reference in a new issue