Fix #3728 Properly remove last category

This commit is contained in:
Raphaël Doursenaud 2015-10-15 10:13:52 +02:00
parent 05686b532c
commit 6c2b46f939
4 changed files with 24 additions and 16 deletions

View File

@ -1991,12 +1991,14 @@ class Adherent extends CommonObject
// Process
foreach ($to_del as $del) {
$c->fetch($del);
$c->del_type($this, 'member');
if ($c->fetch($del) > 0) {
$c->del_type($this, 'member');
}
}
foreach ($to_add as $add) {
$c->fetch($add);
$c->add_type($this, 'member');
if ($c->fetch($add) > 0) {
$c->add_type($this, 'member');
}
}
return;

View File

@ -1155,12 +1155,14 @@ class Contact extends CommonObject
// Process
foreach ($to_del as $del) {
$c->fetch($del);
$c->del_type($this, 'contact');
if ($c->fetch($del) > 0) {
$c->del_type($this, 'contact');
}
}
foreach ($to_add as $add) {
$c->fetch($add);
$c->add_type($this, 'contact');
if ($c->fetch($add) > 0) {
$c->add_type($this, 'contact');
}
}
return;

View File

@ -3976,12 +3976,14 @@ class Product extends CommonObject
// Process
foreach($to_del as $del) {
$c->fetch($del);
$c->del_type($this, 'product');
if ($c->fetch($del) > 0) {
$c->del_type($this, 'product');
}
}
foreach ($to_add as $add) {
$c->fetch($add);
$c->add_type($this, 'product');
if ($c->fetch($add) > 0) {
$c->add_type($this, 'product');
}
}
return;

View File

@ -3395,12 +3395,14 @@ class Societe extends CommonObject
// Process
foreach ($to_del as $del) {
$c->fetch($del);
$c->del_type($this, $type_text);
if ($c->fetch($del) > 0) {
$c->del_type($this, $type_text);
}
}
foreach ($to_add as $add) {
$c->fetch($add);
$c->add_type($this, $type_text);
if ($c->fetch($add) > 0) {
$c->add_type($this, $type_text);
}
}
return;