From b03c12c12947ad832dfe2b610e70d4df1bf2f3d5 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 9 Sep 2025 19:25:09 +0200 Subject: [PATCH] FIX Societe - Problem of date on outstanding opened late (#35266) --- htdocs/societe/class/societe.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 14ddcd19613..f2c9efdc3b3 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -4875,10 +4875,12 @@ class Societe extends CommonObject $alreadypayed=price2num($paiement + $creditnotes + $deposits,'MT'); $remaintopay=price2num($invoice->total_ttc - $paiement - $creditnotes - $deposits,'MT'); */ + $today = dol_get_first_hour(dol_now('tzuser')); // Returns today at 00:00 in the user's time zone + $sql = "SELECT rowid, ref, total_ht, total_ttc, paye, type, fk_statut as status, close_code FROM ".MAIN_DB_PREFIX.$table." as f"; $sql .= " WHERE fk_soc = ".((int) $this->id); if (!empty($late)) { - $sql .= " AND date_lim_reglement < '".$this->db->idate(dol_now())."'"; + $sql .= " AND date_lim_reglement < '".$this->db->idate($today)."'"; } if ($mode == 'supplier') { $sql .= " AND entity IN (".getEntity('facture_fourn').")";