mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-02-13 03:12:35 +01:00
Fix confusion between ->childs and ->childsoncascade
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user