mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-01-25 10:13:22 +01:00
fix: possibilit de crer des sous catgories ayant le mme nom
This commit is contained in:
@@ -457,11 +457,11 @@ class Categorie
|
||||
/**
|
||||
* V<>rifie si une cat<61>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<EFBFBD> en tant que cat<61>gorie ou sous-cat<61>gorie
|
||||
else if ($c->already_exists($_POST["nom"],$_POST["catsMeres"])) // on regarde si le nom n'existe pas d<>j<EFBFBD> en tant que cat<61>gorie ou sous-cat<61>gorie
|
||||
{
|
||||
echo "<p>".$langs->trans ("ErrCatAlreadyExists")."</p>";
|
||||
$OK = false;
|
||||
|
||||
Reference in New Issue
Block a user