From ca070a0efef4f52dc604bdc2d6cb01fd8c8d5fa2 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 20 Feb 2006 18:36:10 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20possibilit=E9=20de=20cr=E9er=20des=20sou?= =?UTF-8?q?s=20cat=E9gories=20ayant=20le=20m=EAme=20nom?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/categories/categorie.class.php | 4 ++-- htdocs/categories/create.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/categories/categorie.class.php b/htdocs/categories/categorie.class.php index 900d7d690c6..62c75e67996 100644 --- a/htdocs/categories/categorie.class.php +++ b/htdocs/categories/categorie.class.php @@ -457,11 +457,11 @@ class Categorie /** * Vérifie si une catégorie porte le label $label */ - function already_exists($label) + function already_exists($label, $catmere) { $sql = "SELECT count(c.rowid)"; $sql.= " FROM ".MAIN_DB_PREFIX."categorie as c, ".MAIN_DB_PREFIX."categorie_association as ca"; - $sql.= " WHERE c.label = '".$label."' AND c.rowid = ca.fk_categorie_fille"; + $sql.= " WHERE c.label = '".$label."' AND c.rowid = ca.fk_categorie_fille AND ca.fk_categorie_mere = '".$catmere."'"; $res = $this->db->query ($sql); $res = $this->db->fetch_array ($res); diff --git a/htdocs/categories/create.php b/htdocs/categories/create.php index 9c1bb7658ba..ddb4f9e2fc4 100644 --- a/htdocs/categories/create.php +++ b/htdocs/categories/create.php @@ -139,7 +139,7 @@ print ''; echo "

".$langs->trans ("ErrForgotField")." \"".$langs->trans ("Label")."\"

"; $OK = false; } - else if ($c->already_exists($_POST["nom"],$_POST["catsMeres"]) // on regarde si le nom n'existe pas déjà en tant que catégorie ou sous-catégorie + else if ($c->already_exists($_POST["nom"],$_POST["catsMeres"])) // on regarde si le nom n'existe pas déjà en tant que catégorie ou sous-catégorie { echo "

".$langs->trans ("ErrCatAlreadyExists")."

"; $OK = false;