2
0
forked from Wavyzz/dolibarr

Merge pull request #13726 from simicar29/11.0-supplierproposal

Clean line extrafields when deleting supplier proposal
This commit is contained in:
Laurent Destailleur
2020-04-23 19:27:39 +02:00
committed by GitHub

View File

@@ -2061,11 +2061,14 @@ class SupplierProposal extends CommonObject
if (! $error) 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; $sql = "DELETE FROM ".MAIN_DB_PREFIX."supplier_proposaldet WHERE fk_supplier_proposal = ".$this->id;
if ($this->db->query($sql)) if ($this->db->query($sql))
{ {
$sql = "DELETE FROM ".MAIN_DB_PREFIX."supplier_proposal WHERE rowid = ".$this->id; $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 // Delete linked object
$res = $this->deleteObjectLinked(); $res = $this->deleteObjectLinked();