From f757f9c4cc6f34f5ae884100dcbbcf72e140d252 Mon Sep 17 00:00:00 2001 From: Alexandre Janniaux Date: Wed, 15 Jan 2025 20:01:40 +0100 Subject: [PATCH] accounting: fix num_rows without call from $db $res->num_rows will not work on PostgreSQL. $db->num_rows() must be used instead to execute the correct procedure depending on the database backend. --- htdocs/core/lib/accounting.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/accounting.lib.php b/htdocs/core/lib/accounting.lib.php index e3876491055..ff23193441e 100644 --- a/htdocs/core/lib/accounting.lib.php +++ b/htdocs/core/lib/accounting.lib.php @@ -295,7 +295,7 @@ function getDefaultDatesForTransfer() $sql .= " WHERE date_start < '".$db->idate(dol_now())."' AND date_end > '".$db->idate(dol_now())."'"; $sql .= $db->plimit(1); $res = $db->query($sql); - if ($res->num_rows > 0) { + if ($db->num_rows($res) > 0) { $obj = $db->fetch_object($res); $date_start = $db->jdate($obj->date_start);