From d0999e5458025d7fcc6fc76f9baa63dae6426f3e Mon Sep 17 00:00:00 2001 From: Alexis Algoud Date: Fri, 19 Jun 2015 14:30:23 +0200 Subject: [PATCH] FIX hide category if it's not enable --- htdocs/product/card.php | 48 +++++++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 21 deletions(-) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 08c391c11c4..c6710c09680 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -979,12 +979,14 @@ else $doleditor->Create(); print ""; - - // Categories - print ''.$langs->trans("Categories").''; - $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, '', 'parent', 64, 0, 1); - print $form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, '', 0, 250); - print ""; + + if($conf->categorie->enabled) { + // Categories + print ''.$langs->trans("Categories").''; + $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, '', 'parent', 64, 0, 1); + print $form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, '', 0, 250); + print ""; + } // Units if($conf->global->PRODUCT_USE_UNITS) @@ -1270,18 +1272,20 @@ else $doleditor->Create(); print ""; - - // Categories - print ''.$langs->trans("Categories").''; - $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, '', 'parent', 64, 0, 1); - $c = new Categorie($db); - $cats = $c->containing($object->id,Categorie::TYPE_PRODUCT); - foreach($cats as $cat) { - $arrayselected[] = $cat->id; + + if($conf->categorie->enabled) { + // Categories + print ''.$langs->trans("Categories").''; + $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, '', 'parent', 64, 0, 1); + $c = new Categorie($db); + $cats = $c->containing($object->id,Categorie::TYPE_PRODUCT); + foreach($cats as $cat) { + $arrayselected[] = $cat->id; + } + print $form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, '', 0, '100%'); + print ""; } - print $form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, '', 0, '100%'); - print ""; - + // Units if($conf->global->PRODUCT_USE_UNITS) { @@ -1593,10 +1597,12 @@ else print ' '."\n"; // Categories - print ''.$langs->trans("Categories").''; - print $form->showCategories($object->id,'product',1); - print ""; - + if($conf->categorie->enabled) { + print ''.$langs->trans("Categories").''; + print $form->showCategories($object->id,'product',1); + print ""; + } + print "\n"; dol_fiche_end();