// AdminSupplierOrdersController : when quantity_received_today is checked, the checkbox is now checked; the state of the order is now updated when receiving the first part of it
This commit is contained in:
1 parent
7c978fc44d
commit
0347a3d090
3 files changed
+24
-14
No files matched your search
@@ -84,7 +84,7 @@
|
|||||||
{$tr.$key}
|
{$tr.$key}
|
||||||
{* If type is 'editable', an input is created *}
|
{* If type is 'editable', an input is created *}
|
||||||
{elseif isset($params.type) && $params.type == 'editable' && isset($tr.id)}
|
{elseif isset($params.type) && $params.type == 'editable' && isset($tr.id)}
|
||||||
<input type="text" class="{$key}" name="{$key}_{$tr.id}" value="{$tr.$key}">
|
<input type="text" name="{$key}_{$tr.id}" value="{$tr.$key}" class="{$key}" />
|
||||||
{elseif isset($params.callback)}
|
{elseif isset($params.callback)}
|
||||||
{$tr.$key}
|
{$tr.$key}
|
||||||
{elseif isset($tr.$key) && $key == 'color'}
|
{elseif isset($tr.$key) && $key == 'color'}
|
||||||
|
|||||||
@@ -23,13 +23,15 @@
|
|||||||
* @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
|
||||||
*}
|
*}
|
||||||
<div>
|
<script language="javascript">
|
||||||
<h2>{l s='Supplier Order'} #{$supplier_order_reference}</h2>
|
$(function() {
|
||||||
</div>
|
$('input.quantity_received_today').live('click', function() {
|
||||||
|
/* checks checkbox when the input is clicked */
|
||||||
<div style="margin-top: 20px;">
|
$(this).parents('tr:eq(0)').find('input[type=checkbox]').attr('checked', true);
|
||||||
<fieldset>
|
});
|
||||||
<legend>{l s='Order'} #{$supplier_order_reference}</legend>
|
});
|
||||||
{$content}
|
</script>
|
||||||
</fieldset>
|
<fieldset>
|
||||||
</div>
|
<legend>{l s='Order'} #{$supplier_order_reference}</legend>
|
||||||
|
{$content}
|
||||||
|
</fieldset>
|
||||||
@@ -835,7 +835,7 @@ class AdminSupplierOrdersControllerCore extends AdminController
|
|||||||
|
|
||||||
// display these global order informations
|
// display these global order informations
|
||||||
$this->displayInformation($this->l('This interface allows you to update the quantities of this on-going order.').'<br />');
|
$this->displayInformation($this->l('This interface allows you to update the quantities of this on-going order.').'<br />');
|
||||||
$this->displayInformation($this->l('Be careful : once you add quantities, you cannot go back unless you add new stock movements.').'<br />');
|
$this->displayInformation($this->l('Be careful : once you update, you cannot go back unless you add new negative stock movements.').'<br />');
|
||||||
|
|
||||||
// generates content
|
// generates content
|
||||||
$content = $helper->generateList($this->_list, $this->fieldsDisplay);
|
$content = $helper->generateList($this->_list, $this->fieldsDisplay);
|
||||||
@@ -1105,7 +1105,8 @@ class AdminSupplierOrdersControllerCore extends AdminController
|
|||||||
foreach ($to_update as $id_supplier_order_detail => $quantity)
|
foreach ($to_update as $id_supplier_order_detail => $quantity)
|
||||||
{
|
{
|
||||||
$supplier_order_detail = new SupplierOrderDetail($id_supplier_order_detail);
|
$supplier_order_detail = new SupplierOrderDetail($id_supplier_order_detail);
|
||||||
if (Validate::isLoadedObject($supplier_order_detail))
|
$supplier_order = new SupplierOrder((int)Tools::getValue('id_supplier_order'));
|
||||||
|
if (Validate::isLoadedObject($supplier_order_detail) && Validate::isLoadedObject($supplier_order))
|
||||||
{
|
{
|
||||||
// checks if quantity is valid
|
// checks if quantity is valid
|
||||||
// It's possible to receive more quantity than expected in case of a shipping error from the supplier
|
// It's possible to receive more quantity than expected in case of a shipping error from the supplier
|
||||||
@@ -1116,12 +1117,19 @@ class AdminSupplierOrdersControllerCore extends AdminController
|
|||||||
$supplier_receipt_history = new SupplierOrderReceiptHistory();
|
$supplier_receipt_history = new SupplierOrderReceiptHistory();
|
||||||
$supplier_receipt_history->id_supplier_order_detail = (int)$id_supplier_order_detail;
|
$supplier_receipt_history->id_supplier_order_detail = (int)$id_supplier_order_detail;
|
||||||
$supplier_receipt_history->id_employee = (int)$this->context->employee->id;
|
$supplier_receipt_history->id_employee = (int)$this->context->employee->id;
|
||||||
$supplier_receipt_history->id_supplier_order_state = (int)4;
|
$supplier_receipt_history->id_supplier_order_state = (int)$supplier_order->id_supplier_order_state;
|
||||||
$supplier_receipt_history->quantity = (int)$quantity;
|
$supplier_receipt_history->quantity = (int)$quantity;
|
||||||
$supplier_receipt_history->add();
|
$supplier_receipt_history->add();
|
||||||
|
|
||||||
$supplier_order_detail->quantity_received += (int)$quantity;
|
$supplier_order_detail->quantity_received += (int)$quantity;
|
||||||
$supplier_order_detail->save();
|
$supplier_order_detail->save();
|
||||||
|
|
||||||
|
// if current state is "Pending receipt", then we sets it to "Order received in part"
|
||||||
|
if (3 == $supplier_order->id_supplier_order_state)
|
||||||
|
{
|
||||||
|
$supplier_order->id_supplier_order_state = 4;
|
||||||
|
$supplier_order->save();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user