Merge pull request #9935 from atm-maxime/fix_socdelete_unlink_parent

Fix parent link was not removed on societe deletion #9106
This commit is contained in:
Laurent Destailleur 2018-11-05 09:35:41 +01:00 committed by GitHub
commit 8b373fb7a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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)
{ {