From d3bef6ee32b1f35f51efed4e16bab1c38de993cc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 27 Sep 2025 18:28:35 +0200 Subject: [PATCH 1/8] Debug v23 --- dev/build/generate_filelist_xml.php | 30 +++++++++++++------ .../company/sync_contacts_dolibarr2ldap.php | 2 ++ 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/dev/build/generate_filelist_xml.php b/dev/build/generate_filelist_xml.php index 5dc2219cb1e..9853f860c08 100755 --- a/dev/build/generate_filelist_xml.php +++ b/dev/build/generate_filelist_xml.php @@ -50,6 +50,13 @@ $includeconstants = array(); $buildzip = 0; if (empty($argv[1])) { + print '***** '.$script_file.' *****'."\n"; + print "Generate the file filelist-x.y.z[-mybuild].xml with signature of files. "; + print "This includes the 3 sections:\n"; + print "- dolibarr_htdocs_dir\n"; + print "- dolibarr_scripts_dir\n"; + print "- dolibarr_unalterable_files (only files inside the scope of the unalterable module)\n"; + print "\n"; print "Usage: ".$script_file." release=auto[-mybuild]|x.y.z[-mybuild] [includecustom=1] [includeconstant=CC:MY_CONF_NAME:value] [buildzip=1]\n"; print "Example: ".$script_file." release=6.0.0 includecustom=1 includeconstant=FR:INVOICE_CAN_ALWAYS_BE_REMOVED:0 includeconstant=all:MAILING_NO_USING_PHPMAIL:1\n"; exit(1); @@ -97,7 +104,7 @@ $savrelease = $release; $tmpver = explode('-', $release, 2); if ($tmpver[0] == 'auto') { $release = DOL_VERSION; - if ($tmpver[1] && $tmpver[0] == 'auto') { + if (!empty($tmpver[1]) && $tmpver[0] == 'auto') { $release .= '-'.$tmpver[1]; } } @@ -126,10 +133,10 @@ if (empty($includecustom)) { } } -print "Working on files into : ".DOL_DOCUMENT_ROOT."\n"; -print "Release : ".$release."\n"; -print "Include custom in signature : ".$includecustom."\n"; -print "Include constants in signature : "; +print "Working on files into : ".DOL_DOCUMENT_ROOT."\n"; +print "Release : ".$release."\n"; +print "Include custom dir in signature : ".(empty($includecustom) ? 'no' : 'yes')."\n"; +print "Include constants in signature : ".(empty($includeconstants) ? 'none' : ''); foreach ($includeconstants as $countrycode => $tmp) { foreach ($tmp as $constname => $constvalue) { print $constname.'='.$constvalue." "; @@ -155,9 +162,12 @@ $gitcommit = 'seetag'; $branchname = preg_replace('/^(\d+\.\d+)\..*$/', '\1', $release); // Keep only x.y into x.y.z $fileforgit = dirname(dirname(dirname(__FILE__))).'/.git/refs/heads/'.$branchname; print "Try to get last commit ID from file ".$fileforgit."\n"; -$fileforgitcontent = file_get_contents($fileforgit); +$fileforgitcontent = ''; +if (file_exists($fileforgit)) { + $fileforgitcontent = file_get_contents($fileforgit); +} if (empty($fileforgitcontent)) { - print "Failed to get the last commit ID. Are you on the branch for the release (branch name '.$branchname.') ?\n"; + print "Failed to get the last commit ID. Are you on the branch for the release (branch name ".$branchname.") ?\n"; } $gitcommit = trim($fileforgitcontent); @@ -350,7 +360,7 @@ if ($newdir != $dir) { } fputs($fp, ' '."\n"); $dir = $newdir; - $needtoclose = 1; + //$needtoclose = 1; // close will be done in next filethat is in same dir } if (filetype($file) == "file") { $md5 = md5_file($file); @@ -361,7 +371,7 @@ if ($needtoclose) { fputs($fp, ' '."\n"); $needtoclose = 0; } -// Add the interfaces.class.php file +// Add the commontrigger.class.php file $file = dirname(__FILE__).'/../../htdocs/core/class/commontrigger.class.php'; $newdir = str_replace(DOL_DOCUMENT_ROOT, '', dirname($file)); $newdir = str_replace(dirname(__FILE__).'/../../htdocs', '', dirname($file)); @@ -374,6 +384,8 @@ if ($newdir != $dir) { $dir = $newdir; $needtoclose = 1; } + +$needtoclose = 1; // This is the last file if (filetype($file) == "file") { $md5 = md5_file($file); $checksumconcat[] = $md5; diff --git a/scripts/company/sync_contacts_dolibarr2ldap.php b/scripts/company/sync_contacts_dolibarr2ldap.php index c209b799a12..5448ac8b115 100755 --- a/scripts/company/sync_contacts_dolibarr2ldap.php +++ b/scripts/company/sync_contacts_dolibarr2ldap.php @@ -52,6 +52,8 @@ require_once DOL_DOCUMENT_ROOT."/core/class/ldap.class.php"; * @var HookManager $hookmanager * @var Translate $langs * @var User $user + * + * @var string $dolibarr_main_db_readonly */ // Global variables From 33ca6820a285904647bc01c3067e54ee521939ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 27 Sep 2025 22:08:13 +0200 Subject: [PATCH 2/8] add doc (#35516) * add doc * add doc * add doc * fix * fix * fix --------- Co-authored-by: Laurent Destailleur --- dev/build/phpstan/phpstan-baseline.neon | 66 ------------------- htdocs/blockedlog/ajax/block-info.php | 5 +- htdocs/core/js/listview.js | 2 +- .../modules/mailings/contacts1.modules.php | 10 ++- .../core/modules/mailings/fraise.modules.php | 10 ++- .../modules/mailings/thirdparties.modules.php | 4 +- .../modules/mailings/xinputfile.modules.php | 11 +++- .../modules/mailings/xinputuser.modules.php | 15 ++++- 8 files changed, 45 insertions(+), 78 deletions(-) diff --git a/dev/build/phpstan/phpstan-baseline.neon b/dev/build/phpstan/phpstan-baseline.neon index 74de89b1ee4..8b47ab438e6 100644 --- a/dev/build/phpstan/phpstan-baseline.neon +++ b/dev/build/phpstan/phpstan-baseline.neon @@ -7332,18 +7332,6 @@ parameters: count: 1 path: ../../../htdocs/core/lib/website.lib.php - - - message: '#^Ternary operator condition is always false\.$#' - identifier: ternary.alwaysFalse - count: 1 - path: ../../../htdocs/core/lib/website.lib.php - - - - message: '#^Ternary operator condition is always true\.$#' - identifier: ternary.alwaysTrue - count: 1 - path: ../../../htdocs/core/lib/website.lib.php - - message: '#^Call to function is_object\(\) with object will always evaluate to true\.$#' identifier: function.alreadyNarrowedType @@ -8016,30 +8004,6 @@ parameters: count: 1 path: ../../../htdocs/core/modules/import/import_xlsx.modules.php - - - message: '#^Property mailing_contacts1\:\:\$require_admin has no type specified\.$#' - identifier: missingType.property - count: 1 - path: ../../../htdocs/core/modules/mailings/contacts1.modules.php - - - - message: '#^Property mailing_contacts1\:\:\$require_module has no type specified\.$#' - identifier: missingType.property - count: 1 - path: ../../../htdocs/core/modules/mailings/contacts1.modules.php - - - - message: '#^Property mailing_fraise\:\:\$require_admin has no type specified\.$#' - identifier: missingType.property - count: 1 - path: ../../../htdocs/core/modules/mailings/fraise.modules.php - - - - message: '#^Property mailing_fraise\:\:\$require_module has no type specified\.$#' - identifier: missingType.property - count: 1 - path: ../../../htdocs/core/modules/mailings/fraise.modules.php - - message: '#^Call to function is_object\(\) with object will always evaluate to true\.$#' identifier: function.alreadyNarrowedType @@ -8064,30 +8028,6 @@ parameters: count: 1 path: ../../../htdocs/core/modules/mailings/modules_mailings.php - - - message: '#^Property mailing_xinputfile\:\:\$require_admin has no type specified\.$#' - identifier: missingType.property - count: 1 - path: ../../../htdocs/core/modules/mailings/xinputfile.modules.php - - - - message: '#^Property mailing_xinputfile\:\:\$require_module has no type specified\.$#' - identifier: missingType.property - count: 1 - path: ../../../htdocs/core/modules/mailings/xinputfile.modules.php - - - - message: '#^Property mailing_xinputuser\:\:\$require_admin has no type specified\.$#' - identifier: missingType.property - count: 1 - path: ../../../htdocs/core/modules/mailings/xinputuser.modules.php - - - - message: '#^Property mailing_xinputuser\:\:\$require_module has no type specified\.$#' - identifier: missingType.property - count: 1 - path: ../../../htdocs/core/modules/mailings/xinputuser.modules.php - - message: '#^Comparison operation "\>" between 1 and 0 is always true\.$#' identifier: greater.alwaysTrue @@ -10788,12 +10728,6 @@ parameters: count: 3 path: ../../../htdocs/fourn/facture/card.php - - - message: '#^Variable \$objectsrc might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../../htdocs/fourn/facture/card.php - - message: '#^Variable \$upload_dir might not be defined\.$#' identifier: variable.undefined diff --git a/htdocs/blockedlog/ajax/block-info.php b/htdocs/blockedlog/ajax/block-info.php index c3678b5ec97..d357b64f4ac 100644 --- a/htdocs/blockedlog/ajax/block-info.php +++ b/htdocs/blockedlog/ajax/block-info.php @@ -1,7 +1,7 @@ * Copyright (C) 2017 ATM Consulting - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2025 Frédéric France * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify @@ -99,6 +99,7 @@ function formatObject($objtoshow, $prefix) $newobjtoshow = $objtoshow; + $tmpobject = null; $arrayoffields = array(); if ($prefix == 'mycompany' || $prefix == 'thirdparty') { include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; @@ -140,7 +141,7 @@ function formatObject($objtoshow, $prefix) // Field code $s .= ''; - $s .= ''; + $s .= ''; $s .= ($prefix ? $prefix.' > ' : ''); $s .= $key; $s .= ''; diff --git a/htdocs/core/js/listview.js b/htdocs/core/js/listview.js index 09db31a6977..1e63fef36f3 100644 --- a/htdocs/core/js/listview.js +++ b/htdocs/core/js/listview.js @@ -51,7 +51,7 @@ function Listview_modifyUrl(strURL,paramName,paramNewValue){ strURL=strFirstPart+paramNewValue+strLastPart; } else{ - if (strURL.search('=')!=-1) // permet de verifier s'il y a dej� des param�tres dans l'URL + if (strURL.search('=')!=-1) // permet de verifier s'il y a dejà des paramètres dans l'URL strURL+='&'+paramName+'='+paramNewValue; else strURL+='?'+paramName+'='+paramNewValue; diff --git a/htdocs/core/modules/mailings/contacts1.modules.php b/htdocs/core/modules/mailings/contacts1.modules.php index 6a47290e352..7ed274b78b6 100644 --- a/htdocs/core/modules/mailings/contacts1.modules.php +++ b/htdocs/core/modules/mailings/contacts1.modules.php @@ -3,7 +3,7 @@ * Copyright (C) 2005-2009 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2024-2025 MDW - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2025 Frédéric France * * 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 @@ -37,7 +37,15 @@ class mailing_contacts1 extends MailingTargets public $name = 'ContactCompanies'; // Identifiant du module mailing // This label is used if no translation is found for key XXX neither MailingModuleDescXXX where XXX=name is found public $desc = 'Contacts of thirdparties (prospects, customers, suppliers...)'; + + /** + * @var string[] This module allows to select by categories must be also enabled if category module is not activated + */ public $require_module = array("societe"); // Module mailing actif si modules require_module actifs + + /** + * @var int <0,1> Set to 1 if selector is available for admin users only + */ public $require_admin = 0; // Module mailing actif pour user admin ou non /** diff --git a/htdocs/core/modules/mailings/fraise.modules.php b/htdocs/core/modules/mailings/fraise.modules.php index a551cebab49..177d3e676df 100644 --- a/htdocs/core/modules/mailings/fraise.modules.php +++ b/htdocs/core/modules/mailings/fraise.modules.php @@ -1,7 +1,7 @@ * Copyright (C) 2005-2009 Regis Houssin - * Copyright (C) 2018-2024 Frédéric France + * Copyright (C) 2018-2025 Frédéric France * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify @@ -37,9 +37,15 @@ class mailing_fraise extends MailingTargets public $name = 'FundationMembers'; // Identifiant du module mailing // This label is used if no translation is found for key XXX neither MailingModuleDescXXX where XXX=name is found public $desc = 'Foundation members with emails'; - // Set to 1 if selector is available for admin users only + + /** + * @var int <0,1> Set to 1 if selector is available for admin users only + */ public $require_admin = 0; + /** + * @var string[] This module allows to select by categories must be also enabled if category module is not activated + */ public $require_module = array('adherent'); /** diff --git a/htdocs/core/modules/mailings/thirdparties.modules.php b/htdocs/core/modules/mailings/thirdparties.modules.php index 4385c039596..9039cd3faba 100644 --- a/htdocs/core/modules/mailings/thirdparties.modules.php +++ b/htdocs/core/modules/mailings/thirdparties.modules.php @@ -3,7 +3,7 @@ * Copyright (C) 2005-2010 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2024-2025 MDW - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2025 Frédéric France * * This file is an example to follow to add your own email selector inside * the Dolibarr email tool. @@ -37,7 +37,7 @@ class mailing_thirdparties extends MailingTargets public $desc = "Third parties (by categories)"; /** - * @var int + * @var int<0,1> */ public $require_admin = 0; diff --git a/htdocs/core/modules/mailings/xinputfile.modules.php b/htdocs/core/modules/mailings/xinputfile.modules.php index 1e2a4818307..a487bd35d7d 100644 --- a/htdocs/core/modules/mailings/xinputfile.modules.php +++ b/htdocs/core/modules/mailings/xinputfile.modules.php @@ -1,6 +1,7 @@ * Copyright (C) 2024 MDW + * Copyright (C) 2025 Frédéric France * * 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 @@ -33,8 +34,16 @@ class mailing_xinputfile extends MailingTargets { public $name = 'EmailsFromFile'; // Identifiant du module mailing // This label is used if no translation is found for key XXX neither MailingModuleDescXXX where XXX=name is found - public $desc = 'EMails from a file'; // Libelle utilise si aucune traduction pour MailingModuleDescXXX ou XXX=name trouv�e + public $desc = 'EMails from a file'; // Libelle utilise si aucune traduction pour MailingModuleDescXXX ou XXX=name trouvée + + /** + * @var string[] This module allows to select by categories must be also enabled if category module is not activated + */ public $require_module = array(); // Module mailing actif si modules require_module actifs + + /** + * @var int<0,1> + */ public $require_admin = 0; // Module mailing actif pour user admin ou non /** diff --git a/htdocs/core/modules/mailings/xinputuser.modules.php b/htdocs/core/modules/mailings/xinputuser.modules.php index 3d4ce3cf34e..72e1f0ee3fa 100644 --- a/htdocs/core/modules/mailings/xinputuser.modules.php +++ b/htdocs/core/modules/mailings/xinputuser.modules.php @@ -1,6 +1,7 @@ * Copyright (C) 2024 MDW + * Copyright (C) 2025 Frédéric France * * 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 @@ -33,8 +34,16 @@ class mailing_xinputuser extends MailingTargets { public $name = 'EmailsFromUser'; // Identifiant du module mailing // This label is used if no translation is found for key XXX neither MailingModuleDescXXX where XXX=name is found - public $desc = 'EMails input by user'; // Libelle utilise si aucune traduction pour MailingModuleDescXXX ou XXX=name trouv�e + public $desc = 'EMails input by user'; // Libelle utilise si aucune traduction pour MailingModuleDescXXX ou XXX=name trouvée + + /** + * @var string[] This module allows to select by categories must be also enabled if category module is not activated + */ public $require_module = array(); // Module mailing actif si modules require_module actifs + + /** + * @var int<0,1> + */ public $require_admin = 0; // Module mailing actif pour user admin ou non /** @@ -108,8 +117,8 @@ class mailing_xinputuser extends MailingTargets { global $langs; - $s = ''; - $s .= ''; + $s = ''; + return $s; } From c17f13316adcc3c1e313003339ae1aaba785acd7 Mon Sep 17 00:00:00 2001 From: Anthony Damhet <73399671+EchoLoGeek@users.noreply.github.com> Date: Sun, 28 Sep 2025 01:21:40 +0200 Subject: [PATCH 3/8] UIUX - More intuitive select table (#35485) * More intuitive select table Added for objects: - Members - ActionComm - Mailing - Bank Accounts - Various Payments - Cash Control - Paiement - Contacts - VAT - Contracts - Cron - Gifts (Dons) - Expedition - Expense Reports - FichInter - Supplier Proposals - Supplier Orders - Supplier Invoices - Supplier Paiements - Products and supplier products - Holidays - Knowledge record - Partnership - Inventory - Stock - Projects - Tasks - Tickets - Societes - Salaries - Resource - Users * Add Status message on documentation * Remove intuitive select experimetns --------- Co-authored-by: Laurent Destailleur --- htdocs/adherents/list.php | 2 +- htdocs/comm/action/list.php | 2 +- htdocs/comm/mailing/list.php | 2 +- htdocs/compta/bank/list.php | 2 +- htdocs/compta/bank/various_payment/list.php | 2 +- htdocs/compta/cashcontrol/cashcontrol_list.php | 2 +- htdocs/compta/paiement/list.php | 2 +- htdocs/compta/tva/list.php | 2 +- htdocs/contact/list.php | 2 +- htdocs/contrat/list.php | 2 +- htdocs/cron/list.php | 2 +- htdocs/don/list.php | 2 +- htdocs/expedition/list.php | 2 +- htdocs/expensereport/list.php | 2 +- htdocs/fichinter/list.php | 2 +- htdocs/fourn/commande/list.php | 2 +- htdocs/fourn/facture/list.php | 2 +- htdocs/fourn/paiement/list.php | 2 +- htdocs/fourn/product/list.php | 2 +- htdocs/holiday/list.php | 2 +- htdocs/knowledgemanagement/knowledgerecord_list.php | 2 +- htdocs/partnership/partnership_list.php | 2 +- htdocs/product/inventory/list.php | 2 +- htdocs/product/list.php | 2 +- htdocs/product/stock/list.php | 2 +- htdocs/projet/list.php | 2 +- htdocs/projet/tasks/list.php | 2 +- htdocs/resource/list.php | 2 +- htdocs/salaries/list.php | 2 +- htdocs/societe/list.php | 2 +- htdocs/supplier_proposal/list.php | 2 +- htdocs/ticket/list.php | 2 +- htdocs/user/list.php | 2 +- 33 files changed, 33 insertions(+), 33 deletions(-) diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index 3dd1d7a0c73..eea353f37c0 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -1273,7 +1273,7 @@ while ($i < $imaxinloop) { } else { // Show line of result $j = 0; - print ''; + print ''; // Action column if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index 36d78a11e92..16095fe87f3 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -1053,7 +1053,7 @@ while ($i < $imaxinloop) { } $event_start_date_css = $event_end_date_css = $event_more_class; - print ''; + print ''; // Action column if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print ''; diff --git a/htdocs/comm/mailing/list.php b/htdocs/comm/mailing/list.php index ce8c94718a5..0d59a52fc09 100644 --- a/htdocs/comm/mailing/list.php +++ b/htdocs/comm/mailing/list.php @@ -508,7 +508,7 @@ while ($i < $imaxinloop) { // Show here line of result $j = 0; - print ''; + print ''; // Action column if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print ''; diff --git a/htdocs/compta/bank/list.php b/htdocs/compta/bank/list.php index dca0983244b..0f7dc103859 100644 --- a/htdocs/compta/bank/list.php +++ b/htdocs/compta/bank/list.php @@ -658,7 +658,7 @@ foreach ($accounts as $key => $type) { } else { // Show line of result $j = 0; - print ''; + print ''; // Action column if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { diff --git a/htdocs/compta/bank/various_payment/list.php b/htdocs/compta/bank/various_payment/list.php index c570082caac..da2d140aed3 100644 --- a/htdocs/compta/bank/various_payment/list.php +++ b/htdocs/compta/bank/various_payment/list.php @@ -742,7 +742,7 @@ while ($i < $imaxinloop) { } else { // Show here line of result $j = 0; - print ''; + print ''; // Action column if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print ''; diff --git a/htdocs/compta/cashcontrol/cashcontrol_list.php b/htdocs/compta/cashcontrol/cashcontrol_list.php index 10031583fcb..b1f4227eb23 100644 --- a/htdocs/compta/cashcontrol/cashcontrol_list.php +++ b/htdocs/compta/cashcontrol/cashcontrol_list.php @@ -617,7 +617,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) { } else { // Show here line of result $j = 0; - print ''; + print ''; // Action column if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php index e0c31b5ec11..3cf5dc2f71f 100644 --- a/htdocs/compta/paiement/list.php +++ b/htdocs/compta/paiement/list.php @@ -710,7 +710,7 @@ while ($i < $imaxinloop) { } else { // Show line of result $j = 0; - print ''; + print ''; // Action column if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { diff --git a/htdocs/compta/tva/list.php b/htdocs/compta/tva/list.php index ae6b4642ed6..98052f8fb0e 100644 --- a/htdocs/compta/tva/list.php +++ b/htdocs/compta/tva/list.php @@ -631,7 +631,7 @@ while ($i < $imaxinloop) { } else { // Show here line of result $j = 0; - print ''; + print ''; // Action column if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print ''; diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 79c6b23a69e..8bdfcfe41e1 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -1520,7 +1520,7 @@ while ($i < $imaxinloop) { } } else { // Show here line of result - print ''; + print ''; // Action column if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print ''; diff --git a/htdocs/cron/list.php b/htdocs/cron/list.php index 1beac6e5f97..a7d6170bb5d 100644 --- a/htdocs/cron/list.php +++ b/htdocs/cron/list.php @@ -556,7 +556,7 @@ if ($num > 0) { $datelastrun = $db->jdate($obj->datelastrun); $datelastresult = $db->jdate($obj->datelastresult); - print ''; + print ''; // Action column if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { diff --git a/htdocs/don/list.php b/htdocs/don/list.php index 717eab52a64..5e84c977f28 100644 --- a/htdocs/don/list.php +++ b/htdocs/don/list.php @@ -597,7 +597,7 @@ while ($i < $imaxinloop) { } else { // Show line of result $j = 0; - print ''; + print ''; // Action column if ($conf->main_checkbox_left_column) { diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index 2c16ba18590..2df3d35c9f0 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -1525,7 +1525,7 @@ while ($i < $imaxinloop) { print ''; } } else { - print ''; + print ''; // Action column if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index 083f15978d0..062d92fcfd1 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -843,7 +843,7 @@ if ($num > 0) { } else { // Show line of result $j = 0; - print ''; + print ''; // Action column if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php index 8f49f5a0bbb..d17fabb671e 100644 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -861,7 +861,7 @@ while ($i < $imaxinloop) { } else { // Show here line of result $j = 0; - print ''; + print ''; // Action column if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print ''; diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index eb41bfb3ba2..694701c8bb5 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -1843,7 +1843,7 @@ if ($resql) { print ''; } } else { - print ''; + print ''; // Action column if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print ''; diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index d7a0f000c47..82673db629b 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -1733,7 +1733,7 @@ while ($i < $imaxinloop) { } else { // Show line of result $j = 0; - print ''; + print ''; // Action column if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { diff --git a/htdocs/fourn/paiement/list.php b/htdocs/fourn/paiement/list.php index acf7e968368..d81beae870e 100644 --- a/htdocs/fourn/paiement/list.php +++ b/htdocs/fourn/paiement/list.php @@ -614,7 +614,7 @@ while ($i < $imaxinloop) { } else { // Show line of result $j = 0; - print ''; + print ''; // Action column if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { diff --git a/htdocs/fourn/product/list.php b/htdocs/fourn/product/list.php index 92f921d7022..16c65831807 100644 --- a/htdocs/fourn/product/list.php +++ b/htdocs/fourn/product/list.php @@ -421,7 +421,7 @@ while ($i < $imaxinloop) { $productstatic->barcode = $objp->barcode; $productstatic->barcode_type = $objp->fk_barcode_type; - print ''; + print ''; // Action column if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index 21f0285d842..201c7ad378e 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -909,7 +909,7 @@ if ($id && !$user->hasRight('holiday', 'readall') && !in_array($id, $childids)) } else { // Show here line of result $j = 0; - print ''; + print ''; // Action column if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print ''; diff --git a/htdocs/knowledgemanagement/knowledgerecord_list.php b/htdocs/knowledgemanagement/knowledgerecord_list.php index c70522de2d1..bfa07c23806 100644 --- a/htdocs/knowledgemanagement/knowledgerecord_list.php +++ b/htdocs/knowledgemanagement/knowledgerecord_list.php @@ -680,7 +680,7 @@ while ($i < $imaxinloop) { } else { // Show here line of result $j = 0; - print ''; + print ''; // Action column if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print ''; diff --git a/htdocs/partnership/partnership_list.php b/htdocs/partnership/partnership_list.php index a87dc72cab6..082c9300c17 100644 --- a/htdocs/partnership/partnership_list.php +++ b/htdocs/partnership/partnership_list.php @@ -943,7 +943,7 @@ while ($i < $imaxinloop) { } else { // Show here line of result $j = 0; - print ''; + print ''; // Action column if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print ''; diff --git a/htdocs/product/inventory/list.php b/htdocs/product/inventory/list.php index 02a6dca71fe..3a6659a7667 100644 --- a/htdocs/product/inventory/list.php +++ b/htdocs/product/inventory/list.php @@ -665,7 +665,7 @@ while ($i < $imaxinloop) { } else { // Show here line of result $j = 0; - print ''; + print ''; // Action column if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print ''; diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 6f7408f83c1..10216a428cc 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -1700,7 +1700,7 @@ while ($i < $imaxinloop) { } else { // Show line of result $j = 0; - print ''; + print ''; // Action column if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { diff --git a/htdocs/product/stock/list.php b/htdocs/product/stock/list.php index 65f81175706..36c6e45405c 100644 --- a/htdocs/product/stock/list.php +++ b/htdocs/product/stock/list.php @@ -738,7 +738,7 @@ while ($i < $imaxinloop) { } else { // Show line of result $j = 0; - print ''; + print ''; // Action column if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index c2894bf4f24..510967b46e2 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -1901,7 +1901,7 @@ while ($i < $imaxinloop) { // Show here line of result $j = 0; - print ''; + print ''; // Action column if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print ''; diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index 7bf3627b198..ffd9e40f4af 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -1211,7 +1211,7 @@ while ($i < $imaxinloop) { if ($userAccess >= 0) { // Show here line of result $j = 0; - print ''; + print ''; // Action column if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { diff --git a/htdocs/resource/list.php b/htdocs/resource/list.php index f2c10001a2d..399cda05737 100644 --- a/htdocs/resource/list.php +++ b/htdocs/resource/list.php @@ -605,7 +605,7 @@ while ($i < $imaxinloop) { $objectstatic->max_users = $obj->max_users; $objectstatic->url = $obj->url; - print ''; + print ''; // Action column if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { diff --git a/htdocs/salaries/list.php b/htdocs/salaries/list.php index 2f91444275e..d46a59b26fc 100644 --- a/htdocs/salaries/list.php +++ b/htdocs/salaries/list.php @@ -837,7 +837,7 @@ while ($i < $imaxinloop) { } else { // Show here line of result $j = 0; - print ''; + print ''; // Action column if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print ''; diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 7c2aa6887b1..aac87a42cd5 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -1944,7 +1944,7 @@ while ($i < $imaxinloop) { } else { // Show line of result $j = 0; - print ''; } } else { - print ''; + print ''; // Action column if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print ''; diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index 81a8583ff8d..048dfa2d75f 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -1071,7 +1071,7 @@ while ($i < $imaxinloop) { } else { // Show line of result $j = 0; - print ''; + print ''; // Action column if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { diff --git a/htdocs/user/list.php b/htdocs/user/list.php index 99778d673e8..c600d36af18 100644 --- a/htdocs/user/list.php +++ b/htdocs/user/list.php @@ -1085,7 +1085,7 @@ while ($i < $imaxinloop) { } else { // Show here line of result $j = 0; - print ''; + print ''; // Action column if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print ''; From 65a04831a99d0fc640c9b7aeed847cffbce30d7d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 28 Sep 2025 01:42:50 +0200 Subject: [PATCH 4/8] Fix height --- htdocs/website/index.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 57326f23ee5..b3d85050662 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -3633,6 +3633,9 @@ if (!GETPOST('hide_websitemenu')) { $onlylang['none'] = 'none'; $textifempty = $langs->trans("Default"); } + + $formheight = 300; + $formquestion = array( array('type' => 'hidden', 'name' => 'sourcepageurl', 'value' => $objectpage->pageurl), array('type' => 'other', 'tdclass' => 'fieldrequired', 'name' => 'newwebsite', 'label' => $langs->trans("WebSite"), 'value' => $formwebsite->selectWebsite((string) $object->id, 'newwebsite', 0)), @@ -3641,12 +3644,13 @@ if (!GETPOST('hide_websitemenu')) { ); if (count($onlylang) > 1) { $formquestion[] = array('type' => 'checkbox', 'tdclass' => 'maxwidth200', 'name' => 'is_a_translation', 'label' => $langs->trans("PageIsANewTranslation"), 'value' => 0, 'morecss' => 'margintoponly'); + $formheight += 50; } $value = $formadmin->select_language($preselectedlanguage, 'newlang', 0, array(), $textifempty, 0, 0, 'minwidth200', 1, 0, 0, $onlylang, 1); $formquestion[] = array('type' => 'other', 'name' => 'newlang', 'label' => $form->textwithpicto($langs->trans("Language"), $langs->trans("DefineListOfAltLanguagesInWebsiteProperties")), 'value' => $value); - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?website='.$object->ref.'&pageid='.$pageid, $langs->trans('ClonePage'), '', 'confirm_createpagefromclone', $formquestion, 0, 1, 300, 550); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?website='.$object->ref.'&pageid='.$pageid, $langs->trans('ClonePage'), '', 'confirm_createpagefromclone', $formquestion, 0, 1, $formheight, 550); print $formconfirm; } From 6441c423232b46b5981cda6d1de1b9f5a42a73dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 28 Sep 2025 13:54:39 +0200 Subject: [PATCH 5/8] clean code (#35529) * clean code * clean code * clean code --- dev/build/phpstan/phpstan-baseline.neon | 54 ---------------- htdocs/core/class/commonobject.class.php | 6 +- htdocs/don/class/paymentdonation.class.php | 75 ++++++++++------------ 3 files changed, 36 insertions(+), 99 deletions(-) diff --git a/dev/build/phpstan/phpstan-baseline.neon b/dev/build/phpstan/phpstan-baseline.neon index 8b47ab438e6..5b94cc9c07c 100644 --- a/dev/build/phpstan/phpstan-baseline.neon +++ b/dev/build/phpstan/phpstan-baseline.neon @@ -9378,60 +9378,6 @@ parameters: count: 1 path: ../../../htdocs/document.php - - - message: '#^Negated boolean expression is always true\.$#' - identifier: booleanNot.alwaysTrue - count: 5 - path: ../../../htdocs/don/class/paymentdonation.class.php - - - - message: '#^Property PaymentDonation\:\:\$amount \(float\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 3 - path: ../../../htdocs/don/class/paymentdonation.class.php - - - - message: '#^Property PaymentDonation\:\:\$fk_bank \(int\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 3 - path: ../../../htdocs/don/class/paymentdonation.class.php - - - - message: '#^Property PaymentDonation\:\:\$fk_donation \(int\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 4 - path: ../../../htdocs/don/class/paymentdonation.class.php - - - - message: '#^Property PaymentDonation\:\:\$fk_typepayment \(int\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 3 - path: ../../../htdocs/don/class/paymentdonation.class.php - - - - message: '#^Property PaymentDonation\:\:\$fk_user_creat \(int\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 3 - path: ../../../htdocs/don/class/paymentdonation.class.php - - - - message: '#^Property PaymentDonation\:\:\$fk_user_modif \(int\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 3 - path: ../../../htdocs/don/class/paymentdonation.class.php - - - - message: '#^Property PaymentDonation\:\:\$num_payment \(string\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 3 - path: ../../../htdocs/don/class/paymentdonation.class.php - - - - message: '#^Result of && is always true\.$#' - identifier: booleanAnd.alwaysTrue - count: 2 - path: ../../../htdocs/don/class/paymentdonation.class.php - - message: '#^Variable \$maxlength might not be defined\.$#' identifier: variable.undefined diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index bd451169a82..872cb575009 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -758,13 +758,13 @@ abstract class CommonObject public $user_modification_id; /** - * @var int ID + * @var int|null ID * @deprecated Use $user_creation_id */ public $fk_user_creat; /** - * @var ?int ID + * @var int|null ID * @deprecated Use $user_modification_id */ public $fk_user_modif; @@ -11342,7 +11342,7 @@ abstract class CommonObject $comment = new Comment($this->db); $result = $comment->fetchAllFor($this->element, $this->id); if ($result < 0) { - $this->errors = array_merge($this->errors, $comment->errors); + $this->setErrorsFromObject($comment); return -1; } else { $this->comments = $comment->comments; diff --git a/htdocs/don/class/paymentdonation.class.php b/htdocs/don/class/paymentdonation.class.php index 6ccd7a1827a..2bb9e094302 100644 --- a/htdocs/don/class/paymentdonation.class.php +++ b/htdocs/don/class/paymentdonation.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2025 Frédéric France * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify @@ -52,7 +52,7 @@ class PaymentDonation extends CommonObject public $rowid; /** - * @var int ID + * @var ?int ID */ public $fk_donation; @@ -67,7 +67,7 @@ class PaymentDonation extends CommonObject public $datep = ''; /** - * @var float amount + * @var ?float amount */ public $amount; // Total amount of payment @@ -77,42 +77,42 @@ class PaymentDonation extends CommonObject public $amounts = array(); // Array of amounts /** - * @var int Payment mode ID + * @var ?int Payment mode ID * @deprecated Use $paymenttype * @see $paymenttype */ public $fk_typepayment; /** - * @var int Payment mode ID or Code. TODO Use only the code in this field. + * @var ?int Payment mode ID or Code. TODO Use only the code in this field. */ public $paymenttype; /** - * @var string Payment reference + * @var ?string Payment reference * (Cheque or bank transfer reference. Can be "ABC123") */ public $num_payment; /** - * @var int ID + * @var ?int ID */ public $fk_bank; /** - * @var int ID + * @var ?int ID */ public $fk_user_creat; /** - * @var int ID + * @var ?int ID */ public $fk_user_modif; /** * @deprecated Use $amount, $amounts * @see $amount, $amounts - * @var float + * @var ?float */ public $total; @@ -320,8 +320,8 @@ class PaymentDonation extends CommonObject $this->num_payment = $obj->num_payment; $this->note_public = $obj->note_public; $this->fk_bank = $obj->fk_bank; - $this->fk_user_creat = $obj->fk_user_creat; - $this->fk_user_modif = $obj->fk_user_modif; + $this->fk_user_creat = $obj->fk_user_creat; + $this->fk_user_modif = $obj->fk_user_modif; $this->type_code = $obj->type_code; $this->type_label = $obj->type_label; @@ -405,17 +405,13 @@ class PaymentDonation extends CommonObject $this->errors[] = "Error ".$this->db->lasterror(); } - if (!$error) { - if (!$notrigger) { - if (!$error && !$notrigger) { - // Call triggers - $result = $this->call_trigger('DONATION_PAYMENT_MODIFY', $user); - if ($result < 0) { - $error++; - } - // End call triggers - } + if (!$error && !$notrigger) { + // Call triggers + $result = $this->call_trigger('DONATION_PAYMENT_MODIFY', $user); + if ($result < 0) { + $error++; } + // End call triggers } // Commit or rollback @@ -443,20 +439,19 @@ class PaymentDonation extends CommonObject public function delete($user, $notrigger = 0) { global $conf, $langs; + $error = 0; $this->db->begin(); - if (!$error) { - $sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_url"; - $sql .= " WHERE type='payment_donation' AND url_id=".(int) $this->id; + $sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_url"; + $sql .= " WHERE type='payment_donation' AND url_id=".(int) $this->id; - dol_syslog(get_class($this)."::delete", LOG_DEBUG); - $resql = $this->db->query($sql); - if (!$resql) { - $error++; - $this->errors[] = "Error ".$this->db->lasterror(); - } + dol_syslog(get_class($this)."::delete", LOG_DEBUG); + $resql = $this->db->query($sql); + if (!$resql) { + $error++; + $this->errors[] = "Error ".$this->db->lasterror(); } if (!$error) { @@ -471,17 +466,13 @@ class PaymentDonation extends CommonObject } } - if (!$error) { - if (!$notrigger) { - if (!$error && !$notrigger) { - // Call triggers - $result = $this->call_trigger('DONATION_PAYMENT_DELETE', $user); - if ($result < 0) { - $error++; - } - // End call triggers - } + if (!$error && !$notrigger) { + // Call triggers + $result = $this->call_trigger('DONATION_PAYMENT_DELETE', $user); + if ($result < 0) { + $error++; } + // End call triggers } // Commit or rollback @@ -639,7 +630,7 @@ class PaymentDonation extends CommonObject $this->datep, (string) $this->paymenttype, // Payment mode id or code ("CHQ or VIR for example") $label, - $amount, + (float) $amount, $this->num_payment, 0, $user, From a161c5fb67c18dd1ccbf1ac731d0da95a2965c6b Mon Sep 17 00:00:00 2001 From: MDW Date: Sun, 28 Sep 2025 13:55:39 +0200 Subject: [PATCH 6/8] Qual: Fix phan notices, update baseline (#35528) # Qual: Fix phan notices, update baseline Fix some new phan notices and update baseline --- dev/tools/phan/baseline.txt | 1 - .../datapolicy/class/datapolicycron.class.php | 21 ++++++++++++------- .../documentlist.controller.class.php | 16 +++++++++----- .../shareddocuments.controller.class.php | 15 +++++++++---- 4 files changed, 36 insertions(+), 17 deletions(-) diff --git a/dev/tools/phan/baseline.txt b/dev/tools/phan/baseline.txt index 1a63a4df70f..142321ab70a 100644 --- a/dev/tools/phan/baseline.txt +++ b/dev/tools/phan/baseline.txt @@ -31,7 +31,6 @@ return [ // Currently, file_suppressions and directory_suppressions are the only supported suppressions 'file_suppressions' => [ - 'htdocs/bookcal/calendar_card.php' => ['PhanUndeclaredProperty'], 'htdocs/bookcal/class/availabilities.class.php' => ['PhanUndeclaredMethod', 'PhanUndeclaredProperty'], 'htdocs/bookcal/class/calendar.class.php' => ['PhanUndeclaredMethod', 'PhanUndeclaredProperty'], 'htdocs/categories/viewcat.php' => ['PhanUndeclaredProperty'], diff --git a/htdocs/datapolicy/class/datapolicycron.class.php b/htdocs/datapolicy/class/datapolicycron.class.php index 9e808f61993..6d02140a37a 100644 --- a/htdocs/datapolicy/class/datapolicycron.class.php +++ b/htdocs/datapolicy/class/datapolicycron.class.php @@ -2,7 +2,7 @@ /* Copyright (C) 2018 Nicolas ZABOURI * Copyright (C) 2018-2025 Frédéric France * Copyright (C) 2024 William Mead - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2025 Quentin VIAL--GOUTEYRON * * This program is free software: you can redistribute it and/or modify @@ -273,7 +273,7 @@ class DataPolicyCron * * @return int Returns 0 for success, 1 for failure, as required for cron jobs. */ - public function cleanDataForDataPolicy() : int + public function cleanDataForDataPolicy(): int { global $conf, $user; @@ -411,7 +411,7 @@ class DataPolicyCron * @param array $policy The policy configuration. * @return int The result of the update operation, or 0 if skipped. */ - private function _handleAnonymize($object, $user, $policy) : int + private function _handleAnonymize($object, $user, $policy): int { foreach ($policy['anonymize_fields'] as $field => $val) { if ($val == 'MAKEANONYMOUS') { @@ -437,7 +437,7 @@ class DataPolicyCron * @param CommonObject $object The target object. * @param User $user The user object. * @param array $policy The policy configuration. - * @param string $method The method key ('delete' or 'update'). + * @param 'delete'|'update' $method The method key ('delete' or 'update'). * @return mixed[] The list of arguments for the call. */ private function _buildCallArguments($object, $user, $policy, $method) @@ -449,9 +449,16 @@ class DataPolicyCron $paramConfig = $policy['call_params'][$method] ?? []; - return array_map(function (string $paramName) use ($availableArgs) { - return $availableArgs[$paramName]; - }, $paramConfig); + return array_map( + /** + * @param string$paramName Name of parameter to get + * @return mixed Parameter value + */ + static function (string $paramName) use ($availableArgs) { + return $availableArgs[$paramName]; + }, + $paramConfig + ); } /** diff --git a/htdocs/webportal/controllers/documentlist.controller.class.php b/htdocs/webportal/controllers/documentlist.controller.class.php index aca9b280f92..c90b9c8e697 100644 --- a/htdocs/webportal/controllers/documentlist.controller.class.php +++ b/htdocs/webportal/controllers/documentlist.controller.class.php @@ -1,7 +1,7 @@ - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2025 Schaffhauser sébastien * 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 @@ -96,10 +96,16 @@ class DocumentListController extends AbstractDocumentController $fileList = dol_dir_list($dir_ged_tiers, 'files', 0, '', '', 'date', SORT_DESC); // 2. Define the link builder function - /** @param array $file */ - $linkBuilder = function (array $file) use ($client_dir_name) { - return DOL_URL_ROOT . '/document.php?modulepart=societe&attachment=1&file=' . urlencode($client_dir_name . '/' . $file['name']); - }; + /** + * Get url for file (anonymous function) + * + * @param array $file File (array) to get url for + * @return string Url for file + */ + $linkBuilder + = static function (array $file) use ($client_dir_name) { + return DOL_URL_ROOT . '/document.php?modulepart=societe&attachment=1&file=' . urlencode($client_dir_name . '/' . $file['name']); + }; // 3. Call the parent method to display the table $this->displayDocumentTable( diff --git a/htdocs/webportal/controllers/shareddocuments.controller.class.php b/htdocs/webportal/controllers/shareddocuments.controller.class.php index 3899b243572..4d765240ebe 100644 --- a/htdocs/webportal/controllers/shareddocuments.controller.class.php +++ b/htdocs/webportal/controllers/shareddocuments.controller.class.php @@ -2,6 +2,7 @@ /* * Copyright (C) 2024 Frédéric France * Copyright (c) 2025 Schaffhauser sébastien + * Copyright (C) 2025 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 * the Free Software Foundation. @@ -82,10 +83,16 @@ class SharedDocumentsController extends AbstractDocumentController $fileList = dol_dir_list($dir_ged_partage, 'files', 0, '', '', 'date', SORT_DESC); // 2. Define the link builder function - /** @param array $file */ - $linkBuilder = function (array $file) use ($shared_dir_relative_path) { - return DOL_URL_ROOT . '/document.php?modulepart=ecm&file=' . urlencode($shared_dir_relative_path . '/' . $file['name']); - }; + /** + * Get url for file (anonymous function) + * + * @param array $file File (array) to get url for + * @return string Url for file + */ + $linkBuilder + = static function (array $file) use ($shared_dir_relative_path) { + return DOL_URL_ROOT . '/document.php?modulepart=ecm&file=' . urlencode($shared_dir_relative_path . '/' . $file['name']); + }; // 3. Call the parent method to display the table $this->displayDocumentTable( From d286de568432b8d160b904307711a1f620b54d73 Mon Sep 17 00:00:00 2001 From: Joachim Kueter Date: Sun, 28 Sep 2025 13:57:36 +0200 Subject: [PATCH 7/8] odd optional column for VAT reverse charge flag (#35530) --- htdocs/fourn/facture/list.php | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 82673db629b..3f253fc5084 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -96,6 +96,7 @@ $search_multicurrency_montant_ttc = GETPOST('search_multicurrency_montant_ttc', $search_status = GETPOST('search_status', 'intcomma'); // Can be '' or a numeric $search_paymentmode = GETPOST('search_paymentmode', 'intcomma'); $search_paymentcond = GETPOST('search_paymentcond') ? GETPOSTINT('search_paymentcond') : ''; +$search_vat_reverse_charge = GETPOST('search_vat_reverse_charge', 'alpha'); $search_town = GETPOST('search_town', 'alpha'); $search_zip = GETPOST('search_zip', 'alpha'); $search_state = GETPOST("search_state"); @@ -200,7 +201,8 @@ $arrayfields = array( 's.zip' => array('label' => "Zip", 'checked' => '-1', 'position' => 44), 'state.nom' => array('label' => "StateShort", 'checked' => '0', 'position' => 45), 'country.code_iso' => array('label' => "Country", 'checked' => '0', 'position' => 46), - 'typent.code' => array('label' => "ThirdPartyType", 'checked' => $checkedtypetiers, 'position' => 49), + 'typent.code' => array('label' => "ThirdPartyType", 'checked' => $checkedtypetiers, 'position' => 48), + 'f.vat_reverse_charge' => array('label' => "VATReverseCharge", 'checked' => '0', 'position' => 49, 'enabled' => (getDolGlobalString('ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE') ? '1' : '0')), 'f.fk_mode_reglement' => array('label' => "PaymentMode", 'checked' => '1', 'position' => 52), 'f.fk_cond_reglement' => array('label' => "PaymentConditionsShort", 'checked' => '1', 'position' => 50), 'f.total_ht' => array('label' => "AmountHT", 'checked' => '1', 'position' => 105), @@ -305,6 +307,7 @@ if (empty($reshook)) { $search_status = ''; $search_paymentmode = ''; $search_paymentcond = ''; + $search_vat_reverse_charge = ''; $search_town = ''; $search_zip = ""; $search_state = ""; @@ -510,7 +513,7 @@ $help_url = 'EN:Suppliers_Invoices|FR:FactureFournisseur|ES:Facturas_de_proveedo // Build and execute select // -------------------------------------------------------------------- $sql = "SELECT"; -$sql .= " f.rowid as facid, f.ref, f.ref_supplier, f.type, f.subtype, f.datef, f.date_lim_reglement as datelimite, f.fk_mode_reglement, f.fk_cond_reglement,"; +$sql .= " f.rowid as facid, f.ref, f.ref_supplier, f.type, f.subtype, f.datef, f.date_lim_reglement as datelimite, f.fk_mode_reglement, f.fk_cond_reglement, f.vat_reverse_charge,"; $sql .= " f.total_ht, f.total_ttc, f.total_tva as total_vat, f.paye as paye, f.close_code, f.fk_statut as fk_statut, f.libelle as label, f.datec as date_creation, f.tms as date_modification,"; $sql .= " f.localtax1 as total_localtax1, f.localtax2 as total_localtax2,"; $sql .= ' f.fk_multicurrency, f.multicurrency_code, f.multicurrency_tx, f.multicurrency_total_ht, f.multicurrency_total_tva as multicurrency_total_vat, f.multicurrency_total_ttc,'; @@ -679,6 +682,9 @@ if ($search_paymentmode > 0) { if ($search_paymentcond > 0) { $sql .= " AND f.fk_cond_reglement = ".((int) $search_paymentcond); } +if ($search_vat_reverse_charge != '') { + $sql .= " AND f.vat_reverse_charge = ".((int) $search_vat_reverse_charge); +} if ($search_date_start) { $sql .= " AND f.datef >= '" . $db->idate($search_date_start) . "'"; } @@ -1021,6 +1027,9 @@ if ($search_paymentmode) { if ($search_paymentcond) { $param .= '&search_paymentcond='.urlencode((string) ($search_paymentcond)); } +if ($search_vat_reverse_charge != '') { + $param .= '&search_vat_reverse_charge='.urlencode((string) ($search_vat_reverse_charge)); +} if ($show_files) { $param .= '&show_files='.urlencode((string) ($show_files)); } @@ -1285,6 +1294,12 @@ if (!empty($arrayfields['typent.code']['checked'])) { print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 1, 0, 0, '', 0, 0, 0, (!getDolGlobalString('SOCIETE_SORT_ON_TYPEENT') ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT), '', 1); print ''; } +// VAT Reverse Charge +if (!empty($arrayfields['f.vat_reverse_charge']['checked'])) { + print ''; + print $form->selectyesno('search_vat_reverse_charge', $search_vat_reverse_charge, 1, 0, 1, 1); + print ''; +} // Condition of payment if (!empty($arrayfields['f.fk_cond_reglement']['checked'])) { print ''; @@ -1494,6 +1509,10 @@ if (!empty($arrayfields['typent.code']['checked'])) { print_liste_field_titre($arrayfields['typent.code']['label'], $_SERVER["PHP_SELF"], "typent.code", "", $param, '', $sortfield, $sortorder, 'center '); $totalarray['nbfield']++; } +if (!empty($arrayfields['f.vat_reverse_charge']['checked'])) { + print_liste_field_titre($arrayfields['f.vat_reverse_charge']['label'], $_SERVER["PHP_SELF"], "f.vat_reverse_charge", "", $param, "", $sortfield, $sortorder, 'center '); + $totalarray['nbfield']++; +} if (!empty($arrayfields['f.fk_cond_reglement']['checked'])) { print_liste_field_titre($arrayfields['f.fk_cond_reglement']['label'], $_SERVER["PHP_SELF"], "f.fk_cond_reglement", "", $param, "", $sortfield, $sortorder); $totalarray['nbfield']++; @@ -1918,6 +1937,15 @@ while ($i < $imaxinloop) { $totalarray['nbfield']++; } } + // VAT Reverse Charge + if (!empty($arrayfields['f.vat_reverse_charge']['checked'])) { + print ''; + print yn($obj->vat_reverse_charge); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } // Payment condition if (!empty($arrayfields['f.fk_cond_reglement']['checked'])) { From 8fa1df65609df2914cd1e07598bb750be53714e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 28 Sep 2025 13:58:30 +0200 Subject: [PATCH 8/8] clean code (#35518) * clean code * fix * fix * clean code --- dev/build/phpstan/phpstan-baseline.neon | 78 ------------------- htdocs/core/class/commonobject.class.php | 2 +- htdocs/expedition/class/expedition.class.php | 2 +- .../class/expensereportline.class.php | 2 +- .../class/fournisseur.commande.class.php | 2 +- .../class/productfournisseurprice.class.php | 2 +- .../class/supplier_proposal.class.php | 44 +++++++++-- 7 files changed, 42 insertions(+), 90 deletions(-) diff --git a/dev/build/phpstan/phpstan-baseline.neon b/dev/build/phpstan/phpstan-baseline.neon index 5b94cc9c07c..9be8c722afa 100644 --- a/dev/build/phpstan/phpstan-baseline.neon +++ b/dev/build/phpstan/phpstan-baseline.neon @@ -7578,12 +7578,6 @@ parameters: count: 1 path: ../../../htdocs/core/modules/commande/doc/pdf_einstein.modules.php - - - message: '#^Property CommonObject\:\:\$multicurrency_tx \(array\\|float\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 3 - path: ../../../htdocs/core/modules/commande/doc/pdf_einstein.modules.php - - message: '#^Ternary operator condition is always false\.$#' identifier: ternary.alwaysFalse @@ -7602,12 +7596,6 @@ parameters: count: 1 path: ../../../htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php - - - message: '#^Property CommonObject\:\:\$multicurrency_tx \(array\\|float\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 4 - path: ../../../htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php - - message: '#^Ternary operator condition is always false\.$#' identifier: ternary.alwaysFalse @@ -7734,12 +7722,6 @@ parameters: count: 1 path: ../../../htdocs/core/modules/facture/doc/pdf_crabe.modules.php - - - message: '#^Property CommonObject\:\:\$multicurrency_tx \(array\\|float\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 4 - path: ../../../htdocs/core/modules/facture/doc/pdf_crabe.modules.php - - message: '#^Ternary operator condition is always false\.$#' identifier: ternary.alwaysFalse @@ -7770,12 +7752,6 @@ parameters: count: 1 path: ../../../htdocs/core/modules/facture/doc/pdf_octopus.modules.php - - - message: '#^Property CommonObject\:\:\$multicurrency_tx \(array\\|float\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 4 - path: ../../../htdocs/core/modules/facture/doc/pdf_octopus.modules.php - - message: '#^Call to function is_object\(\) with object will always evaluate to true\.$#' identifier: function.alreadyNarrowedType @@ -7794,12 +7770,6 @@ parameters: count: 1 path: ../../../htdocs/core/modules/facture/doc/pdf_sponge.modules.php - - - message: '#^Property CommonObject\:\:\$multicurrency_tx \(array\\|float\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 3 - path: ../../../htdocs/core/modules/facture/doc/pdf_sponge.modules.php - - message: '#^Ternary operator condition is always false\.$#' identifier: ternary.alwaysFalse @@ -8586,12 +8556,6 @@ parameters: count: 1 path: ../../../htdocs/core/modules/mrp/doc/pdf_vinci.modules.php - - - message: '#^Property CommonObject\:\:\$multicurrency_tx \(array\\|float\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../../htdocs/core/modules/mrp/doc/pdf_vinci.modules.php - - message: '#^Property Mo\:\:\$lines \(array\\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -8718,24 +8682,12 @@ parameters: count: 3 path: ../../../htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php - - - message: '#^Property CommonObject\:\:\$multicurrency_tx \(array\\|float\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 3 - path: ../../../htdocs/core/modules/propale/doc/pdf_azur.modules.php - - message: '#^Ternary operator condition is always false\.$#' identifier: ternary.alwaysFalse count: 1 path: ../../../htdocs/core/modules/propale/doc/pdf_azur.modules.php - - - message: '#^Property CommonObject\:\:\$multicurrency_tx \(array\\|float\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 5 - path: ../../../htdocs/core/modules/propale/doc/pdf_cyan.modules.php - - message: '#^Ternary operator condition is always false\.$#' identifier: ternary.alwaysFalse @@ -8772,12 +8724,6 @@ parameters: count: 1 path: ../../../htdocs/core/modules/societe/doc/doc_generic_odt.modules.php - - - message: '#^Property CommonObject\:\:\$multicurrency_tx \(array\\|float\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../../htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php - - message: '#^Right side of \|\| is always false\.$#' identifier: booleanOr.rightAlwaysFalse @@ -8796,12 +8742,6 @@ parameters: count: 1 path: ../../../htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php - - - message: '#^Property CommandeFournisseur\:\:\$multicurrency_tx \(float\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../../htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php - - message: '#^Right side of \|\| is always false\.$#' identifier: booleanOr.rightAlwaysFalse @@ -8820,12 +8760,6 @@ parameters: count: 1 path: ../../../htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php - - - message: '#^Property CommandeFournisseur\:\:\$multicurrency_tx \(float\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../../htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php - - message: '#^Right side of \|\| is always false\.$#' identifier: booleanOr.rightAlwaysFalse @@ -8844,12 +8778,6 @@ parameters: count: 1 path: ../../../htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php - - - message: '#^Property SupplierProposal\:\:\$multicurrency_tx \(float\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../../htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php - - message: '#^Ternary operator condition is always false\.$#' identifier: ternary.alwaysFalse @@ -8862,12 +8790,6 @@ parameters: count: 1 path: ../../../htdocs/core/modules/supplier_proposal/doc/pdf_zenith.modules.php - - - message: '#^Property SupplierProposal\:\:\$multicurrency_tx \(float\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../../htdocs/core/modules/supplier_proposal/doc/pdf_zenith.modules.php - - message: '#^Right side of \|\| is always false\.$#' identifier: booleanOr.rightAlwaysFalse diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 872cb575009..a81f98260ea 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -554,7 +554,7 @@ abstract class CommonObject public $multicurrency_code; /** - * @var float|float[] Multicurrency rate ("tx" = "taux" in French) + * @var null|float|float[] Multicurrency rate ("tx" = "taux" in French) * Or, just for the Paiement object, an array: invoice ID => currency rate for that invoice. */ public $multicurrency_tx; diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 8551275d894..4ae80b92bfc 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -276,7 +276,7 @@ class Expedition extends CommonObject */ public $multicurrency_code; /** - * @var float + * @var ?float */ public $multicurrency_tx; /** diff --git a/htdocs/expensereport/class/expensereportline.class.php b/htdocs/expensereport/class/expensereportline.class.php index 37cf2bc1657..ddce5c718ce 100644 --- a/htdocs/expensereport/class/expensereportline.class.php +++ b/htdocs/expensereport/class/expensereportline.class.php @@ -198,7 +198,7 @@ class ExpenseReportLine extends CommonObjectLine public $multicurrency_code; /** - * @var float + * @var ?float */ public $multicurrency_tx; diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 33752c0fa37..0c36ef87656 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -330,7 +330,7 @@ class CommandeFournisseur extends CommonOrder public $multicurrency_code; /** - * @var float Rate + * @var ?float Rate */ public $multicurrency_tx; diff --git a/htdocs/product/class/productfournisseurprice.class.php b/htdocs/product/class/productfournisseurprice.class.php index 7a5f5f31cfd..2b1ea94008b 100644 --- a/htdocs/product/class/productfournisseurprice.class.php +++ b/htdocs/product/class/productfournisseurprice.class.php @@ -217,7 +217,7 @@ class ProductFournisseurPrice extends CommonObject */ public $multicurrency_code; /** - * @var float + * @var ?float */ public $multicurrency_tx; /** diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index ed82ae8c82a..0ee4e7fb94b 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -234,7 +234,7 @@ class SupplierProposal extends CommonObject */ public $multicurrency_code; /** - * @var float + * @var ?float */ public $multicurrency_tx; /** @@ -542,15 +542,13 @@ class SupplierProposal extends CommonObject return -1; } if ($result < -1) { - $this->error = $productsupplier->error; - $this->errors = $productsupplier->errors; + $this->setErrorsFromObject($productsupplier); $this->db->rollback(); dol_syslog(get_class($this)."::addline result=".$result." - ".$this->error, LOG_ERR); return -1; } } else { - $this->error = $productsupplier->error; - $this->errors = $productsupplier->errors; + $this->setErrorsFromObject($productsupplier); $this->db->rollback(); return -1; } @@ -578,7 +576,23 @@ class SupplierProposal extends CommonObject $pu = 0; } - $tabprice = calcul_price_total($qty, $pu, (float) $remise_percent, $txtva, (float) $txlocaltax1, (float) $txlocaltax2, 0, $price_base_type, $info_bits, $type, $this->thirdparty, $localtaxes_type, 100, $this->multicurrency_tx, $pu_ht_devise); + $tabprice = calcul_price_total( + $qty, + $pu, + (float) $remise_percent, + $txtva, + (float) $txlocaltax1, + (float) $txlocaltax2, + 0, + $price_base_type, + $info_bits, + $type, + $this->thirdparty, + $localtaxes_type, + 100, + (float) $this->multicurrency_tx, + $pu_ht_devise + ); $total_ht = $tabprice[0]; $total_tva = $tabprice[1]; $total_ttc = $tabprice[2]; @@ -769,7 +783,23 @@ class SupplierProposal extends CommonObject $pu = 0; } - $tabprice = calcul_price_total($qty, $pu, (float) $remise_percent, $txtva, (float) $txlocaltax1, (float) $txlocaltax2, 0, $price_base_type, $info_bits, $type, $this->thirdparty, $localtaxes_type, 100, $this->multicurrency_tx, $pu_ht_devise); + $tabprice = calcul_price_total( + $qty, + $pu, + (float) $remise_percent, + $txtva, + (float) $txlocaltax1, + (float) $txlocaltax2, + 0, + $price_base_type, + $info_bits, + $type, + $this->thirdparty, + $localtaxes_type, + 100, + (float) $this->multicurrency_tx, + $pu_ht_devise + ); $total_ht = $tabprice[0]; $total_tva = $tabprice[1]; $total_ttc = $tabprice[2];