From 5b89eaf13d03cbfb50a37301fd48597b160fc406 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 23 Feb 2006 12:23:53 +0000 Subject: [PATCH] =?UTF-8?q?d=E9but=20restructuration=20du=20code?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/categories/fiche.php | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/htdocs/categories/fiche.php b/htdocs/categories/fiche.php index a947c13c942..a49d637860a 100644 --- a/htdocs/categories/fiche.php +++ b/htdocs/categories/fiche.php @@ -54,18 +54,25 @@ if ($_POST["action"] == 'add' && $user->rights->produit->creer) $categorie->label = stripslashes($_POST["nom"]); $categorie->description = stripslashes($_POST["description"]); $cats_meres = isset($_POST['catsMeres']) ? $_POST['catsMeres'] : array(); + $ok = true; if (!$categorie->label || !$categorie->description) { $_GET["action"] = 'create'; + $ok = false; } - 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 ($ok) + { + 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'; + $ok = false; + } + } + + if ($ok) { $res = $categorie->create(); if ($res < 0) @@ -129,7 +136,7 @@ if ($user->rights->produit->creer) print $categorie->description.''; print ''; print $langs->trans("AddIn").' '; - print $html->select_nombre_sous_categorie($nbcats,"cats_meres").' '; + print $html->select_nombre_sous_categorie($nbcats,"choix").' '; print $langs->trans("categories"); print ''; print '';