From b1e693a1acf87f95a22b982fabe382b08fba550d Mon Sep 17 00:00:00 2001 From: SAINT-PATRICE <30402322+preg26@users.noreply.github.com> Date: Thu, 12 Mar 2026 14:02:27 +0100 Subject: [PATCH] Update contratligne.class.php for Postgres active_line and close_line (#37477) * Update contratligne.class.php for Postgres * Update contratligne.class.php close_line for postgres --- htdocs/contrat/class/contratligne.class.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/contrat/class/contratligne.class.php b/htdocs/contrat/class/contratligne.class.php index 84bcd9b4002..a480183a39c 100644 --- a/htdocs/contrat/class/contratligne.class.php +++ b/htdocs/contrat/class/contratligne.class.php @@ -937,9 +937,9 @@ class ContratLigne extends CommonObjectLine if ($resql) { if ($date_end >= 0) { // Update column llx_contrat.denormalized_lower_panned_end_date with next expiration date of an open contract - $sqltoupdatecontract = "UPDATE ".MAIN_DB_PREFIX."contrat as c"; - $sqltoupdatecontract .= " SET c.denormalized_lower_planned_end_date = (SELECT MIN(date_fin_validite) FROM ".MAIN_DB_PREFIX."contratdet as cd WHERE cd.fk_contrat = ".((int) $this->fk_contrat)." AND cd.statut = ".ContratLigne::STATUS_OPEN.")"; - $sqltoupdatecontract .= " WHERE c.rowid = ".((int) $this->fk_contrat); + $sqltoupdatecontract = "UPDATE ".MAIN_DB_PREFIX."contrat"; + $sqltoupdatecontract .= " SET denormalized_lower_planned_end_date = (SELECT MIN(date_fin_validite) FROM ".MAIN_DB_PREFIX."contratdet as cd WHERE cd.fk_contrat = ".((int) $this->fk_contrat)." AND cd.statut = ".ContratLigne::STATUS_OPEN.")"; + $sqltoupdatecontract .= " WHERE rowid = ".((int) $this->fk_contrat); $resqltoupdatecontract = $this->db->query($sqltoupdatecontract); if (!$resqltoupdatecontract) { $this->error = $this->db->lasterror(); @@ -1002,9 +1002,9 @@ class ContratLigne extends CommonObjectLine $resql = $this->db->query($sql); if ($resql) { // Update column llx_contrat.denormalized_lower_panned_end_date with next expiration date of an open contract - $sqltoupdatecontract = "UPDATE ".MAIN_DB_PREFIX."contrat as c"; - $sqltoupdatecontract .= " SET c.denormalized_lower_planned_end_date = (SELECT MIN(date_fin_validite) FROM ".MAIN_DB_PREFIX."contratdet as cd WHERE cd.fk_contrat = ".((int) $this->fk_contrat)." AND cd.statut = ".ContratLigne::STATUS_OPEN.")"; - $sqltoupdatecontract .= " WHERE c.rowid = ".((int) $this->fk_contrat); + $sqltoupdatecontract = "UPDATE ".MAIN_DB_PREFIX."contrat"; + $sqltoupdatecontract .= " SET denormalized_lower_planned_end_date = (SELECT MIN(date_fin_validite) FROM ".MAIN_DB_PREFIX."contratdet as cd WHERE cd.fk_contrat = ".((int) $this->fk_contrat)." AND cd.statut = ".ContratLigne::STATUS_OPEN.")"; + $sqltoupdatecontract .= " WHERE rowid = ".((int) $this->fk_contrat); $resqltoupdatecontract = $this->db->query($sqltoupdatecontract); if (!$resqltoupdatecontract) { $this->error = $this->db->lasterror();