[-] Core: Fix #PSCFV-9652 too much payments for multishipping orders

This commit is contained in:
Rémi Gaillard
2013-07-08 16:07:20 +02:00
parent 4b88e8cc06
commit f413d9e6e6
2 changed files with 16 additions and 7 deletions
+6 -4
View File
@@ -522,14 +522,16 @@ class OrderInvoiceCore extends ObjectModel
*/
public function getTotalPaid()
{
if (!array_key_exists($this->id, self::$_total_paid_cache))
$cache_id = 'order_invoice_paid_'.(int)$this->id;
if (!Cache::isStored($cache_id))
{
self::$_total_paid_cache[$this->id] = 0;
$amount = 0;
$payments = OrderPayment::getByInvoiceId($this->id);
foreach ($payments as $payment)
self::$_total_paid_cache[$this->id] += $payment->amount;
$amount += $payment->amount;
Cache::store($cache_id, $amount);
}
return self::$_total_paid_cache[$this->id];
return Cache::retrieve($cache_id);
}
/**