[-] Core: Fix #PSCFV-9652 too much payments for multishipping orders
This commit is contained in:
+10
-3
@@ -1146,13 +1146,14 @@ class OrderCore extends ObjectModel
|
||||
if ($use_existing_payment)
|
||||
{
|
||||
$id_order_payments = Db::getInstance()->executeS('
|
||||
SELECT op.id_order_payment
|
||||
SELECT DISTINCT op.id_order_payment
|
||||
FROM `'._DB_PREFIX_.'order_payment` op
|
||||
INNER JOIN `'._DB_PREFIX_.'orders` o ON (o.reference = op.order_reference)
|
||||
LEFT JOIN `'._DB_PREFIX_.'order_invoice_payment` oip ON (oip.id_order_payment = op.id_order_payment)
|
||||
WHERE oip.id_order_payment IS NULL AND o.id_order = '.(int)$order_invoice->id_order);
|
||||
|
||||
WHERE (oip.id_order != '.(int)$order_invoice->id_order.' OR oip.id_order IS NULL) AND o.id_order = '.(int)$order_invoice->id_order);
|
||||
|
||||
if (count($id_order_payments))
|
||||
{
|
||||
foreach ($id_order_payments as $order_payment)
|
||||
Db::getInstance()->execute('
|
||||
INSERT INTO `'._DB_PREFIX_.'order_invoice_payment`
|
||||
@@ -1160,6 +1161,9 @@ class OrderCore extends ObjectModel
|
||||
`id_order_invoice` = '.(int)$order_invoice->id.',
|
||||
`id_order_payment` = '.(int)$order_payment['id_order_payment'].',
|
||||
`id_order` = '.(int)$order_invoice->id_order);
|
||||
// Clear cache
|
||||
Cache::clean('order_invoice_paid_*');
|
||||
}
|
||||
}
|
||||
|
||||
// Update order cart rule
|
||||
@@ -1465,6 +1469,9 @@ class OrderCore extends ObjectModel
|
||||
$res = Db::getInstance()->execute('
|
||||
INSERT INTO `'._DB_PREFIX_.'order_invoice_payment`
|
||||
VALUES('.(int)$order_invoice->id.', '.(int)$order_payment->id.', '.(int)$this->id.')');
|
||||
|
||||
// Clear cache
|
||||
Cache::clean('order_invoice_paid_*');
|
||||
}
|
||||
|
||||
return $res;
|
||||
|
||||
Reference in New Issue
Block a user