Fix parent link was not removed on societe deletion #9106

This commit is contained in:
Maxime Kohlhaas 2018-11-01 15:41:58 +01:00
parent 4b402aa6d1
commit 29c0448a2e

View File

@ -1519,6 +1519,19 @@ class Societe extends CommonObject
} }
} }
// Remove links to subsidiaries companies
if (! $error)
{
$sql = "UPDATE ".MAIN_DB_PREFIX."societe";
$sql.= " SET parent = NULL";
$sql.= " WHERE parent = " . $id;
if (! $this->db->query($sql))
{
$error++;
$this->errors[] = $this->db->lasterror();
}
}
// Remove third party // Remove third party
if (! $error) if (! $error)
{ {