fix: on pouvait crer des catgories principales avec le mme nom

This commit is contained in:
Regis Houssin 2006-02-20 19:28:21 +00:00
parent f138287629
commit 7ebd18bc25
2 changed files with 7 additions and 2 deletions

View File

@ -461,7 +461,12 @@ class Categorie
{
$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 AND ca.fk_categorie_mere = '".$catmere."'";
$sql.= " WHERE c.label = '".$label."'";
if ($catmere)
{
$sql.= " AND c.rowid = ca.fk_categorie_fille";
$sql.= " AND ca.fk_categorie_mere = '".$catmere."'";
}
$res = $this->db->query ($sql);
$res = $this->db->fetch_array ($res);

View File

@ -139,7 +139,7 @@ print '<tr><td valign="top" width="30%">';
echo "<p>".$langs->trans ("ErrForgotField")." \"".$langs->trans ("Label")."\"</p>";
$OK = false;
}
else if ($c->already_exists($_POST["nom"],$cats_meres)) // 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"],$cat_mere)) // on regarde si le nom n'existe pas déjà en tant que catégorie ou sous-catégorie
{
echo "<p>".$langs->trans ("ErrCatAlreadyExists")."</p>";
$OK = false;