[*] BO : Improvement invoices management

This commit is contained in:
jBreux
2011-12-16 09:14:11 +00:00
parent fbb7f9afa7
commit ccb0731126
12 changed files with 189 additions and 46 deletions
+22
View File
@@ -143,6 +143,28 @@ class OrderHistoryCore extends ObjectModel
}
}
// Set order as paid
if ($newOS->paid == 1)
{
$invoices = $order->getInvoicesCollection();
$payment_method = Module::getInstanceByName($order->module);
foreach ($invoices as $invoice)
{
$rest_paid = $invoice->getRestPaid();
if ($rest_paid)
{
$payment = new OrderPayment();
$payment->id_order = $order->id;
$payment->id_order_invoice = $invoice->id;
$payment->id_currency = $order->id_currency;
$payment->amount = $rest_paid;
$payment->payment_method = $payment_method->displayName;
$payment->conversion_rate = 1;
$payment->save();
}
}
}
$this->id_order_state = (int)($new_order_state);
/* Change invoice number of order ? */