From 6c70652d2968ca11d356249e6a73e42ccfb5476b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 30 Mar 2026 19:13:52 +0200 Subject: [PATCH 1/6] fix phpstan (#37660) * fix phpstan * Update get_changed_php.sh * Update get_changed_php.sh * Update document.php * Update document.php --- .github/scripts/get_changed_php.sh | 5 ++--- htdocs/public/ticket/document.php | 6 +++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/scripts/get_changed_php.sh b/.github/scripts/get_changed_php.sh index 57a95f969a4..86244a47627 100755 --- a/.github/scripts/get_changed_php.sh +++ b/.github/scripts/get_changed_php.sh @@ -34,7 +34,6 @@ if [[ "$pr_number" == "null" ]]; then exit 0 fi -# Split repository into owner and repo name # Split repository into owner and repo name using Bash parameter expansion owner="${GITHUB_REPOSITORY%%/*}" # Extract text before the first '/' repo="${GITHUB_REPOSITORY##*/}" # Extract text after the last '/' @@ -72,12 +71,12 @@ done all_changed_files=$(IFS=" " ; echo "${changed_php_files[*]}") all_changed_lang=$(IFS=" " ; echo "${changed_lang_files[*]}") - +forbidden_files="" #forbidden_files=$(echo "$all_changed_lang" | grep -E 'htdocs/langs/([^/]+)/.*\.lang$' | grep -v 'htdocs/langs/en_US/') #if [ -n "$forbidden_files" ]; then # echo "You tried to modify one or more language files that are not allowed to be modified in Pull requests." # echo "$forbidden_files" -# echo "To modify translation that are not the source language (en_US), you must modify them from transifex.com" +# echo "To modify translations that are not the source language (en_US), you must modify them from transifex.com" # exit 10 #fi diff --git a/htdocs/public/ticket/document.php b/htdocs/public/ticket/document.php index ef7380213db..62463a2965d 100644 --- a/htdocs/public/ticket/document.php +++ b/htdocs/public/ticket/document.php @@ -233,7 +233,7 @@ $fullpath_original_file = getMultidirOutput($object, 'ticket').'/'.$original_fil // Security: // Limit access if permissions are wrong -if (!$accessallowed) { +if (!$accessallowed) { // @phpstan-ignore-line as value is set to 1 just before accessforbidden(); } @@ -269,7 +269,7 @@ if (!file_exists($fullpath_original_file_osencoded)) { top_httphead($type); header('Content-Description: File Transfer'); -if ($encoding) { +if ($encoding) { // @phpstan-ignore-line as variable is set to '' and never change header('Content-Encoding: '.$encoding); } // Add MIME Content-Disposition from RFC 2183 (inline=automatically displayed, attachment=need user action to open) @@ -289,7 +289,7 @@ if (is_object($db)) { } // Send file now -if ($readfile) { +if ($readfile) { // @phpstan-ignore-line as value is set to true just before header('Content-Length: '.dol_filesize($fullpath_original_file)); readfileLowMemory($fullpath_original_file_osencoded); From 81aaba6e8663fc6ab6b76afd30fa84b994425e8d Mon Sep 17 00:00:00 2001 From: support-accellier <151022268+support-accellier@users.noreply.github.com> Date: Mon, 30 Mar 2026 22:49:49 +0530 Subject: [PATCH 2/6] Add check for defined SUBTOTALS_SPECIAL_CODE (#37666) Bugfix for #37663 --- htdocs/core/class/commonobject.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index e627be232d0..151ef3be886 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -5958,7 +5958,7 @@ abstract class CommonObject $this->tpl['strike'] = 0; if ($restrictlist == 'services' && $line->product_type != Product::TYPE_SERVICE) { $this->tpl['strike'] = 1; - } elseif ($line->special_code == SUBTOTALS_SPECIAL_CODE) { + } elseif (defined('SUBTOTALS_SPECIAL_CODE') && $line->special_code == SUBTOTALS_SPECIAL_CODE) { $this->tpl['strike'] = 1; } From eab90a73f5895de47ef7d1b296288dabf3f2a054 Mon Sep 17 00:00:00 2001 From: Zakaria Boushaba <48571684+Boushabazakaria@users.noreply.github.com> Date: Mon, 30 Mar 2026 18:31:17 +0100 Subject: [PATCH 3/6] Use INVOICE_ENABLE_NEGATIVE_QTY constant for negative invoice line quantities (#37669) Co-authored-by: Zakaria Boushaba Co-authored-by: Laurent Destailleur --- htdocs/compta/facture/card.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 54b6db590cc..31fe89c8eb9 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -2564,7 +2564,7 @@ if (empty($reshook)) { setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Qty')), null, 'errors'); $error++; } - if ($qty < 0) { + if ($qty < 0 && !getDolGlobalString('INVOICE_ENABLE_NEGATIVE_QTY')) { $langs->load("errors"); setEventMessages($langs->trans('ErrorQtyForCustomerInvoiceCantBeNegative'), null, 'errors'); $error++; @@ -2585,7 +2585,7 @@ if (empty($reshook)) { } $price_base_type = null; - if (!$error && ($qty >= 0) && (!empty($line_desc) || (!empty($idprod) && $idprod > 0))) { + if (!$error && (!empty($line_desc) || (!empty($idprod) && $idprod > 0))) { $ret = $object->fetch($id); if ($ret < 0) { dol_print_error($db, $object->error); @@ -3199,7 +3199,7 @@ if (empty($reshook)) { $error++; } } - if ($qty < 0) { + if ($qty < 0 && !getDolGlobalString('INVOICE_ENABLE_NEGATIVE_QTY')) { $langs->load("errors"); setEventMessages($langs->trans('ErrorQtyForCustomerInvoiceCantBeNegative'), null, 'errors'); $error++; From 08e5308772dcb73d58adeeda519f303633eb58d8 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 30 Mar 2026 19:53:22 +0200 Subject: [PATCH 4/6] FIX: avoid string + float TypeError (#37670) * FIX: avoid string + float TypeError # FIX: Avoid string + float TypeError DoliDB::jdate() can return empty string which resulted in `[php:error] [pid 1131683:tid 1131683] [client 192.168.0.254:28642] PHP Fatal error: Uncaught TypeError: Unsupported operand types: string + float in .../htdocs/compta/bank/class/account.class.php:262`. Cast jdate result to int where it is used in numerical comparisons or numeric expressions. * Fix: 'forbidden_files: unbound variable' --------- Co-authored-by: Laurent Destailleur --- .github/scripts/get_changed_php.sh | 3 ++- htdocs/compta/bank/class/account.class.php | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/scripts/get_changed_php.sh b/.github/scripts/get_changed_php.sh index 86244a47627..d01bd532322 100755 --- a/.github/scripts/get_changed_php.sh +++ b/.github/scripts/get_changed_php.sh @@ -1,4 +1,4 @@ -#!/bin/bash +b!/bin/bash # Copyright (C) 2025 MDW set -euo pipefail @@ -71,6 +71,7 @@ done all_changed_files=$(IFS=" " ; echo "${changed_php_files[*]}") all_changed_lang=$(IFS=" " ; echo "${changed_lang_files[*]}") + forbidden_files="" #forbidden_files=$(echo "$all_changed_lang" | grep -E 'htdocs/langs/([^/]+)/.*\.lang$' | grep -v 'htdocs/langs/en_US/') #if [ -n "$forbidden_files" ]; then diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 88d369076c5..e544bdda620 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -10,7 +10,7 @@ * Copyright (C) 2016 Ferran Marcet * Copyright (C) 2019 JC Prieto * Copyright (C) 2022-2025 Frédéric France - * Copyright (C) 2024-2025 MDW + * Copyright (C) 2024-2026 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -1426,7 +1426,7 @@ class Account extends CommonObject while ($obj = $this->db->fetch_object($resql)) { $response->nbtodo++; - if ($this->db->jdate($obj->datefin) < ($now - $conf->bank->rappro->warning_delay)) { + if ((int) $this->db->jdate($obj->datefin) < ($now - $conf->bank->rappro->warning_delay)) { $response->nbtodolate++; } } @@ -2626,7 +2626,7 @@ class AccountLine extends CommonObjectLine $resql = $this->db->query($sql); if ($resql) { $obj = $this->db->fetch_object($resql); - $newdate = $this->db->jdate($obj->datev) + (3600 * 24 * $sign); + $newdate = (int) $this->db->jdate($obj->datev) + (3600 * 24 * $sign); $sql = "UPDATE ".MAIN_DB_PREFIX."bank SET"; $sql .= " datev = '".$this->db->idate($newdate)."'"; @@ -2689,7 +2689,7 @@ class AccountLine extends CommonObjectLine $resql = $this->db->query($sql); if ($resql) { $obj = $this->db->fetch_object($resql); - $newdate = $this->db->jdate($obj->dateo) + (3600 * 24 * $sign); + $newdate = (int) $this->db->jdate($obj->dateo) + (3600 * 24 * $sign); $sql = "UPDATE ".MAIN_DB_PREFIX."bank SET"; $sql .= " dateo = '".$this->db->idate($newdate)."'"; From 2e7d48240313a2f7a56ab5308461125f8e5ae1d2 Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Mon, 30 Mar 2026 19:59:23 +0200 Subject: [PATCH 5/6] Fix #37642 regression (#37672) --- dev/build/makepack-dolibarrmodule.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dev/build/makepack-dolibarrmodule.pl b/dev/build/makepack-dolibarrmodule.pl index 856bedc6126..93d6d0d2181 100755 --- a/dev/build/makepack-dolibarrmodule.pl +++ b/dev/build/makepack-dolibarrmodule.pl @@ -157,7 +157,7 @@ foreach my $PROJECT (@PROJECTLIST) { . ucfirst($PROJECT) . ".class.php" ); - $custom = 0; + $custom = 1; if ( !$result ) { $result = open( $IN, @@ -180,7 +180,7 @@ foreach my $PROJECT (@PROJECTLIST) { } } else { - $custom = 1; + $custom = 0; } while (<$IN>) { if ( $_ =~ /this->version\s*=\s*'([\d\.]+)'/ ) { From 7959a116d64c13e57bc06d510304938e37768be1 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Mon, 30 Mar 2026 20:37:46 +0200 Subject: [PATCH 6/6] FIX Accountancy - Fix some problem on ajax greyout on select_auxaccount() (#37657) * FIX Accountancy - Fix some problem on ajax greyout on select_auxaccount() * Update auxaccount.php --------- Co-authored-by: Laurent Destailleur --- htdocs/accountancy/bookkeeping/card.php | 30 ++++++++++++---- htdocs/core/ajax/auxaccount.php | 24 ++++++++----- .../core/class/html.formaccounting.class.php | 36 +++++++------------ 3 files changed, 51 insertions(+), 39 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index 635f9e540cb..47014ab2ffa 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -580,13 +580,29 @@ if (!empty($conf->use_javascript_ajax)) { print "\n" . ''; + $ajaxoptions['update'] = array($labelhtmlname => 'label_name'); } + // Hidden input + jQuery UI autocomplete JS + $out .= ajax_autocompleter($selectid, $htmlname, DOL_URL_ROOT.'/core/ajax/auxaccount.php', $urloption, $minLength, 0, $ajaxoptions); + return $out; } @@ -637,15 +628,14 @@ class FormAccounting extends Form } // Build native select — select2 is automatically activated by Form::selectarray() with $useajax=1 - $out .= Form::selectarray($htmlname, $aux_account, $selectid, ($showempty ? (is_numeric($showempty) ? 1 : $showempty) : 0), 0, 0, '', 0, 0, 0, '', $morecss, 1); + $out .= Form::selectarray($htmlname, $aux_account, $selectid, $placeholder, 0, 0, '', 0, 0, 0, '', $morecss, 1); - // Autofill subledger label on select2 selection event + // Autofill subledger label on select2 selection event (mode 1 only) if (!empty($conf->use_javascript_ajax) && !empty($labelhtmlname)) { $out .= '