mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
fix: possibilit de crer des sous catgories ayant le mme nom
This commit is contained in:
parent
bfccefd66c
commit
ca070a0efe
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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"],$_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 "<p>".$langs->trans ("ErrCatAlreadyExists")."</p>";
|
||||
$OK = false;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user