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.
This commit is contained in:
Alexandre Janniaux 2025-01-15 20:01:40 +01:00
parent 1198ae5769
commit f757f9c4cc

View file

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