diff --git a/admin-dev/themes/template/helper/list/list_footer.tpl b/admin-dev/themes/template/helper/list/list_footer.tpl index e360a5519..eb72b1f98 100644 --- a/admin-dev/themes/template/helper/list/list_footer.tpl +++ b/admin-dev/themes/template/helper/list/list_footer.tpl @@ -36,4 +36,4 @@ - + \ No newline at end of file diff --git a/admin-dev/themes/template/helper/list/list_header.tpl b/admin-dev/themes/template/helper/list/list_header.tpl index ded3ac459..11a14108a 100644 --- a/admin-dev/themes/template/helper/list/list_header.tpl +++ b/admin-dev/themes/template/helper/list/list_header.tpl @@ -59,6 +59,8 @@ {/if}{* End if simple_header *} +  + {if $show_toolbar}
@@ -74,7 +76,7 @@ {/if}
{block name="leadin"}{/block}
-  +
diff --git a/admin-dev/themes/template/stock_cover/content.tpl b/admin-dev/themes/template/stock_cover/content.tpl deleted file mode 100644 index 2b6fe8559..000000000 --- a/admin-dev/themes/template/stock_cover/content.tpl +++ /dev/null @@ -1,51 +0,0 @@ -{* -* 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 -*} - - - -{if count($stock_cover_periods) > 1} -
- - -
-{/if} -{if count($stock_cover_warehouses) > 1} -
- - -
-{/if} - - -{$content} \ No newline at end of file diff --git a/admin-dev/themes/template/stock_instant_state/content.tpl b/admin-dev/themes/template/stock_instant_state/content.tpl deleted file mode 100644 index aca257311..000000000 --- a/admin-dev/themes/template/stock_instant_state/content.tpl +++ /dev/null @@ -1,39 +0,0 @@ -{* -* 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 -*} -{if count($list_warehouses) > 1} -
- - - - -
-{/if} - -{$content} diff --git a/admin-dev/themes/template/stock_mvt/content.tpl b/admin-dev/themes/template/stock_mvt/content.tpl deleted file mode 100644 index 734d84a6a..000000000 --- a/admin-dev/themes/template/stock_mvt/content.tpl +++ /dev/null @@ -1,39 +0,0 @@ -{* -* 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: 9556 $ -* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) -* International Registered Trademark & Property of PrestaShop SA -*} -{if count($list_warehouses) > 1} -
- - - - -
-{/if} - -{$content} \ No newline at end of file diff --git a/controllers/admin/AdminStockCoverController.php b/controllers/admin/AdminStockCoverController.php index 54ffd0430..0dfed0d18 100644 --- a/controllers/admin/AdminStockCoverController.php +++ b/controllers/admin/AdminStockCoverController.php @@ -147,10 +147,10 @@ class AdminStockCoverControllerCore extends AdminController if ($this->getCurrentCoverageWarehouse() != -1) $this->_where .= ' AND s.id_warehouse = '.$this->getCurrentCoverageWarehouse(); - $this->context->smarty->assign('stock_cover_periods', $this->stock_cover_periods); - $this->context->smarty->assign('stock_cover_cur_period', $this->getCurrentCoveragePeriod()); - $this->context->smarty->assign('stock_cover_warehouses', $this->stock_cover_warehouses); - $this->context->smarty->assign('stock_cover_cur_warehouse', $this->getCurrentCoverageWarehouse()); + $this->tpl_list_vars['stock_cover_periods'] = $this->stock_cover_periods; + $this->tpl_list_vars['stock_cover_cur_period'] = $this->getCurrentCoveragePeriod(); + $this->tpl_list_vars['stock_cover_warehouses'] = $this->stock_cover_warehouses; + $this->tpl_list_vars['stock_cover_cur_warehouse'] = $this->getCurrentCoverageWarehouse(); $this->displayInformation( $this->l('Considering the coverage period choosen and the quantity of products/combinations that you sold, diff --git a/controllers/admin/AdminStockInstantStateController.php b/controllers/admin/AdminStockInstantStateController.php index 73a8db9c8..000372d71 100644 --- a/controllers/admin/AdminStockInstantStateController.php +++ b/controllers/admin/AdminStockInstantStateController.php @@ -96,8 +96,8 @@ class AdminStockInstantStateControllerCore extends AdminController //no link on list rows $this->list_no_link = true; - $this->context->smarty->assign('list_warehouses', Warehouse::getWarehouseList(true)); - $this->context->smarty->assign('current_warehouse', $this->getCurrentWarehouseId()); + $this->tpl_list_vars['list_warehouses'] = Warehouse::getWarehouseList(true); + $this->tpl_list_vars['current_warehouse'] = $this->getCurrentWarehouseId(); return parent::initList(); } diff --git a/controllers/admin/AdminStockManagementController.php b/controllers/admin/AdminStockManagementController.php index fa6c4c071..539f4373e 100644 --- a/controllers/admin/AdminStockManagementController.php +++ b/controllers/admin/AdminStockManagementController.php @@ -86,6 +86,8 @@ class AdminStockManagementControllerCore extends AdminController // no link on list rows $this->list_no_link = true; + $this->toolbar_btn = array(); + $this->_select = 'a.id_product as id, COUNT(pa.id_product_attribute) as variations'; $this->_join = 'LEFT JOIN `'._DB_PREFIX_.'product_attribute` pa ON (pa.id_product = a.id_product)'; @@ -689,6 +691,19 @@ class AdminStockManagementControllerCore extends AdminController 'href' => '#', 'desc' => $this->l('Save') ); + + // Default cancel button - like old back link + if (!isset($this->no_back) || $this->no_back == false) + { + $back = Tools::safeOutput(Tools::getValue('back', '')); + if (empty($back)) + $back = self::$currentIndex.'&token='.$this->token; + + $this->toolbar_btn['cancel'] = array( + 'href' => $back, + 'desc' => $this->l('Cancel') + ); + } break; default: @@ -705,13 +720,22 @@ class AdminStockManagementControllerCore extends AdminController parent::init(); if (Tools::isSubmit('addstock')) + { $this->display = 'addstock'; + $this->toolbar_title = $this->l('Stock : Add product'); + } if (Tools::isSubmit('removestock')) + { $this->display = 'removestock'; + $this->toolbar_title = $this->l('Stock : Remove product'); + } if (Tools::isSubmit('transferstock')) + { $this->display = 'transferstock'; + $this->toolbar_title = $this->l('Stock : Transfer product'); + } } /** @@ -760,6 +784,8 @@ class AdminStockManagementControllerCore extends AdminController // Render list $helper = new HelperList(); $helper->bulk_actions = array(); + $helper->toolbar_fix = $this->toolbar_fix; + $helper->show_toolbar = false; $helper->actions = $this->actions; $helper->list_skip_actions = $this->list_skip_actions; $helper->no_link = true; @@ -928,10 +954,8 @@ class AdminStockManagementControllerCore extends AdminController if (file_exists($this->context->smarty->template_dir.'/'.$this->tpl_folder.'form.tpl')) $helper->tpl = $this->tpl_folder.'form.tpl'; + $this->setHelperDisplay($helper); $helper->submit_action = $this->display; - $helper->toolbar_btn = $this->toolbar_btn; - $helper->currentIndex = self::$currentIndex; - $helper->token = $this->token; $helper->id = null; // no display standard hidden field in the form $helper->languages = $this->_languages; $helper->default_form_language = $this->default_form_language; diff --git a/controllers/admin/AdminStockMvtController.php b/controllers/admin/AdminStockMvtController.php index 46a1d06a7..350d73e1c 100644 --- a/controllers/admin/AdminStockMvtController.php +++ b/controllers/admin/AdminStockMvtController.php @@ -95,7 +95,7 @@ class AdminStockMvtControllerCore extends AdminController ) ); - $this->context->smarty->assign('list_warehouses', array()); + $this->tpl_list_vars['list_warehouses'] = array(); parent::__construct(); } @@ -106,6 +106,8 @@ class AdminStockMvtControllerCore extends AdminController */ public function initForm() { + $this->toolbar_title = $this->l('Stock : Add Stock movement reason'); + $this->fields_form = array( 'legend' => array( 'title' => $this->l('Stock Movement Reason'), @@ -176,30 +178,27 @@ class AdminStockMvtControllerCore extends AdminController $this->addRowActionSkipList('edit', array(6, 7)); $this->addRowActionSkipList('delete', array(1, 2, 3, 4, 6, 7)); - if (!isset($_GET['addstock_mvt_reason']) || (Tools::isSubmit('submitAddstock_mvt_reason') && Tools::getValue('id_stock_mvt_reason'))) - { - $first_list = '

'.$this->l('Stock movement reason').'

'; - $first_list .= parent::initList(); - } + $this->toolbar_title = $this->l('Stock : Stock movements reasons'); + $first_list = parent::initList(); /* * Manage second list */ $warehouses = Warehouse::getWarehouseList(true); array_unshift($warehouses, array('id_warehouse' => -1, 'name' => $this->l('All Warehouses'))); - $this->context->smarty->assign('list_warehouses', $warehouses); - $this->context->smarty->assign('current_warehouse', $this->getCurrentWarehouseId()); + $this->tpl_list_vars['list_warehouses'] = $warehouses; + $this->tpl_list_vars['current_warehouse'] = $this->getCurrentWarehouseId(); // reset actions, toolbar and query vars $this->actions = array(); $this->toolbar_btn = array(); + $this->toolbar_title = $this->l('Stock : Stock movements'); unset($this->_select, $this->_join, $this->_group, $this->_filterHaving, $this->_filter); // override table, land, className and identifier for the current controller $this->table = 'stock_mvt'; $this->className = 'StockMvt'; $this->identifier = 'id_stock_mvt'; - $this->show_toolbar = false; $this->lang = false; // test if a filter is applied for this list diff --git a/controllers/admin/AdminSupplierOrdersController.php b/controllers/admin/AdminSupplierOrdersController.php index 24dfc2e29..e03cb53f1 100644 --- a/controllers/admin/AdminSupplierOrdersController.php +++ b/controllers/admin/AdminSupplierOrdersController.php @@ -139,6 +139,8 @@ class AdminSupplierOrdersControllerCore extends AdminController { if (Tools::isSubmit('addsupplier_order_state')) { + $this->toolbar_title = $this->l('Stock : Add Supplier order state'); + $this->fields_form = array( 'legend' => array( 'title' => $this->l('Supplier Order State'), @@ -263,6 +265,13 @@ class AdminSupplierOrdersControllerCore extends AdminController Tools::isSubmit('submitAddsupplier_order') || Tools::isSubmit('submitUpdatesupplier_order')) { + + if (Tools::isSubmit('addsupplier_order') || Tools::isSubmit('submitAddsupplier_order')) + $this->toolbar_title = $this->l('Stock : Create new supplier order'); + + if (Tools::isSubmit('updatesupplier_order') || Tools::isSubmit('submitUpdatesupplier_order')) + $this->toolbar_title = $this->l('Stock : Manage supplier order'); + $this->addJqueryUI('ui.datepicker'); //get warehouses list @@ -405,8 +414,8 @@ class AdminSupplierOrdersControllerCore extends AdminController $this->addRowActionSkipList('edit', array(1, 2, 3, 4, 5, 6)); $this->addRowActionSkipList('delete', array(1, 2, 3, 4, 5, 6)); - $first_list = '

'.$this->l('Suppliers Orders States').'

'; - $first_list .= parent::initList(); + $this->toolbar_title = $this->l('Stock : Suppliers Orders States'); + $first_list = parent::initList(); /* * Manage second list @@ -415,6 +424,7 @@ class AdminSupplierOrdersControllerCore extends AdminController $this->actions = array(); $this->list_skip_actions = array(); $this->toolbar_btn = array(); + $this->toolbar_title = ''; unset($this->_select, $this->_join, $this->_group, $this->_filterHaving, $this->_filter); // override table, land, className and identifier for the current controller @@ -786,8 +796,8 @@ class AdminSupplierOrdersControllerCore extends AdminController a.id_supplier_order_detail as id, a.quantity_received as quantity_received, 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, + IF (a.quantity_expected < a.quantity_received, 0, a.quantity_expected - a.quantity_received) as quantity_left, + IF (a.quantity_expected < a.quantity_received, 0, 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, p.reference as p_reference, p.ean13 as p_ean13'; @@ -1098,9 +1108,8 @@ class AdminSupplierOrdersControllerCore extends AdminController 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) + // It's possible to receive more quantity than expected in case of a shipping error from the supplier + if (!Validate::isInt($quantity) || $quantity < 0) $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 { @@ -1117,7 +1126,7 @@ class AdminSupplierOrdersControllerCore extends AdminController } } - if (!count($this_errors)) + if (!count($this->_errors)) { // display confirm message $token = Tools::getValue('token') ? Tools::getValue('token') : $this->token; diff --git a/controllers/admin/AdminWarehousesController.php b/controllers/admin/AdminWarehousesController.php index 6880974eb..453f70c3a 100644 --- a/controllers/admin/AdminWarehousesController.php +++ b/controllers/admin/AdminWarehousesController.php @@ -51,6 +51,8 @@ class AdminWarehousesControllerCore extends AdminController 'employee' => array( 'title' => $this->l('Manager'), 'width' => 200, + 'filter_key' => 'employee', + 'havingFilter' => true ), 'location' => array( 'title' => $this->l('Location'), @@ -115,9 +117,11 @@ class AdminWarehousesControllerCore extends AdminController $query->where('active = 1'); $employees_array = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query); + $this->toolbar_title = $this->l('Stock : Warehouse management'); + $this->fields_form = array( 'legend' => array( - 'title' => $this->l('Warehouse'), + 'title' => $this->l('Warehouse management'), 'image' => '../img/admin/tab.gif' ), 'input' => array(