fix: on pouvait créer des catégories principales avec le même nom
This commit is contained in:
parent
f138287629
commit
7ebd18bc25
@ -461,7 +461,12 @@ class Categorie
|
|||||||
{
|
{
|
||||||
$sql = "SELECT count(c.rowid)";
|
$sql = "SELECT count(c.rowid)";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."categorie as c, ".MAIN_DB_PREFIX."categorie_association as ca";
|
$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->query ($sql);
|
||||||
$res = $this->db->fetch_array ($res);
|
$res = $this->db->fetch_array ($res);
|
||||||
|
|||||||
@ -139,7 +139,7 @@ print '<tr><td valign="top" width="30%">';
|
|||||||
echo "<p>".$langs->trans ("ErrForgotField")." \"".$langs->trans ("Label")."\"</p>";
|
echo "<p>".$langs->trans ("ErrForgotField")." \"".$langs->trans ("Label")."\"</p>";
|
||||||
$OK = false;
|
$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>";
|
echo "<p>".$langs->trans ("ErrCatAlreadyExists")."</p>";
|
||||||
$OK = false;
|
$OK = false;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user