// AdminSupplierOrdersController : updated (fixed with modifications of HelperList & AdminController + update_receipt)

This commit is contained in:
bMancone
2011-11-07 13:05:07 +00:00
parent 8747306424
commit f79a6facbf
5 changed files with 245 additions and 129 deletions
@@ -82,8 +82,9 @@
{$tr.$key} {$tr.$key}
{elseif isset($params.type) && $params.type == 'datetime'} {elseif isset($params.type) && $params.type == 'datetime'}
{$tr.$key} {$tr.$key}
{elseif isset($params.type) && $params.type == 'editable'} {* If type is 'editable', an input is created *}
<input type="text" name="{$key}" value="{$tr.$key}"> {elseif isset($params.type) && $params.type == 'editable' && isset($tr.id)}
<input type="text" class="{$key}" name="{$key}_{$tr.id}" value="{$tr.$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,87 +23,94 @@
* @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>
<h2>{l s='Supplier Order'} #{$supplier_order_reference}</h2>
</div>
<div style="margin-top: 20px;"> {extends file="helper/view/view.tpl"}
<fieldset>
<legend>{l s='Order'} #{$supplier_order_reference}</legend>
<table style="width: 400px;" classe="table">
<tr>
<td>{l s='Employee:'}</td>
<td>{$supplier_order_employee}</td>
</tr>
<tr>
<td>{l s='Last update:'}</td>
<td>{$supplier_order_last_update}</td>
</tr>
<tr>
<td>{l s='Delivery expected:'}</td>
<td>{$supplier_order_expected}</td>
</tr>
</table>
</fieldset>
</div>
<div style="margin-top: 20px;"> {block name="override_tpl"}
<fieldset>
<legend>{l s='Products'}</legend>
{$supplier_order_detail_content}
</fieldset>
</div>
<div style="margin-top: 20px;"> <div>
<fieldset> <h2>{l s='Supplier Order'} #{$supplier_order_reference}</h2>
<legend>{l s='Summary'}</legend> </div>
<table style="width: 400px;" classe="table">
<tr> <div style="margin-top: 20px;">
<th>{l s='Designation'}</th> <fieldset>
<th width='60px'>{l s='Value'}</th> <legend>{l s='Order'} #{$supplier_order_reference}</legend>
</tr> <table style="width: 400px;" classe="table">
<tr> <tr>
<td bgcolor="#000000"></td> <td>{l s='Employee:'}</td>
<td bgcolor="#000000"></td> <td>{$supplier_order_employee}</td>
</tr> </tr>
<tr> <tr>
<td>{l s='Total TE'}</td> <td>{l s='Last update:'}</td>
<td>{$supplier_order_total_te}</td> <td>{$supplier_order_last_update}</td>
</tr> </tr>
<tr> <tr>
<td>{l s='Discount'}</td> <td>{l s='Delivery expected:'}</td>
<td>{$supplier_order_discount_value_te}</td> <td>{$supplier_order_expected}</td>
</tr> </tr>
<tr> </table>
<td>{l s='Total with discount TE'}</td> </fieldset>
<td>{$supplier_order_total_with_discount_te}</td> </div>
</tr>
<tr> <div style="margin-top: 20px;">
<td bgcolor="#000000"></td> <fieldset>
<td bgcolor="#000000"></td> <legend>{l s='Products'}</legend>
</tr> {$supplier_order_detail_content}
<tr> </fieldset>
<td>{l s='Total Tax'}</td> </div>
<td>{$supplier_order_total_tax}</td>
</tr> <div style="margin-top: 20px;">
<tr> <fieldset>
<td>{l s='Total TI'}</td> <legend>{l s='Summary'}</legend>
<td>{$supplier_order_total_ti}</td> <table style="width: 400px;" classe="table">
</tr> <tr>
<tr> <th>{l s='Designation'}</th>
<td bgcolor="#000000"></td> <th width='60px'>{l s='Value'}</th>
<td bgcolor="#000000"></td> </tr>
</tr> <tr>
<tr> <td bgcolor="#000000"></td>
<td>{l s='TOTAL TO PAY'}</td> <td bgcolor="#000000"></td>
<td>{$supplier_order_total_ti}</td> </tr>
</tr> <tr>
</table> <td>{l s='Total TE'}</td>
</fieldset> <td>{$supplier_order_total_te}</td>
</div> </tr>
<tr>
<td>{l s='Discount'}</td>
<td>{$supplier_order_discount_value_te}</td>
</tr>
<tr>
<td>{l s='Total with discount TE'}</td>
<td>{$supplier_order_total_with_discount_te}</td>
</tr>
<tr>
<td bgcolor="#000000"></td>
<td bgcolor="#000000"></td>
</tr>
<tr>
<td>{l s='Total Tax'}</td>
<td>{$supplier_order_total_tax}</td>
</tr>
<tr>
<td>{l s='Total TI'}</td>
<td>{$supplier_order_total_ti}</td>
</tr>
<tr>
<td bgcolor="#000000"></td>
<td bgcolor="#000000"></td>
</tr>
<tr>
<td>{l s='TOTAL TO PAY'}</td>
<td>{$supplier_order_total_ti}</td>
</tr>
</table>
</fieldset>
</div>
<div style="margin-top: 20px;">
<a href="{$current}&token={$token}">
<img src="../img/admin/arrow2.gif" />{l s='Back to supplier orders'}
</a>
</div>
<div style="margin-top: 20px;"> {/block}
<a href="{$current}&token={$token}">
<img src="../img/admin/arrow2.gif" />{l s='Back to supplier orders'}
</a>
</div>
+13 -5
View File
@@ -63,7 +63,12 @@ class SupplierOrderDetailCore extends ObjectModel
/** /**
* @var int Quantity ordered * @var int Quantity ordered
*/ */
public $quantity = 0; public $quantity_expected = 0;
/**
* @var int Quantity received
*/
public $quantity_received = 0;
/** /**
* @var float This defines the price of the product, considering the number of units to buy. * @var float This defines the price of the product, considering the number of units to buy.
@@ -119,7 +124,8 @@ class SupplierOrderDetailCore extends ObjectModel
'id_currency', 'id_currency',
'exchange_rate', 'exchange_rate',
'unit_price_te', 'unit_price_te',
'quantity', 'quantity_expected',
'quantity_received',
'price_te', 'price_te',
'discount_rate', 'discount_rate',
'discount_value_te', 'discount_value_te',
@@ -138,7 +144,8 @@ class SupplierOrderDetailCore extends ObjectModel
'id_currency' => 'isUnsignedId', 'id_currency' => 'isUnsignedId',
'exchange_rate' => 'isFloat', 'exchange_rate' => 'isFloat',
'unit_price_te' => 'isPrice', 'unit_price_te' => 'isPrice',
'quantity' => 'isUnsignedInt', 'quantity_expected' => 'isUnsignedInt',
'quantity_received' => 'isUnsignedInt',
'price_te' => 'isPrice', 'price_te' => 'isPrice',
'discount_rate' => 'isFloat', 'discount_rate' => 'isFloat',
'discount_value_te' => 'isPrice', 'discount_value_te' => 'isPrice',
@@ -173,7 +180,8 @@ class SupplierOrderDetailCore extends ObjectModel
$fields['id_currency'] = (int)$this->id_currency; $fields['id_currency'] = (int)$this->id_currency;
$fields['exchange_rate'] = (float)$this->exchange_rate; $fields['exchange_rate'] = (float)$this->exchange_rate;
$fields['unit_price_te'] = (float)$this->unit_price_te; $fields['unit_price_te'] = (float)$this->unit_price_te;
$fields['quantity'] = (int)$this->quantity; $fields['quantity_expected'] = (int)$this->quantity_expected;
$fields['quantity_received'] = (int)$this->quantity_received;
$fields['price_te'] = (float)$this->price_te; $fields['price_te'] = (float)$this->price_te;
$fields['discount_rate'] = (float)$this->discount_rate; $fields['discount_rate'] = (float)$this->discount_rate;
$fields['discount_value_te'] = (float)$this->discount_value_te; $fields['discount_value_te'] = (float)$this->discount_value_te;
@@ -217,7 +225,7 @@ class SupplierOrderDetailCore extends ObjectModel
protected function calculatePrices() protected function calculatePrices()
{ {
// calcul entry price // calcul entry price
$htis->price_te = (float)$this->unit_price_te * (int)$this->quantity; $htis->price_te = (float)$this->unit_price_te * (int)$this->quantity_expected;
// calcul entry discount value // calcul entry discount value
if ($this->discount_rate != null && is_numeric($this->discount_rate) && $this->discount_rate > 0) if ($this->discount_rate != null && is_numeric($this->discount_rate) && $this->discount_rate > 0)
@@ -43,7 +43,7 @@ class SupplierOrderReceiptHistoryCore extends ObjectModel
/** /**
* @var int State * @var int State
*/ */
public $id_state; public $id_supplier_order_state;
/** /**
* @var int Quantity delivered * @var int Quantity delivered
@@ -57,15 +57,14 @@ class SupplierOrderReceiptHistoryCore extends ObjectModel
protected $fieldsRequired = array( protected $fieldsRequired = array(
'id_supplier_order_detail', 'id_supplier_order_detail',
'id_state', 'id_supplier_order_state',
'id_employee', 'id_employee',
'quantity', 'quantity'
'date_add'
); );
protected $fieldsValidate = array( protected $fieldsValidate = array(
'id_supplier_order_detail' => 'isUnsignedId', 'id_supplier_order_detail' => 'isUnsignedId',
'id_state' => 'isUnsignedId', 'id_supplier_order_state' => 'isUnsignedId',
'id_employee' => 'isUnsignedId', 'id_employee' => 'isUnsignedId',
'quantity' => 'isUnsignedInt', 'quantity' => 'isUnsignedInt',
'date_add' => 'isDate' 'date_add' => 'isDate'
@@ -86,9 +85,10 @@ class SupplierOrderReceiptHistoryCore extends ObjectModel
$this->validateFields(); $this->validateFields();
$fields['id_supplier_order_detail'] = (int)$this->id_supplier_order_detail; $fields['id_supplier_order_detail'] = (int)$this->id_supplier_order_detail;
$fields['id_state'] = (int)$this->id_state; $fields['id_supplier_order_state'] = (int)$this->id_supplier_order_state;
$fields['id_employee'] = (int)$this->id_employee; $fields['id_employee'] = (int)$this->id_employee;
$fields['quantity'] = (int)$this->quantity; $fields['quantity'] = (int)$this->quantity;
$fields['date_add'] = pSQL($this->date_add); $fields['date_add'] = pSQL($this->date_add);
return $fields; return $fields;
@@ -522,9 +522,6 @@ class AdminSupplierOrdersControllerCore extends AdminController
LEFT JOIN `'._DB_PREFIX_.'warehouse` w ON (w.id_warehouse = a.id_warehouse) LEFT JOIN `'._DB_PREFIX_.'warehouse` w ON (w.id_warehouse = a.id_warehouse)
LEFT JOIN `'._DB_PREFIX_.'employee` e ON (e.id_employee = a.id_employee)'; LEFT JOIN `'._DB_PREFIX_.'employee` e ON (e.id_employee = a.id_employee)';
// call postProcess() for take care about actions and filters
$this->postProcess();
// init the toolbar according to the current list // init the toolbar according to the current list
$this->initToolbar(); $this->initToolbar();
@@ -603,6 +600,7 @@ class AdminSupplierOrdersControllerCore extends AdminController
$helper->submit_action = 'submitChangestate'; $helper->submit_action = 'submitChangestate';
$helper->currentIndex = self::$currentIndex; $helper->currentIndex = self::$currentIndex;
$helper->toolbar_btn = $this->toolbar_btn; $helper->toolbar_btn = $this->toolbar_btn;
$helper->toolbar_fix = false;
$helper->token = $this->token; $helper->token = $this->token;
$helper->id = null; // no display standard hidden field in the form $helper->id = null; // no display standard hidden field in the form
$helper->languages = $this->_languages; $helper->languages = $this->_languages;
@@ -651,7 +649,7 @@ class AdminSupplierOrdersControllerCore extends AdminController
//for each product in error array, check if it is in products array, and remove it to conserve last user values //for each product in error array, check if it is in products array, and remove it to conserve last user values
foreach ($this->order_products_errors as $pe) foreach ($this->order_products_errors as $pe)
foreach ($products as $index_p => $p) foreach ($products as $index_p => $p)
if(($p['id_product'] == $pe['id_product']) && ($p['id_product_attribute'] == $pe['id_product_attribute'])) if (($p['id_product'] == $pe['id_product']) && ($p['id_product_attribute'] == $pe['id_product_attribute']))
unset($products[$index_p]); unset($products[$index_p]);
// then merge arrays // then merge arrays
@@ -705,10 +703,18 @@ class AdminSupplierOrdersControllerCore extends AdminController
// re-defines fieldsDisplay // re-defines fieldsDisplay
$this->fieldsDisplay = array( $this->fieldsDisplay = array(
'id' => array(
'title' => $this->l('ID'),
'align' => 'center',
'width' => 20,
'orderby' => false,
'filter' => false,
'search' => false,
),
'p_reference' => array( 'p_reference' => array(
'title' => $this->l('Reference'), 'title' => $this->l('Reference'),
'align' => 'center', 'align' => 'center',
'width' => 100, 'width' => 30,
'orderby' => false, 'orderby' => false,
'filter' => false, 'filter' => false,
'search' => false, 'search' => false,
@@ -716,23 +722,32 @@ class AdminSupplierOrdersControllerCore extends AdminController
'p_ean13' => array( 'p_ean13' => array(
'title' => $this->l('EAN13'), 'title' => $this->l('EAN13'),
'align' => 'center', 'align' => 'center',
'width' => 75, 'width' => 30,
'orderby' => false, 'orderby' => false,
'filter' => false, 'filter' => false,
'search' => false, 'search' => false,
), ),
'p_name' => array( 'p_name' => array(
'title' => $this->l('Name'), 'title' => $this->l('Name'),
'align' => 'center',
'width' => 350, 'width' => 350,
'orderby' => false, 'orderby' => false,
'filter' => false, 'filter' => false,
'search' => false, 'search' => false,
), ),
'quantity_received_today' => array(
'title' => $this->l('Quantity received today'),
'align' => 'center',
'width' => 20,
'type' => 'editable',
'orderby' => false,
'filter' => false,
'search' => false,
),
'quantity_received' => array( 'quantity_received' => array(
'title' => $this->l('Quantity received'), 'title' => $this->l('Quantity received'),
'align' => 'center', 'align' => 'center',
'width' => 30, 'width' => 20,
'type' => 'editable',
'orderby' => false, 'orderby' => false,
'filter' => false, 'filter' => false,
'search' => false, 'search' => false,
@@ -740,7 +755,15 @@ class AdminSupplierOrdersControllerCore extends AdminController
'quantity_expected' => array( 'quantity_expected' => array(
'title' => $this->l('Quantity expected'), 'title' => $this->l('Quantity expected'),
'align' => 'center', 'align' => 'center',
'width' => 75, 'width' => 20,
'orderby' => false,
'filter' => false,
'search' => false,
),
'quantity_left' => array(
'title' => $this->l('Quantity left to receive'),
'align' => 'center',
'width' => 20,
'orderby' => false, 'orderby' => false,
'filter' => false, 'filter' => false,
'search' => false, 'search' => false,
@@ -761,13 +784,14 @@ class AdminSupplierOrdersControllerCore extends AdminController
// gets values corresponding to fieldsDisplay // gets values corresponding to fieldsDisplay
$this->_select = ' $this->_select = '
a.id_supplier_order_detail as id, a.id_supplier_order_detail as id,
SUM(sorh.quantity) as quantity_received, a.quantity_received as quantity_received,
a.quantity as quantity_expected, a.quantity_expected as quantity_expected,
(a.quantity_expected - a.quantity_received) as quantity_left,
(a.quantity_expected - a.quantity_received) as quantity_received_today,
IFNULL(CONCAT(pl.name, \' : \', GROUP_CONCAT(agl.name, \' - \', al.name SEPARATOR \', \')), pl.name) as p_name, IFNULL(CONCAT(pl.name, \' : \', GROUP_CONCAT(agl.name, \' - \', al.name SEPARATOR \', \')), pl.name) as p_name,
p.reference as p_reference, p.reference as p_reference,
p.ean13 as p_ean13'; p.ean13 as p_ean13';
$this->_join = ' $this->_join = '
LEFT JOIN '._DB_PREFIX_.'supplier_order_receipt_history sorh ON (sorh.id_supplier_order_detail = a.id_supplier_order_detail)
INNER JOIN '._DB_PREFIX_.'product_lang pl ON (pl.id_product = a.id_product AND pl.id_lang = '.$lang_id.') INNER JOIN '._DB_PREFIX_.'product_lang pl ON (pl.id_product = a.id_product AND pl.id_lang = '.$lang_id.')
LEFT JOIN '._DB_PREFIX_.'product p ON (p.id_product = a.id_product) LEFT JOIN '._DB_PREFIX_.'product p ON (p.id_product = a.id_product)
LEFT JOIN '._DB_PREFIX_.'product_attribute_combination pac ON (pac.id_product_attribute = a.id_product_attribute) LEFT JOIN '._DB_PREFIX_.'product_attribute_combination pac ON (pac.id_product_attribute = a.id_product_attribute)
@@ -778,7 +802,7 @@ class AdminSupplierOrdersControllerCore extends AdminController
$this->_group = 'GROUP BY a.id_supplier_order_detail'; $this->_group = 'GROUP BY a.id_supplier_order_detail';
// gets the list ordered by price desc, without limit // gets the list ordered by price desc, without limit
$this->getList($lang_id, 'quantity', 'DESC', 0, false, false); $this->getList($lang_id, 'quantity_expected', 'DESC', 0, false, false);
// defines action for POST // defines action for POST
$action = '&id_supplier_order='.$id_supplier_order.'&submitUpdateReceipt'; $action = '&id_supplier_order='.$id_supplier_order.'&submitUpdateReceipt';
@@ -787,13 +811,17 @@ class AdminSupplierOrdersControllerCore extends AdminController
$helper->simple_header = true; $helper->simple_header = true;
$helper->table = $this->table; $helper->table = $this->table;
$helper->no_link = true; $helper->no_link = true;
$helper->show_toolbar = false;
$helper->toolbar_fix = false;
$helper->shopLinkType = ''; $helper->shopLinkType = '';
$helper->currentIndex = self::$currentIndex.$action; $helper->currentIndex = self::$currentIndex.$action;
$helper->token = $this->token; $helper->token = $this->token;
$helper->identifier = $this->identifier; $helper->identifier = $this->identifier;
$helper->bulk_actions = array('Update' => array('text' => $this->l('Update selected'), 'confirm' => $this->l('Update selected items?')));
// 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 />');
// generates content // generates content
$content = $helper->generateList($this->_list, $this->fieldsDisplay); $content = $helper->generateList($this->_list, $this->fieldsDisplay);
@@ -818,8 +846,8 @@ class AdminSupplierOrdersControllerCore extends AdminController
$this->initUpdateReceiptContent(); $this->initUpdateReceiptContent();
else if (Tools::isSubmit('viewsupplier_order') && Tools::isSubmit('id_supplier_order')) else if (Tools::isSubmit('viewsupplier_order') && Tools::isSubmit('id_supplier_order'))
{ {
$this->action = 'view';
$this->display = 'view'; $this->display = 'view';
$this->viewSupplierOrder();
parent::initContent(); parent::initContent();
} }
else if (Tools::isSubmit('updatesupplier_order')) else if (Tools::isSubmit('updatesupplier_order'))
@@ -887,7 +915,7 @@ class AdminSupplierOrdersControllerCore extends AdminController
// get product informations // get product informations
$entry->id_product = substr($id, 0, $pos); $entry->id_product = substr($id, 0, $pos);
$entry->id_product_attribute = substr($id, $pos+1); $entry->id_product_attribute = substr($id, $pos + 1);
$entry->unit_price_te = (float)Tools::getValue('input_unit_price_te_'.$id, 0); $entry->unit_price_te = (float)Tools::getValue('input_unit_price_te_'.$id, 0);
$entry->quantity = (int)Tools::getValue('input_quantity_'.$id, 0); $entry->quantity = (int)Tools::getValue('input_quantity_'.$id, 0);
$entry->discount_rate = (float)Tools::getValue('input_discount_rate_'.$id, 0); $entry->discount_rate = (float)Tools::getValue('input_discount_rate_'.$id, 0);
@@ -925,9 +953,7 @@ class AdminSupplierOrdersControllerCore extends AdminController
$this->_errors[] = Tools::displayError($this->l('Please verify informations of the product: ').$entry->name.' '.$error_str); $this->_errors[] = Tools::displayError($this->l('Please verify informations of the product: ').$entry->name.' '.$error_str);
} }
else else
{
$entry->save(); $entry->save();
}
} }
} }
} }
@@ -943,7 +969,8 @@ class AdminSupplierOrdersControllerCore extends AdminController
// Checks access // Checks access
if (Tools::isSubmit('submitAddsupplier_order') && !($this->tabAccess['add'] === '1')) if (Tools::isSubmit('submitAddsupplier_order') && !($this->tabAccess['add'] === '1'))
$this->_errors[] = Tools::displayError('You do not have the required permission to add a supplier order.'); $this->_errors[] = Tools::displayError('You do not have the required permission to add a supplier order.');
if (Tools::isSubmit('submitUpdateReceipt') && !($this->tabAccess['edit'] === '1'))
$this->_errors[] = Tools::displayError('You do not have the required permission to edit an order.');
// Global checks when add / update a supplier order // Global checks when add / update a supplier order
if (Tools::isSubmit('submitAddsupplier_order')) if (Tools::isSubmit('submitAddsupplier_order'))
{ {
@@ -1024,9 +1051,77 @@ class AdminSupplierOrdersControllerCore extends AdminController
} }
} }
if (Tools::isSubmit('submitUpdateReceipt') && Tools::isSubmit('id_supplier_order'))
$this->postProcessUpdateReceipt();
parent::postProcess(); parent::postProcess();
} }
/**
* Helper function for AdminSupplierOrdersController::postProcess()
*
* @see AdminSupplierOrdersController::postProcess()
*/
protected function postProcessUpdateReceipt()
{
// gets all box selected
$rows = Tools::getValue('supplier_order_detailBox');
if (!$rows)
{
$this->_errors[] = Tools::displayError('You did not select any product to update');
return;
}
// final array with id_supplier_order_detail and value to update
$to_update = array();
// gets quantity for each id_order_detail
foreach ($rows as $row)
{
if (Tools::getValue('quantity_received_today_'.$row))
$to_update[$row] = (int)Tools::getValue('quantity_received_today_'.$row);
}
// checks if there is something to update
if (!count($to_update))
{
$this->_errors[] = Tools::displayError('You did not select any product to update');
return;
}
foreach ($to_update as $id_supplier_order_detail => $quantity)
{
$supplier_order_detail = new SupplierOrderDetail($id_supplier_order_detail);
if (Validate::isLoadedObject($supplier_order_detail))
{
// checks if quantity is valid
if (!Validate::isInt($quantity) ||
$quantity < 0 ||
$supplier_order_detail->quantity_received + $quantity > $supplier_order_detail->quantity_expected)
$this->_errors[] = sprintf(Tools::displayError('Quantity (%d) for product #%d is not valid'), (int)$quantity, (int)$id_supplier_order_detail);
else // everything is valid : updates
{
$supplier_receipt_history = new SupplierOrderReceiptHistory();
$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_supplier_order_state = (int)4;
$supplier_receipt_history->quantity = (int)$quantity;
$supplier_receipt_history->add();
$supplier_order_detail->quantity_received += (int)$quantity;
$supplier_order_detail->save();
}
}
}
if (!count($this_errors))
{
// display confirm message
$token = Tools::getValue('token') ? Tools::getValue('token') : $this->token;
$redirect = self::$currentIndex.'&token='.$token;
Tools::redirectAdmin($redirect.'&conf=4');
}
}
/** /**
* Display state action link * Display state action link
* @param string $token the token to add to the link * @param string $token the token to add to the link
@@ -1139,6 +1234,8 @@ class AdminSupplierOrdersControllerCore extends AdminController
// renders list // renders list
$helper = new HelperList(); $helper = new HelperList();
$helper->no_link = true; $helper->no_link = true;
$helper->show_toolbar = false;
$helper->toolbar_fix = false;
$helper->shopLinkType = ''; $helper->shopLinkType = '';
$helper->identifier = $this->identifier; $helper->identifier = $this->identifier;
$helper->colorOnBackground = true; $helper->colorOnBackground = true;
@@ -1151,13 +1248,14 @@ class AdminSupplierOrdersControllerCore extends AdminController
} }
/** /**
* Used to display details of an order * @see AdminController::initView()
* @see AdminSupplierOrdersController::initContent()
*/ */
protected function viewSupplierOrder() public function initView()
{ {
$this->displayInformation($this->l('This interface allows you to display detailed informations on your order.').'<br />'); $this->displayInformation($this->l('This interface allows you to display detailed informations on your order.').'<br />');
$this->show_toolbar = false;
$this->toolbar_fix = false;
$this->table = 'supplier_order_detail'; $this->table = 'supplier_order_detail';
$this->identifier = 'id_supplier_order_detail'; $this->identifier = 'id_supplier_order_detail';
$this->className = 'SupplierOrderDetail'; $this->className = 'SupplierOrderDetail';
@@ -1201,7 +1299,7 @@ class AdminSupplierOrdersControllerCore extends AdminController
'filter' => false, 'filter' => false,
'search' => false, 'search' => false,
), ),
'quantity' => array( 'quantity_expected' => array(
'title' => $this->l('Quantity'), 'title' => $this->l('Quantity'),
'align' => 'center', 'align' => 'center',
'width' => 75, 'width' => 75,
@@ -1325,13 +1423,14 @@ class AdminSupplierOrdersControllerCore extends AdminController
$helper = new HelperList(); $helper = new HelperList();
$helper->simple_header = true; $helper->simple_header = true;
$helper->no_link = true; $helper->no_link = true;
$helper->show_toolbar = false;
$helper->toolbar_fix = false;
$helper->shopLinkType = ''; $helper->shopLinkType = '';
$helper->identifier = $this->identifier; $helper->identifier = $this->identifier;
// generates content // generates content
$content = $helper->generateList($this->_list, $this->fieldsDisplay); $content = $helper->generateList($this->_list, $this->fieldsDisplay);
// displays content // displays content
$this->context->smarty->assign('supplier_order_detail_content', $content);
// gets global order information // gets global order information
$supplier_order = new SupplierOrder((int)$id_supplier_order); $supplier_order = new SupplierOrder((int)$id_supplier_order);
@@ -1339,26 +1438,27 @@ class AdminSupplierOrdersControllerCore extends AdminController
{ {
// gets the currency used in this order // gets the currency used in this order
$currency = Currency::getCurrency($supplier_order->id_currency); $currency = Currency::getCurrency($supplier_order->id_currency);
$this->context->smarty->assign('supplier_order_currency_sign', $currency ? $currency['sign'] : '');
// gets the employee in charge of the order // gets the employee in charge of the order
$employee = new Employee($supplier_order->id_employee); $employee = new Employee($supplier_order->id_employee);
$this->context->smarty->assign('supplier_order_employee', (Validate::isLoadedObject($employee) ? $employee->firstname.' '.$employee->lastname : ''));
// display these global order informations // display these global order informations
$this->context->smarty->assign( $this->tpl_view_vars = array(
array( 'supplier_order_detail_content' => $content,
'supplier_order_reference' => $supplier_order->reference, 'supplier_order_currency_sign' => $currency ? $currency['sign'] : '',
'supplier_order_last_update' => $supplier_order->date_upd, 'supplier_order_employee' => (Validate::isLoadedObject($employee) ? $employee->firstname.' '.$employee->lastname : ''),
'supplier_order_expected' => $supplier_order->date_delivery_expected, 'supplier_order_reference' => $supplier_order->reference,
'supplier_order_total_te' => $supplier_order->total_te, 'supplier_order_last_update' => $supplier_order->date_upd,
'supplier_order_discount_value_te' => $supplier_order->discount_value_te, 'supplier_order_expected' => $supplier_order->date_delivery_expected,
'supplier_order_total_with_discount_te' => $supplier_order->total_with_discount_te, 'supplier_order_total_te' => $supplier_order->total_te,
'supplier_order_total_tax' => $supplier_order->total_tax, 'supplier_order_discount_value_te' => $supplier_order->discount_value_te,
'supplier_order_total_ti' => $supplier_order->total_ti, 'supplier_order_total_with_discount_te' => $supplier_order->total_with_discount_te,
) 'supplier_order_total_tax' => $supplier_order->total_tax,
'supplier_order_total_ti' => $supplier_order->total_ti,
); );
} }
return parent::initView();
} }
/** /**