diff --git a/admin-dev/themes/template/products/quantities.tpl b/admin-dev/themes/template/products/quantities.tpl index 5810a1541..c8a3b4c60 100644 --- a/admin-dev/themes/template/products/quantities.tpl +++ b/admin-dev/themes/template/products/quantities.tpl @@ -23,14 +23,14 @@ - depends_on_stock == 1}checked="checked" {/if} type="radio" name="depends_on_stock" class="depends_on_stock" id="depends_on_stock_1" value="1"/> - + 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"/> +

- depends_on_stock == 0}checked="checked" {/if} type="radio" name="depends_on_stock" class="depends_on_stock" id="depends_on_stock_0" value="0"/> + 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"/>

diff --git a/classes/AdminController.php b/classes/AdminController.php index 57a6b9290..de7e536a4 100644 --- a/classes/AdminController.php +++ b/classes/AdminController.php @@ -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 diff --git a/classes/Product.php b/classes/Product.php index 54598a72a..c3be1e347 100644 --- a/classes/Product.php +++ b/classes/Product.php @@ -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(); diff --git a/controllers/admin/AdminProductsController.php b/controllers/admin/AdminProductsController.php index 68f09b35a..ccfd05aa0 100644 --- a/controllers/admin/AdminProductsController.php +++ b/controllers/admin/AdminProductsController.php @@ -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'), diff --git a/controllers/admin/AdminSupplyOrdersController.php b/controllers/admin/AdminSupplyOrdersController.php index bcf74a302..57ea3d1c2 100644 --- a/controllers/admin/AdminSupplyOrdersController.php +++ b/controllers/admin/AdminSupplyOrdersController.php @@ -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() */