diff --git a/admin-dev/themes/default/admin.css b/admin-dev/themes/default/admin.css index 1223a8f3a..d8f0e1cef 100644 --- a/admin-dev/themes/default/admin.css +++ b/admin-dev/themes/default/admin.css @@ -213,6 +213,7 @@ form#product_form h4 { font-size:18px; font-weight:normal;} .filter-stock { background-color:#ebedf4; border:1px solid #c2c4d9; margin-bottom:15px; padding:10px; display:block; min-height:25px;} .filter-stock #stock_cover {float:left; margin-right:30px;} .filter-stock #stock_instant_state {float:left; margin-right:30px;} +.filter-stock #supply_orders {float:left; margin-right:30px;} .filter-stock label {width:auto;} .filter-stock .select-filter { float:left;} .filter-stock .button-filter { float:right;} diff --git a/admin-dev/themes/template/supply_orders/list_header.tpl b/admin-dev/themes/template/supply_orders/list_header.tpl new file mode 100644 index 000000000..dcc63aecb --- /dev/null +++ b/admin-dev/themes/template/supply_orders/list_header.tpl @@ -0,0 +1,46 @@ +{* +* 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 +*} +{extends file="helper/list/list_header.tpl"} +{block name=override_header} +{if isset($warehouses) && count($warehouses) > 0 && isset($filter_status)} +
+
+ + + + + +
+
+{/if} +{/block} + + + \ No newline at end of file diff --git a/controllers/admin/AdminStockMvtController.php b/controllers/admin/AdminStockMvtController.php index 489443e41..031ed0c55 100644 --- a/controllers/admin/AdminStockMvtController.php +++ b/controllers/admin/AdminStockMvtController.php @@ -40,7 +40,6 @@ class AdminStockMvtControllerCore extends AdminController $this->list_no_link = true; $this->displayInformation($this->l('This interface allows you to display the stock movements for a selected warehouse.').'
'); - $this->displayInformation($this->l('Also, it allows you to add and edit your own stock movement labels.')); $this->fieldsDisplay = array( 'product_reference' => array( diff --git a/controllers/admin/AdminSupplyOrdersController.php b/controllers/admin/AdminSupplyOrdersController.php index 3682b841f..72ce55f7a 100644 --- a/controllers/admin/AdminSupplyOrdersController.php +++ b/controllers/admin/AdminSupplyOrdersController.php @@ -30,6 +30,12 @@ */ class AdminSupplyOrdersControllerCore extends AdminController { + + /* + * @var array List of warehouses + */ + private $warehouses; + public function __construct() { $this->context = Context::getContext(); @@ -100,6 +106,11 @@ class AdminSupplyOrdersControllerCore extends AdminController ), ); + // gets the list of warehouses available + $this->warehouses = Warehouse::getWarehouses(true); + // gets the final list of warehouses + array_unshift($this->warehouses, array('id_warehouse' => -1, 'name' => $this->l('All Warehouses'))); + parent::__construct(); } @@ -322,6 +333,13 @@ class AdminSupplyOrdersControllerCore extends AdminController public function initList() { $this->displayInformation($this->l('This interface allows you to manage supply orders.').'
'); + $this->displayInformation($this->l('Also, you can create templates that you can later use to generate actual orders.').'
'); + + // assigns warehouses + $this->tpl_list_vars['warehouses'] = $this->warehouses; + $this->tpl_list_vars['current_warehouse'] = $this->getCurrentWarehouse(); + $this->tpl_list_vars['filter_status'] = $this->getFilterStatus(); + // access if (!($this->tabAccess['add'] === '1')) @@ -350,10 +368,17 @@ class AdminSupplyOrdersControllerCore extends AdminController LEFT JOIN `'._DB_PREFIX_.'warehouse` w ON (w.id_warehouse = a.id_warehouse)'; $this->_where = ' AND a.is_template = 0'; + if ($this->getCurrentWarehouse() != -1) + $this->_where .= ' AND a.id_warehouse = '.$this->getCurrentWarehouse(); + if ($this->getFilterStatus() != 0) + $this->_where .= ' AND st.enclosed != 1'; $first_list = parent::initList(); // second list : templates $second_list = null; + unset($this->tpl_list_vars['warehouses']); + unset($this->tpl_list_vars['current_warehouse']); + unset($this->tpl_list_vars['filter_status']); // unsets actions $this->actions = array(); @@ -367,6 +392,8 @@ class AdminSupplyOrdersControllerCore extends AdminController // adds filter, to gets only templates unset($this->_where); $this->_where = ' AND a.is_template = 1'; + if ($this->getCurrentWarehouse() != -1) + $this->_where .= ' AND a.id_warehouse = '.$this->getCurrentWarehouse(); // re-defines toolbar & buttons $this->toolbar_title = $this->l('Stock : Supply orders templates'); @@ -1792,4 +1819,38 @@ class AdminSupplyOrdersControllerCore extends AdminController $redirect = self::$currentIndex.'&token='.$token; $this->redirect_after = $redirect.'&conf=19'; } + + /** + * Gets the current warehouse used + * + * @return int id_warehouse + */ + private function getCurrentWarehouse() + { + static $warehouse = 0; + + if ($warehouse == 0) + { + $warehouse = -1; // all warehouses + if ((int)Tools::getValue('id_warehouse')) + $warehouse = (int)Tools::getValue('id_warehouse'); + } + return $warehouse; + } + + /** + * Gets the current warehouse used + * + * @return int id_warehouse + */ + private function getFilterStatus() + { + static $status = 0; + + $status = 0; + if (Tools::getValue('filter_status') === 'on') + $status = 1; + + return $status; + } }