From fe57cf697f8fc0f539f07f2f495e8e09461e66bf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 4 Feb 2018 14:34:31 +0100 Subject: [PATCH] Fix init category selected --- htdocs/product/card.php | 5 +++-- htdocs/societe/card.php | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index a54f1d90885..861c46328df 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1106,11 +1106,11 @@ else print ""; //} - if($conf->categorie->enabled) { + 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, '100%'); + print $form->multiselectarray('categories', $cate_arbo, GETPOST('categories', 'array'), '', 0, '', 0, '100%'); print ""; } @@ -1464,6 +1464,7 @@ else $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); + $arrayselected=array(); foreach($cats as $cat) { $arrayselected[] = $cat->id; } diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 9d0a58d3196..e858eaf9a6e 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -1893,6 +1893,7 @@ else $cate_arbo = $form->select_all_categories(Categorie::TYPE_CUSTOMER, null, null, null, null, 1); $c = new Categorie($db); $cats = $c->containing($object->id, Categorie::TYPE_CUSTOMER); + $arrayselected=array(); foreach ($cats as $cat) { $arrayselected[] = $cat->id; } @@ -1907,6 +1908,7 @@ else $cate_arbo = $form->select_all_categories(Categorie::TYPE_SUPPLIER, null, null, null, null, 1); $c = new Categorie($db); $cats = $c->containing($object->id, Categorie::TYPE_SUPPLIER); + $arrayselected=array(); foreach ($cats as $cat) { $arrayselected[] = $cat->id; }