// activate stockCover admin interface + debug and adaptations
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@9565 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
@@ -1,32 +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 <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision: 8697 $
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
|
||||
<fieldset>
|
||||
<legend><img src="../img/admin/tab.gif" />{l s='Stock Management'}</legend>
|
||||
<p>{l s='Several tools are available to manage your stock.'}</p>
|
||||
<br />
|
||||
<p>{l s='Please choose a tool by selecting a Tools sub-tab above.'}</p>
|
||||
</fieldset>
|
||||
@@ -1,5 +1,5 @@
|
||||
{*
|
||||
* 2007-2011 PrestaShop
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
@@ -23,7 +23,6 @@
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
{l s="Considering the coverage period choosen and the quantity of products/combinations that you sold, this array gives you an idea of when one product will run out of stock"}
|
||||
|
||||
{if count($stock_cover_periods) > 1}
|
||||
<form type="get" onchange="submit();">
|
||||
|
||||
Vendored
+18
-4
@@ -333,13 +333,27 @@
|
||||
'AdminDeliverySlipController' => '',
|
||||
'AdminEmailsControllerCore' => 'controllers/admin/AdminEmailsController.php',
|
||||
'AdminEmailsController' => '',
|
||||
'AdminEmployeesControllerCore' => 'controllers/admin/AdminEmployeesController.php',
|
||||
'AdminEmployeesController' => '',
|
||||
'AdminGendersController' => 'controllers/admin/AdminGendersController.php',
|
||||
'AdminGeolocationControllerCore' => 'controllers/admin/AdminGeolocationController.php',
|
||||
'AdminGeolocationController' => '',
|
||||
'AdminGroupShopControllerCore' => 'controllers/admin/AdminGroupShopController.php',
|
||||
'AdminGroupShopController' => '',
|
||||
'AdminHomeControllerCore' => 'controllers/admin/AdminHomeController.php',
|
||||
'AdminHomeController' => 'override/controllers/admin/AdminHomeController.php',
|
||||
'AdminImagesController' => 'controllers/admin/AdminImagesController.php',
|
||||
'AdminInvoicesControllerCore' => 'controllers/admin/AdminInvoicesController.php',
|
||||
'AdminInvoicesController' => '',
|
||||
'AdminLogsControllerCore' => 'controllers/admin/AdminLogsController.php',
|
||||
'AdminLogsController' => '',
|
||||
'AdminMetaControllerCore' => 'controllers/admin/AdminMetaController.php',
|
||||
'AdminMetaController' => '',
|
||||
'AdminOrderMessageController' => 'controllers/admin/AdminOrderMessageController.php',
|
||||
'AdminOrdersControllerCore' => 'controllers/admin/AdminOrdersController.php',
|
||||
'AdminOrdersController' => '',
|
||||
'AdminPDFControllerCore' => 'controllers/admin/AdminPDFController.php',
|
||||
'AdminPDFController' => '',
|
||||
'AdminProductsController' => 'controllers/admin/AdminProductsController.php',
|
||||
'AdminQuickAccessesController' => 'controllers/admin/AdminQuickAccessesController.php',
|
||||
'AdminRequestSqlControllerCore' => 'controllers/admin/AdminRequestSqlController.php',
|
||||
@@ -350,12 +364,12 @@
|
||||
'AdminShopUrlController' => '',
|
||||
'AdminStatesControllerCore' => 'controllers/admin/AdminStatesController.php',
|
||||
'AdminStatesController' => '',
|
||||
'AdminStockControllerCore' => 'controllers/admin/AdminStockController.php',
|
||||
'AdminStockController' => '',
|
||||
'AdminStockCoverController' => 'controllers/admin/AdminStockCoverController.php',
|
||||
'AdminStockCoverControllerCore' => 'controllers/admin/AdminStockCoverController.php',
|
||||
'AdminStockCoverController' => '',
|
||||
'AdminStockInstantStateControllerCore' => 'controllers/admin/AdminStockInstantStateController.php',
|
||||
'AdminStockInstantStateController' => '',
|
||||
'AdminStockManagementController' => 'controllers/admin/AdminStockManagementController.php',
|
||||
'AdminStockManagementControllerCore' => 'controllers/admin/AdminStockManagementController.php',
|
||||
'AdminStockManagementController' => '',
|
||||
'AdminStoresControllerCore' => 'controllers/admin/AdminStoresController.php',
|
||||
'AdminStoresController' => '',
|
||||
'AdminToolsControllerCore' => 'controllers/admin/AdminToolsController.php',
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
<?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: 6844 $
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
class AdminStockControllerCore extends AdminController
|
||||
{
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
/**
|
||||
* @since 1.5.0
|
||||
*/
|
||||
class AdminStockCoverController extends AdminController
|
||||
class AdminStockCoverControllerCore extends AdminController
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
@@ -37,20 +37,43 @@ class AdminStockCoverController extends AdminController
|
||||
$this->className = 'Product';
|
||||
$this->lang = true;
|
||||
|
||||
$this->addRowAction('details');
|
||||
|
||||
$this->fieldsDisplay = array(
|
||||
'reference' => array('title' => $this->l('Reference'), 'align' => 'center', 'width' => 100, 'widthColumn' => 150),
|
||||
'ean13' => array('title' => $this->l('EAN13'), 'align' => 'center', 'width' => 75, 'widthColumn' => 100),
|
||||
'name' => array('title' => $this->l('Name'), 'width' => 350, 'widthColumn' => 'auto', 'filter_key' => 'b!name'),
|
||||
'coverage' => array('title' => $this->l('Average time left'), 'width' => 50, 'widthColumn' => 60, 'orderby' => false, 'search' => false),
|
||||
'stock' => array('title' => $this->l('Qty in stock'), 'width' => 50, 'widthColumn' => 60, 'orderby' => false, 'search' => false),
|
||||
'reference' => array(
|
||||
'title' => $this->l('Reference'),
|
||||
'align' => 'center',
|
||||
'width' => 100,
|
||||
'widthColumn' => 150,
|
||||
'filter_key' => 'a!reference'
|
||||
),
|
||||
'ean13' => array(
|
||||
'title' => $this->l('EAN13'),
|
||||
'align' => 'center',
|
||||
'width' => 75,
|
||||
'widthColumn' => 100,
|
||||
'filter_key' => 'a!ean13'
|
||||
),
|
||||
'name' => array(
|
||||
'title' => $this->l('Name'),
|
||||
'width' => 350,
|
||||
'widthColumn' => 'auto',
|
||||
'filter_key' => 'b!name'
|
||||
),
|
||||
'coverage' => array(
|
||||
'title' => $this->l('Average time left'),
|
||||
'width' => 50,
|
||||
'widthColumn' => 60,
|
||||
'orderby' => false,
|
||||
'search' => false
|
||||
),
|
||||
'stock' => array(
|
||||
'title' => $this->l('Qty in stock'),
|
||||
'width' => 50,
|
||||
'widthColumn' => 60,
|
||||
'orderby' => false,
|
||||
'search' => false
|
||||
),
|
||||
);
|
||||
|
||||
$this->_select = 'a.id_product as id, COUNT(pa.id_product_attribute) as variations, s.physical_quantity as stock';
|
||||
$this->_join = 'LEFT JOIN `'._DB_PREFIX_.'product_attribute` pa ON (pa.id_product = a.id_product)
|
||||
LEFT JOIN `'._DB_PREFIX_.'stock` s ON (s.id_product = a.id_product AND s.id_product_attribute = 0)';
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
@@ -62,7 +85,6 @@ class AdminStockCoverController extends AdminController
|
||||
{
|
||||
if (Tools::isSubmit('id'))
|
||||
{
|
||||
|
||||
$this->lang = false;
|
||||
$lang_id = (int)$this->context->language->id;
|
||||
$product_id = (int)Tools::getValue('id');
|
||||
@@ -70,7 +92,7 @@ class AdminStockCoverController extends AdminController
|
||||
$query = '
|
||||
SELECT a.id_product_attribute as id, a.id_product, a.reference, a.ean13,
|
||||
IFNULL(CONCAT(pl.name, \' : \', GROUP_CONCAT(agl.`name`, \' - \', al.name SEPARATOR \', \')),pl.name) as name,
|
||||
s.physical_quantity as stock
|
||||
IFNULL(s.physical_quantity, 0) as stock
|
||||
FROM '._DB_PREFIX_.'product_attribute a
|
||||
INNER JOIN '._DB_PREFIX_.'product_lang pl ON (pl.id_product = a.id_product AND pl.id_lang = '.$lang_id.')
|
||||
LEFT JOIN '._DB_PREFIX_.'product_attribute_combination pac ON (pac.id_product_attribute = a.id_product_attribute)
|
||||
@@ -83,7 +105,7 @@ class AdminStockCoverController extends AdminController
|
||||
|
||||
$datas = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query);
|
||||
foreach ($datas as &$data)
|
||||
$data['coverage'] = StockManagerFactory::getManager()->getProductCoverage($data['id'], $data['id_product'], 7);
|
||||
$data['coverage'] = StockManagerFactory::getManager()->getProductCoverage($data['id_product'], $data['id'], $this->getCurrentCoveragePeriod());
|
||||
|
||||
echo Tools::jsonEncode(array('data'=> $datas, 'fields_display' => $this->fieldsDisplay));
|
||||
}
|
||||
@@ -91,12 +113,19 @@ class AdminStockCoverController extends AdminController
|
||||
}
|
||||
|
||||
/**
|
||||
* AdminController::initContent() override
|
||||
* @see AdminController::initContent()
|
||||
* AdminController::initList() override
|
||||
* @see AdminController::initList()
|
||||
*/
|
||||
public function initContent()
|
||||
public function initList()
|
||||
{
|
||||
$this->display = 'list';
|
||||
$this->addRowAction('details');
|
||||
|
||||
//no link on list rows
|
||||
$this->list_no_link = true;
|
||||
|
||||
$this->_select = 'a.id_product as id, COUNT(pa.id_product_attribute) as variations, s.physical_quantity as stock';
|
||||
$this->_join = 'LEFT JOIN `'._DB_PREFIX_.'product_attribute` pa ON (pa.id_product = a.id_product)
|
||||
LEFT JOIN `'._DB_PREFIX_.'stock` s ON (s.id_product = a.id_product AND s.id_product_attribute = 0)';
|
||||
|
||||
$stock_cover_periods = array(
|
||||
$this->l('One week') => 7,
|
||||
@@ -110,28 +139,31 @@ class AdminStockCoverController extends AdminController
|
||||
$this->context->smarty->assign('stock_cover_periods', $stock_cover_periods);
|
||||
$this->context->smarty->assign('stock_cover_cur_period', $this->getCurrentCoveragePeriod());
|
||||
|
||||
parent::initContent();
|
||||
$this->displayInformation(
|
||||
$this->l('Considering the coverage period choosen and the quantity of products/combinations that you sold,
|
||||
this interface gives you an idea of when one product will run out of stock .'
|
||||
)
|
||||
);
|
||||
|
||||
return parent::initList();
|
||||
}
|
||||
|
||||
/**
|
||||
* AdminController::getList() override
|
||||
* @see AdminController::getList()
|
||||
*/
|
||||
public function getList($id_lang, $orderBy = null, $orderWay = null, $start = 0, $limit = null, $id_lang_shop = false)
|
||||
public function getList($id_lang, $order_by = null, $order_way = null, $start = 0, $limit = null, $id_lang_shop = false)
|
||||
{
|
||||
parent::getList($id_lang, $orderBy, $orderWay, $start, $limit, $id_lang_shop);
|
||||
parent::getList($id_lang, $order_by, $order_way, $start, $limit, $id_lang_shop);
|
||||
|
||||
if ($this->display == 'list')
|
||||
$nb_items = count($this->_list);
|
||||
for ($i = 0; $i < $nb_items; ++$i)
|
||||
{
|
||||
$nb_items = count($this->_list);
|
||||
for ($i = 0; $i < $nb_items; ++$i)
|
||||
$item = &$this->_list[$i];
|
||||
if ((int)$item['variations'] <= 0)
|
||||
{
|
||||
$item = &$this->_list[$i];
|
||||
if ((int)$item['variations'] <= 0)
|
||||
{
|
||||
$item['coverage'] = StockManagerFactory::getManager()->getProductCoverage($item['id'], 0, 4);
|
||||
$this->addRowActionSkipList('details', array($item['id']));
|
||||
}
|
||||
$item['coverage'] = StockManagerFactory::getManager()->getProductCoverage($item['id'], 0, 4);
|
||||
$this->addRowActionSkipList('details', array($item['id']));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,29 +40,33 @@ class AdminWarehousesControllerCore extends AdminController
|
||||
$this->fieldsDisplay = array(
|
||||
'reference' => array(
|
||||
'title' => $this->l('Reference'),
|
||||
'width' => 40
|
||||
'width' => 40,
|
||||
),
|
||||
'name' => array(
|
||||
'title' => $this->l('Name'),
|
||||
'width' => 300,
|
||||
'havingFilter' => true
|
||||
),
|
||||
'management_type' => array(
|
||||
'title' => $this->l('Managment type'),
|
||||
'width' => 40
|
||||
'width' => 40,
|
||||
),
|
||||
'employee' => array(
|
||||
'title' => $this->l('Manager'),
|
||||
'width' => 150,
|
||||
'havingFilter' => true
|
||||
),
|
||||
'location' => array(
|
||||
'title' => $this->l('Location'),
|
||||
'width' => 150
|
||||
'width' => 150,
|
||||
'orderby' => false,
|
||||
'filter' => false,
|
||||
'search' => false,
|
||||
),
|
||||
'contact' => array(
|
||||
'title' => $this->l('Phone Number'),
|
||||
'width' => 50
|
||||
'width' => 50,
|
||||
'orderby' => false,
|
||||
'filter' => false,
|
||||
'search' => false,
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
@@ -943,6 +943,11 @@ INSERT INTO `PREFIX_access` (`id_profile`, `id_tab`, `view`, `add`, `edit`, `del
|
||||
(3, 90, 0, 0, 0, 0),
|
||||
(3, 91, 0, 0, 0, 0),
|
||||
(3, 92, 0, 0, 0, 0),
|
||||
(3, 95, 1, 1, 1, 1),
|
||||
(3, 96, 1, 1, 1, 1),
|
||||
(3, 97, 1, 1, 1, 1),
|
||||
(3, 98, 1, 1, 1, 1),
|
||||
(3, 99, 1, 1, 1, 1),
|
||||
(4, 1, 1, 1, 1, 1),
|
||||
(4, 2, 0, 0, 0, 0),
|
||||
(4, 3, 0, 0, 0, 0),
|
||||
@@ -1026,6 +1031,11 @@ INSERT INTO `PREFIX_access` (`id_profile`, `id_tab`, `view`, `add`, `edit`, `del
|
||||
(4, 90, 0, 0, 0, 0),
|
||||
(4, 91, 0, 0, 0, 0),
|
||||
(4, 92, 0, 0, 0, 0),
|
||||
(4, 95, 0, 0, 0, 0),
|
||||
(4, 96, 0, 0, 0, 0),
|
||||
(4, 97, 0, 0, 0, 0),
|
||||
(4, 98, 0, 0, 0, 0),
|
||||
(4, 99, 0, 0, 0, 0),
|
||||
(5, 1, 1, 1, 1, 1),
|
||||
(5, 2, 1, 1, 1, 1),
|
||||
(5, 3, 1, 1, 1, 1),
|
||||
@@ -1108,7 +1118,12 @@ INSERT INTO `PREFIX_access` (`id_profile`, `id_tab`, `view`, `add`, `edit`, `del
|
||||
(5, 89, 0, 0, 0, 0),
|
||||
(5, 90, 0, 0, 0, 0),
|
||||
(5, 91, 0, 0, 0, 0),
|
||||
(5, 92, 0, 0, 0, 0);
|
||||
(5, 92, 0, 0, 0, 0),
|
||||
(5, 95, 0, 0, 0, 0),
|
||||
(5, 96, 0, 0, 0, 0),
|
||||
(5, 97, 0, 0, 0, 0),
|
||||
(5, 98, 0, 0, 0, 0),
|
||||
(5, 99, 0, 0, 0, 0);
|
||||
|
||||
INSERT INTO `PREFIX_module_access` (`id_profile`, `id_module`, `configure`, `view`) (SELECT 2, id_module, 0, 1 FROM PREFIX_module);
|
||||
INSERT INTO `PREFIX_module_access` (`id_profile`, `id_module`, `configure`, `view`) (SELECT 3, id_module, 0, 1 FROM PREFIX_module);
|
||||
|
||||
@@ -863,7 +863,8 @@ INSERT INTO `PREFIX_tab` (`id_tab`, `class_name`, `id_parent`, `position`) VALUE
|
||||
(95, 'AdminStock', 0, 15),
|
||||
(96, 'AdminWarehouses', 95, 1),
|
||||
(97, 'AdminStockManagement', 95, 2),
|
||||
(98, 'AdminStockInstantState', 95, 4);
|
||||
(98, 'AdminStockInstantState', 95, 4),
|
||||
(99, 'AdminStockCover', 95, 5);
|
||||
|
||||
INSERT INTO `PREFIX_access` (`id_profile`, `id_tab`, `view`, `add`, `edit`, `delete`) (SELECT 1, id_tab, 1, 1, 1, 1 FROM `PREFIX_tab`);
|
||||
|
||||
@@ -886,7 +887,8 @@ INSERT INTO `PREFIX_tab_lang` (`id_lang`, `id_tab`, `name`) VALUES
|
||||
(1, 95, 'Stock'),
|
||||
(1, 96, 'Warehouses'),
|
||||
(1, 97, 'Stock Management'),
|
||||
(1, 98, 'Stock instant state');
|
||||
(1, 98, 'Stock instant state'),
|
||||
(1, 99, 'Stock cover');
|
||||
|
||||
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'),
|
||||
@@ -907,7 +909,8 @@ INSERT INTO `PREFIX_tab_lang` (`id_lang`, `id_tab`, `name`) VALUES
|
||||
(2, 95, 'Stock'),
|
||||
(2, 96, 'Entrepôts'),
|
||||
(2, 97, 'Gestion du stock'),
|
||||
(2, 98, 'Etat instantané du stock');
|
||||
(2, 98, 'Etat instantané du stock'),
|
||||
(2, 99, 'Couverture de stock');
|
||||
|
||||
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'),
|
||||
@@ -927,7 +930,8 @@ INSERT INTO `PREFIX_tab_lang` (`id_lang`, `id_tab`, `name`) VALUES
|
||||
(3, 95, 'Stock'),
|
||||
(3, 96, 'Warehouses'),
|
||||
(3, 97, 'Stock Management'),
|
||||
(3, 98, 'Stock instant state');
|
||||
(3, 98, 'Stock instant state'),
|
||||
(3, 99, 'Stock cover');
|
||||
|
||||
INSERT INTO `PREFIX_tab_lang` (`id_lang`, `id_tab`, `name`) VALUES
|
||||
(4, 1, 'Katalog'),(4, 2, 'Kunden'),(4, 3, 'Bestellungen'),(4, 4, 'Zahlung'),
|
||||
@@ -948,7 +952,8 @@ INSERT INTO `PREFIX_tab_lang` (`id_lang`, `id_tab`, `name`) VALUES
|
||||
(4, 95, 'Stock'),
|
||||
(4, 96, 'Warehouses'),
|
||||
(4, 97, 'Stock Management'),
|
||||
(4, 98, 'Stock instant state');
|
||||
(4, 98, 'Stock instant state'),
|
||||
(4, 99, 'Stock cover');
|
||||
|
||||
INSERT INTO `PREFIX_tab_lang` (`id_lang`, `id_tab`, `name`) VALUES
|
||||
(5, 1, 'Catalogo'),(5, 2, 'Clienti'),(5, 3, 'Ordini'),(5, 4, 'Pagamento'),
|
||||
@@ -969,8 +974,8 @@ INSERT INTO `PREFIX_tab_lang` (`id_lang`, `id_tab`, `name`) VALUES
|
||||
(5, 95, 'Stock'),
|
||||
(5, 96, 'Warehouses'),
|
||||
(5, 97, 'Stock Management'),
|
||||
(5, 98, 'Stock instant state');
|
||||
|
||||
(5, 98, 'Stock instant state'),
|
||||
(5, 99, 'Stock cover');
|
||||
|
||||
INSERT IGNORE INTO `PREFIX_tab_lang` (`id_tab`, `id_lang`, `name`)
|
||||
(SELECT `id_tab`, id_lang, (SELECT tl.`name`
|
||||
|
||||
Reference in New Issue
Block a user