diff --git a/htdocs/categories/fiche.php b/htdocs/categories/fiche.php index 12852bf48fb..267afd605e5 100644 --- a/htdocs/categories/fiche.php +++ b/htdocs/categories/fiche.php @@ -44,6 +44,8 @@ else llxHeader("","",$langs->trans("Categories")); $html = new Form($db); + + // Action ajout d'un produit ou service if ($_POST["action"] == 'add' && $user->rights->produit->creer) { @@ -53,7 +55,13 @@ if ($_POST["action"] == 'add' && $user->rights->produit->creer) $categorie->description = stripslashes($_POST["description"]); $cats_meres = isset($_POST['catsMeres']) ? $_POST['catsMeres'] : array(); - if (!$categorie->label || !$categorie->description) + if (sizeof ($cats_meres) > 1 && sizeof (array_unique ($cats_meres)) != sizeof ($cats_meres)) + { // alors il y a des valeurs en double + print '
'.$langs->trans("ErrSameCatSelected").'
'; + $_GET["action"] = 'create'; + } + + else if (!$categorie->label || !$categorie->description) { $_GET["action"] = 'create'; } @@ -161,32 +169,6 @@ if ($user->rights->produit->creer) print ''; /* - get_all_categories();//on récupère toutes les catégories et leurs attributs - - for ($i = 0; $i < $nbcats ; $i++) - { - echo "