[-] FO : #PSCFI-5795 : fixed a bug where the opc freeze when an Order is to 0
This commit is contained in:
@@ -303,7 +303,10 @@ class OrderDetailCore extends ObjectModel
|
|||||||
|
|
||||||
if (count($this->tax_calculator->taxes) == 0)
|
if (count($this->tax_calculator->taxes) == 0)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
if ($order->total_products <= 0)
|
||||||
|
return true;
|
||||||
|
|
||||||
$ratio = $this->unit_price_tax_excl / $order->total_products;
|
$ratio = $this->unit_price_tax_excl / $order->total_products;
|
||||||
$order_reduction_amount = $order->total_discounts_tax_excl * $ratio;
|
$order_reduction_amount = $order->total_discounts_tax_excl * $ratio;
|
||||||
$discounted_price_tax_excl = $this->unit_price_tax_excl - $order_reduction_amount;
|
$discounted_price_tax_excl = $this->unit_price_tax_excl - $order_reduction_amount;
|
||||||
|
|||||||
@@ -222,7 +222,9 @@ class OrderHistoryCore extends ObjectModel
|
|||||||
if ($new_os->paid == 1)
|
if ($new_os->paid == 1)
|
||||||
{
|
{
|
||||||
$invoices = $order->getInvoicesCollection();
|
$invoices = $order->getInvoicesCollection();
|
||||||
$payment_method = Module::getInstanceByName($order->module);
|
if ($order->total_paid != 0)
|
||||||
|
$payment_method = Module::getInstanceByName($order->module);
|
||||||
|
|
||||||
foreach ($invoices as $invoice)
|
foreach ($invoices as $invoice)
|
||||||
{
|
{
|
||||||
$rest_paid = $invoice->getRestPaid();
|
$rest_paid = $invoice->getRestPaid();
|
||||||
@@ -232,10 +234,14 @@ class OrderHistoryCore extends ObjectModel
|
|||||||
$payment->order_reference = $order->reference;
|
$payment->order_reference = $order->reference;
|
||||||
$payment->id_currency = $order->id_currency;
|
$payment->id_currency = $order->id_currency;
|
||||||
$payment->amount = $rest_paid;
|
$payment->amount = $rest_paid;
|
||||||
$payment->payment_method = $payment_method->displayName;
|
|
||||||
|
if ($order->total_paid != 0)
|
||||||
|
$payment->payment_method = $payment_method->displayName;
|
||||||
|
else
|
||||||
|
$payment->payment_method = null;
|
||||||
|
|
||||||
$payment->conversion_rate = 1;
|
$payment->conversion_rate = 1;
|
||||||
$payment->save();
|
$payment->save();
|
||||||
|
|
||||||
Db::getInstance()->execute('
|
Db::getInstance()->execute('
|
||||||
INSERT INTO `'._DB_PREFIX_.'order_invoice_payment`
|
INSERT INTO `'._DB_PREFIX_.'order_invoice_payment`
|
||||||
VALUES('.(int)$invoice->id.', '.(int)$payment->id.', '.(int)$order->id.')');
|
VALUES('.(int)$invoice->id.', '.(int)$payment->id.', '.(int)$order->id.')');
|
||||||
|
|||||||
Reference in New Issue
Block a user