// CRUD for StockMvtLabels & SupplyOrderStatus are now in AdminStockConfigurationController
This commit is contained in:
1 parent
11b6135140
commit
2e19a2bda4
5 files changed
+650
-562
No files matched your search
@@ -0,0 +1,552 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* 2007-2011 PrestaShop
|
||||||
|
*
|
||||||
|
* NOTICE OF LICENSE
|
||||||
|
*
|
||||||
|
* This source file is subject to the Open Software License (OSL 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/osl-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 <contact@prestashop.com>
|
||||||
|
* @copyright 2007-2011 PrestaShop SA
|
||||||
|
* @version Release: $Revision$
|
||||||
|
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||||
|
* International Registered Trademark & Property of PrestaShop SA
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @since 1.5.0
|
||||||
|
*/
|
||||||
|
class AdminStockConfigurationController extends AdminController
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* By default, we use StockMvtReason as the table / className
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->context = Context::getContext();
|
||||||
|
$this->table = 'stock_mvt_reason';
|
||||||
|
$this->className = 'StockMvtReason';
|
||||||
|
$this->lang = true;
|
||||||
|
|
||||||
|
// defines fields
|
||||||
|
$this->fieldsDisplay = array(
|
||||||
|
'id_stock_mvt_reason' => array(
|
||||||
|
'title' => $this->l('ID'),
|
||||||
|
'align' => 'center',
|
||||||
|
'width' => 40,
|
||||||
|
'search' => false,
|
||||||
|
),
|
||||||
|
'sign' => array(
|
||||||
|
'title' => $this->l('Sign'),
|
||||||
|
'width' => 100,
|
||||||
|
'align' => 'center',
|
||||||
|
'type' => 'select',
|
||||||
|
'filter_key' => 'a!sign',
|
||||||
|
'list' => array(
|
||||||
|
'1' => $this->l('Increment'),
|
||||||
|
'-1' => $this->l('Decrement'),
|
||||||
|
),
|
||||||
|
'icon' => array(
|
||||||
|
-1 => 'remove_stock.png',
|
||||||
|
1 => 'add_stock.png'
|
||||||
|
),
|
||||||
|
'orderby' => false
|
||||||
|
),
|
||||||
|
'name' => array(
|
||||||
|
'title' => $this->l('Name'),
|
||||||
|
'filter_key' => 'b!name',
|
||||||
|
'width' => 250
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
// loads labels (incremenation)
|
||||||
|
$reasons_inc = StockMvtReason::getStockMvtReasonsWithFilter($this->context->language->id,
|
||||||
|
array(Configuration::get('PS_STOCK_MVT_TRANSFER_TO')), 1);
|
||||||
|
// loads labaels (decremenation)
|
||||||
|
$reasons_dec = StockMvtReason::getStockMvtReasonsWithFilter($this->context->language->id,
|
||||||
|
array(Configuration::get('PS_STOCK_MVT_TRANSFER_FROM')), -1);
|
||||||
|
|
||||||
|
// defines options for StockMvt
|
||||||
|
$this->options = array(
|
||||||
|
'general' => array(
|
||||||
|
'title' => $this->l('Options'),
|
||||||
|
'fields' => array(
|
||||||
|
'PS_STOCK_MVT_INC_REASON_DEFAULT' => array(
|
||||||
|
'title' => $this->l('Default label when incrementing stock:'),
|
||||||
|
'cast' => 'intval',
|
||||||
|
'type' => 'select',
|
||||||
|
'list' => $reasons_inc,
|
||||||
|
'identifier' => 'id_stock_mvt_reason',
|
||||||
|
'visibility' => Shop::CONTEXT_ALL
|
||||||
|
),
|
||||||
|
'PS_STOCK_MVT_DEC_REASON_DEFAULT' => array(
|
||||||
|
'title' => $this->l('Default label when decrementing stock:'),
|
||||||
|
'cast' => 'intval',
|
||||||
|
'type' => 'select',
|
||||||
|
'list' => $reasons_dec,
|
||||||
|
'identifier' => 'id_stock_mvt_reason',
|
||||||
|
'visibility' => Shop::CONTEXT_ALL
|
||||||
|
),
|
||||||
|
'PS_STOCK_CUSTOMER_ORDER_REASON' => array(
|
||||||
|
'title' => $this->l('Default label when decrementing stock when a customer order is shipped:'),
|
||||||
|
'cast' => 'intval',
|
||||||
|
'type' => 'select',
|
||||||
|
'list' => $reasons_dec,
|
||||||
|
'identifier' => 'id_stock_mvt_reason',
|
||||||
|
'visibility' => Shop::CONTEXT_ALL
|
||||||
|
),
|
||||||
|
'PS_STOCK_MVT_SUPPLY_ORDER' => array(
|
||||||
|
'title' => $this->l('Default label when incrementing stock when a supply order is received:'),
|
||||||
|
'cast' => 'intval',
|
||||||
|
'type' => 'select',
|
||||||
|
'list' => $reasons_inc,
|
||||||
|
'identifier' => 'id_stock_mvt_reason',
|
||||||
|
'visibility' => Shop::CONTEXT_ALL
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'submit' => array(),
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function init()
|
||||||
|
{
|
||||||
|
// if we are managing the second list (i.e. supply order state)
|
||||||
|
if (Tools::isSubmit('addsupply_order_state') ||
|
||||||
|
Tools::isSubmit('updatesupply_order_state') ||
|
||||||
|
Tools::isSubmit('deletesupply_order_state'))
|
||||||
|
{
|
||||||
|
$this->table = 'supply_order_state';
|
||||||
|
$this->className = 'SupplyOrderState';
|
||||||
|
$this->identifier = 'id_supply_order_state';
|
||||||
|
$this->display = 'edit';
|
||||||
|
}
|
||||||
|
return parent::init();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* AdminController::initForm() override
|
||||||
|
* @see AdminController::initForm()
|
||||||
|
*/
|
||||||
|
public function initForm()
|
||||||
|
{
|
||||||
|
// if we are managing StockMvtReason
|
||||||
|
if (Tools::isSubmit('addstock_mvt_reason') || Tools::isSubmit('updatestock_mvt_reason'))
|
||||||
|
{
|
||||||
|
$this->toolbar_title = $this->l('Stock : Add stock movement label');
|
||||||
|
|
||||||
|
$this->fields_form = array(
|
||||||
|
'legend' => array(
|
||||||
|
'title' => $this->l('Stock Movement Label'),
|
||||||
|
'image' => '../img/admin/edit.gif'
|
||||||
|
),
|
||||||
|
'input' => array(
|
||||||
|
array(
|
||||||
|
'type' => 'text',
|
||||||
|
'lang' => true,
|
||||||
|
'label' => $this->l('Name:'),
|
||||||
|
'name' => 'name',
|
||||||
|
'size' => 50,
|
||||||
|
'required' => true
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'type' => 'select',
|
||||||
|
'label' => $this->l('Action:'),
|
||||||
|
'name' => 'sign',
|
||||||
|
'required' => true,
|
||||||
|
'options' => array(
|
||||||
|
'query' => array(
|
||||||
|
array(
|
||||||
|
'id' => '1',
|
||||||
|
'name' => $this->l('Increase stock')
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'id' => '-1',
|
||||||
|
'name' => $this->l('Decrease stock')
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'id' => 'id',
|
||||||
|
'name' => 'name'
|
||||||
|
),
|
||||||
|
'desc' => $this->l('Select the corresponding action : increments or decrements stock.')
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'submit' => array(
|
||||||
|
'title' => $this->l(' Save '),
|
||||||
|
'class' => 'button'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
// else, if we are managing Supply Order State
|
||||||
|
else if (Tools::isSubmit('addsupply_order_state') ||
|
||||||
|
Tools::isSubmit('updatesupply_order_state') ||
|
||||||
|
Tools::isSubmit('submitAddsupply_order_state') ||
|
||||||
|
Tools::isSubmit('submitUpdatesupply_order_state'))
|
||||||
|
{
|
||||||
|
$this->fields_form = array(
|
||||||
|
'legend' => array(
|
||||||
|
'title' => $this->l('Supply Order Status'),
|
||||||
|
'image' => '../img/admin/edit.gif'
|
||||||
|
),
|
||||||
|
'input' => array(
|
||||||
|
array(
|
||||||
|
'type' => 'text',
|
||||||
|
'lang' => true,
|
||||||
|
'label' => $this->l('Status:'),
|
||||||
|
'name' => 'name',
|
||||||
|
'size' => 50,
|
||||||
|
'required' => true
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'type' => 'color',
|
||||||
|
'label' => $this->l('Color:'),
|
||||||
|
'name' => 'color',
|
||||||
|
'size' => 20,
|
||||||
|
'desc' => $this->l('Back office background will be displayed in this color. HTML colors only.'),
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'type' => 'radio',
|
||||||
|
'label' => $this->l('Editable:'),
|
||||||
|
'name' => 'editable',
|
||||||
|
'required' => true,
|
||||||
|
'class' => 't',
|
||||||
|
'is_bool' => true,
|
||||||
|
'values' => array(
|
||||||
|
array(
|
||||||
|
'id' => 'active_on',
|
||||||
|
'value' => 1,
|
||||||
|
'label' => $this->l('Yes')
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'id' => 'active_off',
|
||||||
|
'value' => 0,
|
||||||
|
'label' => $this->l('No')
|
||||||
|
)
|
||||||
|
),
|
||||||
|
'desc' => $this->l('For this status, you have to define if it is possible to edit the order.
|
||||||
|
An editable order is an order not valid to send to the supplier.')
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'type' => 'radio',
|
||||||
|
'label' => $this->l('Delivery note:'),
|
||||||
|
'name' => 'delivery_note',
|
||||||
|
'required' => true,
|
||||||
|
'class' => 't',
|
||||||
|
'is_bool' => true,
|
||||||
|
'values' => array(
|
||||||
|
array(
|
||||||
|
'id' => 'active_on',
|
||||||
|
'value' => 1,
|
||||||
|
'label' => $this->l('Yes')
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'id' => 'active_off',
|
||||||
|
'value' => 0,
|
||||||
|
'label' => $this->l('No')
|
||||||
|
)
|
||||||
|
),
|
||||||
|
'desc' => $this->l('For this status, you have to define if it is possible to generate the delivery note of the order.')
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'type' => 'radio',
|
||||||
|
'label' => $this->l('Delivery state:'),
|
||||||
|
'name' => 'receipt_state',
|
||||||
|
'required' => true,
|
||||||
|
'class' => 't',
|
||||||
|
'is_bool' => true,
|
||||||
|
'values' => array(
|
||||||
|
array(
|
||||||
|
'id' => 'active_on',
|
||||||
|
'value' => 1,
|
||||||
|
'label' => $this->l('Yes')
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'id' => 'active_off',
|
||||||
|
'value' => 0,
|
||||||
|
'label' => $this->l('No')
|
||||||
|
)
|
||||||
|
),
|
||||||
|
'desc' => $this->l('For this status, you have to define if products have been partially/completely received.
|
||||||
|
This allows to know if the products ordered have to be added to the corresponding warehouse.'),
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'type' => 'radio',
|
||||||
|
'label' => $this->l('Pending receipt:'),
|
||||||
|
'name' => 'pending_receipt',
|
||||||
|
'required' => true,
|
||||||
|
'class' => 't',
|
||||||
|
'is_bool' => true,
|
||||||
|
'values' => array(
|
||||||
|
array(
|
||||||
|
'id' => 'active_on',
|
||||||
|
'value' => 1,
|
||||||
|
'label' => $this->l('Yes')
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'id' => 'active_off',
|
||||||
|
'value' => 0,
|
||||||
|
'label' => $this->l('No')
|
||||||
|
)
|
||||||
|
),
|
||||||
|
'desc' => $this->l('Does this status mean that you are waiting for the delivery ?')
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'submit' => array(
|
||||||
|
'title' => $this->l(' Save '),
|
||||||
|
'class' => 'button'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
if (Tools::isSubmit('addsupply_order_state'))
|
||||||
|
$this->toolbar_title = $this->l('Stock : Add supply order status');
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->toolbar_title = $this->l('Stock : Update Supply order status');
|
||||||
|
|
||||||
|
$id_supply_order_state = Tools::getValue('id_supply_order_state', 0);
|
||||||
|
|
||||||
|
// only some fields are editable for initial states
|
||||||
|
if (in_array($id_supply_order_state, array(1, 2, 3, 4, 5, 6)))
|
||||||
|
{
|
||||||
|
$this->fields_form = array(
|
||||||
|
'legend' => array(
|
||||||
|
'title' => $this->l('Supply Order status'),
|
||||||
|
'image' => '../img/admin/edit.gif'
|
||||||
|
),
|
||||||
|
'input' => array(
|
||||||
|
array(
|
||||||
|
'type' => 'text',
|
||||||
|
'lang' => true,
|
||||||
|
'label' => $this->l('Status:'),
|
||||||
|
'name' => 'name',
|
||||||
|
'size' => 50,
|
||||||
|
'required' => true
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'type' => 'color',
|
||||||
|
'label' => $this->l('Back office color:'),
|
||||||
|
'name' => 'color',
|
||||||
|
'size' => 20,
|
||||||
|
'desc' => $this->l('Back office background will be displayed in this color. HTML colors only'),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'submit' => array(
|
||||||
|
'title' => $this->l(' Save '),
|
||||||
|
'class' => 'button'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!($obj = new SupplyOrderState((int)$id_supply_order_state)))
|
||||||
|
return;
|
||||||
|
|
||||||
|
$this->fields_value = array(
|
||||||
|
'color' => $obj->color,
|
||||||
|
'editable' => $obj->editable,
|
||||||
|
'delivery_note' => $obj->delivery_note,
|
||||||
|
'receipt_state' => $obj->receipt_state,
|
||||||
|
'pending_receipt' => $obj->pending_receipt,
|
||||||
|
);
|
||||||
|
foreach ($this->getLanguages() as $language)
|
||||||
|
$this->fields_value['name'][$language['id_lang']] = $this->getFieldValue($obj, 'name', $language['id_lang']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return parent::initForm();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* AdminController::initList() override
|
||||||
|
* @see AdminController::initList()
|
||||||
|
*/
|
||||||
|
public function initList()
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* General messages displayed for all lists
|
||||||
|
*/
|
||||||
|
$this->displayInformation($this->l('This interface allows you to configure your supply orders status and stock movements labels.').'<br />');
|
||||||
|
|
||||||
|
// Checks access
|
||||||
|
if (!($this->tabAccess['add'] === '1'))
|
||||||
|
unset($this->toolbar_btn['new']);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* First list
|
||||||
|
* Stock Mvt Labels/Reasons
|
||||||
|
*/
|
||||||
|
$first_list = null;
|
||||||
|
$this->list_no_link = true;
|
||||||
|
$this->addRowAction('edit');
|
||||||
|
$this->addRowAction('delete');
|
||||||
|
$this->addRowActionSkipList('edit', array(1, 2, 3, 4, 5, 6, 7, 8));
|
||||||
|
$this->addRowActionSkipList('delete', array(1, 2, 3, 4, 5, 6, 7, 8));
|
||||||
|
$this->_where = ' AND a.deleted = 0';
|
||||||
|
|
||||||
|
$this->toolbar_title = $this->l('Stock : Stock movements labels');
|
||||||
|
$first_list = parent::initList();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Second list
|
||||||
|
* Supply Order Status/State
|
||||||
|
*/
|
||||||
|
$second_list = null;
|
||||||
|
unset($this->_select, $this->_where, $this->_join, $this->_group, $this->_filterHaving, $this->_filter, $this->list_skip_actions['delete'], $this->list_skip_actions['edit']);
|
||||||
|
|
||||||
|
// generates the actual second list
|
||||||
|
$second_list = $this->initSupplyOrderStatusList();
|
||||||
|
|
||||||
|
// resets default table and className for options list management
|
||||||
|
$this->table = 'stock_mvt_reason';
|
||||||
|
$this->className = 'StockMvtReason';
|
||||||
|
|
||||||
|
// returns the final list
|
||||||
|
return $second_list.$first_list;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Help function for AdminStockConfigurationController::initList()
|
||||||
|
* @see AdminStockConfigurationController::initList()
|
||||||
|
*/
|
||||||
|
public function initSupplyOrderStatusList()
|
||||||
|
{
|
||||||
|
$this->table = 'supply_order_state';
|
||||||
|
$this->className = 'SupplyOrderState';
|
||||||
|
$this->identifier = 'id_supply_order_state';
|
||||||
|
$this->_defaultOrderBy = 'id_supply_order_state';
|
||||||
|
$this->lang = true;
|
||||||
|
$this->list_no_link = true;
|
||||||
|
$this->addRowActionSkipList('delete', array(1, 2, 3, 4, 5, 6));
|
||||||
|
$this->toolbar_title = $this->l('Stock : Supply Order status');
|
||||||
|
$this->initToolbar();
|
||||||
|
|
||||||
|
$this->fieldsDisplay = array(
|
||||||
|
'name' => array(
|
||||||
|
'title' => $this->l('Name'),
|
||||||
|
'color' => 'color',
|
||||||
|
),
|
||||||
|
'editable' => array(
|
||||||
|
'title' => $this->l('Editable?'),
|
||||||
|
'align' => 'center',
|
||||||
|
'icon' => array(
|
||||||
|
'1' => 'enabled.gif',
|
||||||
|
'0' => 'disabled.gif'
|
||||||
|
),
|
||||||
|
'type' => 'bool',
|
||||||
|
'width' => 170,
|
||||||
|
'orderby' => false
|
||||||
|
),
|
||||||
|
'delivery_note' => array(
|
||||||
|
'title' => $this->l('Delivery note available?'),
|
||||||
|
'align' => 'center',
|
||||||
|
'icon' => array(
|
||||||
|
'1' => 'enabled.gif',
|
||||||
|
'0' => 'disabled.gif'
|
||||||
|
),
|
||||||
|
'type' => 'bool',
|
||||||
|
'width' => 170,
|
||||||
|
'orderby' => false
|
||||||
|
),
|
||||||
|
'pending_receipt' => array(
|
||||||
|
'title' => $this->l('Is a pending receipt state?'),
|
||||||
|
'align' => 'center',
|
||||||
|
'icon' => array(
|
||||||
|
'1' => 'enabled.gif',
|
||||||
|
'0' => 'disabled.gif'
|
||||||
|
),
|
||||||
|
'type' => 'bool',
|
||||||
|
'width' => 170,
|
||||||
|
'orderby' => false
|
||||||
|
),
|
||||||
|
'receipt_state' => array(
|
||||||
|
'title' => $this->l('Is a delivery state?'),
|
||||||
|
'align' => 'center',
|
||||||
|
'icon' => array(
|
||||||
|
'1' => 'enabled.gif',
|
||||||
|
'0' => 'disabled.gif'
|
||||||
|
),
|
||||||
|
'type' => 'bool',
|
||||||
|
'width' => 170,
|
||||||
|
'orderby' => false
|
||||||
|
),
|
||||||
|
'enclosed' => array(
|
||||||
|
'title' => $this->l('Is an enclosed order state?'),
|
||||||
|
'align' => 'center',
|
||||||
|
'icon' => array(
|
||||||
|
'1' => 'enabled.gif',
|
||||||
|
'0' => 'disabled.gif'
|
||||||
|
),
|
||||||
|
'type' => 'bool',
|
||||||
|
'width' => 170,
|
||||||
|
'orderby' => false
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
return parent::initList();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* AdminController::postProcess() override
|
||||||
|
* @see AdminController::postProcess()
|
||||||
|
*/
|
||||||
|
public function postProcess()
|
||||||
|
{
|
||||||
|
// StockMvtReason
|
||||||
|
if (Tools::isSubmit('delete'.$this->table))
|
||||||
|
$this->deleted = true;
|
||||||
|
|
||||||
|
// SupplyOrderState
|
||||||
|
if (Tools::isSubmit('submitAddsupply_order_state') ||
|
||||||
|
Tools::isSubmit('deletesupply_order_state') ||
|
||||||
|
Tools::isSubmit('submitUpdatesupply_order_state'))
|
||||||
|
{
|
||||||
|
if (Tools::isSubmit('deletesupply_order_state'))
|
||||||
|
$this->action = 'delete';
|
||||||
|
else
|
||||||
|
$this->action = 'save';
|
||||||
|
$this->table = 'supply_order_state';
|
||||||
|
$this->className = 'SupplyOrderState';
|
||||||
|
$this->identifier = 'id_supply_order_state';
|
||||||
|
$this->_defaultOrderBy = 'id_supply_order_state';
|
||||||
|
}
|
||||||
|
|
||||||
|
return parent::postProcess();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* AdminController::getList() override
|
||||||
|
* @see AdminController::getList()
|
||||||
|
*/
|
||||||
|
public function getList($id_lang, $order_by = null, $order_way = null, $start = 0, $limit = null, $id_lang_shop = false)
|
||||||
|
{
|
||||||
|
parent::getList($id_lang, $order_by, $order_way, $start, $limit, $id_lang_shop);
|
||||||
|
|
||||||
|
//If there is a field product_name in the list, check if this field is null and display standard message
|
||||||
|
foreach ($this->fieldsDisplay as $key => $value)
|
||||||
|
if ($key == 'product_name')
|
||||||
|
{
|
||||||
|
$nb_items = count($this->_list);
|
||||||
|
|
||||||
|
for ($i = 0; $i < $nb_items; ++$i)
|
||||||
|
{
|
||||||
|
$item = &$this->_list[$i];
|
||||||
|
|
||||||
|
if (empty($item['product_name']))
|
||||||
|
$item['product_name'] = $this->l('The name of this product is not available. Maybe it has been deleted from the system.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -33,205 +33,15 @@ class AdminStockMvtControllerCore extends AdminController
|
|||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->context = Context::getContext();
|
$this->context = Context::getContext();
|
||||||
$this->table = 'stock_mvt_reason';
|
|
||||||
$this->className = 'StockMvtReason';
|
|
||||||
$this->lang = true;
|
|
||||||
|
|
||||||
$this->fieldsDisplay = array(
|
|
||||||
'id_stock_mvt_reason' => array(
|
|
||||||
'title' => $this->l('ID'),
|
|
||||||
'align' => 'center',
|
|
||||||
'width' => 40,
|
|
||||||
'search' => false,
|
|
||||||
),
|
|
||||||
'sign' => array(
|
|
||||||
'title' => $this->l('Sign'),
|
|
||||||
'width' => 100,
|
|
||||||
'align' => 'center',
|
|
||||||
'type' => 'select',
|
|
||||||
'filter_key' => 'a!sign',
|
|
||||||
'list' => array(
|
|
||||||
'1' => $this->l('Increment'),
|
|
||||||
'-1' => $this->l('Decrement'),
|
|
||||||
),
|
|
||||||
'icon' => array(
|
|
||||||
-1 => 'remove_stock.png',
|
|
||||||
1 => 'add_stock.png'
|
|
||||||
),
|
|
||||||
'orderby' => false
|
|
||||||
),
|
|
||||||
'name' => array(
|
|
||||||
'title' => $this->l('Name'),
|
|
||||||
'filter_key' => 'b!name',
|
|
||||||
'width' => 500
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
$reasons_inc = StockMvtReason::getStockMvtReasonsWithFilter($this->context->language->id,
|
|
||||||
array(Configuration::get('PS_STOCK_MVT_TRANSFER_TO')), 1);
|
|
||||||
$reasons_dec = StockMvtReason::getStockMvtReasonsWithFilter($this->context->language->id,
|
|
||||||
array(Configuration::get('PS_STOCK_MVT_TRANSFER_FROM')), -1);
|
|
||||||
|
|
||||||
$this->options = array(
|
|
||||||
'general' => array(
|
|
||||||
'title' => $this->l('Options'),
|
|
||||||
'fields' => array(
|
|
||||||
'PS_STOCK_MVT_INC_REASON_DEFAULT' => array(
|
|
||||||
'title' => $this->l('Default label when incrementing stock:'),
|
|
||||||
'cast' => 'intval',
|
|
||||||
'type' => 'select',
|
|
||||||
'list' => $reasons_inc,
|
|
||||||
'identifier' => 'id_stock_mvt_reason',
|
|
||||||
'visibility' => Shop::CONTEXT_ALL
|
|
||||||
),
|
|
||||||
'PS_STOCK_MVT_DEC_REASON_DEFAULT' => array(
|
|
||||||
'title' => $this->l('Default label when decrementing stock:'),
|
|
||||||
'cast' => 'intval',
|
|
||||||
'type' => 'select',
|
|
||||||
'list' => $reasons_dec,
|
|
||||||
'identifier' => 'id_stock_mvt_reason',
|
|
||||||
'visibility' => Shop::CONTEXT_ALL
|
|
||||||
),
|
|
||||||
'PS_STOCK_CUSTOMER_ORDER_REASON' => array(
|
|
||||||
'title' => $this->l('Default label when decrementing stock when a customer order is shipped:'),
|
|
||||||
'cast' => 'intval',
|
|
||||||
'type' => 'select',
|
|
||||||
'list' => $reasons_dec,
|
|
||||||
'identifier' => 'id_stock_mvt_reason',
|
|
||||||
'visibility' => Shop::CONTEXT_ALL
|
|
||||||
),
|
|
||||||
'PS_STOCK_MVT_SUPPLY_ORDER' => array(
|
|
||||||
'title' => $this->l('Default label when incrementing stock when a supply order is received:'),
|
|
||||||
'cast' => 'intval',
|
|
||||||
'type' => 'select',
|
|
||||||
'list' => $reasons_inc,
|
|
||||||
'identifier' => 'id_stock_mvt_reason',
|
|
||||||
'visibility' => Shop::CONTEXT_ALL
|
|
||||||
),
|
|
||||||
),
|
|
||||||
'submit' => array(),
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
$this->tpl_list_vars['list_warehouses'] = array();
|
|
||||||
|
|
||||||
$this->_where = ' AND a.deleted = 0';
|
|
||||||
|
|
||||||
parent::__construct();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* AdminController::initForm() override
|
|
||||||
* @see AdminController::initForm()
|
|
||||||
*/
|
|
||||||
public function initForm()
|
|
||||||
{
|
|
||||||
$this->toolbar_title = $this->l('Stock : Add Stock movement label');
|
|
||||||
|
|
||||||
$this->fields_form = array(
|
|
||||||
'legend' => array(
|
|
||||||
'title' => $this->l('Stock Movement Label'),
|
|
||||||
'image' => '../img/admin/edit.gif'
|
|
||||||
),
|
|
||||||
'input' => array(
|
|
||||||
array(
|
|
||||||
'type' => 'text',
|
|
||||||
'lang' => true,
|
|
||||||
'label' => $this->l('Name:'),
|
|
||||||
'name' => 'name',
|
|
||||||
'size' => 50,
|
|
||||||
'required' => true
|
|
||||||
),
|
|
||||||
array(
|
|
||||||
'type' => 'select',
|
|
||||||
'label' => $this->l('Action:'),
|
|
||||||
'name' => 'sign',
|
|
||||||
'required' => true,
|
|
||||||
'options' => array(
|
|
||||||
'query' => array(
|
|
||||||
array(
|
|
||||||
'id' => '1',
|
|
||||||
'name' => $this->l('Increase stock')
|
|
||||||
),
|
|
||||||
array(
|
|
||||||
'id' => '-1',
|
|
||||||
'name' => $this->l('Decrease stock')
|
|
||||||
),
|
|
||||||
),
|
|
||||||
'id' => 'id',
|
|
||||||
'name' => 'name'
|
|
||||||
),
|
|
||||||
'desc' => $this->l('Select the corresponding action : increments or decrements stock.')
|
|
||||||
),
|
|
||||||
),
|
|
||||||
'submit' => array(
|
|
||||||
'title' => $this->l(' Save '),
|
|
||||||
'class' => 'button'
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
return parent::initForm();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* AdminController::initList() override
|
|
||||||
* @see AdminController::initList()
|
|
||||||
*/
|
|
||||||
public function initList()
|
|
||||||
{
|
|
||||||
$this->displayInformation($this->l('This interface allows you to display the stock movements for a selected warehouse.').'<br />');
|
|
||||||
$this->displayInformation($this->l('Also, it allows you to add and edit your own stock movement labels.'));
|
|
||||||
|
|
||||||
// access
|
|
||||||
if (!($this->tabAccess['add'] === '1'))
|
|
||||||
unset($this->toolbar_btn['new']);
|
|
||||||
|
|
||||||
//no link on list rows
|
|
||||||
$this->list_no_link = true;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Manage default list
|
|
||||||
*/
|
|
||||||
$this->addRowAction('edit');
|
|
||||||
$this->addRowAction('delete');
|
|
||||||
$this->addRowActionSkipList('edit', array(1, 2, 3, 4, 5, 6, 7, 8));
|
|
||||||
$this->addRowActionSkipList('delete', array(1, 2, 3, 4, 5, 6, 7, 8));
|
|
||||||
|
|
||||||
$this->toolbar_title = $this->l('Stock : Stock movements labels');
|
|
||||||
$first_list = parent::initList();
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Manage second list
|
|
||||||
*/
|
|
||||||
$warehouses = Warehouse::getWarehouses(true);
|
|
||||||
array_unshift($warehouses, array('id_warehouse' => -1, 'name' => $this->l('All Warehouses')));
|
|
||||||
$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->deleted = false;
|
|
||||||
$this->table = 'stock_mvt';
|
$this->table = 'stock_mvt';
|
||||||
$this->className = 'StockMvt';
|
$this->className = 'StockMvt';
|
||||||
$this->identifier = 'id_stock_mvt';
|
$this->identifier = 'id_stock_mvt';
|
||||||
$this->lang = false;
|
$this->lang = false;
|
||||||
|
|
||||||
// test if a filter is applied for this list
|
$this->list_no_link = true;
|
||||||
if (Tools::isSubmit('submitFilter'.$this->table) || $this->context->cookie->{'submitFilter'.$this->table} !== false)
|
$this->displayInformation($this->l('This interface allows you to display the stock movements for a selected warehouse.').'<br />');
|
||||||
$this->filter = true;
|
$this->displayInformation($this->l('Also, it allows you to add and edit your own stock movement labels.'));
|
||||||
|
|
||||||
// test if a filter reset request is required for this list
|
|
||||||
if (isset($_POST['submitReset'.$this->table]))
|
|
||||||
$this->action = 'reset_filters';
|
|
||||||
else
|
|
||||||
$this->action = '';
|
|
||||||
|
|
||||||
// redifine fields display
|
|
||||||
$this->fieldsDisplay = array(
|
$this->fieldsDisplay = array(
|
||||||
'product_reference' => array(
|
'product_reference' => array(
|
||||||
'title' => $this->l('Reference'),
|
'title' => $this->l('Reference'),
|
||||||
@@ -299,8 +109,19 @@ class AdminStockMvtControllerCore extends AdminController
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
// make new query
|
parent::__construct();
|
||||||
unset ($this->_where);
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* AdminController::initList() override
|
||||||
|
* @see AdminController::initList()
|
||||||
|
*/
|
||||||
|
public function initList()
|
||||||
|
{
|
||||||
|
// removes toolbar btn
|
||||||
|
$this->toolbar_btn = array();
|
||||||
|
|
||||||
|
// overrides select
|
||||||
$this->_select = '
|
$this->_select = '
|
||||||
CONCAT(pl.name, \' \', GROUP_CONCAT(IFNULL(al.name, \'\'), \'\')) product_name,
|
CONCAT(pl.name, \' \', GROUP_CONCAT(IFNULL(al.name, \'\'), \'\')) product_name,
|
||||||
CONCAT(a.employee_lastname, \' \', a.employee_firstname) AS employee,
|
CONCAT(a.employee_lastname, \' \', a.employee_firstname) AS employee,
|
||||||
@@ -310,6 +131,7 @@ class AdminStockMvtControllerCore extends AdminController
|
|||||||
stock.upc AS product_upc,
|
stock.upc AS product_upc,
|
||||||
w.id_currency AS id_currency';
|
w.id_currency AS id_currency';
|
||||||
|
|
||||||
|
// overrides join
|
||||||
$this->_join = 'INNER JOIN '._DB_PREFIX_.'stock stock ON a.id_stock = stock.id_stock
|
$this->_join = 'INNER JOIN '._DB_PREFIX_.'stock stock ON a.id_stock = stock.id_stock
|
||||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (
|
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (
|
||||||
stock.id_product = pl.id_product
|
stock.id_product = pl.id_product
|
||||||
@@ -325,29 +147,23 @@ class AdminStockMvtControllerCore extends AdminController
|
|||||||
al.id_attribute = pac.id_attribute
|
al.id_attribute = pac.id_attribute
|
||||||
AND al.id_lang = '.(int)$this->context->language->id.'
|
AND al.id_lang = '.(int)$this->context->language->id.'
|
||||||
)';
|
)';
|
||||||
|
// overrides group
|
||||||
$this->_group = 'GROUP BY a.id_stock_mvt';
|
$this->_group = 'GROUP BY a.id_stock_mvt';
|
||||||
|
|
||||||
|
// overrides where depending on the warehouse
|
||||||
$id_warehouse = $this->getCurrentWarehouseId();
|
$id_warehouse = $this->getCurrentWarehouseId();
|
||||||
if ($id_warehouse > 0)
|
if ($id_warehouse > 0)
|
||||||
$this->_where = ' AND w.id_warehouse = '.$id_warehouse;
|
$this->_where = ' AND w.id_warehouse = '.$id_warehouse;
|
||||||
|
|
||||||
// call postProcess() for take care about actions and filters
|
// sets the current warehouse
|
||||||
$this->postProcess();
|
$this->tpl_list_vars['current_warehouse'] = $this->getCurrentWarehouseId();
|
||||||
|
|
||||||
// generate the second list
|
|
||||||
$second_list = parent::initList();
|
|
||||||
|
|
||||||
// reset all query vars
|
|
||||||
unset($this->_select, $this->_join, $this->_group, $this->_filterHaving, $this->_filter);
|
|
||||||
|
|
||||||
// reset default table and className for options list management
|
|
||||||
$this->table = 'stock_mvt_reason';
|
|
||||||
$this->className = 'StockMvtReason';
|
|
||||||
|
|
||||||
// return the two lists
|
|
||||||
return $second_list.$first_list;
|
|
||||||
|
|
||||||
|
// sets the list of warehouses
|
||||||
|
$warehouses = Warehouse::getWarehouses(true);
|
||||||
|
array_unshift($warehouses, array('id_warehouse' => -1, 'name' => $this->l('All Warehouses')));
|
||||||
|
$this->tpl_list_vars['list_warehouses'] = $warehouses;
|
||||||
|
|
||||||
|
return parent::initList();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -369,19 +185,6 @@ class AdminStockMvtControllerCore extends AdminController
|
|||||||
return $warehouse;
|
return $warehouse;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* AdminController::postProcess() override
|
|
||||||
* @see AdminController::postProcess()
|
|
||||||
*/
|
|
||||||
public function postProcess()
|
|
||||||
{
|
|
||||||
//when deleting a movement reason, enable deleted flag for parent postProcess and no remove the corresponding row from the database
|
|
||||||
if (Tools::isSubmit('delete'.$this->table))
|
|
||||||
$this->deleted = true;
|
|
||||||
|
|
||||||
return parent::postProcess();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AdminController::getList() override
|
* AdminController::getList() override
|
||||||
* @see AdminController::getList()
|
* @see AdminController::getList()
|
||||||
|
|||||||
@@ -33,69 +33,70 @@ class AdminSupplyOrdersControllerCore extends AdminController
|
|||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->context = Context::getContext();
|
$this->context = Context::getContext();
|
||||||
$this->table = 'supply_order_state';
|
$this->table = 'supply_order';
|
||||||
$this->className = 'SupplyOrderState';
|
$this->className = 'SupplyOrder';
|
||||||
$this->lang = true;
|
$this->identifier = 'id_supply_order';
|
||||||
|
$this->lang = false;
|
||||||
|
|
||||||
|
$this->addRowAction('updatereceipt');
|
||||||
|
$this->addRowAction('changestate');
|
||||||
|
$this->addRowAction('edit');
|
||||||
|
$this->addRowAction('view');
|
||||||
|
$this->addRowAction('details');
|
||||||
|
$this->list_no_link = true;
|
||||||
|
|
||||||
$this->fieldsDisplay = array(
|
$this->fieldsDisplay = array(
|
||||||
'name' => array(
|
'reference' => array(
|
||||||
'title' => $this->l('Name'),
|
'title' => $this->l('Reference'),
|
||||||
|
'width' => 130,
|
||||||
|
'havingFilter' => true
|
||||||
|
),
|
||||||
|
'supplier' => array(
|
||||||
|
'title' => $this->l('Supplier'),
|
||||||
|
'width' => 130,
|
||||||
|
'filter_key' => 's!name'
|
||||||
|
),
|
||||||
|
'warehouse' => array(
|
||||||
|
'title' => $this->l('Warehouse'),
|
||||||
|
'width' => 130,
|
||||||
|
'filter_key' => 'w!name'
|
||||||
|
),
|
||||||
|
'state' => array(
|
||||||
|
'title' => $this->l('Status'),
|
||||||
|
'width' => 200,
|
||||||
|
'filter_key' => 'stl!name',
|
||||||
'color' => 'color',
|
'color' => 'color',
|
||||||
),
|
),
|
||||||
'editable' => array(
|
'date_add' => array(
|
||||||
'title' => $this->l('Editable?'),
|
'title' => $this->l('Creation'),
|
||||||
'align' => 'center',
|
'width' => 150,
|
||||||
'icon' => array(
|
'align' => 'right',
|
||||||
'1' => 'enabled.gif',
|
'type' => 'date',
|
||||||
'0' => 'disabled.gif'
|
'havingFilter' => true,
|
||||||
),
|
'filter_key' => 'a!date_add'
|
||||||
'type' => 'bool',
|
|
||||||
'width' => 170,
|
|
||||||
'orderby' => false
|
|
||||||
),
|
),
|
||||||
'delivery_note' => array(
|
'date_upd' => array(
|
||||||
'title' => $this->l('Delivery note available?'),
|
'title' => $this->l('Last modification'),
|
||||||
'align' => 'center',
|
'width' => 150,
|
||||||
'icon' => array(
|
'align' => 'right',
|
||||||
'1' => 'enabled.gif',
|
'type' => 'date',
|
||||||
'0' => 'disabled.gif'
|
'havingFilter' => true,
|
||||||
),
|
'filter_key' => 'a!date_upd'
|
||||||
'type' => 'bool',
|
|
||||||
'width' => 170,
|
|
||||||
'orderby' => false
|
|
||||||
),
|
),
|
||||||
'pending_receipt' => array(
|
'date_delivery_expected' => array(
|
||||||
'title' => $this->l('Is a pending receipt state?'),
|
'title' => $this->l('Delivery (expected)'),
|
||||||
'align' => 'center',
|
'width' => 150,
|
||||||
'icon' => array(
|
'align' => 'right',
|
||||||
'1' => 'enabled.gif',
|
'type' => 'date',
|
||||||
'0' => 'disabled.gif'
|
'havingFilter' => true,
|
||||||
),
|
'filter_key' => 'a!date_delivery_expected'
|
||||||
'type' => 'bool',
|
|
||||||
'width' => 170,
|
|
||||||
'orderby' => false
|
|
||||||
),
|
),
|
||||||
'receipt_state' => array(
|
'id_pdf' => array(
|
||||||
'title' => $this->l('Is a delivery state?'),
|
'title' => $this->l('PDF'),
|
||||||
'align' => 'center',
|
'width' => 80,
|
||||||
'icon' => array(
|
'callback' => 'printPDFIcons',
|
||||||
'1' => 'enabled.gif',
|
'orderby' => false,
|
||||||
'0' => 'disabled.gif'
|
'search' => false
|
||||||
),
|
|
||||||
'type' => 'bool',
|
|
||||||
'width' => 170,
|
|
||||||
'orderby' => false
|
|
||||||
),
|
|
||||||
'enclosed' => array(
|
|
||||||
'title' => $this->l('Is an enclosed order state?'),
|
|
||||||
'align' => 'center',
|
|
||||||
'icon' => array(
|
|
||||||
'1' => 'enabled.gif',
|
|
||||||
'0' => 'disabled.gif'
|
|
||||||
),
|
|
||||||
'type' => 'bool',
|
|
||||||
'width' => 170,
|
|
||||||
'orderby' => false
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -146,169 +147,6 @@ class AdminSupplyOrdersControllerCore extends AdminController
|
|||||||
*/
|
*/
|
||||||
public function initForm()
|
public function initForm()
|
||||||
{
|
{
|
||||||
if (Tools::isSubmit('addsupply_order_state') ||
|
|
||||||
Tools::isSubmit('updatesupply_order_state') ||
|
|
||||||
Tools::isSubmit('submitAddsupply_order_state') ||
|
|
||||||
Tools::isSubmit('submitUpdatesupply_order_state'))
|
|
||||||
{
|
|
||||||
$this->fields_form = array(
|
|
||||||
'legend' => array(
|
|
||||||
'title' => $this->l('Supply Order Status'),
|
|
||||||
'image' => '../img/admin/edit.gif'
|
|
||||||
),
|
|
||||||
'input' => array(
|
|
||||||
array(
|
|
||||||
'type' => 'text',
|
|
||||||
'lang' => true,
|
|
||||||
'label' => $this->l('Status:'),
|
|
||||||
'name' => 'name',
|
|
||||||
'size' => 50,
|
|
||||||
'required' => true
|
|
||||||
),
|
|
||||||
array(
|
|
||||||
'type' => 'color',
|
|
||||||
'label' => $this->l('Color:'),
|
|
||||||
'name' => 'color',
|
|
||||||
'size' => 20,
|
|
||||||
'desc' => $this->l('Back office background will be displayed in this color. HTML colors only.'),
|
|
||||||
),
|
|
||||||
array(
|
|
||||||
'type' => 'radio',
|
|
||||||
'label' => $this->l('Editable:'),
|
|
||||||
'name' => 'editable',
|
|
||||||
'required' => true,
|
|
||||||
'class' => 't',
|
|
||||||
'is_bool' => true,
|
|
||||||
'values' => array(
|
|
||||||
array(
|
|
||||||
'id' => 'active_on',
|
|
||||||
'value' => 1,
|
|
||||||
'label' => $this->l('Yes')
|
|
||||||
),
|
|
||||||
array(
|
|
||||||
'id' => 'active_off',
|
|
||||||
'value' => 0,
|
|
||||||
'label' => $this->l('No')
|
|
||||||
)
|
|
||||||
),
|
|
||||||
'desc' => $this->l('For this status, you have to define if it is possible to edit the order.
|
|
||||||
An editable order is an order not valid to send to the supplier.')
|
|
||||||
),
|
|
||||||
array(
|
|
||||||
'type' => 'radio',
|
|
||||||
'label' => $this->l('Delivery note:'),
|
|
||||||
'name' => 'delivery_note',
|
|
||||||
'required' => true,
|
|
||||||
'class' => 't',
|
|
||||||
'is_bool' => true,
|
|
||||||
'values' => array(
|
|
||||||
array(
|
|
||||||
'id' => 'active_on',
|
|
||||||
'value' => 1,
|
|
||||||
'label' => $this->l('Yes')
|
|
||||||
),
|
|
||||||
array(
|
|
||||||
'id' => 'active_off',
|
|
||||||
'value' => 0,
|
|
||||||
'label' => $this->l('No')
|
|
||||||
)
|
|
||||||
),
|
|
||||||
'desc' => $this->l('For this status, you have to define if it is possible to generate the delivery note of the order.')
|
|
||||||
),
|
|
||||||
array(
|
|
||||||
'type' => 'radio',
|
|
||||||
'label' => $this->l('Delivery state:'),
|
|
||||||
'name' => 'receipt_state',
|
|
||||||
'required' => true,
|
|
||||||
'class' => 't',
|
|
||||||
'is_bool' => true,
|
|
||||||
'values' => array(
|
|
||||||
array(
|
|
||||||
'id' => 'active_on',
|
|
||||||
'value' => 1,
|
|
||||||
'label' => $this->l('Yes')
|
|
||||||
),
|
|
||||||
array(
|
|
||||||
'id' => 'active_off',
|
|
||||||
'value' => 0,
|
|
||||||
'label' => $this->l('No')
|
|
||||||
)
|
|
||||||
),
|
|
||||||
'desc' => $this->l('For this status, you have to define if products have been partially/completely received.
|
|
||||||
This allows to know if the products ordered have to be added to the corresponding warehouse.'),
|
|
||||||
),
|
|
||||||
array(
|
|
||||||
'type' => 'radio',
|
|
||||||
'label' => $this->l('Pending receipt:'),
|
|
||||||
'name' => 'pending_receipt',
|
|
||||||
'required' => true,
|
|
||||||
'class' => 't',
|
|
||||||
'is_bool' => true,
|
|
||||||
'values' => array(
|
|
||||||
array(
|
|
||||||
'id' => 'active_on',
|
|
||||||
'value' => 1,
|
|
||||||
'label' => $this->l('Yes')
|
|
||||||
),
|
|
||||||
array(
|
|
||||||
'id' => 'active_off',
|
|
||||||
'value' => 0,
|
|
||||||
'label' => $this->l('No')
|
|
||||||
)
|
|
||||||
),
|
|
||||||
'desc' => $this->l('Does this status mean that you are waiting for the delivery ?')
|
|
||||||
),
|
|
||||||
),
|
|
||||||
'submit' => array(
|
|
||||||
'title' => $this->l(' Save '),
|
|
||||||
'class' => 'button'
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
if (Tools::isSubmit('addsupply_order_state'))
|
|
||||||
$this->toolbar_title = $this->l('Stock : Add supply order status');
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->toolbar_title = $this->l('Stock : Update Supply order status');
|
|
||||||
|
|
||||||
$id_supply_order_state = Tools::getValue('id_supply_order_state', 0);
|
|
||||||
|
|
||||||
// only some fields are editable for initial states
|
|
||||||
if (in_array($id_supply_order_state, array(1, 2, 3, 4, 5, 6)))
|
|
||||||
{
|
|
||||||
$this->fields_form = array(
|
|
||||||
'legend' => array(
|
|
||||||
'title' => $this->l('Supply Order status'),
|
|
||||||
'image' => '../img/admin/edit.gif'
|
|
||||||
),
|
|
||||||
'input' => array(
|
|
||||||
array(
|
|
||||||
'type' => 'text',
|
|
||||||
'lang' => true,
|
|
||||||
'label' => $this->l('Status:'),
|
|
||||||
'name' => 'name',
|
|
||||||
'size' => 50,
|
|
||||||
'required' => true
|
|
||||||
),
|
|
||||||
array(
|
|
||||||
'type' => 'color',
|
|
||||||
'label' => $this->l('Back office color:'),
|
|
||||||
'name' => 'color',
|
|
||||||
'size' => 20,
|
|
||||||
'desc' => $this->l('Back office background will be displayed in this color. HTML colors only'),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
'submit' => array(
|
|
||||||
'title' => $this->l(' Save '),
|
|
||||||
'class' => 'button'
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return parent::initForm();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Tools::isSubmit('addsupply_order') ||
|
if (Tools::isSubmit('addsupply_order') ||
|
||||||
Tools::isSubmit('updatesupply_order') ||
|
Tools::isSubmit('updatesupply_order') ||
|
||||||
Tools::isSubmit('submitAddsupply_order') ||
|
Tools::isSubmit('submitAddsupply_order') ||
|
||||||
@@ -462,114 +300,12 @@ class AdminSupplyOrdersControllerCore extends AdminController
|
|||||||
public function initList()
|
public function initList()
|
||||||
{
|
{
|
||||||
$this->displayInformation($this->l('This interface allows you to manage supply orders.').'<br />');
|
$this->displayInformation($this->l('This interface allows you to manage supply orders.').'<br />');
|
||||||
$this->displayInformation($this->l('Also, it allows you to add and edit your own supply order status.'));
|
|
||||||
|
|
||||||
// access
|
// access
|
||||||
if (!($this->tabAccess['add'] === '1'))
|
if (!($this->tabAccess['add'] === '1'))
|
||||||
unset($this->toolbar_btn['new']);
|
unset($this->toolbar_btn['new']);
|
||||||
|
|
||||||
//no link on list rows
|
// overrides query
|
||||||
$this->list_no_link = true;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Manage default list
|
|
||||||
*/
|
|
||||||
$this->addRowAction('edit');
|
|
||||||
$this->addRowAction('delete');
|
|
||||||
$this->addRowActionSkipList('delete', array(1, 2, 3, 4, 5, 6));
|
|
||||||
|
|
||||||
$this->toolbar_title = $this->l('Stock : Suppliers Orders status');
|
|
||||||
$first_list = parent::initList();
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Manage second list
|
|
||||||
*/
|
|
||||||
// reset actions, toolbar and query vars
|
|
||||||
$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
|
|
||||||
$this->table = 'supply_order';
|
|
||||||
$this->className = 'SupplyOrder';
|
|
||||||
$this->identifier = 'id_supply_order';
|
|
||||||
$this->lang = false;
|
|
||||||
|
|
||||||
$this->addRowAction('updatereceipt');
|
|
||||||
$this->addRowAction('changestate');
|
|
||||||
$this->addRowAction('edit');
|
|
||||||
$this->addRowAction('view');
|
|
||||||
$this->addRowAction('details');
|
|
||||||
|
|
||||||
// test if a filter is applied for this list
|
|
||||||
if (Tools::isSubmit('submitFilter'.$this->table) || $this->context->cookie->{'submitFilter'.$this->table} !== false)
|
|
||||||
$this->filter = true;
|
|
||||||
|
|
||||||
// test if a filter reset request is required for this list
|
|
||||||
if (isset($_POST['submitReset'.$this->table]))
|
|
||||||
$this->action = 'reset_filters';
|
|
||||||
else
|
|
||||||
$this->action = '';
|
|
||||||
|
|
||||||
// redifine fields display
|
|
||||||
$this->fieldsDisplay = array(
|
|
||||||
'reference' => array(
|
|
||||||
'title' => $this->l('Reference'),
|
|
||||||
'width' => 130,
|
|
||||||
'havingFilter' => true
|
|
||||||
),
|
|
||||||
'supplier' => array(
|
|
||||||
'title' => $this->l('Supplier'),
|
|
||||||
'width' => 130,
|
|
||||||
'filter_key' => 's!name'
|
|
||||||
),
|
|
||||||
'warehouse' => array(
|
|
||||||
'title' => $this->l('Warehouse'),
|
|
||||||
'width' => 130,
|
|
||||||
'filter_key' => 'w!name'
|
|
||||||
),
|
|
||||||
'state' => array(
|
|
||||||
'title' => $this->l('Status'),
|
|
||||||
'width' => 200,
|
|
||||||
'filter_key' => 'stl!name',
|
|
||||||
'color' => 'color',
|
|
||||||
),
|
|
||||||
'date_add' => array(
|
|
||||||
'title' => $this->l('Creation'),
|
|
||||||
'width' => 150,
|
|
||||||
'align' => 'right',
|
|
||||||
'type' => 'date',
|
|
||||||
'havingFilter' => true,
|
|
||||||
'filter_key' => 'a!date_add'
|
|
||||||
),
|
|
||||||
'date_upd' => array(
|
|
||||||
'title' => $this->l('Last modification'),
|
|
||||||
'width' => 150,
|
|
||||||
'align' => 'right',
|
|
||||||
'type' => 'date',
|
|
||||||
'havingFilter' => true,
|
|
||||||
'filter_key' => 'a!date_upd'
|
|
||||||
),
|
|
||||||
'date_delivery_expected' => array(
|
|
||||||
'title' => $this->l('Delivery (expected)'),
|
|
||||||
'width' => 150,
|
|
||||||
'align' => 'right',
|
|
||||||
'type' => 'date',
|
|
||||||
'havingFilter' => true,
|
|
||||||
'filter_key' => 'a!date_delivery_expected'
|
|
||||||
),
|
|
||||||
'id_pdf' => array(
|
|
||||||
'title' => $this->l('PDF'),
|
|
||||||
'width' => 80,
|
|
||||||
'callback' => 'printPDFIcons',
|
|
||||||
'orderby' => false,
|
|
||||||
'search' => false
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
// make new query
|
|
||||||
$this->_select = '
|
$this->_select = '
|
||||||
s.name AS supplier,
|
s.name AS supplier,
|
||||||
w.name AS warehouse,
|
w.name AS warehouse,
|
||||||
@@ -591,17 +327,7 @@ class AdminSupplyOrdersControllerCore extends AdminController
|
|||||||
LEFT JOIN `'._DB_PREFIX_.'supplier` s ON a.id_supplier = s.id_supplier
|
LEFT JOIN `'._DB_PREFIX_.'supplier` s ON a.id_supplier = s.id_supplier
|
||||||
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)';
|
||||||
|
|
||||||
// init the toolbar according to the current list
|
return parent::initList();
|
||||||
$this->initToolbar();
|
|
||||||
|
|
||||||
// generate the second list
|
|
||||||
$second_list = parent::initList();
|
|
||||||
|
|
||||||
// reset all query vars
|
|
||||||
unset($this->_select, $this->_join, $this->_group, $this->_filterHaving, $this->_filter);
|
|
||||||
|
|
||||||
// return the two lists
|
|
||||||
return $second_list.$first_list;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Executable
BIN
Binary file not shown.
|
After Width: | Height: | Size: 416 B |
@@ -959,7 +959,9 @@ INSERT INTO `PREFIX_tab` (`id_tab`, `class_name`, `id_parent`, `position`) VALUE
|
|||||||
(103, 'AdminAccountingManagement', 102, 1),
|
(103, 'AdminAccountingManagement', 102, 1),
|
||||||
(104, 'AdminAccountingExport', 102, 2),
|
(104, 'AdminAccountingExport', 102, 2),
|
||||||
(105, 'AdminCmsCategories', -1, 0),
|
(105, 'AdminCmsCategories', -1, 0),
|
||||||
(106, 'AdminCms', -1, 0), (107, 'AdminLogin', -1 , 0);
|
(106, 'AdminCms', -1, 0),
|
||||||
|
(107, 'AdminLogin', -1 , 0),
|
||||||
|
(108, 'AdminStockConfiguration', 95, 7);
|
||||||
|
|
||||||
INSERT INTO `PREFIX_access` (`id_profile`, `id_tab`, `view`, `add`, `edit`, `delete`) (SELECT 1, id_tab, 1, 1, 1, 1 FROM `PREFIX_tab`);
|
INSERT INTO `PREFIX_access` (`id_profile`, `id_tab`, `view`, `add`, `edit`, `delete`) (SELECT 1, id_tab, 1, 1, 1, 1 FROM `PREFIX_tab`);
|
||||||
|
|
||||||
@@ -990,7 +992,8 @@ INSERT INTO `PREFIX_tab_lang` (`id_lang`, `id_tab`, `name`) VALUES
|
|||||||
(1, 103, 'Account Number Management'),
|
(1, 103, 'Account Number Management'),
|
||||||
(1, 104, 'Export'),
|
(1, 104, 'Export'),
|
||||||
(1, 105, 'CMS categories'),
|
(1, 105, 'CMS categories'),
|
||||||
(1, 106, 'CMS pages');
|
(1, 106, 'CMS pages'),
|
||||||
|
(1, 108, 'Configuration');
|
||||||
|
|
||||||
INSERT INTO `PREFIX_tab_lang` (`id_lang`, `id_tab`, `name`) VALUES
|
INSERT INTO `PREFIX_tab_lang` (`id_lang`, `id_tab`, `name`) VALUES
|
||||||
(2, 1, 'Catalogue'),(2, 2, 'Clients'),(2, 3, 'Commandes'),(2, 4, 'Paiement'),(2, 5, 'Transport'),
|
(2, 1, 'Catalogue'),(2, 2, 'Clients'),(2, 3, 'Commandes'),(2, 4, 'Paiement'),(2, 5, 'Transport'),
|
||||||
@@ -1019,7 +1022,8 @@ INSERT INTO `PREFIX_tab_lang` (`id_lang`, `id_tab`, `name`) VALUES
|
|||||||
(2, 103, 'Gestion des numéros de comptes'),
|
(2, 103, 'Gestion des numéros de comptes'),
|
||||||
(2, 104, 'Export'),
|
(2, 104, 'Export'),
|
||||||
(2, 105, 'Catégories CMS'),
|
(2, 105, 'Catégories CMS'),
|
||||||
(2, 106, 'Pages CMS');
|
(2, 106, 'Pages CMS'),
|
||||||
|
(2, 108, 'Configuration');
|
||||||
|
|
||||||
INSERT INTO `PREFIX_tab_lang` (`id_lang`, `id_tab`, `name`) VALUES
|
INSERT INTO `PREFIX_tab_lang` (`id_lang`, `id_tab`, `name`) VALUES
|
||||||
(3, 1, 'Catálogo'),(3, 2, 'Clientes'),(3, 3, 'Pedidos'),(3, 4, 'Pago'),(3, 5, 'Transporte'),
|
(3, 1, 'Catálogo'),(3, 2, 'Clientes'),(3, 3, 'Pedidos'),(3, 4, 'Pago'),(3, 5, 'Transporte'),
|
||||||
@@ -1047,7 +1051,8 @@ INSERT INTO `PREFIX_tab_lang` (`id_lang`, `id_tab`, `name`) VALUES
|
|||||||
(3, 103, 'Account Number Management'),
|
(3, 103, 'Account Number Management'),
|
||||||
(3, 104, 'Export'),
|
(3, 104, 'Export'),
|
||||||
(3, 105, 'CMS categories'),
|
(3, 105, 'CMS categories'),
|
||||||
(3, 106, 'CMS pages');
|
(3, 106, 'CMS pages'),
|
||||||
|
(3, 108, 'Configuration');
|
||||||
|
|
||||||
INSERT INTO `PREFIX_tab_lang` (`id_lang`, `id_tab`, `name`) VALUES
|
INSERT INTO `PREFIX_tab_lang` (`id_lang`, `id_tab`, `name`) VALUES
|
||||||
(4, 1, 'Katalog'),(4, 2, 'Kunden'),(4, 3, 'Bestellungen'),(4, 4, 'Zahlung'),
|
(4, 1, 'Katalog'),(4, 2, 'Kunden'),(4, 3, 'Bestellungen'),(4, 4, 'Zahlung'),
|
||||||
@@ -1076,7 +1081,8 @@ INSERT INTO `PREFIX_tab_lang` (`id_lang`, `id_tab`, `name`) VALUES
|
|||||||
(4, 103, 'Account Number Management'),
|
(4, 103, 'Account Number Management'),
|
||||||
(4, 104, 'Export'),
|
(4, 104, 'Export'),
|
||||||
(4, 105, 'CMS categories'),
|
(4, 105, 'CMS categories'),
|
||||||
(4, 106, 'CMS pages');
|
(4, 106, 'CMS pages'),
|
||||||
|
(4, 108, 'Configuration');
|
||||||
|
|
||||||
INSERT INTO `PREFIX_tab_lang` (`id_lang`, `id_tab`, `name`) VALUES
|
INSERT INTO `PREFIX_tab_lang` (`id_lang`, `id_tab`, `name`) VALUES
|
||||||
(5, 1, 'Catalogo'),(5, 2, 'Clienti'),(5, 3, 'Ordini'),(5, 4, 'Pagamento'),
|
(5, 1, 'Catalogo'),(5, 2, 'Clienti'),(5, 3, 'Ordini'),(5, 4, 'Pagamento'),
|
||||||
@@ -1105,7 +1111,8 @@ INSERT INTO `PREFIX_tab_lang` (`id_lang`, `id_tab`, `name`) VALUES
|
|||||||
(5, 103, 'Account Number Management'),
|
(5, 103, 'Account Number Management'),
|
||||||
(5, 104, 'Export'),
|
(5, 104, 'Export'),
|
||||||
(5, 105, 'CMS categories'),
|
(5, 105, 'CMS categories'),
|
||||||
(5, 106, 'CMS pages');
|
(5, 106, 'CMS pages'),
|
||||||
|
(5, 108, 'Configuration');
|
||||||
|
|
||||||
INSERT IGNORE INTO `PREFIX_tab_lang` (`id_tab`, `id_lang`, `name`)
|
INSERT IGNORE INTO `PREFIX_tab_lang` (`id_tab`, `id_lang`, `name`)
|
||||||
(SELECT `id_tab`, id_lang, (SELECT tl.`name`
|
(SELECT `id_tab`, id_lang, (SELECT tl.`name`
|
||||||
|
|||||||
Reference in new issue
Block a user