[-] BO : fixed bug #PSCFV-2503 - fix issue on stock update when product line edition in order

This commit is contained in:
aFolletete
2012-05-21 18:04:07 +00:00
parent ecd5e63860
commit 5a43c0b78e
4 changed files with 14 additions and 9 deletions
@@ -23,7 +23,7 @@
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
<form method="POST" action="{$currentIndex}&viewOrder&id_order={$order->id|escape:'htmlall':'UTF-8'}&token={$smarty.get.token|escape:'htmlall':'UTF-8'}">
<form method="POST" action="{$current_index}&viewOrder&id_order={$order->id|escape:'htmlall':'UTF-8'}&token={$smarty.get.token|escape:'htmlall':'UTF-8'}">
<label>{l s='Name'}</label>
<div class="margin-form">
<input type="text" name="discount_name" value="" />
@@ -109,7 +109,7 @@
{if !isset($document->is_delivery)}
<tr id="invoiceNote{$document->id}" style="display:none" class="current-edit">
<td colspan="5">
<form action="{$currentIndex}&viewOrder&id_order={$order->id}&token={$smarty.get.token|escape:'htmlall':'UTF-8'}" method="post">
<form action="{$current_index}&viewOrder&id_order={$order->id}&token={$smarty.get.token|escape:'htmlall':'UTF-8'}" method="post">
<p>
<label for="editNote{$document->id}" class="t">{l s='Note'}</label>
<input type="hidden" name="id_order_invoice" value="{$document->id}" />
@@ -129,7 +129,7 @@
<td colspan="5" class="center">
<h3>{l s='No document is available'}</h3>
{if isset($invoice_management_active) && $invoice_management_active}
<p><a class="button" href="{$currentIndex}&viewOrder&submitGenerateInvoice&id_order={$order->id}&token={$smarty.get.token|escape:'htmlall':'UTF-8'}">{l s='Generate invoice'}</a></p>
<p><a class="button" href="{$current_index}&viewOrder&submitGenerateInvoice&id_order={$order->id}&token={$smarty.get.token|escape:'htmlall':'UTF-8'}">{l s='Generate invoice'}</a></p>
{/if}
</td>
</tr>
@@ -238,7 +238,7 @@
</p>
{/if}
<form id="formAddPayment" method="post" action="{$currentIndex}&viewOrder&id_order={$smarty.get.id_order|escape:'htmlall':'UTF-8'}&token={$smarty.get.token|escape:'htmlall':'UTF-8'}">
<form id="formAddPayment" method="post" action="{$current_index}&viewOrder&id_order={$smarty.get.id_order|escape:'htmlall':'UTF-8'}&token={$smarty.get.token|escape:'htmlall':'UTF-8'}">
<table class="table" width="100%" cellspacing="0" cellpadding="0">
<colgroup>
<col width="15%"></col>
@@ -510,7 +510,7 @@
<div class="clear" style="margin-bottom: 10px;"></div>
</div>
<form style="width: 98%" class="container-command-top-spacing" action="{$currentIndex}&vieworder&token={$smarty.get.token}" method="post" onsubmit="return orderDeleteProduct('{l s='Cannot return this product'}', '{l s='Quantity to cancel is greater than quantity available'}');">
<form style="width: 98%" class="container-command-top-spacing" action="{$current_index}&vieworder&token={$smarty.get.token}" method="post" onsubmit="return orderDeleteProduct('{l s='Cannot return this product'}', '{l s='Quantity to cancel is greater than quantity available'}');">
<input type="hidden" name="id_order" value="{$order->id}" />
<fieldset style="width: 100%; ">
<div style="display: none">
@@ -635,7 +635,7 @@
</td>
{if $can_edit}
<td class="center">
<a href="{$currentIndex}&submitDeleteVoucher&id_order_cart_rule={$discount['id_order_cart_rule']}&id_order={$smarty.get.id_order|escape:'htmlall':'UTF-8'}&token={$smarty.get.token|escape:'htmlall':'UTF-8'}"><img src="../img/admin/delete.gif" alt="{l s='Delete voucher'}" /></a>
<a href="{$current_index}&submitDeleteVoucher&id_order_cart_rule={$discount['id_order_cart_rule']}&id_order={$smarty.get.id_order|escape:'htmlall':'UTF-8'}&token={$smarty.get.token|escape:'htmlall':'UTF-8'}"><img src="../img/admin/delete.gif" alt="{l s='Delete voucher'}" /></a>
</td>
{/if}
</tr>
@@ -731,5 +731,5 @@
<div class="clear">&nbsp;</div>
<br /><br /><a href="{$currentIndex}&token={$smarty.get.token}"><img src="../img/admin/arrow2.gif" /> {l s='Back to list'}</a><br />
<br /><br /><a href="{$current_index}&token={$smarty.get.token}"><img src="../img/admin/arrow2.gif" /> {l s='Back to list'}</a><br />
{/block}
+7 -2
View File
@@ -1272,7 +1272,7 @@ class AdminOrdersControllerCore extends AdminController
'currencies' => Currency::getCurrencies(),
'previousOrder' => $order->getPreviousOrderId(),
'nextOrder' => $order->getNextOrderId(),
'currentIndex' => self::$currentIndex,
'current_index' => self::$currentIndex,
'carrierModuleCall' => $carrier_module_call,
'iso_code_lang' => $this->context->language->iso_code,
'id_lang' => $this->context->language->id,
@@ -1631,7 +1631,7 @@ class AdminOrdersControllerCore extends AdminController
'invoices_collection' => $invoice_collection,
'current_id_lang' => Context::getContext()->language->id,
'link' => Context::getContext()->link,
'currentIndex' => self::$currentIndex
'current_index' => self::$currentIndex
));
die(Tools::jsonEncode(array(
@@ -1767,6 +1767,8 @@ class AdminOrdersControllerCore extends AdminController
$res &= $order->update();
}
$old_quantity = $order_detail->product_quantity;
$order_detail->product_quantity = $product_quantity;
// Save order detail
$res &= $order_detail->update();
@@ -1782,6 +1784,9 @@ class AdminOrdersControllerCore extends AdminController
$product['amount_refundable'] = $product['total_price_tax_incl'] - $resume['amount_tax_incl'];
$product['amount_refund'] = Tools::displayPrice($resume['amount_tax_incl']);
// Update product available quantity
StockAvailable::updateQuantity($product['product_id'], $product['product_attribute_id'], ($old_quantity - $product['product_quantity']), $order->id_shop);
// Get invoices collection
$invoice_collection = $order->getInvoicesCollection();