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
This commit is contained in:
SAINT-PATRICE 2026-03-12 14:02:27 +01:00 committed by GitHub
parent 502bc82815
commit b1e693a1ac
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

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