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

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@15566 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
aFolletete
2012-05-21 18:04:07 +00:00
parent e70fbf89dc
commit 545abdbc24
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) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA * 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> <label>{l s='Name'}</label>
<div class="margin-form"> <div class="margin-form">
<input type="text" name="discount_name" value="" /> <input type="text" name="discount_name" value="" />
@@ -109,7 +109,7 @@
{if !isset($document->is_delivery)} {if !isset($document->is_delivery)}
<tr id="invoiceNote{$document->id}" style="display:none" class="current-edit"> <tr id="invoiceNote{$document->id}" style="display:none" class="current-edit">
<td colspan="5"> <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> <p>
<label for="editNote{$document->id}" class="t">{l s='Note'}</label> <label for="editNote{$document->id}" class="t">{l s='Note'}</label>
<input type="hidden" name="id_order_invoice" value="{$document->id}" /> <input type="hidden" name="id_order_invoice" value="{$document->id}" />
@@ -129,7 +129,7 @@
<td colspan="5" class="center"> <td colspan="5" class="center">
<h3>{l s='No document is available'}</h3> <h3>{l s='No document is available'}</h3>
{if isset($invoice_management_active) && $invoice_management_active} {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} {/if}
</td> </td>
</tr> </tr>
@@ -238,7 +238,7 @@
</p> </p>
{/if} {/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"> <table class="table" width="100%" cellspacing="0" cellpadding="0">
<colgroup> <colgroup>
<col width="15%"></col> <col width="15%"></col>
@@ -510,7 +510,7 @@
<div class="clear" style="margin-bottom: 10px;"></div> <div class="clear" style="margin-bottom: 10px;"></div>
</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}" /> <input type="hidden" name="id_order" value="{$order->id}" />
<fieldset style="width: 100%; "> <fieldset style="width: 100%; ">
<div style="display: none"> <div style="display: none">
@@ -635,7 +635,7 @@
</td> </td>
{if $can_edit} {if $can_edit}
<td class="center"> <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> </td>
{/if} {/if}
</tr> </tr>
@@ -731,5 +731,5 @@
<div class="clear">&nbsp;</div> <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} {/block}
+7 -2
View File
@@ -1272,7 +1272,7 @@ class AdminOrdersControllerCore extends AdminController
'currencies' => Currency::getCurrencies(), 'currencies' => Currency::getCurrencies(),
'previousOrder' => $order->getPreviousOrderId(), 'previousOrder' => $order->getPreviousOrderId(),
'nextOrder' => $order->getNextOrderId(), 'nextOrder' => $order->getNextOrderId(),
'currentIndex' => self::$currentIndex, 'current_index' => self::$currentIndex,
'carrierModuleCall' => $carrier_module_call, 'carrierModuleCall' => $carrier_module_call,
'iso_code_lang' => $this->context->language->iso_code, 'iso_code_lang' => $this->context->language->iso_code,
'id_lang' => $this->context->language->id, 'id_lang' => $this->context->language->id,
@@ -1631,7 +1631,7 @@ class AdminOrdersControllerCore extends AdminController
'invoices_collection' => $invoice_collection, 'invoices_collection' => $invoice_collection,
'current_id_lang' => Context::getContext()->language->id, 'current_id_lang' => Context::getContext()->language->id,
'link' => Context::getContext()->link, 'link' => Context::getContext()->link,
'currentIndex' => self::$currentIndex 'current_index' => self::$currentIndex
)); ));
die(Tools::jsonEncode(array( die(Tools::jsonEncode(array(
@@ -1767,6 +1767,8 @@ class AdminOrdersControllerCore extends AdminController
$res &= $order->update(); $res &= $order->update();
} }
$old_quantity = $order_detail->product_quantity;
$order_detail->product_quantity = $product_quantity; $order_detail->product_quantity = $product_quantity;
// Save order detail // Save order detail
$res &= $order_detail->update(); $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_refundable'] = $product['total_price_tax_incl'] - $resume['amount_tax_incl'];
$product['amount_refund'] = Tools::displayPrice($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 // Get invoices collection
$invoice_collection = $order->getInvoicesCollection(); $invoice_collection = $order->getInvoicesCollection();