Clean line extrafields when deleting supplier proposal

This commit is contained in:
Marc Guenneugues 2020-04-23 18:33:58 +02:00
parent 6819255b76
commit ab5c2b1fd5

View File

@ -2061,11 +2061,14 @@ class SupplierProposal extends CommonObject
if (! $error)
{
$main = MAIN_DB_PREFIX . 'supplier_proposaldet';
$ef = $main . "_extrafields";
$sqlef = "DELETE FROM $ef WHERE fk_object IN (SELECT rowid FROM $main WHERE fk_supplier_proposal = " . $this->id . ")";
$sql = "DELETE FROM ".MAIN_DB_PREFIX."supplier_proposaldet WHERE fk_supplier_proposal = ".$this->id;
if ($this->db->query($sql))
{
$sql = "DELETE FROM ".MAIN_DB_PREFIX."supplier_proposal WHERE rowid = ".$this->id;
if ($this->db->query($sql))
if ($this->db->query($sqlef) && $this->db->query($sql))
{
// Delete linked object
$res = $this->deleteObjectLinked();