// Small fix
This commit is contained in:
+10
-9
@@ -1132,19 +1132,20 @@ class OrderCore extends ObjectModel
|
|||||||
// Update order payment
|
// Update order payment
|
||||||
if ($use_existing_payment)
|
if ($use_existing_payment)
|
||||||
{
|
{
|
||||||
$id_order_payment = Db::getInstance()->getValue('
|
$id_order_payments = Db::getInstance()->executeS('
|
||||||
SELECT MAX(id_order_payment) FROM `'._DB_PREFIX_.'order_payment` op
|
SELECT id_order_payment FROM `'._DB_PREFIX_.'order_payment` op
|
||||||
INNER JOIN `'._DB_PREFIX_.'orders` o
|
INNER JOIN `'._DB_PREFIX_.'orders` o
|
||||||
ON o.reference = op.order_reference
|
ON o.reference = op.order_reference
|
||||||
WHERE id_order = '.(int)$order_invoice->id_order);
|
WHERE id_order = '.(int)$order_invoice->id_order);
|
||||||
|
|
||||||
if ($id_order_payment)
|
if (count($id_order_payments))
|
||||||
Db::getInstance()->execute('
|
foreach ($id_order_payments as $order_payment)
|
||||||
INSERT INTO `'._DB_PREFIX_.'order_invoice_payment`
|
Db::getInstance()->execute('
|
||||||
SET
|
INSERT INTO `'._DB_PREFIX_.'order_invoice_payment`
|
||||||
`id_order_invoice` = '.(int)$order_invoice->id.',
|
SET
|
||||||
`id_order_payment` = '.(int)$id_order_payment.',
|
`id_order_invoice` = '.(int)$order_invoice->id.',
|
||||||
`id_order` = '.(int)$order_invoice->id_order);
|
`id_order_payment` = '.(int)$order_payment['id_order_payment'].',
|
||||||
|
`id_order` = '.(int)$order_invoice->id_order);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update order cart rule
|
// Update order cart rule
|
||||||
|
|||||||
@@ -338,7 +338,12 @@ class AdminOrdersControllerCore extends AdminController
|
|||||||
$history = new OrderHistory();
|
$history = new OrderHistory();
|
||||||
$history->id_order = $order->id;
|
$history->id_order = $order->id;
|
||||||
$history->id_employee = (int)$this->context->employee->id;
|
$history->id_employee = (int)$this->context->employee->id;
|
||||||
$history->changeIdOrderState($order_state->id, $order->id);
|
|
||||||
|
$use_existings_payment = false;
|
||||||
|
if (!$order->hasInvoice())
|
||||||
|
$use_existings_payment = true;
|
||||||
|
$history->changeIdOrderState($order_state->id, $order->id, true);
|
||||||
|
|
||||||
$carrier = new Carrier($order->id_carrier, $order->id_lang);
|
$carrier = new Carrier($order->id_carrier, $order->id_lang);
|
||||||
$templateVars = array();
|
$templateVars = array();
|
||||||
if ($history->id_order_state == Configuration::get('PS_OS_SHIPPING') && $order->shipping_number)
|
if ($history->id_order_state == Configuration::get('PS_OS_SHIPPING') && $order->shipping_number)
|
||||||
@@ -996,7 +1001,7 @@ class AdminOrdersControllerCore extends AdminController
|
|||||||
$this->errors[] = Tools::displayError('This order already has an invoice');
|
$this->errors[] = Tools::displayError('This order already has an invoice');
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$order->setInvoice();
|
$order->setInvoice(true);
|
||||||
Tools::redirectAdmin(self::$currentIndex.'&id_order='.$order->id.'&vieworder&conf=4&token='.$this->token);
|
Tools::redirectAdmin(self::$currentIndex.'&id_order='.$order->id.'&vieworder&conf=4&token='.$this->token);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user