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
commit a90398af06
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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();