// #PSFV-94 : fix toolbar and leadin integration on all stock controllers + bugs fix
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@9932 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 = '<hr /><h2>'.$this->l('Stock movement reason').'</h2>';
|
||||
$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
|
||||
|
||||
@@ -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 = '<hr /><h2>'.$this->l('Suppliers Orders States').'</h2>';
|
||||
$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;
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user