debug : empeche asociation d'une cate avec elle-meme
This commit is contained in:
parent
5662485361
commit
d710e41823
@ -155,16 +155,18 @@ class Categorie
|
|||||||
{
|
{
|
||||||
$sql = 'delete from '.MAIN_DB_PREFIX.'categorie_association';
|
$sql = 'delete from '.MAIN_DB_PREFIX.'categorie_association';
|
||||||
$sql .= ' WHERE fk_categorie_mere = "'.$this->id.'" or fk_categorie_fille = "'.$this->id.'"';
|
$sql .= ' WHERE fk_categorie_mere = "'.$this->id.'" or fk_categorie_fille = "'.$this->id.'"';
|
||||||
|
|
||||||
if (! $this->db->query($sql))
|
if (! $this->db->query($sql))
|
||||||
{
|
{
|
||||||
dolibarr_print_error($this->db);
|
dolibarr_print_error($this->db);
|
||||||
return -1;
|
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 = 'insert into '.MAIN_DB_PREFIX.'categorie_association(fk_categorie_mere,fk_categorie_fille)';
|
||||||
$sql .= ' VALUES ("'.$this->id_mere.'","'.$this->id.'")';
|
$sql .= ' VALUES ("'.$this->id_mere.'","'.$this->id.'")';
|
||||||
|
print $sql;
|
||||||
if (! $this->db->query($sql))
|
if (! $this->db->query($sql))
|
||||||
{
|
{
|
||||||
dolibarr_print_error($this->db);
|
dolibarr_print_error($this->db);
|
||||||
|
|||||||
@ -42,6 +42,8 @@ if ($_POST["action"] == 'update' && $user->rights->categorie->creer)
|
|||||||
$categorie->description = $_POST["description"];
|
$categorie->description = $_POST["description"];
|
||||||
if($_POST['catMere'] != "-1")
|
if($_POST['catMere'] != "-1")
|
||||||
$categorie->id_mere = $_POST['catMere'];
|
$categorie->id_mere = $_POST['catMere'];
|
||||||
|
else
|
||||||
|
$categorie->id_mere = "";
|
||||||
|
|
||||||
|
|
||||||
if (!$categorie->label || !$categorie->description)
|
if (!$categorie->label || !$categorie->description)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user