debug : empeche asociation d'une cate avec elle-meme

This commit is contained in:
Andre Cianfarani 2006-03-20 15:20:39 +00:00
parent 5662485361
commit d710e41823
2 changed files with 5 additions and 1 deletions

View File

@ -155,16 +155,18 @@ class Categorie
{
$sql = 'delete from '.MAIN_DB_PREFIX.'categorie_association';
$sql .= ' WHERE fk_categorie_mere = "'.$this->id.'" or fk_categorie_fille = "'.$this->id.'"';
if (! $this->db->query($sql))
{
dolibarr_print_error($this->db);
return -1;
}
if($this->id_mere !="")
if($this->id_mere !="" && $this->id_mere!=$this->id)
{
$sql = 'insert into '.MAIN_DB_PREFIX.'categorie_association(fk_categorie_mere,fk_categorie_fille)';
$sql .= ' VALUES ("'.$this->id_mere.'","'.$this->id.'")';
print $sql;
if (! $this->db->query($sql))
{
dolibarr_print_error($this->db);

View File

@ -42,6 +42,8 @@ if ($_POST["action"] == 'update' && $user->rights->categorie->creer)
$categorie->description = $_POST["description"];
if($_POST['catMere'] != "-1")
$categorie->id_mere = $_POST['catMere'];
else
$categorie->id_mere = "";
if (!$categorie->label || !$categorie->description)