Fix confusion between ->childs and ->childsoncascade

This commit is contained in:
Laurent Destailleur
2019-06-22 20:17:40 +02:00
parent 71b266b5a8
commit b202c7eaa0
14 changed files with 76 additions and 42 deletions

View File

@@ -7490,7 +7490,7 @@ abstract class CommonObject
$this->db->begin();
if ($forcechilddeletion)
if ($forcechilddeletion) // Force also delete of childtables that should lock deletion in standard case when option force is off
{
foreach($this->childtables as $table)
{
@@ -7518,6 +7518,20 @@ abstract class CommonObject
}
}
// Delete cascade first
foreach($this->childtablesoncascade as $table)
{
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.$table.' WHERE '.$this->fk_element.' = '.$this->id;
$resql = $this->db->query($sql);
if (! $resql)
{
$this->error=$this->db->lasterror();
$this->errors[]=$this->error;
$this->db->rollback();
return -1;
}
}
if (! $error) {
if (! $notrigger) {
// Call triggers