// 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>
|
||||
<tr>
|
||||
<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"/>
|
||||
<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>
|
||||
<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'} {if $stock_management_active == 0} - <b>{l s='Not possible if stock management is not enabled'}</b>{/if}</label>
|
||||
<br /><br />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<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>
|
||||
<br /><br />
|
||||
</td>
|
||||
|
||||
@@ -1174,6 +1174,12 @@ class AdminControllerCore extends Controller
|
||||
{
|
||||
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_exists_cache = Tools::file_exists_cache(_PS_ADMIN_DIR_.$img_cache_url);
|
||||
// retrocompatibility : change png to gif if icon not exists
|
||||
|
||||
+2
-2
@@ -944,9 +944,9 @@ class ProductCore extends ObjectModel
|
||||
return false;
|
||||
|
||||
//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))
|
||||
{
|
||||
$stock_available = new StockAvailable();
|
||||
|
||||
@@ -1615,19 +1615,24 @@ class AdminProductsControllerCore extends AdminController
|
||||
{
|
||||
// i is used as product_tab id
|
||||
$i = 0;
|
||||
$advanced_stock_management_active = Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT');
|
||||
|
||||
foreach ($this->available_tabs as $product_tab)
|
||||
{
|
||||
$product_tabs[$product_tab] = array(
|
||||
'id' => ++$i.'-'.$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,
|
||||
if ($advanced_stock_management_active == 1 || ($advanced_stock_management_active == 0 && ($product_tab != 'Warehouses')))
|
||||
{
|
||||
$product_tabs[$product_tab] = array(
|
||||
'id' => ++$i.'-'.$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
|
||||
$this->tpl_form_vars['newproduct'] = 1;
|
||||
$this->tpl_form_vars['newproduct'] = 1;
|
||||
|
||||
$this->tpl_form_vars['product_tabs'] = $product_tabs;
|
||||
$this->tpl_form_vars['tabs_toolbar_save_buttons'] = $this->tabs_toolbar_save_buttons;
|
||||
@@ -3136,22 +3141,12 @@ class AdminProductsControllerCore extends AdminController
|
||||
'attribute_designation' => ''
|
||||
);
|
||||
|
||||
// Get physical quantities & available quantities
|
||||
$stock_manager = StockManagerFactory::getManager();
|
||||
$total_quantity = 0;
|
||||
$physical_quantity = array();
|
||||
// Get available quantities
|
||||
$available_quantity = array();
|
||||
$product_designation = array();
|
||||
|
||||
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
|
||||
$available_quantity[$attribute['id_product_attribute']] = StockAvailable::getQuantityAvailableByProduct((int)$obj->id,
|
||||
$attribute['id_product_attribute']);
|
||||
@@ -3162,9 +3157,8 @@ class AdminProductsControllerCore extends AdminController
|
||||
|
||||
$data->assign(array(
|
||||
'attributes' => $attributes,
|
||||
'total_quantity' => $total_quantity,
|
||||
'physical_quantity' => $physical_quantity,
|
||||
'available_quantity' => $available_quantity,
|
||||
'stock_management_active' => Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT'),
|
||||
'product_designation' => $product_designation,
|
||||
'product' => $this->object,
|
||||
'token_preferences' => Tools::getAdminTokenLite('AdminPPreferences'),
|
||||
|
||||
@@ -1400,6 +1400,7 @@ class AdminSupplyOrdersControllerCore extends AdminController
|
||||
'title' => $this->l('State'),
|
||||
'width' => 100,
|
||||
'align' => 'left',
|
||||
'color' => 'color',
|
||||
'havingFilter' => true
|
||||
),
|
||||
);
|
||||
@@ -1433,7 +1434,7 @@ class AdminSupplyOrdersControllerCore extends AdminController
|
||||
$helper->toolbar_fix = false;
|
||||
$helper->shopLinkType = '';
|
||||
$helper->identifier = $this->identifier;
|
||||
$helper->colorOnBackground = true;
|
||||
//$helper->colorOnBackground = true;
|
||||
$helper->simple_header = true;
|
||||
$content = $helper->generateList($this->_list, $this->fieldsDisplay);
|
||||
|
||||
@@ -1549,6 +1550,7 @@ class AdminSupplyOrdersControllerCore extends AdminController
|
||||
|
||||
die();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see AdminController::initView()
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user