From 540329340912b56763813e22519d977374306be2 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Thu, 16 Jan 2025 06:19:22 +0100 Subject: [PATCH 1/4] Remove inappropriate --- htdocs/accountancy/journal/purchasesjournal.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index 437b436b733..afe272ba7d9 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -3,7 +3,7 @@ * Copyright (C) 2007-2010 Jean Heimburger * Copyright (C) 2011 Juanjo Menent * Copyright (C) 2012 Regis Houssin - * Copyright (C) 2013-2024 Alexandre Spangaro + * Copyright (C) 2013-2025 Alexandre Spangaro * Copyright (C) 2013-2016 Olivier Geffroy * Copyright (C) 2013-2016 Florian Henry * Copyright (C) 2018-2024 Frédéric France @@ -1276,12 +1276,10 @@ if (empty($action) || $action == 'view') { // Subledger account print ""; print ''; - print ""; $tmpvatrate = (empty($def_tva[$key][$k]) ? (empty($arrayofvat[$key][$k]) ? '' : $arrayofvat[$key][$k]) : implode(', ', $def_tva[$key][$k])); $labelvatrate = $langs->trans("Taxes").' '.$tmpvatrate.' %'; $labelvatrate .= ($numtax ? ' - Localtax '.$numtax : ''); print "" . $bookkeepingstatic->accountingLabelForOperation($companystatic->getNomUrl(0, 'supplier'), $invoicestatic->ref_supplier, $labelvatrate) . ""; - print ""; print ''.($mt >= 0 ? price($mt) : '').""; print ''.($mt < 0 ? price(-$mt) : '').""; print ""; From d85c39e77ba9f4852f134ed23e52e3837540a59e Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Thu, 16 Jan 2025 14:47:03 +0100 Subject: [PATCH 2/4] Fix CI --- htdocs/core/lib/functions.lib.php | 2 +- .../interface_50_modNotification_Notification.class.php | 3 --- htdocs/loan/card.php | 2 +- htdocs/user/bank.php | 4 ++-- 4 files changed, 4 insertions(+), 7 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index bffc520abb0..4c9a5d4cedd 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -9185,7 +9185,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, } elseif (property_exists($object, 'delivery_date')) { $date_delivery = $object->delivery_date; } - $substitutionarray['__DATE_DELIVERY__'] = (isset($date_delivery) ? dol_print_date($date_delivery, 'day', 0, $outputlangs) : ''); + $substitutionarray['__DATE_DELIVERY__'] = (isset($date_delivery) ? dol_print_date($date_delivery, 'day', false, $outputlangs) : ''); $substitutionarray['__DATE_DELIVERY_DAY__'] = (isset($date_delivery) ? dol_print_date($date_delivery, "%d") : ''); $substitutionarray['__DATE_DELIVERY_DAY_TEXT__'] = (isset($date_delivery) ? dol_print_date($date_delivery, "%A") : ''); $substitutionarray['__DATE_DELIVERY_MON__'] = (isset($date_delivery) ? dol_print_date($date_delivery, "%m") : ''); diff --git a/htdocs/core/triggers/interface_50_modNotification_Notification.class.php b/htdocs/core/triggers/interface_50_modNotification_Notification.class.php index c3bdc971328..86bf821cd36 100644 --- a/htdocs/core/triggers/interface_50_modNotification_Notification.class.php +++ b/htdocs/core/triggers/interface_50_modNotification_Notification.class.php @@ -99,9 +99,6 @@ class InterfaceNotification extends DolibarrTriggers $notify = new Notify($this->db); $resultSend = $notify->send($action, $object); if ($resultSend < 0) { - if (!isset($this->errors)) { - $this->errors = []; - } $this->errors = array_merge($this->errors, $notify->errors); return $resultSend; } diff --git a/htdocs/loan/card.php b/htdocs/loan/card.php index f0025e642a6..aefbc83ca92 100644 --- a/htdocs/loan/card.php +++ b/htdocs/loan/card.php @@ -205,7 +205,7 @@ if (empty($reshook)) { $object->capital = $capital; $object->nbterm = GETPOSTINT("nbterm"); - $object->rate = price2num(GETPOST("rate", 'alpha')); + $object->rate = GETPOSTFLOAT("rate"); $object->insurance_amount = GETPOSTFLOAT('insurance_amount'); $accountancy_account_capital = GETPOST('accountancy_account_capital'); diff --git a/htdocs/user/bank.php b/htdocs/user/bank.php index 0a9a378fb35..edd8ff48472 100644 --- a/htdocs/user/bank.php +++ b/htdocs/user/bank.php @@ -125,7 +125,7 @@ if ($user->hasRight('salaries', 'readall')) { if ($user->hasRight('hrm', 'read')) { $ok = true; } -if ($user->hasRight('expensereport', 'readall') || ($user->hasRight('expensereport', 'readall') && in_array($object->id, $childids))) { +if ($user->hasRight('expensereport', 'readall') || ($user->hasRight('expensereport', 'read') && in_array($object->id, $childids))) { $ok = true; } if ($user->hasRight('holiday', 'readall') || ($user->hasRight('holiday', 'read') && in_array($object->id, $childids))) { @@ -778,7 +778,7 @@ if ($action != 'edit' && $action != 'create') { // If not bank account yet, $ac // Latest expense report if (isModEnabled('expensereport') && - ($user->hasRight('expensereport', 'readall') || ($user->hasRight('expensereport', 'lire') && $object->id == $user->id)) + ($user->hasRight('expensereport', 'readall') || ($user->hasRight('expensereport', 'read') && $object->id == $user->id)) ) { $exp = new ExpenseReport($db); From eaa51fed7b4e18d494d47fd9db8061aa5c95518b Mon Sep 17 00:00:00 2001 From: Alexandre Janniaux Date: Wed, 15 Jan 2025 20:01:40 +0100 Subject: [PATCH 3/4] 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); From 63c991413ee7db10a44ff7458a13b58f0881b662 Mon Sep 17 00:00:00 2001 From: Alexandre Janniaux Date: Wed, 15 Jan 2025 20:01:40 +0100 Subject: [PATCH 4/4] api_thirdparties: fix num_rows typo $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. But the call was not written properly and both were mixed up in commit 25741a618ebc162af25ede4936b8087f580e85bf which used $db->num_rows, and then fixed in 72c443868c235c31cb192c1202d277b6df4cd380 which used $db->num_rows($result) where suited, except this location. --- htdocs/societe/class/api_thirdparties.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/class/api_thirdparties.class.php b/htdocs/societe/class/api_thirdparties.class.php index 4461bb644e3..9f1049544cf 100644 --- a/htdocs/societe/class/api_thirdparties.class.php +++ b/htdocs/societe/class/api_thirdparties.class.php @@ -1865,7 +1865,7 @@ class Thirdparties extends DolibarrApi $result = $this->db->query($sql); // We do not found an existing SocieteAccount entity for this fk_soc and site ; we then create a new one. - if ($result && $this->db->num_rows == 0) { + if ($result && $this->db->num_rows($result) == 0) { if (!isset($request_data['key_account'])) { throw new RestException(422, 'Unprocessable Entity: You must pass the key_account attribute in your request data !'); }