// Stock Management : Show stock interfaces only if the option is active in the configuration + debug
This commit is contained in:
@@ -23,14 +23,14 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td valign="top" style="vertical-align:top;">
|
<td valign="top" style="vertical-align:top;">
|
||||||
<input {if $product->depends_on_stock == 1}checked="checked" {/if} type="radio" name="depends_on_stock" class="depends_on_stock" id="depends_on_stock_1" value="1"/>
|
<input {if $product->depends_on_stock == 1 && $stock_management_active == 1}checked="checked" {/if} {if $stock_management_active == 0}disabled="disabled" {/if} type="radio" name="depends_on_stock" class="depends_on_stock" id="depends_on_stock_1" value="1"/>
|
||||||
<label style="float:none;font-weight:normal" for="depends_on_stock_1">{l s='Available quantities for current product and its combinations are based on stock in the warehouses'}</label>
|
<label style="float:none;font-weight:normal" for="depends_on_stock_1">{l s='Available quantities for current product and its combinations are based on stock in the warehouses'} {if $stock_management_active == 0} - <b>{l s='Not possible if stock management is not enabled'}</b>{/if}</label>
|
||||||
<br /><br />
|
<br /><br />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td valign="top" style="vertical-align:top;">
|
<td valign="top" style="vertical-align:top;">
|
||||||
<input {if $product->depends_on_stock == 0}checked="checked" {/if} type="radio" name="depends_on_stock" class="depends_on_stock" id="depends_on_stock_0" value="0"/>
|
<input {if $product->depends_on_stock == 0 || $stock_management_active == 0}checked="checked" {/if} type="radio" name="depends_on_stock" class="depends_on_stock" id="depends_on_stock_0" value="0"/>
|
||||||
<label style="float:none;font-weight:normal" for="depends_on_stock_0">{l s='I want to specify available quantities manually, and manage my stock independently'}</label>
|
<label style="float:none;font-weight:normal" for="depends_on_stock_0">{l s='I want to specify available quantities manually, and manage my stock independently'}</label>
|
||||||
<br /><br />
|
<br /><br />
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
@@ -1174,6 +1174,12 @@ class AdminControllerCore extends Controller
|
|||||||
{
|
{
|
||||||
if (Tab::checkTabRights($tab['id_tab']) === true)
|
if (Tab::checkTabRights($tab['id_tab']) === true)
|
||||||
{
|
{
|
||||||
|
if ($tab['name'] == 'Stock' && Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT') == 0)
|
||||||
|
{
|
||||||
|
unset($tabs[$index]);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$img_cache_url = 'themes/'.$this->context->employee->bo_theme.'/img/t/'.$tab['class_name'].'.png';
|
$img_cache_url = 'themes/'.$this->context->employee->bo_theme.'/img/t/'.$tab['class_name'].'.png';
|
||||||
$img_exists_cache = Tools::file_exists_cache(_PS_ADMIN_DIR_.$img_cache_url);
|
$img_exists_cache = Tools::file_exists_cache(_PS_ADMIN_DIR_.$img_cache_url);
|
||||||
// retrocompatibility : change png to gif if icon not exists
|
// retrocompatibility : change png to gif if icon not exists
|
||||||
|
|||||||
+2
-2
@@ -944,9 +944,9 @@ class ProductCore extends ObjectModel
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
//Try to set available quantitiy if product quantity not depend on stock
|
//Try to set available quantitiy if product quantity not depend on stock
|
||||||
$depend_on_stock = StockAvailable::dependsOnStock($this->id);
|
$depends_on_stock = StockAvailable::dependsOnStock($this->id);
|
||||||
|
|
||||||
if (!$depend_on_stock)
|
if (!$depends_on_stock)
|
||||||
if (!StockAvailable::updateQuantity($this->id, $id_product_attribute, $quantity))
|
if (!StockAvailable::updateQuantity($this->id, $id_product_attribute, $quantity))
|
||||||
{
|
{
|
||||||
$stock_available = new StockAvailable();
|
$stock_available = new StockAvailable();
|
||||||
|
|||||||
@@ -1615,19 +1615,24 @@ class AdminProductsControllerCore extends AdminController
|
|||||||
{
|
{
|
||||||
// i is used as product_tab id
|
// i is used as product_tab id
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
$advanced_stock_management_active = Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT');
|
||||||
|
|
||||||
foreach ($this->available_tabs as $product_tab)
|
foreach ($this->available_tabs as $product_tab)
|
||||||
{
|
{
|
||||||
$product_tabs[$product_tab] = array(
|
if ($advanced_stock_management_active == 1 || ($advanced_stock_management_active == 0 && ($product_tab != 'Warehouses')))
|
||||||
'id' => ++$i.'-'.$product_tab,
|
{
|
||||||
'selected' => (strtolower($product_tab) == strtolower($action)),
|
$product_tabs[$product_tab] = array(
|
||||||
'name' => $this->available_tabs_lang[$product_tab],
|
'id' => ++$i.'-'.$product_tab,
|
||||||
'href' => $this->context->link->getAdminLink('AdminProducts').'&id_product='.Tools::getValue('id_product').'&action='.$product_tab,
|
'selected' => (strtolower($product_tab) == strtolower($action)),
|
||||||
|
'name' => $this->available_tabs_lang[$product_tab],
|
||||||
|
'href' => $this->context->link->getAdminLink('AdminProducts').'&id_product='.Tools::getValue('id_product').'&action='.$product_tab,
|
||||||
);
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$this->tpl_form_vars['newproduct'] = 0;
|
$this->tpl_form_vars['newproduct'] = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
$this->tpl_form_vars['newproduct'] = 1;
|
$this->tpl_form_vars['newproduct'] = 1;
|
||||||
|
|
||||||
$this->tpl_form_vars['product_tabs'] = $product_tabs;
|
$this->tpl_form_vars['product_tabs'] = $product_tabs;
|
||||||
$this->tpl_form_vars['tabs_toolbar_save_buttons'] = $this->tabs_toolbar_save_buttons;
|
$this->tpl_form_vars['tabs_toolbar_save_buttons'] = $this->tabs_toolbar_save_buttons;
|
||||||
@@ -3136,22 +3141,12 @@ class AdminProductsControllerCore extends AdminController
|
|||||||
'attribute_designation' => ''
|
'attribute_designation' => ''
|
||||||
);
|
);
|
||||||
|
|
||||||
// Get physical quantities & available quantities
|
// Get available quantities
|
||||||
$stock_manager = StockManagerFactory::getManager();
|
|
||||||
$total_quantity = 0;
|
|
||||||
$physical_quantity = array();
|
|
||||||
$available_quantity = array();
|
$available_quantity = array();
|
||||||
$product_designation = array();
|
$product_designation = array();
|
||||||
|
|
||||||
foreach ($attributes as $attribute)
|
foreach ($attributes as $attribute)
|
||||||
{
|
{
|
||||||
$physical_quantity[$attribute['id_product_attribute']] = (int)$stock_manager->getProductPhysicalQuantities(
|
|
||||||
(int)$obj->id,
|
|
||||||
(int)$attribute['id_product_attribute']
|
|
||||||
);
|
|
||||||
|
|
||||||
$total_quantity += $physical_quantity[$attribute['id_product_attribute']];
|
|
||||||
|
|
||||||
// Get available quantity for the current product attribute in the current shop
|
// Get available quantity for the current product attribute in the current shop
|
||||||
$available_quantity[$attribute['id_product_attribute']] = StockAvailable::getQuantityAvailableByProduct((int)$obj->id,
|
$available_quantity[$attribute['id_product_attribute']] = StockAvailable::getQuantityAvailableByProduct((int)$obj->id,
|
||||||
$attribute['id_product_attribute']);
|
$attribute['id_product_attribute']);
|
||||||
@@ -3162,9 +3157,8 @@ class AdminProductsControllerCore extends AdminController
|
|||||||
|
|
||||||
$data->assign(array(
|
$data->assign(array(
|
||||||
'attributes' => $attributes,
|
'attributes' => $attributes,
|
||||||
'total_quantity' => $total_quantity,
|
|
||||||
'physical_quantity' => $physical_quantity,
|
|
||||||
'available_quantity' => $available_quantity,
|
'available_quantity' => $available_quantity,
|
||||||
|
'stock_management_active' => Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT'),
|
||||||
'product_designation' => $product_designation,
|
'product_designation' => $product_designation,
|
||||||
'product' => $this->object,
|
'product' => $this->object,
|
||||||
'token_preferences' => Tools::getAdminTokenLite('AdminPPreferences'),
|
'token_preferences' => Tools::getAdminTokenLite('AdminPPreferences'),
|
||||||
|
|||||||
@@ -1400,6 +1400,7 @@ class AdminSupplyOrdersControllerCore extends AdminController
|
|||||||
'title' => $this->l('State'),
|
'title' => $this->l('State'),
|
||||||
'width' => 100,
|
'width' => 100,
|
||||||
'align' => 'left',
|
'align' => 'left',
|
||||||
|
'color' => 'color',
|
||||||
'havingFilter' => true
|
'havingFilter' => true
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@@ -1433,7 +1434,7 @@ class AdminSupplyOrdersControllerCore extends AdminController
|
|||||||
$helper->toolbar_fix = false;
|
$helper->toolbar_fix = false;
|
||||||
$helper->shopLinkType = '';
|
$helper->shopLinkType = '';
|
||||||
$helper->identifier = $this->identifier;
|
$helper->identifier = $this->identifier;
|
||||||
$helper->colorOnBackground = true;
|
//$helper->colorOnBackground = true;
|
||||||
$helper->simple_header = true;
|
$helper->simple_header = true;
|
||||||
$content = $helper->generateList($this->_list, $this->fieldsDisplay);
|
$content = $helper->generateList($this->_list, $this->fieldsDisplay);
|
||||||
|
|
||||||
@@ -1549,6 +1550,7 @@ class AdminSupplyOrdersControllerCore extends AdminController
|
|||||||
|
|
||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see AdminController::initView()
|
* @see AdminController::initView()
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user