diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index 7606fea4fac..db290a2b9fa 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -387,6 +387,7 @@ ErrorDeletingGeneratedProducts=There was an error while trying to delete existin NbOfDifferentValues=No. of different values NbProducts=Number of products ParentProduct=Parent product +ParentProductOfVariant=Parent product of variant HideChildProducts=Hide variant products ShowChildProducts=Show variant products NoEditVariants=Go to Parent product card and edit variants price impact in the variants tab diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 0a04ac35930..5b8158e8d04 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -105,12 +105,9 @@ $optioncss = GETPOST('optioncss', 'alpha'); $type = GETPOST("type", "int"); $mode = GETPOST('mode', 'alpha'); - -//Show/hide child products -if (isModEnabled('variants') && !empty($conf->global->PRODUIT_ATTRIBUTES_HIDECHILD)) { // PRODUIT_ATTRIBUTES_HIDECHILD means: show the checkbox to show/hide child +// Show/hide child product variants +if (isModEnabled('variants')) { $show_childproducts = GETPOST('search_show_childproducts'); -} else { - $show_childproducts = ''; } $diroutputmassaction = $conf->product->dir_output.'/temp/massgeneration/'.$user->id; @@ -226,7 +223,7 @@ $arrayfields = array( 'p.fk_product_type'=>array('label'=>"Type", 'checked'=>0, 'enabled'=>(isModEnabled("product") && isModEnabled("service")), 'position'=>11), 'p.barcode'=>array('label'=>"Gencod", 'checked'=>1, 'enabled'=>(isModEnabled('barcode')), 'position'=>12), 'p.duration'=>array('label'=>"Duration", 'checked'=>($contextpage != 'productlist'), 'enabled'=>(isModEnabled("service") && (string) $type == '1'), 'position'=>13), - 'pac.fk_product_parent' => array('label'=>"ParentProduct", 'checked'=> -1, 'enabled'=>(isModEnabled('variants')), 'position'=>14), + 'pac.fk_product_parent' => array('label'=>"ParentProductOfVariant", 'checked'=>-1, 'enabled'=>(isModEnabled('variants')), 'position'=>14), 'p.finished'=>array('label'=>"Nature", 'checked'=>0, 'enabled'=>(isModEnabled("product") && $type != '1'), 'position'=>19), 'p.weight'=>array('label'=>'Weight', 'checked'=>0, 'enabled'=>(isModEnabled("product") && $type != '1'), 'position'=>20), 'p.weight_units'=>array('label'=>'WeightUnits', 'checked'=>0, 'enabled'=>(isModEnabled("product") && $type != '1'), 'position'=>21), @@ -441,7 +438,7 @@ if (empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { } $sql .= ' p.datec as date_creation, p.tms as date_update, p.pmp, p.stock, p.cost_price,'; $sql .= ' p.weight, p.weight_units, p.length, p.length_units, p.width, p.width_units, p.height, p.height_units, p.surface, p.surface_units, p.volume, p.volume_units, fk_country, fk_state,'; -if (!empty($conf->global->PRODUCT_USE_UNITS)) { +if (getDolGlobalString('PRODUCT_USE_UNITS')) { $sql .= ' p.fk_unit, cu.label as cu_label,'; } $sql .= ' MIN(pfp.unitprice) as bestpurchaseprice'; @@ -479,11 +476,10 @@ $sql .= $linktopfp; if (getDolGlobalInt('MAIN_MULTILANGS')) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_lang as pl ON pl.fk_product = p.rowid AND pl.lang = '".$db->escape($langs->getDefaultLang())."'"; } - if (isModEnabled('variants')) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_attribute_combination pac ON pac.fk_product_child = p.rowid"; } -if (!empty($conf->global->PRODUCT_USE_UNITS)) { +if (getDolGlobalString('PRODUCT_USE_UNITS')) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_units cu ON cu.rowid = p.fk_unit"; } @@ -509,7 +505,7 @@ if (dol_strlen($search_type) && $search_type != '-1') { } } -if (isModEnabled('variants') && (!empty($conf->global->PRODUIT_ATTRIBUTES_HIDECHILD) && !$show_childproducts)) { +if (isModEnabled('variants') && !$show_childproducts) { $sql .= " AND pac.rowid IS NULL"; } @@ -619,13 +615,12 @@ if (empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { $sql .= " ppe.accountancy_code_sell, ppe.accountancy_code_sell_intra, ppe.accountancy_code_sell_export, ppe.accountancy_code_buy, ppe.accountancy_code_buy_intra, ppe.accountancy_code_buy_export,"; } $sql .= ' p.weight, p.weight_units, p.length, p.length_units, p.width, p.width_units, p.height, p.height_units, p.surface, p.surface_units, p.volume, p.volume_units, p.fk_country, p.fk_state'; -if (!empty($conf->global->PRODUCT_USE_UNITS)) { +if (getDolGlobalString('PRODUCT_USE_UNITS')) { $sql .= ', p.fk_unit, cu.label'; } if (isModEnabled('workstation')) { - $sql .= ', p.fk_default_workstation, ws.status, ws.ref '; + $sql .= ', p.fk_default_workstation, ws.status, ws.ref'; } - if (isModEnabled('variants')) { $sql .= ', pac.rowid'; $sql .= ', pac.fk_product_parent'; @@ -912,8 +907,8 @@ if (isModEnabled('categorie') && $user->hasRight('categorie', 'read')) { $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_PRODUCT, $searchCategoryProductList, 'minwidth300', $searchCategoryProductOperator ? $searchCategoryProductOperator : 0); } -//Show/hide child products. Hidden by default -if (isModEnabled('variants') && !empty($conf->global->PRODUIT_ATTRIBUTES_HIDECHILD)) { +// Show/hide child variant products +if (isModEnabled('variants')) { $moreforfilter .= '