Clean line extrafields when deleting proposal

This commit is contained in:
Marc Guenneugues 2020-04-23 18:02:53 +02:00
parent 6819255b76
commit 94be1870ec

View File

@ -2992,8 +2992,11 @@ class Propal extends CommonObject
if (!$error)
{
$main = MAIN_DB_PREFIX . 'propaldet';
$ef = $main . "_extrafields";
$sqlef = "DELETE FROM $ef WHERE fk_object IN (SELECT rowid FROM $main WHERE fk_propal = " . $this->id . ")";
$sql = "DELETE FROM ".MAIN_DB_PREFIX."propaldet WHERE fk_propal = ".$this->id;
if ($this->db->query($sql))
if ($this->db->query($sqlef) && $this->db->query($sql))
{
$sql = "DELETE FROM ".MAIN_DB_PREFIX."propal WHERE rowid = ".$this->id;
if ($this->db->query($sql))