fix: possibilité de créer des sous catégories ayant le même nom
This commit is contained in:
parent
2ef242bb35
commit
411c3c6d91
@ -459,8 +459,9 @@ class Categorie
|
|||||||
*/
|
*/
|
||||||
function already_exists($label)
|
function already_exists($label)
|
||||||
{
|
{
|
||||||
$sql = "SELECT count(rowid) FROM ".MAIN_DB_PREFIX."categorie ";
|
$sql = "SELECT count(c.rowid)";
|
||||||
$sql .= "WHERE label = '".$label."'";
|
$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";
|
||||||
|
|
||||||
$res = $this->db->query ($sql);
|
$res = $this->db->query ($sql);
|
||||||
$res = $this->db->fetch_array ($res);
|
$res = $this->db->fetch_array ($res);
|
||||||
|
|||||||
@ -139,14 +139,14 @@ 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"]))
|
else if ($c->already_exists($_POST["nom"])
|
||||||
{
|
{
|
||||||
// on regarde si le champ nom n'est pas déjà dans la table catégorie (rappel: un nom est unique dans la table catégorie
|
// on regarde si le champ nom n'est pas déjà dans la table catégorie (rappel: un nom est unique dans la table catégorie
|
||||||
// nb a déjà été renseigné, il contient le nombre de catégories
|
// nb a déjà été renseigné, il contient le nombre de catégories
|
||||||
echo "<p>".$langs->trans ("ErrCatAlreadyExists")."</p>";
|
echo "<p>".$langs->trans ("ErrCatAlreadyExists")."</p>";
|
||||||
$OK = false;
|
$OK = false;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
if ($_POST["description"] == '')
|
if ($_POST["description"] == '')
|
||||||
{
|
{
|
||||||
echo "<p>".$langs->trans ("ErrForgotField")." \"".$langs->trans ("Description")."\"</p>";
|
echo "<p>".$langs->trans ("ErrForgotField")." \"".$langs->trans ("Description")."\"</p>";
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user