diff --git a/admin-dev/themes/template/supplier_orders_receipt_history/list_action_details.tpl b/admin-dev/themes/template/supplier_orders_receipt_history/list_action_details.tpl new file mode 100644 index 000000000..335ebd0f8 --- /dev/null +++ b/admin-dev/themes/template/supplier_orders_receipt_history/list_action_details.tpl @@ -0,0 +1,125 @@ +{* +* 2007-2011 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA +* @copyright 2007-2011 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*} + + + {$action} + \ No newline at end of file diff --git a/controllers/admin/AdminSupplierOrdersController.php b/controllers/admin/AdminSupplierOrdersController.php index 304524a37..24dfc2e29 100644 --- a/controllers/admin/AdminSupplierOrdersController.php +++ b/controllers/admin/AdminSupplierOrdersController.php @@ -801,6 +801,8 @@ class AdminSupplierOrdersControllerCore extends AdminController $this->_where = 'AND a.`id_supplier_order` = '.(int)$id_supplier_order; $this->_group = 'GROUP BY a.id_supplier_order_detail'; + $this->addRowAction('details'); + // gets the list ordered by price desc, without limit $this->getList($lang_id, 'quantity_expected', 'DESC', 0, false, false); @@ -808,7 +810,9 @@ class AdminSupplierOrdersControllerCore extends AdminController $action = '&id_supplier_order='.$id_supplier_order.'&submitUpdateReceipt'; // renders list $helper = new HelperList(); + $helper->override_folder = 'supplier_orders_receipt_history/'; $helper->simple_header = true; + $helper->actions = $this->actions; $helper->table = $this->table; $helper->no_link = true; $helper->show_toolbar = false; @@ -1244,6 +1248,60 @@ class AdminSupplierOrdersControllerCore extends AdminController echo Tools::jsonEncode(array('use_parent_structure' => false, 'data' => $content)); } + else if (Tools::isSubmit('id_supplier_order_detail')) + { + $this->identifier = 'id_supplier_order_receipt_history'; + $this->table = 'supplier_order_receipt_history'; + $this->display = 'list'; + $this->lang = false; + $lang_id = (int)$this->context->language->id; + $id_supplier_order_detail = (int)Tools::getValue('id_supplier_order_detail'); + + unset($this->fieldsDisplay); + $this->fieldsDisplay = array( + 'date_add' => array( + 'title' => $this->l('Last update'), + 'width' => 50, + 'align' => 'left', + 'type' => 'datetime', + 'havingFilter' => true + ), + 'employee' => array( + 'title' => $this->l('Employee'), + 'width' => 100, + 'align' => 'left', + 'havingFilter' => true + ), + 'quantity' => array( + 'title' => $this->l('Quantity received'), + 'width' => 100, + 'align' => 'left', + 'havingFilter' => true + ), + ); + + // loads history of the given order + unset($this->_select, $this->_join, $this->_where, $this->_orderBy, $this->_orderWay, $this->_group, $this->_filterHaving, $this->_filter); + $this->_select = 'CONCAT(e.`lastname`, \' \', e.`firstname`) as employee'; + $this->_join = 'LEFT JOIN `'._DB_PREFIX_.'employee` e ON (e.`id_employee` = a.`id_employee`)'; + $this->_where = 'AND a.`id_supplier_order_detail` = '.(int)$id_supplier_order_detail; + + // gets list and forces no limit clause in the request + $this->getList($lang_id, 'date_add', 'DESC', 0, false, false); + + // renders list + $helper = new HelperList(); + $helper->no_link = true; + $helper->show_toolbar = false; + $helper->toolbar_fix = false; + $helper->shopLinkType = ''; + $helper->identifier = $this->identifier; + $helper->colorOnBackground = true; + $helper->simple_header = true; + $content = $helper->generateList($this->_list, $this->fieldsDisplay); + + echo Tools::jsonEncode(array('use_parent_structure' => false, 'data' => $content)); + } die; }