// fix bug on Payment addition
This commit is contained in:
@@ -47,7 +47,7 @@
|
||||
var txt_add_product_no_product_quantity = "{l s='Error: Quantity of product must be set'}";
|
||||
var txt_add_product_no_product_price = "{l s='Error: Price of product must be set'}";
|
||||
var txt_confirm = "{l s='Are you sure?'}";
|
||||
|
||||
|
||||
var statesShipped = new Array();
|
||||
{foreach from=$states item=state}
|
||||
{if (!$currentState->shipped && $state['shipped'])}
|
||||
@@ -293,7 +293,7 @@
|
||||
</tr>
|
||||
{/foreach}
|
||||
<tr>
|
||||
<td><input type="text" name="payment_date" class="datepicker" size="17" value="{dateFormat date=date('Y-m-d H:i:s') full=true}" /></td>
|
||||
<td><input type="text" name="payment_date" class="datepicker" size="17" value="{date('Y-m-d H:i:s')}" /></td>
|
||||
<td>
|
||||
<select name="payment_method">
|
||||
{foreach from=PaymentModule::getInstalledPaymentModules() item=payment_method}
|
||||
|
||||
@@ -1365,7 +1365,8 @@ class OrderCore extends ObjectModel
|
||||
else
|
||||
$this->total_paid_real += Tools::ps_round(Tools::convertPrice($order_payment->amount, $order_payment->id_currency, false), 2);
|
||||
|
||||
return $order_payment->add() && $this->update();
|
||||
// We put autodate parameter of add method to true if date_add field is null
|
||||
return $order_payment->add(is_null($order_payment->date_add)) && $this->update();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -572,8 +572,12 @@ class AdminOrdersControllerCore extends AdminController
|
||||
elseif (!Validate::isDate(Tools::getValue('payment_date')))
|
||||
$this->_errors[] = Tools::displayError('Date is invalid');
|
||||
else
|
||||
{
|
||||
if (!$order->addOrderPayment($amount, Tools::getValue('payment_method'), Tools::getValue('payment_transaction_id'), $currency, Tools::getValue('payment_date')))
|
||||
$this->_errors[] = Tools::displayError('An error occured on adding of order payment');
|
||||
else
|
||||
Tools::redirectAdmin(self::$currentIndex.'&id_order='.$order->id.'&vieworder&conf=4&token='.$this->token);
|
||||
}
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
@@ -585,7 +589,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$payment_module = Module::getInstanceByName($module_name);
|
||||
$cart = new Cart((int)$id_cart);
|
||||
$payment_module->validateOrder((int)$cart->id, (int)$id_order_state, $cart->getOrderTotal(true, Cart::BOTH), $payment_module->displayName, $this->l(sprintf('Manual order - ID Employee :%1', (int)Context::getContext()->cookie->id_employee)));
|
||||
if($payment_module->currentOrder)
|
||||
if ($payment_module->currentOrder)
|
||||
Tools::redirectAdmin(self::$currentIndex.'&id_order='.$payment_module->currentOrder.'&vieworder'.'&token='.$this->token);
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user