From 4cc3d90cd4e8583ca189877c4ab3687743521d53 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 17 Apr 2026 17:39:17 +0200 Subject: [PATCH 01/53] Fix missing columns --- htdocs/core/lib/project.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index f0ffcf20e1d..78f393b3e8f 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -2509,7 +2509,7 @@ function projectLinesPerMonth(&$inc, $firstdaytoshow, $fuser, $parent, $lines, & if ($lines[$i]->id > 0) { //var_dump('totalforeachday after taskid='.$lines[$i]->id.' and previous one on level '.$level); //var_dump($totalforeachday); - $ret = projectLinesPerMonth($inc, $firstdaytoshow, $fuser, $lines[$i]->id, ($parent == 0 ? $lineswithoutlevel0 : $lines), $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $isavailable, $oldprojectforbreak, $TWeek); + $ret = projectLinesPerMonth($inc, $firstdaytoshow, $fuser, $lines[$i]->id, ($parent == 0 ? $lineswithoutlevel0 : $lines), $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $isavailable, $oldprojectforbreak, $TWeek, $arrayfields); //var_dump('ret with parent='.$lines[$i]->id.' level='.$level); //var_dump($ret); foreach ($ret as $key => $val) { From 0f7847afb2178804e43c5b1e991ad09dab87aeea Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 18 Apr 2026 09:01:51 +0200 Subject: [PATCH 02/53] Fix responsive --- htdocs/core/class/html.formsetup.class.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/core/class/html.formsetup.class.php b/htdocs/core/class/html.formsetup.class.php index efbb0283257..45d35afcaca 100644 --- a/htdocs/core/class/html.formsetup.class.php +++ b/htdocs/core/class/html.formsetup.class.php @@ -242,6 +242,7 @@ class FormSetup if ($reshook > 0) { return $hookmanager->resPrint; } else { + $out = '
'; $out = ''; if (empty($hideTitle)) { if (empty($title)) { @@ -265,6 +266,7 @@ class FormSetup $out .= ''; $out .= '
'; + $out .= '
'; return $out; } } From 9525528d84dd609445996cacdd3428947e4fe60c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 18 Apr 2026 09:03:30 +0200 Subject: [PATCH 03/53] Fix --- htdocs/core/class/html.formsetup.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formsetup.class.php b/htdocs/core/class/html.formsetup.class.php index 45d35afcaca..539fc6ee041 100644 --- a/htdocs/core/class/html.formsetup.class.php +++ b/htdocs/core/class/html.formsetup.class.php @@ -243,7 +243,7 @@ class FormSetup return $hookmanager->resPrint; } else { $out = '
'; - $out = ''; + $out .= '
'; if (empty($hideTitle)) { if (empty($title)) { $title = $this->langs->transnoentitiesnoconv("Parameter"); From f1b2dd6481e22cacb561d29ffdcd3a50b618479d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 18 Apr 2026 22:53:59 +0200 Subject: [PATCH 04/53] FIX add permission test on legacy filemanager - Credit Aksoum Abderrahmane --- htdocs/core/filemanagerdol/connectors/php/config.inc.php | 9 ++++++++- htdocs/core/filemanagerdol/connectors/php/connector.php | 3 +++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/htdocs/core/filemanagerdol/connectors/php/config.inc.php b/htdocs/core/filemanagerdol/connectors/php/config.inc.php index 0704d51f615..7cb8b015ec3 100644 --- a/htdocs/core/filemanagerdol/connectors/php/config.inc.php +++ b/htdocs/core/filemanagerdol/connectors/php/config.inc.php @@ -33,9 +33,9 @@ define('NOTOKENRENEWAL', 1); // Disables token renewal // is a security hole if anybody can access without // being an authenticated user. require_once '../../../../main.inc.php'; - /** * @var Conf $conf + * @var User $user * * @var string $dolibarr_main_data_root * @var string $dolibarr_main_url_root @@ -49,6 +49,13 @@ if ($pos == '/') { //define('DOL_URL_ROOT', $pos); $entity = ((!empty($_SESSION['dol_entity']) && $_SESSION['dol_entity'] > 1) ? $_SESSION['dol_entity'] : null); + +if (!empty($user->admin) && !$user->hasRight('website', 'write')) { + accessforbidden('Need to be admin or having write permission on website module'); + exit; +} + + // SECURITY: You must explicitly enable this "connector". (Set it to "true"). // WARNING: don't just set "$Config['Enabled'] = true ;", you must be sure that only // authenticated users can access this file or use some kind of session checking. diff --git a/htdocs/core/filemanagerdol/connectors/php/connector.php b/htdocs/core/filemanagerdol/connectors/php/connector.php index 25d9312015f..94ea7f864cc 100644 --- a/htdocs/core/filemanagerdol/connectors/php/connector.php +++ b/htdocs/core/filemanagerdol/connectors/php/connector.php @@ -26,6 +26,9 @@ ob_start(); require 'config.inc.php'; // This include the main.inc.php +/** + * @var array $Config + */ require 'connector.lib.php'; if (!$Config['Enabled']) { From 30430e1674aceb0ac6c79539e6df5005a5313d49 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 Apr 2026 19:53:46 +0200 Subject: [PATCH 05/53] NEW Enable AI tools on the message editor for tickets --- htdocs/ai/ajax/generate_content.php | 9 +++- htdocs/ai/class/ai.class.php | 29 +++++++++-- htdocs/core/class/html.formmail.class.php | 1 + htdocs/core/class/html.formticket.class.php | 54 ++++++++++++++++++--- htdocs/core/lib/company.lib.php | 6 ++- htdocs/core/lib/functions.lib.php | 6 ++- htdocs/theme/eldy/global.inc.php | 2 +- htdocs/theme/eldy/timeline.inc.php | 10 ++-- htdocs/theme/md/style.css.php | 2 +- htdocs/ticket/card.php | 6 +-- 10 files changed, 102 insertions(+), 23 deletions(-) diff --git a/htdocs/ai/ajax/generate_content.php b/htdocs/ai/ajax/generate_content.php index 9c32a6a7d6d..bbab82b0862 100644 --- a/htdocs/ai/ajax/generate_content.php +++ b/htdocs/ai/ajax/generate_content.php @@ -112,7 +112,14 @@ if (empty($instructions)) { } } else { if ($function == 'textgenerationemail' || $function == 'textgenerationwebpage') { - print dolPrintHTML($generatedContent); // Note that common HTML tags are NOT escaped (but a sanitization is done) + if ($format == 'html') { + print dolPrintHTML($generatedContent); // Note that common HTML tags are NOT escaped (but a sanitization is done) + } else { + // We must not use dolPrintText because dolPrintText format data including accent in htmlentities for a HTML output. We need a non formatted output. + //print dol_string_onlythesehtmltags('"Ça va" est une expression française et ceci une balise html', 1, 1, 1); + print dol_string_onlythesehtmltags($generatedContent, 1, 1, 1); + //print dol_string_nohtmltag($generatedContent); + } } elseif ($function == 'imagegeneration') { // TODO } elseif ($function == 'videogeneration') { diff --git a/htdocs/ai/class/ai.class.php b/htdocs/ai/class/ai.class.php index 64b82e98f4b..3905b62818f 100644 --- a/htdocs/ai/class/ai.class.php +++ b/htdocs/ai/class/ai.class.php @@ -54,11 +54,11 @@ class Ai */ private $apiEndpoint; - const AI_DEFAULT_PROMPT_FOR_EMAIL = 'You are an email editor. Return all HTML content inside a section tag. Do not add explanation.'; + const AI_DEFAULT_PROMPT_FOR_EMAIL = 'You are an email editor. Return only the content of the message. Do not add explanation.'; // Note: This instruction will also be completed by generateContent() to manage text versus HTML content. const AI_DEFAULT_PROMPT_FOR_WEBPAGE = 'You are a website editor. Return all HTML content inside a section tag. Do not add explanation.'; const AI_DEFAULT_PROMPT_FOR_TEXT_TRANSLATION = 'You are a translator, answer with one and only one translation with no comment and explanation.'; const AI_DEFAULT_PROMPT_FOR_TEXT_SUMMARIZE = 'You are a writer, make the answer in the same language than the original text to summarize.'; - const AI_DEFAULT_PROMPT_FOR_TEXT_REPHRASER = 'You are a writer, give only one answer with no comment and explanation and give the answer in the same language than the original text to rephrase.'; + const AI_DEFAULT_PROMPT_FOR_TEXT_REPHRASER = 'You are a writer, give only one answer with no comment and explanation and give the answer in the same language than the original text to rephrase. If there is carriage return or line feed in original message, keep them.'; const AI_DEFAULT_PROMPT_FOR_EXTRAFIELD_FILLER = 'Give only one answer with no comment and explanation, I want the text to be ready to copy and paste.'; const AI_DEFAULT_PROMPT_FOR_DOC_PARSING = 'You are an assistant to analyze documents. Return your answer with a JSON string and only a JSON string, do not add any other comment.'; const AI_DEFAULT_PROMPT_FOR_TEXT_SPELLCHECKER = 'You are the proofreader, please write your response in the same language as the original text in order to correct spelling and grammar errors.'; @@ -90,7 +90,7 @@ class Ai } /** - * Generate response of instructions + * Generate the response of an AI prompt. * * @param string|array $instructions String instruction to generate content (or file path) or array of payload or ID of file with function threads * @param string $model Model name ('gpt-4.1-turbo', 'gpt-4.1', 'dall-e-3', ...) @@ -147,6 +147,7 @@ class Ai $this->apiEndpoint .= '/'.$moreendpoint; } + // $model may be undefined or 'auto'. // If this is the case, we must get it from $function and $this->apiService if (empty($model) || $model == 'auto') { @@ -169,7 +170,19 @@ class Ai } } - dol_syslog("Call API for apiKey=".substr($this->apiKey, 0, 5).'***********, apiEndpoint='.$this->apiEndpoint.", model=".$model); + dol_syslog("Call API for apiKey=".substr($this->apiKey, 0, 5).'***********, apiEndpoint='.$this->apiEndpoint.", model=".$model.", format=".$format); + if (getDolGlobalString("AI_DEBUG")) { + if (@is_writable($dolibarr_main_data_root)) { // Avoid fatal error on fopen with open_basedir + $outputfile = $dolibarr_main_data_root."/dolibarr_ai.log"; + $fp = fopen($outputfile, "w"); // overwrite + + if ($fp) { + fwrite($fp, "Call API for apiKey=".substr($this->apiKey, 0, 5).'***********, apiEndpoint='.$this->apiEndpoint.", model=".$model.", format=".$format."\n"); + fclose($fp); + dolChmod($outputfile); + } + } + } $response = null; @@ -193,10 +206,16 @@ class Ai $postPrompt = $configurations[$function]['postPrompt']; } } + //var_dump($prePrompt); // Get the default value of prePrompt if not defined if (empty($prePrompt) && $function == 'textgenerationemail') { $prePrompt = self::AI_DEFAULT_PROMPT_FOR_EMAIL; + if ($format === 'html') { + $prePrompt .= ' Return all HTML content inside a section tag'; + } else { + $prePrompt .= ' Return content in UTF8 text. Use Linux carriage return if you need to split a line. Do not include any HTML tag neither HTML entities.'; + } } if (empty($prePrompt) && $function == 'textgenerationwebpage') { $prePrompt = self::AI_DEFAULT_PROMPT_FOR_WEBPAGE; @@ -289,7 +308,7 @@ class Ai if (getDolGlobalString("AI_DEBUG")) { if (@is_writable($dolibarr_main_data_root)) { // Avoid fatal error on fopen with open_basedir $outputfile = $dolibarr_main_data_root."/dolibarr_ai.log"; - $fp = fopen($outputfile, "w"); // overwrite + $fp = fopen($outputfile, "a"); if ($fp) { if ($function == 'docparsing') { diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 631ad64489a..3bf210a1acc 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -1102,6 +1102,7 @@ class FormMail extends Form $defaultmessage = preg_replace("/^\n+/", "", $defaultmessage); } + $out .= ''; $out .= ''; $out .= ''; } + $topic = ""; foreach ($formmail->lines_model as $line) { if (!empty($this->substit) && $this->param['models_id'] == $line->id) { @@ -1797,9 +1803,9 @@ class FormTicket } print ''; if (empty($topic)) { - print ''; @@ -1870,7 +1876,10 @@ class FormTicket $defaultmessage = preg_replace("/^\n+/", "", $defaultmessage); } - print ''; + print ''; + $out = ''; + print $out; + + print ''; print ''; // Title/Label of event @@ -2565,6 +2568,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = null, $nopr $label = $histo[$key]['note']; $actionstatic->id = $histo[$key]['id']; $out .= ' title="' . dol_escape_htmltag($label) . '">'; + $label = preg_replace('/^\[[^\[]*\]/', '[...]', $label); $out .= dol_trunc($label, 120); } if (isset($histo[$key]['type']) && $histo[$key]['type'] == 'mailing') { @@ -2573,7 +2577,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = null, $nopr $label .= ' - ' . $histo[$key]['note']; $out .= ''; - //$out .= img_object($langs->trans("EMailing").'
'.$histo[$key]['note'], "email").' '; + $label = preg_replace('/^\[[^\[]*\]/', '[...]', $label); $out .= dol_trunc($label, 120); $out .= '
'; } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index c47889994d4..9348efab129 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -16983,7 +16983,11 @@ function show_actions_messaging($conf, $langs, $db, $filterobj, $objcon = null, $libelle = ''; if (!empty($actionstatic->code) && preg_match('/^TICKET_MSG_PRIVATE/', $actionstatic->code)) { - $out .= $langs->trans('TicketNewMessage').' ('.$langs->trans('Private').')'; + $out .= $langs->trans('TicketNewMessage').' - '.img_picto($langs->trans('Private'), 'lock', 'class="valignmiddle"').' '.$langs->trans('Private').''; + $summary = preg_replace('/\[[^\]]*\]\s*/', '', $actionstatic->label); + //if ($summary != $object->title) { + $out .= ' - '.dolPrintHTML($summary); + //} } elseif (!empty($actionstatic->code) && preg_match('/^TICKET_MSG/', $actionstatic->code)) { $out .= $langs->trans('TicketNewMessage'); } elseif (isset($histo[$key]['type'])) { diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index ef33cee0fe9..7fab412a06a 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -9131,7 +9131,7 @@ table.jPicker { /* ============================================================================== */ .ai_dropdown { - min-width: 400px !important; + min-width: 500px !important; padding: 12px; left: inherit !important; top: inherit !important; diff --git a/htdocs/theme/eldy/timeline.inc.php b/htdocs/theme/eldy/timeline.inc.php index 3008284835b..e14cd8226b0 100644 --- a/htdocs/theme/eldy/timeline.inc.php +++ b/htdocs/theme/eldy/timeline.inc.php @@ -50,8 +50,8 @@ if (!defined('ISLOADEDBYSTEELSHEET')) { clear: both; } .timeline > li > .timeline-item { - box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); - border:1px solid #d2d2d2; + box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); + border: 1px solid #d2d2d2; border-radius: 3px; margin-top: 0; background: #fff; @@ -64,8 +64,10 @@ if (!defined('ISLOADEDBYSTEELSHEET')) { .timeline > li.timeline-code-ticket_msg_private > .timeline-item, .timeline > li.timeline-code-ticket_msg_private_sentbymail > .timeline-item { - background: #fffbe5; - border-color: #d0cfc0; + /*background: #fffbe5; */ + background-color: rgba(255, 251, 240, 0.5); + opacity: 0.9; + border-color: #d0cfc0; } diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 33e80cc587f..66d529060ea 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -8908,7 +8908,7 @@ table.jPicker { /* ============================================================================== */ .ai_dropdown { - min-width: 400px !important; + min-width: 500px !important; padding: 12px; left: inherit !important; top: inherit !important; diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index 6f30f4f26de..08a339b153a 100644 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -1566,16 +1566,16 @@ if ($action == 'create' || $action == 'presend') { // Substitution array $morehtmlright = ''; - $help = ""; + //$help = ""; $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, $arrayoffamiliestoexclude, $object); complete_substitutions_array($substitutionarray, $outputlangs, $object); - $morehtmlright .= $form->textwithpicto(''.$langs->trans("TicketMessageSubstitutionReplacedByGenericValues").'', $help, 1, 'helpclickable', '', 0, 3, 'helpsubstitution'); + //$morehtmlright .= $form->textwithpicto(''.$langs->trans("TicketMessageSubstitutionReplacedByGenericValues").'', $help, 1, 'helpclickable', '', 0, 3, 'helpsubstitution'); print '
'; print '
'; - print load_fiche_titre($langs->trans('TicketAddMessage'), $morehtmlright, 'messages@ticket'); + print load_fiche_titre($langs->trans('TicketAddMessage'), $morehtmlright, 'fa-comment-dots'); print '
'; From ca850421f093db68ee5e136901eda23ce6e131b8 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 20 Apr 2026 12:35:28 +0200 Subject: [PATCH 06/53] Qual: Fix phpstan notices (#37932) * Qual: Fix phpstan notices # Qual: Fix phpstan notices. - Fix ModeleBoxes::$info_box_contents typing; - Fix validate value to non-string (htdocs/asset/card.php) - Fix type for lines_model in FormMail * Qual: Fix get_tz_array() return typehint * Qual: Fix arguments types to mktime, dol_time --------- Co-authored-by: Laurent Destailleur --- htdocs/asset/card.php | 4 ++-- htdocs/core/boxes/modules_boxes.php | 7 +++---- htdocs/core/class/html.formmail.class.php | 2 +- htdocs/core/lib/date.lib.php | 4 ++-- htdocs/opensurvey/wizard/choix_date.php | 8 ++++---- 5 files changed, 12 insertions(+), 13 deletions(-) diff --git a/htdocs/asset/card.php b/htdocs/asset/card.php index 6d7c7b9ad60..626f315b22c 100644 --- a/htdocs/asset/card.php +++ b/htdocs/asset/card.php @@ -2,7 +2,7 @@ /* Copyright (C) 2017 Laurent Destailleur * Copyright (C) 2018-2025 Alexandre Spangaro * Copyright (C) 2024-2025 Frédéric France - * Copyright (C) 2025 MDW + * Copyright (C) 2025-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 @@ -198,7 +198,7 @@ if ($action == 'create') { print ''; } if (GETPOSTISSET('supplier_invoice_id')) { - $object->fields['supplier_invoice_id'] = array('type' => 'integer:FactureFournisseur:fourn/class/fournisseur.facture.class.php:1:entity IN (__SHARED_ENTITIES__)', 'label' => 'SupplierInvoice', 'enabled' => '1', 'noteditable' => 1, 'position' => 280, 'notnull' => 0, 'visible' => 1, 'index' => 1, 'validate' => '1',); + $object->fields['supplier_invoice_id'] = array('type' => 'integer:FactureFournisseur:fourn/class/fournisseur.facture.class.php:1:entity IN (__SHARED_ENTITIES__)', 'label' => 'SupplierInvoice', 'enabled' => '1', 'noteditable' => 1, 'position' => 280, 'notnull' => 0, 'visible' => 1, 'index' => 1, 'validate' => 1,); print ''; } diff --git a/htdocs/core/boxes/modules_boxes.php b/htdocs/core/boxes/modules_boxes.php index d7d85fbe8b6..dff0b0dc257 100644 --- a/htdocs/core/boxes/modules_boxes.php +++ b/htdocs/core/boxes/modules_boxes.php @@ -3,7 +3,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2014 Raphaël Doursenaud * Copyright (C) 2015-2025 Frédéric France - * Copyright (C) 2024 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 @@ -52,12 +52,12 @@ class ModeleBoxes // Can't be abstract as it is instantiated to build "empty" bo public $param; /** - * @var array,sublink?:string,subtext?:string,picto?:string,target?:string,td?:string}>|array{text:string,nbcol?:int,limit?:int,graph?:int<0,1>,sublink?:string,subtext?:string,picto?:string,target?:string,td?:string} box info heads. Example: array('text' => $langs->trans("BoxScheduledJobs", $max), 'nbcol' => 4); + * @var array,sublink?:string,subtext?:string,picto?:string,target?:string,td?:string}>|array{text:string,nbcol?:int,limit?:int,graph?:int<0,1>,sublink?:string,subtext?:string,picto?:string,target?:string,td?:string} box info heads. Example: array('text' =>->trans("BoxScheduledJobs",), 'nbcol' => 4); */ public $info_box_head = array(); /** - * @var array,maxlength?:int}>>|array,maxlength?:int}> box info content + * @var array,maxlength?:int}|array{td?:string,textnoformat:string,asis?:int<0,1>,maxlength?:int}>>|array,maxlength?:int}|array{td?:string,textnoformat:string,asis?:int<0,1>,maxlength?:int}> box info content */ public $info_box_contents = array(); @@ -487,7 +487,6 @@ class ModeleBoxes // Can't be abstract as it is instantiated to build "empty" bo * * @param ?string[] $forcedirwidget null=All default directories. This parameter is used by modulebuilder module only. * @return array Array list of widgets - * */ public static function getWidgetsList($forcedirwidget = null) { diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 80ab6189190..2bf8b35d575 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -266,7 +266,7 @@ class FormMail extends Form public $withtoccuser = array(); /** - * @var ModelMail[] + * @var CEmailTemplate[] */ public $lines_model; diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php index 34eff7dc3c4..9e5ef6f8596 100644 --- a/htdocs/core/lib/date.lib.php +++ b/htdocs/core/lib/date.lib.php @@ -4,7 +4,7 @@ * Copyright (C) 2011-2015 Juanjo Menent * Copyright (C) 2017 Ferran Marcet * Copyright (C) 2018-2024 Charlene Benke - * Copyright (C) 2024-2025 MDW + * Copyright (C) 2024-2026 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -31,7 +31,7 @@ /** * Return an array with timezone values * - * @return array,string> Array with timezone values + * @return array,string> Array with timezone values */ function get_tz_array() { diff --git a/htdocs/opensurvey/wizard/choix_date.php b/htdocs/opensurvey/wizard/choix_date.php index 2fb2ac4b67f..4bae05abb1a 100644 --- a/htdocs/opensurvey/wizard/choix_date.php +++ b/htdocs/opensurvey/wizard/choix_date.php @@ -427,7 +427,7 @@ if (issetAndNoEmpty('choixjourajout')) { $nbofchoice = count($_SESSION["totalchoixjour"]); for ($i = 0; $i < $nbofchoice; $i++) { $choixjourajout = GETPOST("choixjourajout"); - if ($_SESSION["totalchoixjour"][$i] == mktime(0, 0, 0, $_SESSION["mois"], $choixjourajout[0], $_SESSION["annee"])) { + if ($_SESSION["totalchoixjour"][$i] == mktime(0, 0, 0, $_SESSION["mois"], (int) $choixjourajout[0], $_SESSION["annee"])) { $journeuf = false; } } @@ -436,9 +436,9 @@ if (issetAndNoEmpty('choixjourajout')) { // If the validation is ok, add a field to the session variables that holds all the dates if ($journeuf && issetAndNoEmpty('choixjourajout') === true) { $choixjourajout = GETPOST("choixjourajout"); - array_push($_SESSION["totalchoixjour"], dol_mktime(0, 0, 0, $_SESSION["mois"], $choixjourajout[0], $_SESSION["annee"])); + array_push($_SESSION["totalchoixjour"], dol_mktime(0, 0, 0, $_SESSION["mois"], (int) $choixjourajout[0], $_SESSION["annee"])); sort($_SESSION["totalchoixjour"]); - $cle = array_search(dol_mktime(0, 0, 0, $_SESSION["mois"], $choixjourajout[0], $_SESSION["annee"]), $_SESSION["totalchoixjour"]); + $cle = array_search(dol_mktime(0, 0, 0, $_SESSION["mois"], (int) $choixjourajout[0], $_SESSION["annee"]), $_SESSION["totalchoixjour"]); //On sauvegarde les heures deja entrées for ($i = 0; $i < $cle; $i++) { @@ -479,7 +479,7 @@ if (issetAndNoEmpty('choixjourretrait')) { for ($i = 0; $i < $nbofchoice; $i++) { $choixjourretrait = GETPOST('choixjourretrait'); - if ($_SESSION["totalchoixjour"][$i] == mktime(0, 0, 0, $_SESSION["mois"], $choixjourretrait[0], $_SESSION["annee"])) { + if ($_SESSION["totalchoixjour"][$i] == mktime(0, 0, 0, $_SESSION["mois"], (int) $choixjourretrait[0], $_SESSION["annee"])) { for ($j = $i; $j < $nbofchoice; $j++) { $k = $j + 1; $_SESSION["horaires$j"] = $_SESSION["horaires$k"]; From 1743565a50c340ee612129c1abae0cbaa2e03a36 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 20 Apr 2026 12:36:21 +0200 Subject: [PATCH 07/53] Qual: Fix PHPStan notices (#37933) * Qual: Fix phpstan notice with cast * Qual: Fix initialiser (phpstan) and narrow some types * Qual: Fix typing for object->type field (phpstan) * Qual: Update preg_quote usage in step2.php # Qual: Ignore false phpstan positive for preg_match Add comment to ignore phpstan warning for preg_match argument * Qual: Extend accepted types for arrayoptions (phpstan) * Qual: Fix type hint typo * Qual: Fix type for contact_id assignment * Qual: Add menuonly as allowed reloadmode * Qual: Add PHPStan ignore comments for argument.type * Qual: Ignore unused parameter in constructors (PHPStan) * Qual: Add type hint for $TMsg (PHPStan) * Qual: Cast array values to match expected type (PHPStan) * Qual: Cast $remise_percent_ligne to float (PHPStan) * Qual: Add array specifier to GETPOST for correct type (PHPStan) * Qual: Update sumSituation() argument types * Qual: Cast value to string for printStdColumnContent (PHPStan) * Qual: Ignore PHPStan notice for autoload function return value * Qual: Fix type of argument to Menubase::recur (PHPStan) * Qual: Fix return type hint (PHPStan) * Qual: Add $dolibarr_main_db_type as default global * Qual: Update Phan baseline (due to PHPStan fix) --- dev/tools/phan/baseline.txt | 1 - dev/tools/phan/config.php | 3 +- .../accountancy/class/bookkeeping.class.php | 34 +++++++++++-------- htdocs/accountancy/closure/index.php | 6 ++-- htdocs/comm/action/card.php | 8 ++--- htdocs/core/actions_massactions.inc.php | 15 +++++--- htdocs/core/ajax/selectobject.php | 2 +- .../box_accountancy_last_manual_entries.php | 4 +-- .../box_accountancy_suspense_account.php | 4 +-- htdocs/core/boxes/box_actions.php | 4 +-- htdocs/core/boxes/box_actions_future.php | 4 +-- htdocs/core/boxes/box_activity.php | 4 +-- htdocs/core/boxes/box_birthdays.php | 4 +-- htdocs/core/boxes/box_birthdays_members.php | 4 +-- htdocs/core/boxes/box_boms.php | 4 +-- htdocs/core/boxes/box_bookmarks.php | 4 +-- htdocs/core/boxes/box_clients.php | 4 +-- htdocs/core/boxes/box_commandes.php | 4 +-- htdocs/core/boxes/box_comptes.php | 4 +-- htdocs/core/boxes/box_contacts.php | 4 +-- htdocs/core/boxes/box_contracts.php | 4 +-- ...box_customers_outstanding_bill_reached.php | 4 +-- .../core/boxes/box_dolibarr_state_board.php | 4 +-- htdocs/core/boxes/box_factures.php | 4 +-- htdocs/core/boxes/box_factures_fourn.php | 2 +- htdocs/core/boxes/box_factures_fourn_imp.php | 4 +-- htdocs/core/boxes/box_factures_imp.php | 4 +-- htdocs/core/boxes/box_ficheinter.php | 4 +-- htdocs/core/boxes/box_fournisseurs.php | 4 +-- .../core/boxes/box_funnel_of_prospection.php | 4 +-- htdocs/core/boxes/box_goodcustomers.php | 4 +-- .../boxes/box_graph_invoices_permonth.php | 4 +-- .../core/boxes/box_graph_invoices_peryear.php | 4 +-- .../box_graph_invoices_supplier_permonth.php | 4 +-- .../boxes/box_graph_nb_ticket_last_x_days.php | 4 +-- .../core/boxes/box_graph_nb_tickets_type.php | 4 +-- .../boxes/box_graph_new_vs_close_ticket.php | 4 +-- .../core/boxes/box_graph_orders_permonth.php | 4 +-- .../box_graph_orders_supplier_permonth.php | 4 +-- .../boxes/box_graph_product_distribution.php | 4 +-- .../boxes/box_graph_propales_permonth.php | 4 +-- .../boxes/box_graph_ticket_by_severity.php | 4 +-- .../core/boxes/box_last_knowledgerecord.php | 4 +-- .../box_last_modified_knowledgerecord.php | 4 +-- .../core/boxes/box_last_modified_ticket.php | 4 +-- htdocs/core/boxes/box_last_ticket.php | 4 +-- htdocs/core/boxes/box_lastlogin.php | 4 +-- htdocs/core/boxes/box_members_by_tags.php | 4 +-- htdocs/core/boxes/box_members_by_type.php | 4 +-- .../core/boxes/box_members_last_modified.php | 6 ++-- .../boxes/box_members_last_subscriptions.php | 4 +-- .../box_members_subscriptions_by_year.php | 4 +-- htdocs/core/boxes/box_mos.php | 4 +-- htdocs/core/boxes/box_produits.php | 2 +- .../core/boxes/box_produits_alerte_stock.php | 2 +- htdocs/core/boxes/box_project.php | 4 +-- .../core/boxes/box_project_opportunities.php | 4 +-- htdocs/core/boxes/box_propales.php | 4 +-- htdocs/core/boxes/box_prospect.php | 4 +-- htdocs/core/boxes/box_scheduled_jobs.php | 4 +-- htdocs/core/boxes/box_services_contracts.php | 2 +- htdocs/core/boxes/box_services_expired.php | 4 +-- htdocs/core/boxes/box_shipments.php | 4 +-- htdocs/core/boxes/box_supplier_orders.php | 4 +-- ...box_supplier_orders_awaiting_reception.php | 4 +-- htdocs/core/boxes/box_task.php | 4 +-- htdocs/core/boxes/box_validated_projects.php | 4 +-- htdocs/core/boxes/modules_boxes.php | 2 +- htdocs/core/class/doleditor.class.php | 4 +-- htdocs/core/class/menubase.class.php | 4 +-- htdocs/core/class/smtps.class.php | 6 ++-- htdocs/core/db/mysqli.class.php | 4 +-- htdocs/core/db/pgsql.class.php | 2 +- htdocs/core/db/sqlite3.class.php | 2 +- htdocs/core/lib/ajax.lib.php | 12 +++---- .../expedition/doc/pdf_espadon.modules.php | 4 +-- .../facture/doc/pdf_octopus.modules.php | 22 +++++++----- htdocs/dav/dav.class.php | 6 ++-- htdocs/debugbar/class/autoloader.php | 3 +- .../class/fournisseur.commande.class.php | 6 ++-- .../fourn/class/fournisseur.facture.class.php | 6 ++-- htdocs/fourn/facture/card.php | 24 ++++++------- htdocs/holiday/define_holiday.php | 8 ++--- htdocs/install/step2.php | 2 +- htdocs/install/upgrade2.php | 7 ++-- htdocs/public/payment/newpayment.php | 10 +++--- 86 files changed, 229 insertions(+), 208 deletions(-) diff --git a/dev/tools/phan/baseline.txt b/dev/tools/phan/baseline.txt index 40682345aa6..62f3427736b 100644 --- a/dev/tools/phan/baseline.txt +++ b/dev/tools/phan/baseline.txt @@ -89,7 +89,6 @@ return [ 'htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchDimFetch', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], 'htdocs/core/modules/delivery/mod_delivery_saphir.php' => ['PhanUndeclaredProperty'], 'htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php' => ['PhanTypeMismatchArgument'], - 'htdocs/core/modules/expedition/doc/pdf_espadon.modules.php' => ['PhanTypeMismatchArgument'], 'htdocs/core/modules/expensereport/doc/pdf_standard_expensereport.modules.php' => ['PhanUndeclaredProperty'], 'htdocs/core/modules/facture/doc/pdf_octopus.modules.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable', 'PhanUndeclaredProperty'], 'htdocs/core/modules/holiday/mod_holiday_immaculate.php' => ['PhanTypeMismatchArgument'], diff --git a/dev/tools/phan/config.php b/dev/tools/phan/config.php index 46d1d9335e9..0bc6b843033 100644 --- a/dev/tools/phan/config.php +++ b/dev/tools/phan/config.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2024-2026 MDW * Copyright (C) 2024-2025 Frédéric France * * This is the phan config file used by .github/workflows/phan.yml @@ -279,6 +279,7 @@ return [ 'dolibarr_main_db_encrypted_pass' => 'string', 'dolibarr_main_db_host' => 'string', 'dolibarr_main_db_pass' => 'string', + 'dolibarr_main_db_type' => '?string', 'dolibarr_main_demo' => 'string', 'dolibarr_main_document_root' => 'string', 'dolibarr_main_url_root' => 'string', diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index cd88e050ded..97382861d7a 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -3,7 +3,7 @@ * Copyright (C) 2015-2026 Alexandre Spangaro * Copyright (C) 2015-2020 Florian Henry * Copyright (C) 2018-2025 Frédéric France - * Copyright (C) 2024-2025 MDW + * Copyright (C) 2024-2026 MDW * Copyright (C) 2024 Jose MARTINEZ * Copyright (C) 2025 Nicolas Barrouillet * @@ -2947,7 +2947,7 @@ class BookKeeping extends CommonObject $income_statement_amount = 0; if (getDolGlobalString('ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_INCOME_STATEMENT')) { - $accounting_groups_used_for_income_statement = array_filter(array_map('trim', explode(',', getDolGlobalString('ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_INCOME_STATEMENT'))), 'strlen'); + $accounting_groups_used_for_income_statement = array_filter(array_map('trim', explode(',', getDolGlobalString('ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_INCOME_STATEMENT'))), 'strlen'); // @phpstan-ignore argument.type $pcg_type_filter = array(); foreach ($accounting_groups_used_for_income_statement as $item) { @@ -3073,8 +3073,8 @@ class BookKeeping extends CommonObject } if (!$error && is_object($journal)) { - $accounting_groups_used_for_balance_sheet_account = array_filter(array_map('trim', explode(',', getDolGlobalString('ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_BALANCE_SHEET_ACCOUNT'))), 'strlen'); - $accounting_groups_used_for_income_statement = array_filter(array_map('trim', explode(',', getDolGlobalString('ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_INCOME_STATEMENT'))), 'strlen'); + $accounting_groups_used_for_balance_sheet_account = array_filter(array_map('trim', explode(',', getDolGlobalString('ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_BALANCE_SHEET_ACCOUNT'))), 'strlen'); // @phpstan-ignore argument.type + $accounting_groups_used_for_income_statement = array_filter(array_map('trim', explode(',', getDolGlobalString('ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_INCOME_STATEMENT'))), 'strlen'); // @phpstan-ignore argument.type $pcg_type_filter = array(); $tmp = array_merge($accounting_groups_used_for_balance_sheet_account, $accounting_groups_used_for_income_statement); @@ -3217,8 +3217,8 @@ class BookKeeping extends CommonObject $bookkeeping->subledger_label = null; } else { */ - $bookkeeping->subledger_account = null; - $bookkeeping->subledger_label = null; + $bookkeeping->subledger_account = null; + $bookkeeping->subledger_label = null; //} $bookkeeping->numero_compte = $accountingaccount->account_number; @@ -3422,16 +3422,20 @@ class BookKeeping extends CommonObject $echecT = []; foreach ($toselect as $id) { if ($bookkeeping->fetch($id)) { - if ( !getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER')) { + if (!getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER')) { $accountcustcode = '411'; - } else $accountcustcode = getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER'); + } else { + $accountcustcode = getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER'); + } - if ( !getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER')) { + if (!getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER')) { $accountsuppcode = '401'; - } else $accountsuppcode = getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER'); + } else { + $accountsuppcode = getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER'); + } if (strpos($bookkeeping->numero_compte, $accountcustcode) === 0 || strpos($bookkeeping->numero_compte, $accountsuppcode) === 0) { - $echecT[]=$bookkeeping->numero_compte; + $echecT[] = $bookkeeping->numero_compte; continue; } @@ -3468,7 +3472,10 @@ class BookKeeping extends CommonObject if (!empty($echecImplode)) { $nbEchec = count(explode(',', $echecImplode)); - setEventMessages($nbEchec == 1 ? $langs->trans('NoAccountChangedWithAccountNumber') . ' ' . $echecImplode : $langs->trans('NoAccountsChangedWithAccountNumber') . ' ' . $echecImplode, null, 'errors' + setEventMessages( + $nbEchec == 1 ? $langs->trans('NoAccountChangedWithAccountNumber') . ' ' . $echecImplode : $langs->trans('NoAccountsChangedWithAccountNumber') . ' ' . $echecImplode, + null, + 'errors' ); } @@ -3731,7 +3738,6 @@ class BookKeeping extends CommonObject * @param string $code_journal Accounting journal code * @param int $docdate Date of the document * @return int int Return integer -1 if KO, 1 if OK - * */ public function newReturnAccount(array $toselect, $code_journal, $docdate) { @@ -3753,7 +3759,7 @@ class BookKeeping extends CommonObject $alreadyExtourneT = array(); if ($resqlAlreadyExtourne) { while ($obj4 = $this->db->fetch_object($resqlAlreadyExtourne)) { - $alreadyExtourneT []= $obj4->piece_num; + $alreadyExtourneT [] = $obj4->piece_num; } } diff --git a/htdocs/accountancy/closure/index.php b/htdocs/accountancy/closure/index.php index 8b8e64cf625..e56a49e9138 100644 --- a/htdocs/accountancy/closure/index.php +++ b/htdocs/accountancy/closure/index.php @@ -2,7 +2,7 @@ /* Copyright (C) 2019-2023 Open-DSI * Copyright (C) 2024 Frédéric France * Copyright (C) 2025-2026 Alexandre Spangaro - * Copyright (C) 2025 MDW + * Copyright (C) 2025-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 @@ -122,8 +122,8 @@ if (empty($current_fiscal_period) && !empty($first_active_fiscal_period)) { } } -$accounting_groups_used_for_balance_sheet_account = array_filter(array_map('trim', explode(',', getDolGlobalString('ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_BALANCE_SHEET_ACCOUNT'))), 'strlen'); -$accounting_groups_used_for_income_statement = array_filter(array_map('trim', explode(',', getDolGlobalString('ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_INCOME_STATEMENT'))), 'strlen'); +$accounting_groups_used_for_balance_sheet_account = array_filter(array_map('trim', explode(',', getDolGlobalString('ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_BALANCE_SHEET_ACCOUNT'))), 'strlen'); // @phpstan-ignore argument.type +$accounting_groups_used_for_income_statement = array_filter(array_map('trim', explode(',', getDolGlobalString('ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_INCOME_STATEMENT'))), 'strlen'); // @phpstan-ignore argument.type /* diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index ab35d5e3aa0..9aa1f963be8 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -9,7 +9,7 @@ * Copyright (C) 2015 Alexandre Spangaro * Copyright (C) 2018-2026 Frédéric France * Copyright (C) 2019 Ferran Marcet - * 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 @@ -332,7 +332,7 @@ if (empty($reshook) && $action == 'confirm_clone' && $confirm == 'yes' && $userc //$object->fetch($id); if (!empty($object->socpeopleassigned)) { reset($object->socpeopleassigned); - $object->contact_id = key($object->socpeopleassigned); + $object->contact_id = (int) key($object->socpeopleassigned); } $result = $object->createFromClone($user, GETPOSTINT('socid')); if ($result > 0) { @@ -980,7 +980,7 @@ if (empty($reshook) && $action == 'update' && $usercancreate) { $object->contact_id = GETPOSTINT("contactid"); if (empty($object->contact_id) && !empty($object->socpeopleassigned)) { reset($object->socpeopleassigned); - $object->contact_id = key($object->socpeopleassigned); + $object->contact_id = (int) key($object->socpeopleassigned); } $object->fk_project = GETPOSTINT("projectid"); $taskid = GETPOSTINT('taskid'); @@ -1583,7 +1583,7 @@ if ($action == 'create') { */ // limit date - $repeateventlimitdate = empty($repeateventlimitdate) ? (dol_now() + ((24 * 3600 * 365) + 1)) : $repeateventlimitdate; + $repeateventlimitdate = empty($repeateventlimitdate) ? (dol_now() + ((24 * 3600 * 365) + 1)) : $repeateventlimitdate; print '
'; $out .= $form->textwithpicto($langs->trans('MailText'), $helpforsubstitution, 1, 'help', '', 0, 2, 'substittooltipfrombody'); diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index 1b32a9e08df..a342022f51e 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -1569,11 +1569,13 @@ class FormTicket jQuery("#send_msg_email").prop("checked", true).trigger("change"); } jQuery(".email_line").show(); + jQuery(".not_email_line").hide(); } else { if (!jQuery("#private_message").is(":checked")) { jQuery("#private_message").prop("checked", true).trigger("change"); } jQuery(".email_line").hide(); + jQuery(".not_email_line").show(); } '; @@ -1586,9 +1588,11 @@ class FormTicket jQuery("#private_message").prop("checked", false).trigger("change"); } jQuery(".email_line").show(); + jQuery(".not_email_line").hide(); } else { jQuery(".email_line").hide(); + jQuery(".not_email_line").show(); } }); @@ -1599,6 +1603,7 @@ class FormTicket jQuery("#send_msg_email").prop("checked", false).trigger("change"); } jQuery(".email_line").hide(); + jQuery(".not_email_line").show(); } });'; } @@ -1778,7 +1783,7 @@ class FormTicket // Summary if ($this->withtitletopic) { - print '
'; + print '
'; // Answer to a ticket : display of the thread title in readonly if ($this->withtopicreadonly && $this->topic_title) { print $langs->trans('Summary').' '.$this->topic_title; @@ -1788,6 +1793,7 @@ class FormTicket } print '
'; + + $out .= '
'; + + // Required to show editor assistants + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; + $formmail = new FormMail($this->db); + + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formai.class.php'; + $formai = new FormAI($this->db); + + $formmail->withfckeditor = $ckeditorenabledforticket ? 1 : 0; + $formmail->withlayout = $ckeditorenabledforticket ? 1 : 0; + $formmail->withaiprompt = 'text'; + $formai = new FormAI($this->db); + + $showlinktolayout = ($formmail->withfckeditor && getDolGlobalInt('MAIN_EMAIL_USE_LAYOUT')) ? $formmail->withlayout : ''; + $showlinktolayoutlabel = $langs->trans("FillMessageWithALayout"); + $showlinktoai = ($formmail->withaiprompt && isModEnabled('ai')) ? 'textgenerationemail' : ''; + $showlinktoailabel = $langs->trans("AIEnhancements"); + $formatforouput = ''; + $htmlname = 'message'; + + $formai->substit = $this->substit; + $formai->substit_lines = $this->substit_lines; + + // Fill $out + $db = $this->db; + include DOL_DOCUMENT_ROOT.'/core/tpl/formlayoutai.tpl.php'; + + $out .= '
'; @@ -1896,7 +1939,6 @@ class FormTicket $toolbarname = 'dolibarr_notes'; include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $uselocalbrowser = false; - $ckeditorenabledforticket = (getDolGlobalString('FCKEDITOR_ENABLE_TICKET') >= 2); // 0=no, 1=from backoffice only, 2=from backoffice+public (very dangerous) if (!$ckeditorenabledforticket) { $defaultmessage = dol_string_nohtmltag($defaultmessage, 2); } diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 90dbff4a865..40102d9ef02 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -2555,6 +2555,9 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = null, $nopr // Example $actionstatic->code = AC_COMPANY_MODIFY and $actionstatic->type_code = AC_OTH_AUTO $out .= $actionstatic->getTypePicto(); $out .= $labelOfTypeToShow; + if (preg_match('/PRIVATE/', $actionstatic->code)) { + $out .= ' ' . img_picto($langs->trans("Private"), 'lock', 'class="valignmiddle"'); + } $out .= '
'; print ''; print ''; +print ''; +if (getDolGlobalInt('ACCOUNTING_DEFAULT_NOT_EXPORT_LETTERING')) { + print ''; +} else { + print ''; +} +print ''; + +print ''; +print ''; +if (getDolGlobalInt('ACCOUNTING_DEFAULT_NOT_NOTIFIED_EXPORT_DATE')) { + print ''; +} else { + print ''; +} +print ''; + +print ''; +print ''; +if (getDolGlobalInt('ACCOUNTING_DEFAULT_NOTIFIED_VALIDATION_DATE')) { + print ''; +} else { + print ''; +} +print ''; + +print ''; +print ''; +if (getDolGlobalInt('ACCOUNTING_DEFAULT_NOTIFIED_EXPORTFULL')) { + print ''; +} else { + print ''; +} +print ''; + +print "
'; - print ''; From c97415a3a9c0f40e71fedd1dba82f221443a2bec Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 20 Apr 2026 16:40:10 +0200 Subject: [PATCH 16/53] CI --- htdocs/api/class/api_login.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/api/class/api_login.class.php b/htdocs/api/class/api_login.class.php index c4e87367afb..fe6beac22d5 100644 --- a/htdocs/api/class/api_login.class.php +++ b/htdocs/api/class/api_login.class.php @@ -41,7 +41,7 @@ class Login global $db; $this->db = $db; - if (getDolGlobalString('API_ENABLE_LOGIN_API')) { + if (!getDolGlobalString('API_ENABLE_LOGIN_API')) { throw new RestException(403, "Error: The login APIs are disabled. It is recommended to call the APIs using the DOLAPIKEY token of an allowed user instead of the login/password. API key can be set from the user card. If you really need to get the API token from the login API, you can set the constant API_ENABLE_LOGIN_API."); } } From ee3bcd80007a0f222077f625c32693a149039ef0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 20 Apr 2026 16:47:53 +0200 Subject: [PATCH 17/53] css --- htdocs/website/index.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 2fed0db1c0d..e838146800e 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -4162,7 +4162,7 @@ if ($action == 'editcss') { $head = websiteconfigPrepareHead($object); print dol_get_fiche_head($head, 'general', $langs->trans("General"), 0, 'website'); - print ''."\n"; + print ''."\n"; print '
'; + print '
'; print $langs->trans('TicketProperties'); if (GETPOST('set', 'alpha') != 'properties' && isset($object->status) && ($object->status < $object::STATUS_NEED_MORE_INFO || !getDolGlobalInt('TICKET_DISALLOW_CLASSIFICATION_MODIFICATION_EVEN_IF_CLOSED')) && $permissiontoadd) { - print ''.img_edit($langs->trans('Modify')).''; + print ''.img_edit($langs->trans('Modify')).''; } print '
'; print '
'; // Website @@ -4189,7 +4189,7 @@ if ($action == 'editcss') { $htmltext = ''; print $form->textwithpicto($langs->trans('MainLanguage'), $htmltext, 1, 'help', '', 0, 2, 'WEBSITE_LANG'); print ''; print ''; @@ -4199,7 +4199,7 @@ if ($action == 'editcss') { $htmltext = $langs->trans("Example").': fr,de,sv,it,pt'; print $form->textwithpicto($langs->trans('OtherLanguages'), $htmltext, 1, 'help', '', 0, 2); print ''; print ''; From e88d452eaf3da65867f630b56abd21e363b9f650 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 20 Apr 2026 16:51:32 +0200 Subject: [PATCH 18/53] Doc --- htdocs/core/website.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/website.inc.php b/htdocs/core/website.inc.php index 0097cb3a88c..502ad5968d7 100644 --- a/htdocs/core/website.inc.php +++ b/htdocs/core/website.inc.php @@ -314,7 +314,7 @@ if (!empty($dolibarr_website_allow_custom_php) && $dolibarr_website_allow_custom if (function_exists($systemfunction)) { print '


'; - print 'Website features are protected to be disabled if the PHP system functions ('.implode(',', $systemfunctions).') are not disabled for the website context.
'; + print 'Website features are DISABLED if the PHP system functions ('.implode(',', $systemfunctions).') are NOT disabled for the website context.
'; print 'The value "'.$systemfunction.'" has NOT been found into the current disable_functions=
'; print ''; - print '

'; - print 'You can fix this by changing setup of your PHP ini (changing this in a virtual host with php_admin_value is not effective):
'; - print 'disable_functions="exec,passthru,shell_exec,system,popen,proc_open,..."
'; - print 'but WARNING, this may also break features for:
'; - print '- cron tasks calling command line tools.
'; - print '- and for the backup feature running the database dump tool.
'; - print '- and for the command line antivirus check ran when uploading a file.
'; - print '
'; - print 'If you don\'t use this 3 feature, change your php.ini, if you need at least one, you can bypass this protection by setting $dolibarr_website_allow_custom_php to 2 in your dolibarr config file.'; - print '
'; - exit; // Stop here to PHP later won't be executed - } +$notdisabledsystemfunction = ''; +$systemfunctions = array("exec", "passthru", "shell_exec", "system", "popen", "proc_open"); +foreach ($systemfunctions as $systemfunction) { + // @phpstan-ignore-next-line + if (function_exists($systemfunction)) { + $notdisabledsystemfunction .= ($notdisabledsystemfunction ? ', ' : '').$systemfunction; } } +if (empty($dolibarr_website_allow_custom_php) || ($dolibarr_website_allow_custom_php == 1 && $notdisabledsystemfunction)) { + print '


'; + print 'Website features are protected to be disabled if the PHP system functions ('.implode(',', $systemfunctions).') are not disabled for the website context.
'; + print 'The value "'.$notdisabledsystemfunction.'" has NOT been found into the php parameter current disable_functions '; + //print ''; + + print '

'; + print 'You can fix this by changing setup of your PHP ini (changing this in a virtual host with php_admin_value is not effective):
'; + print 'disable_functions="exec,passthru,shell_exec,system,popen,proc_open,..."
'; + print 'but WARNING, this will break this 3 features for:
'; + print '- 1) Cron tasks calling command line tools.
'; + print '- 2) Internal backup feature running the database dump tool.
'; + print '- 3) Command line antivirus check ran when uploading a file.
'; + print '
'; + print 'If you don\'t use this 3 feature, you can change your php.ini to exclude the exec functions.
If you need at least one, you can bypass this protection by setting $dolibarr_website_allow_custom_php to 2 in your dolibarr config file (Add RCE protection like AppArmor or SELinux in this case).'; + print '
'; + exit; // Stop here to PHP later won't be executed +} + $_COOKIE[$sessionname] = 'obfuscatedcookie'; unset($conf->file->instance_unique_id); diff --git a/htdocs/langs/en_US/website.lang b/htdocs/langs/en_US/website.lang index aee39fbb539..ae49a3be9b2 100644 --- a/htdocs/langs/en_US/website.lang +++ b/htdocs/langs/en_US/website.lang @@ -506,3 +506,5 @@ WebPortalSharedDocsDirHelp=Enter the name of the directory, located in the ECM/G DateM=Modification Date ThisDirectoryIsEmpty=This directory is empty WrittenBy=Written by %s +ImportOfWebsiteTemplateIncludingPHPIsAllowedIf=Import of website templates using dynamic content in PHP is allowed only if $dolibarr_website_allow_custom_php is set to 2 in conf.php. +ImportOfWebsiteTemplateIncludingPHPIsDisabled=Import of website templates using dynamic content in PHP need to have $dolibarr_website_allow_custom_php set to 1 or 2 in conf.php to be allowed. From f3c2eeeb3b0f4620673a0f192336ab7f0c62b3e8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 20 Apr 2026 18:22:41 +0200 Subject: [PATCH 20/53] Try to fix CI --- test/phpunit/AbstractRestAPITest.php | 2 -- test/phpunit/AllTests.php | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/phpunit/AbstractRestAPITest.php b/test/phpunit/AbstractRestAPITest.php index 9e0fcd9d158..923ebb671ba 100644 --- a/test/phpunit/AbstractRestAPITest.php +++ b/test/phpunit/AbstractRestAPITest.php @@ -81,8 +81,6 @@ abstract class AbstractRestAPITest extends CommonClassTest $langs = $this->savlangs; $db = $this->savdb; - dolibarr_set_const($db, 'API_ENABLE_LOGIN_API', 1); - $this->api_url = DOL_MAIN_URL_ROOT.'/api/index.php'; $addheaders = array('Content-Type: application/json', 'Accept: application/json'); diff --git a/test/phpunit/AllTests.php b/test/phpunit/AllTests.php index 2c1c30bd9b5..f8e050c19c3 100644 --- a/test/phpunit/AllTests.php +++ b/test/phpunit/AllTests.php @@ -68,6 +68,8 @@ if (empty($user->id)) { $conf->global->MAIN_DISABLE_ALL_MAILS = 1; $conf->global->MAIN_UMASK = '666'; +dolibarr_set_const($db, 'API_ENABLE_LOGIN_API', 1); + /** * Class for the All test suite From 21d3e3ff992c72d843be72b466cc056923f1dc99 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 20 Apr 2026 18:39:37 +0200 Subject: [PATCH 21/53] Fix travis --- test/phpunit/AllTests.php | 1 + 1 file changed, 1 insertion(+) diff --git a/test/phpunit/AllTests.php b/test/phpunit/AllTests.php index f8e050c19c3..bc82ba761c2 100644 --- a/test/phpunit/AllTests.php +++ b/test/phpunit/AllTests.php @@ -68,6 +68,7 @@ if (empty($user->id)) { $conf->global->MAIN_DISABLE_ALL_MAILS = 1; $conf->global->MAIN_UMASK = '666'; +require_once dirname(__FILE__).'/../../htdocs/core/lib/admin.lib.php'; dolibarr_set_const($db, 'API_ENABLE_LOGIN_API', 1); From 36b940974ad946329762f341560921d9d0d9239a Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 20 Apr 2026 18:39:58 +0200 Subject: [PATCH 22/53] Qual: Fix CI (PHPStan) (#37945) * Qual: Fix CI (PHPStan) # Qual: Fix CI (PHPStan) Fix two PHPStan messages * Update html.formticket.class.php --------- Co-authored-by: Laurent Destailleur --- htdocs/core/class/html.formticket.class.php | 4 ++-- htdocs/core/lib/ajax.lib.php | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index 7bb82fd6b78..4b05e87ba90 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -1911,12 +1911,12 @@ class FormTicket $formmail->withfckeditor = $ckeditorenabledforticket ? 1 : 0; $formmail->withlayout = $ckeditorenabledforticket ? 'email' : ''; - $formmail->withaiprompt = 'text'; + $formmail->withaiprompt = isModEnabled('ai') ? 'text' : ''; $formai = new FormAI($this->db); $showlinktolayout = ($formmail->withfckeditor && getDolGlobalInt('MAIN_EMAIL_USE_LAYOUT')) ? $formmail->withlayout : ''; $showlinktolayoutlabel = $langs->trans("FillMessageWithALayout"); - $showlinktoai = ($formmail->withaiprompt && isModEnabled('ai')) ? 'textgenerationemail' : ''; + $showlinktoai = ($formmail->withaiprompt ? 'textgenerationemail' : ''); $showlinktoailabel = $langs->trans("AIEnhancements"); $formatforouput = ''; $htmlname = 'message'; diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index ab3369a06eb..5b4b8cd17c6 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -37,12 +37,12 @@ * @param string $urloption More parameters on URL request * @param int $minLength Minimum number of chars to trigger that Ajax search * @param int $autoselect Automatic selection if just one value (trigger("change") on field is done if search return only 1 result) - * @param array> $ajaxoptions Multiple options array - * - Ex: array('update'=>array('field1','field2'...)) will reset field1 and field2 once select done - * - Ex: array('disabled'=> ) - * - Ex: array('show'=> ) - * - Ex: array('update_textarea'=> ) - * - Ex: array('option_disabled'=> id to disable and warning to show if we select a disabled value (this is possible when using autocomplete ajax) + * @param array>> $ajaxoptions Multiple options array + * - Ex: array('update'=>array('field1','field2'...)) will reset field1 and field2 once select done + * - Ex: array('disabled'=> ) + * - Ex: array('show'=> ) + * - Ex: array('update_textarea'=> ) + * - Ex: array('option_disabled'=> id to disable and warning to show if we select a disabled value (this is possible when using autocomplete ajax) * @param string $moreparams More params provided to ajax call * @return string Script */ From 3098031a970d695e2495d408ad13e6c474cce079 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 20 Apr 2026 18:45:09 +0200 Subject: [PATCH 23/53] Fix ci --- htdocs/core/db/mysqli.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index aad36e3ee25..874f9437067 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -146,7 +146,7 @@ class DoliDBMysqli extends DoliDB exit; } - $collation = (empty($conf) ? 'utf8_unicode_ci' : $conf->db->dolibarr_main_db_collation); + $collation = (empty($conf) ? 'utf8_unicode_ci' : (string) $conf->db->dolibarr_main_db_collation); if (preg_match('/latin1/', $collation)) { $collation = 'utf8_unicode_ci'; } @@ -179,7 +179,7 @@ class DoliDBMysqli extends DoliDB if (empty($disableforcecharset) && $this->db->character_set_name() != $clientmustbe) { $this->db->set_charset($clientmustbe); // This set utf8_unicode_ci - $collation = $conf->db->dolibarr_main_db_collation; + $collation = (string) $conf->db->dolibarr_main_db_collation; if (preg_match('/latin1/', $collation)) { $collation = 'utf8_unicode_ci'; } From b15add41f8bd0971f28b46908c6f313fd6a2ba1d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 20 Apr 2026 18:50:14 +0200 Subject: [PATCH 24/53] Clean CI file not used --- .github/workflows/README.md | 10 ++--- .github/workflows/ci-pr-devcamp.yaml.disabled | 45 ------------------- 2 files changed, 5 insertions(+), 50 deletions(-) delete mode 100644 .github/workflows/ci-pr-devcamp.yaml.disabled diff --git a/.github/workflows/README.md b/.github/workflows/README.md index abb6782f778..bb4ee919364 100644 --- a/.github/workflows/README.md +++ b/.github/workflows/README.md @@ -12,7 +12,7 @@ This run the actions: - phan.yml - phpstan.yml When all succeed, start: -- Windows-ci; +- windows-ci.yml See https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#running-a-workflow-based-on-the-conclusion-of-another-workflow @@ -21,13 +21,13 @@ The other worklows are: ----------------------- - ci-stale-issues-safe to autoclose old issues. -- ci-phpstan_baseline to update the phpstan baseline file. -- ci-cache-clean-pr to clean cache when closing a PR. -- ci-test to make CI tests +- ci-phpstan_baseline to update the phpstan baseline file. +- ci-cache-clean-pr to clean cache when closing a PR. +- ci-test to make CI tests +- ci-checkfiltesetlock to check we do not modify a file that is locked by a signature in dev/lockedfiles.txt Some tests workflows are: ------------------------ - pr-18 -- pr-18-autolbal - test diff --git a/.github/workflows/ci-pr-devcamp.yaml.disabled b/.github/workflows/ci-pr-devcamp.yaml.disabled deleted file mode 100644 index 375974b43cd..00000000000 --- a/.github/workflows/ci-pr-devcamp.yaml.disabled +++ /dev/null @@ -1,45 +0,0 @@ -# Action to prepare the github action -# Go on Dolibarr Organization - Settings - Developer settings - GitHub App (https://github.com/organizations/Dolibarr/settings/apps) -# Create an App: Enter a name + In Home page URL use https://github.com/Dolibarr/dolibarr + Disable webhook -# Set Permissions (see other app for list of permissions) -# Click on generate the private keys -# Click on Install application - choose the repository of the bot -# Go on Organisation - Secret and variables and create a secret PR_SECRET_KEY and copy the content of received private key. Choose the repository access to "Repository Dolibarr". -# Go on Organisation - Secret and variables and create a variable PR_APP_ID and copy the ID of the previously create ID. Choose the repository access to "Repository Dolibarr". -# - -name: Set the tag with devcamp label during the session of a devcamp -on: - pull_request_target: - types: [opened] - - -permissions: - pull-requests: write - issues: write - -jobs: - add-label-devcamp: - runs-on: ubuntu-latest - - steps: - #- name: Install GitHub CLI - # run: sudo apt-get install gh - - - name: Generate a token - id: generate-token - uses: actions/create-github-app-token@v2 - with: - app-id: ${{ vars.PR_APP_ID }} - private-key: ${{ secrets.PR_SECRET_KEY }} - - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Assign label - env: - GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }} - url: ${{ github.event.pull_request.html_url }} - run: | - echo "env.url=${{env.url}}" - gh pr edit "${{env.url}}" --add-label "Event: DevCamp 2025 XXX" From a26acf725132a98582e01ffdf04d9665e36d44f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 20 Apr 2026 20:42:02 +0200 Subject: [PATCH 25/53] clean code (#37921) * clean code * fix * fix * fix * fix --------- Co-authored-by: Laurent Destailleur --- htdocs/core/lib/admin.lib.php | 7 +--- htdocs/main.inc.php | 5 ++- htdocs/master.inc.php | 9 ++++- htdocs/quickmemo/admin/memo_extrafields.php | 4 +- htdocs/quickmemo/memo_list.php | 42 +-------------------- 5 files changed, 16 insertions(+), 51 deletions(-) diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php index 068a68404ea..6a0c7186cba 100644 --- a/htdocs/core/lib/admin.lib.php +++ b/htdocs/core/lib/admin.lib.php @@ -219,19 +219,14 @@ function run_sql($sqlfile, $silent = 1, $entity = 0, $usesavepoint = 1, $handler if (!empty($reg[2])) { if (is_numeric($reg[2])) { // This is a version $versionrequest = explode('.', $reg[2]); - //var_dump($versionrequest); - //var_dump($versionarray); if (!count($versionrequest) || !count($versionarray) || versioncompare($versionrequest, $versionarray) > 0) { $qualified = 0; } } else { // This is a test on a constant. For example when we have -- VMYSQLUTF8UNICODE, we test constant $conf->global->UTF8UNICODE $dbcollation = strtoupper(preg_replace('/_/', '', $conf->db->dolibarr_main_db_collation)); - //var_dump($reg[2]); - //var_dump($dbcollation); if (empty($conf->db->dolibarr_main_db_collation) || ($reg[2] != $dbcollation)) { $qualified = 0; } - //var_dump($qualified); } } } @@ -239,7 +234,7 @@ function run_sql($sqlfile, $silent = 1, $entity = 0, $usesavepoint = 1, $handler if ($qualified) { // Version qualified, delete SQL comments $buf = preg_replace('/^--\sV(MYSQL|PGSQL)([^\s]*)/i', '', $buf); - //print "Ligne $i qualifi?e par version: ".$buf.'
'; + //print "Line $i qualified by version: ".$buf.'
'; } } diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 809aff66916..e1fdcd3a557 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -13,7 +13,7 @@ * Copyright (C) 2015 Raphaël Doursenaud * Copyright (C) 2020 Demarest Maxime * Copyright (C) 2020-2024 Charlene Benke - * Copyright (C) 2021-2025 Frédéric France + * Copyright (C) 2021-2026 Frédéric France * Copyright (C) 2021 Alexandre Spangaro * Copyright (C) 2023 Joachim Küter * Copyright (C) 2023 Eric Seigne @@ -146,12 +146,13 @@ if (!defined('NOSESSION')) { } -// Init the 6 global objects, this include will make the 'new Xxx()' and set properties for: $conf, $db, $langs, $user, $mysoc, $hookmanager +// Init the 7 global objects, this include will make the 'new Xxx()' and set properties for: $conf, $db, $langs, $user, $mysoc, $hookmanager, $extrafields require_once 'master.inc.php'; /** * The master.inc.php has been included so the following variable are now defined: * @var Conf $conf * @var ?DoliDB $db May be null if NOREQUIREDB is defined + * @var ?ExtraFields $extrafields May be null if NOREQUIREDB is defined * @var ?HookManager $hookmanager May be null if NOHOOKMANAGER is defined * @var ?Translate $langs May be null if NOREQUIRETRAN is defined * @var ?User $user May be null if NOREQUIREUSER is defined diff --git a/htdocs/master.inc.php b/htdocs/master.inc.php index 222538416be..80ad932eac6 100644 --- a/htdocs/master.inc.php +++ b/htdocs/master.inc.php @@ -11,7 +11,7 @@ * Copyright (C) 2011 Philippe Grand * Copyright (C) 2014 Teddy Andreotti <125155@supinfo.com> * Copyright (C) 2024-2025 MDW - * Copyright (C) 2025 Frédéric France + * Copyright (C) 2025-2026 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 @@ -272,6 +272,13 @@ if (!defined('NOREQUIREUSER')) { if (!defined('NOHOOKMANAGER')) { $hookmanager = new HookManager($db); } +/* + * Create $extrafields object + */ +if ($db !== null) { + require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php'; + $extrafields = new ExtraFields($db); +} /* diff --git a/htdocs/quickmemo/admin/memo_extrafields.php b/htdocs/quickmemo/admin/memo_extrafields.php index 6fd8da713e3..fe7b14f838e 100644 --- a/htdocs/quickmemo/admin/memo_extrafields.php +++ b/htdocs/quickmemo/admin/memo_extrafields.php @@ -5,7 +5,7 @@ * Copyright (C) 2012 Regis Houssin * Copyright (C) 2014 Florian Henry * Copyright (C) 2015 Jean-François Ferry - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2026 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,6 +33,7 @@ require '../../main.inc.php'; /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user @@ -43,7 +44,6 @@ require_once '../lib/quickmemo.lib.php'; // Load translation files required by the page $langs->loadLangs(array('quickmemo', 'admin')); -$extrafields = new ExtraFields($db); $form = new Form($db); // List of supported format diff --git a/htdocs/quickmemo/memo_list.php b/htdocs/quickmemo/memo_list.php index 648dd3de952..054cab562cb 100644 --- a/htdocs/quickmemo/memo_list.php +++ b/htdocs/quickmemo/memo_list.php @@ -1,6 +1,6 @@ - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2026 Frédéric France * Copyright (C) 2026 John BOTELLA * * This program is free software; you can redistribute it and/or modify @@ -23,34 +23,13 @@ * \brief List page for memo */ -// General defined Options -//if (! defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET -//if (! defined('MAIN_AUTHENTICATION_MODE')) define('MAIN_AUTHENTICATION_MODE', 'aloginmodule'); // Force authentication handler -//if (! defined('MAIN_LANG_DEFAULT')) define('MAIN_LANG_DEFAULT', 'auto'); // Force LANG (language) to a particular value -//if (! defined('MAIN_SECURITY_FORCECSP')) define('MAIN_SECURITY_FORCECSP', 'none'); // Disable all Content Security Policies -//if (! defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1'); // Disable browser notification -//if (! defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip -//if (! defined('NOLOGIN')) define('NOLOGIN', '1'); // Do not use login - if this page is public (can be called outside logged session). This includes the NOIPCHECK too. -//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); // Do not load ajax.lib.php library -//if (! defined('NOREQUIREDB')) define('NOREQUIREDB', '1'); // Do not create database handler $db -//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); // Do not load html.form.class.php -//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // Do not load and show top and left menu -//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); // Do not load object $mysoc -//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1'); // Do not load object $langs -//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1'); // Do not load object $user -//if (! defined('NOSCANGETFORINJECTION')) define('NOSCANGETFORINJECTION', '1'); // Do not check injection attack on GET parameters -//if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION', '1'); // Do not check injection attack on POST parameters -//if (! defined('NOSESSION')) define('NOSESSION', '1'); // On CLI mode, no need to use web sessions -//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK', '1'); // Do not check style html tag into posted data -//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on) - - // Load Dolibarr environment require '../main.inc.php'; /** * The main.inc.php has been included so the following variable are now defined: * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user @@ -97,13 +76,11 @@ $pagenext = $page + 1; // Initialize technical objects $object = new Memo($db); -$extrafields = new ExtraFields($db); $diroutputmassaction = $conf->quickmemo->dir_output.'/temp/massgeneration/'.$user->id; $hookmanager->initHooks(array($contextpage)); // Note that conf->hooks_modules contains array of activated contexes // Fetch optionals attributes and labels $extrafields->fetch_name_optionals_label($object->table_element); -//$extrafields->fetch_name_optionals_label($object->table_element_line); $search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_'); @@ -512,21 +489,6 @@ if ($num == 1 && getDolGlobalInt('MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $sear llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'mod-quickmemo page-list bodyforlist'); // Can use also classforhorizontalscrolloftabs instead of bodyforlist for a horizontal scroll in the table instead of page -// Example : Adding jquery code -// print ''; - $arrayofselected = is_array($toselect) ? $toselect : array(); $param = ''; From 456034d28678f0522e61543bd9821c0de2355265 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Mon, 20 Apr 2026 21:18:15 +0200 Subject: [PATCH 26/53] NEW Accountancy - Add default options for export (#37938) Co-authored-by: Laurent Destailleur --- htdocs/accountancy/admin/index.php | 116 +++++++++++++++++++++- htdocs/accountancy/bookkeeping/export.php | 21 ++-- htdocs/langs/en_US/accountancy.lang | 8 ++ 3 files changed, 136 insertions(+), 9 deletions(-) diff --git a/htdocs/accountancy/admin/index.php b/htdocs/accountancy/admin/index.php index 9ce79e02889..1e15d8c3754 100644 --- a/htdocs/accountancy/admin/index.php +++ b/htdocs/accountancy/admin/index.php @@ -435,6 +435,62 @@ if ($action == 'setenabletabonthirdparty') { } } +if ($action == 'setexportenablelettering') { + $setexportenablelettering = GETPOSTINT('value'); + $res = dolibarr_set_const($db, "ACCOUNTING_DEFAULT_NOT_EXPORT_LETTERING", $setexportenablelettering, 'yesno', 0, '', $conf->entity); + if (!($res > 0)) { + $error++; + } + + if (!$error) { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } else { + setEventMessages($langs->trans("Error"), null, 'mesgs'); + } +} + +if ($action == 'setexportenableexportdate') { + $setexportenableexportdate = GETPOSTINT('value'); + $res = dolibarr_set_const($db, "ACCOUNTING_DEFAULT_NOT_NOTIFIED_EXPORT_DATE", $setexportenableexportdate, 'yesno', 0, '', $conf->entity); + if (!($res > 0)) { + $error++; + } + + if (!$error) { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } else { + setEventMessages($langs->trans("Error"), null, 'mesgs'); + } +} + +if ($action == 'setexportenablevalidationdate') { + $setexportenablevalidationdate = GETPOSTINT('value'); + $res = dolibarr_set_const($db, "ACCOUNTING_DEFAULT_NOTIFIED_VALIDATION_DATE", $setexportenablevalidationdate, 'yesno', 0, '', $conf->entity); + if (!($res > 0)) { + $error++; + } + + if (!$error) { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } else { + setEventMessages($langs->trans("Error"), null, 'mesgs'); + } +} + +if ($action == 'setexportenablefull') { + $setexportenablefull = GETPOSTINT('value'); + $res = dolibarr_set_const($db, "ACCOUNTING_DEFAULT_NOTIFIED_EXPORTFULL", $setexportenablefull, 'yesno', 0, '', $conf->entity); + if (!($res > 0)) { + $error++; + } + + if (!$error) { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } else { + setEventMessages($langs->trans("Error"), null, 'mesgs'); + } +} + if ($action == 'updateMask') { $maskconstbookkeeping = GETPOST('maskconstbookkeeping', 'aZ09'); $maskbookkeeping = GETPOST('maskbookkeeping', 'alpha'); @@ -989,10 +1045,66 @@ if ($num2) { print ''; } - - print "
'; - print img_picto('', 'language', 'class="picotfixedwidth"'); + print img_picto('', 'language', 'class="pictofixedwidth"'); print $formadmin->select_language((GETPOSTISSET('WEBSITE_LANG') ? GETPOST('WEBSITE_LANG', 'aZ09comma') : ($object->lang ? $object->lang : '0')), 'WEBSITE_LANG', 0, array(), 1, 0, 0, 'minwidth300', 2, 0, 0, array(), 1); print '
'; - print img_picto('', 'language', 'class="picotfixedwidth"'); + print img_picto('', 'language', 'class="pictofixedwidth"'); print ''; print '
\n"; } +print '
'; +print $form->textwithpicto($langs->trans("AccountingDefaultNotExportLettering"), $langs->trans("AccountingDefaultNotExportLetteringDesc")) . ''; + print img_picto($langs->trans("Activated"), 'switch_on'); + print ''; + print img_picto($langs->trans("Disabled"), 'switch_off'); + print '
'; +print $form->textwithpicto($langs->trans("AccountingDefaultNotNotifiedExportDate"), $langs->trans("AccountingDefaultNotNotifiedExportDateDesc")) . ''; + print img_picto($langs->trans("Activated"), 'switch_on'); + print ''; + print img_picto($langs->trans("Disabled"), 'switch_off'); + print '
'; +print $form->textwithpicto($langs->trans("AccountingDefaultNotifiedValidationDate"), $langs->trans("AccountingDefaultNotifiedValidationDateDesc")) . ''; + print img_picto($langs->trans("Activated"), 'switch_on'); + print ''; + print img_picto($langs->trans("Disabled"), 'switch_off'); + print '
'; +print $form->textwithpicto($langs->trans("AccountingDefaultNotifiedExportFull"), $langs->trans("AccountingDefaultNotifiedExportFullDesc")) . ''; + print img_picto($langs->trans("Activated"), 'switch_on'); + print ''; + print img_picto($langs->trans("Disabled"), 'switch_off'); + print '
\n"; + print '
'; print ''; diff --git a/htdocs/accountancy/bookkeeping/export.php b/htdocs/accountancy/bookkeeping/export.php index 515dda487ca..c4537358066 100644 --- a/htdocs/accountancy/bookkeeping/export.php +++ b/htdocs/accountancy/bookkeeping/export.php @@ -812,36 +812,36 @@ if ($action == 'export_file') { if (getDolGlobalInt("ACCOUNTING_ENABLE_LETTERING")) { // If 1, we check by default. - $checked = getDolGlobalString('ACCOUNTING_DEFAULT_NOT_EXPORT_LETTERING') ? 'true' : 'false'; + $checked_exportreconcile = getDolGlobalString('ACCOUNTING_DEFAULT_NOT_EXPORT_LETTERING') ? 'true' : 'false'; $form_question['notexportlettering'] = array( 'name' => 'notexportlettering', 'type' => 'checkbox', 'label' => $langs->trans('NotExportLettering'), - 'value' => $checked, + 'value' => $checked_exportreconcile, ); $form_question['separator1'] = array('name' => 'separator1', 'type' => 'separator'); } // If 1 or not set, we check by default. - $checked = (!isset($conf->global->ACCOUNTING_DEFAULT_NOT_NOTIFIED_EXPORT_DATE) || getDolGlobalString('ACCOUNTING_DEFAULT_NOT_NOTIFIED_EXPORT_DATE')); + $checked_exportdate = getDolGlobalString('ACCOUNTING_DEFAULT_NOT_NOTIFIED_EXPORT_DATE') ? 'true' : 'false'; $form_question['notifiedexportdate'] = array( 'name' => 'notifiedexportdate', 'type' => 'checkbox', 'label' => $langs->trans('NotifiedExportDate'), - 'value' => (getDolGlobalString('ACCOUNTING_DEFAULT_NOT_NOTIFIED_EXPORT_DATE') ? 'false' : 'true'), + 'value' => $checked_exportdate, ); $form_question['separator2'] = array('name' => 'separator2', 'type' => 'separator'); if (!getDolGlobalString("ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE")) { // If 0 or not set, we NOT check by default. - $checked = getDolGlobalString('ACCOUNTING_DEFAULT_NOTIFIED_VALIDATION_DATE'); + $checked_validationdate = getDolGlobalString('ACCOUNTING_DEFAULT_NOTIFIED_VALIDATION_DATE') ? 'true' : 'false'; $form_question['notifiedvalidationdate'] = array( 'name' => 'notifiedvalidationdate', 'type' => 'checkbox', 'label' => $langs->trans('NotifiedValidationDate', $langs->transnoentitiesnoconv("MenuAccountancyClosure")), - 'value' => $checked, + 'value' => $checked_validationdate, ); $form_question['separator3'] = array('name' => 'separator3', 'type' => 'separator'); @@ -865,11 +865,12 @@ if ($action == 'export_file') { $except[] = $langs->trans('SupplierInvoice'); } + $checked_exportfull = getDolGlobalString('ACCOUNTING_DEFAULT_NOTIFIED_EXPORTFULL') ? 'true' : 'false'; $form_question['notifiedexportfull'] = array( 'name' => 'notifiedexportfull', 'type' => 'checkbox', 'label' => $langs->trans('NotifiedExportFull').(empty($except) ? '' : ' ('.$langs->trans("except").' '.implode(', ', $except).')'), - 'value' => 'false', + 'value' => $checked_exportfull, ); $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?'.$param, $langs->trans("ExportFilteredList").'...', $langs->trans('ConfirmExportFile'), 'export_fileconfirm', $form_question, '', 1, 500, 700); @@ -879,12 +880,18 @@ if ($action == 'export_file') { const exportTypesWithDocs = ['.implode(',', $exportTypesWithDocs).']; const $formatExport = jQuery("#formatexport"); + // We retrieve the configured default value (true or false in native JavaScript) + const defaultChecked = ' . $checked_exportfull . '; + function toggleExportFull() { const $checkbox = jQuery("#notifiedexportfull"); const show = exportTypesWithDocs.indexOf(parseInt($formatExport.val())) !== -1; $checkbox.closest(".tagtr").toggle(show); + if (!show) { $checkbox.prop("checked", false); // remove checked if hidden + } else { + $checkbox.prop("checked", defaultChecked); // Restore the default configuration if displayed } } diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 0eebc8b7244..062829a0db9 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -393,6 +393,14 @@ ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE=Activate the management of VAT revers ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE_DESC=When this option is enabled, you can define that a supplier or a given vendor invoice must be transferred into accountancy differently: A additional debit and a credit line will generated into the accounting on 2 given accounts from the chart of account defined into the "%s" setup page. ACCOUNTING_ENABLE_TABONTHIRDPARTY=Activate a tab on third-party cards to view the subsidiary ledger ACCOUNTING_ENABLE_TABONTHIRDPARTY_DESC=When this option is enabled, a new tab is showing in third-party cards to view and manage accounting for the third-party as to reconcile, print & more +AccountingDefaultNotExportLettering=By default, do not export lettering when generating the file +AccountingDefaultNotExportLetteringDesc=If enabled, the lettering information of accounting entries will not be included in the generated export file. +AccountingDefaultNotNotifiedExportDate=By default, mark not yet exported lines as "Exported" +AccountingDefaultNotNotifiedExportDateDesc=If enabled, each exported line will be stamped with the export date. To modify a line marked as exported, you will need to delete the entire accounting entry and re-transfer it to accounting. +AccountingDefaultNotifiedValidationDate=By default, validate and lock exported accounting entries +AccountingDefaultNotifiedValidationDateDesc=If enabled, exported accounting entries will be automatically validated and locked (same effect as the "Close" feature). Editing and deletion of these lines will be PERMANENTLY impossible. +AccountingDefaultNotifiedExportFull=By default, export source documents (Available only on some export models Quadra | FEC | FEC2) +AccountingDefaultNotifiedExportFullDesc=If enabled, source documents associated with accounting entries (invoices, credit notes, etc.) will be included or attached when generating the export file. ## Template MenuListBookkeepingTemplates=Bookkeeping templates BookkeepingTemplates=Bookkeeping templates From 1c0d20e7d98a2d183ce2a5a32353e0ff39ee1081 Mon Sep 17 00:00:00 2001 From: Jon Bendtsen Date: Mon, 20 Apr 2026 21:18:30 +0200 Subject: [PATCH 27/53] FIX API_ENABLE_LOGIN_API should be integer, not string (#37941) * FIX API_ENABLE_LOGIN_API should be integer, not string * Update api_login.class.php * Update api_users.class.php * Update api_login.class.php --------- Co-authored-by: Jon Bendtsen Co-authored-by: Laurent Destailleur --- htdocs/api/class/api_login.class.php | 4 ++-- htdocs/user/class/api_users.class.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/api/class/api_login.class.php b/htdocs/api/class/api_login.class.php index fe6beac22d5..0d1b7dc6390 100644 --- a/htdocs/api/class/api_login.class.php +++ b/htdocs/api/class/api_login.class.php @@ -41,7 +41,7 @@ class Login global $db; $this->db = $db; - if (!getDolGlobalString('API_ENABLE_LOGIN_API')) { + if (!getDolGlobalInt('API_ENABLE_LOGIN_API')) { throw new RestException(403, "Error: The login APIs are disabled. It is recommended to call the APIs using the DOLAPIKEY token of an allowed user instead of the login/password. API key can be set from the user card. If you really need to get the API token from the login API, you can set the constant API_ENABLE_LOGIN_API."); } } @@ -186,7 +186,7 @@ class Login 'success' => array( 'code' => 200, 'token' => $token, - 'entity' => $tmpuser->entity, + 'entity' => $tmpuser->entity ?? 1, 'message' => 'Welcome '.$login.($reset ? ' - Token is new' : ' - This is your token (recorded for your user). You can use it to make any REST API call, or enter it into the DOLAPIKEY field to use the Dolibarr API explorer.') ) ); diff --git a/htdocs/user/class/api_users.class.php b/htdocs/user/class/api_users.class.php index 507b28494fd..2aa0c822092 100644 --- a/htdocs/user/class/api_users.class.php +++ b/htdocs/user/class/api_users.class.php @@ -517,7 +517,7 @@ class Users extends DolibarrApi */ public function setPassword($id, $send_password = false) { - if (!getDolGlobalString('API_ENABLE_LOGIN_API')) { + if (!getDolGlobalInt('API_ENABLE_LOGIN_API')) { throw new RestException(403, "Error: login and password reset APIs are disabled. You can get access token from the backoffice to get access permission but permission and password manipulation from APIs are forbidden."); } From b6497280143d2a0316b269907bfcea76c831d8a6 Mon Sep 17 00:00:00 2001 From: LauraDiaz Date: Mon, 20 Apr 2026 21:18:49 +0200 Subject: [PATCH 28/53] FIX Prevent project creation when required extrafields validation fails (#37939) * Refactor contact addition logic in card.php Prevent calling create() when required extrafields validation fails * Update card.php --------- Co-authored-by: Laurent Destailleur --- htdocs/projet/card.php | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 1a60d29b5c6..d5465236bfc 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -250,25 +250,27 @@ if (empty($reshook)) { $error++; } - $result = $object->create($user); - if (!$error && $result > 0) { - // Add myself as Owner Contact Selected in the form - $typeofcontact = GETPOST('typeofcontact'); - $result = $object->add_contact($user->id, $typeofcontact, 'internal'); + if (!$error) { + $result = $object->create($user); + if ($result > 0) { + // Add myself as Owner Contact Selected in the form + $typeofcontact = GETPOST('typeofcontact'); + $result = $object->add_contact($user->id, $typeofcontact, 'internal'); - // -3 means type not found (renamed, de-activated or deleted), so don't prevent creation if it has been the case - if ($result == -3) { - setEventMessage('ErrorPROJECTLEADERRoleMissingRestoreIt', 'errors'); - $error++; - } elseif ($result < 0) { + // -3 means type not found (renamed, de-activated or deleted), so don't prevent creation if it has been the case + if ($result == -3) { + setEventMessage('ErrorPROJECTLEADERRoleMissingRestoreIt', 'errors'); + $error++; + } elseif ($result < 0) { + $langs->load("errors"); + setEventMessages($object->error, $object->errors, 'errors'); + $error++; + } + } else { $langs->load("errors"); setEventMessages($object->error, $object->errors, 'errors'); $error++; } - } else { - $langs->load("errors"); - setEventMessages($object->error, $object->errors, 'errors'); - $error++; } if (!$error && !empty($object->id) > 0) { // Category association From c4968aedc3135f66df292e59fb04fae26e13d5d2 Mon Sep 17 00:00:00 2001 From: John BOTELLA <68917336+thersane-john@users.noreply.github.com> Date: Mon, 20 Apr 2026 22:01:27 +0200 Subject: [PATCH 29/53] New js context hook for object line create tpl (#37943) Co-authored-by: Laurent Destailleur --- htdocs/core/tpl/objectline_create.tpl.php | 25 +++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index 4b88f97a56e..2997ad591de 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -1019,6 +1019,7 @@ if (!empty($object->thirdparty)) { if (isNaN(pbq)) { console.log("We use experimental option PRODUIT_CUSTOMER_PRICES_BY_QTY or PRODUIT_CUSTOMER_PRICES_BY_QTY but we could not get the id of pbq from product combo list, so load of price may be 0 if product has different prices"); } } + let idProdFournPrice = $(this).val(); // Get the price for the product and display it console.log("Load unit price and set it into #price_ht or #price_ttc for product id="+$(this).val()+" socid=" + jsConf.docObject.socid); $.post(jsConf.url.fetchProductUrl, @@ -1145,6 +1146,11 @@ if (!empty($object->thirdparty)) { jQuery('div[class*="det'+key.replace('options_','_extras_')+'"] > #'+key).val(value); }); } + + // Execute js context Dolibarr Hooks + if (typeof Dolibarr != 'undefined') { + Dolibarr.executeHook('objectLineCreate:LoadUnitPrice', {idProdFournPrice, 'socid': jsConf.docObject.socid,ajaxResultData : data, jsConf}); + } }, 'json' ); @@ -1157,10 +1163,11 @@ if (!empty($object->thirdparty)) { $("#fournprice_predef").find("option").remove(); $("#fournprice_predef").hide(); $("#buying_price").val("").show(); + let idProd = $(this).val(); /* Call post to load content of combo list fournprice_predef */ var token = jsConf.conf.token; // For AJAX Call we use old 'token' and not 'newtoken' - $.post(jsConf.url.getSupplierPrices, { 'idprod': $(this).val(), 'token': token }, function(data) { + $.post(jsConf.url.getSupplierPrices, { 'idprod': idProd, 'token': token }, function(data) { if (data && data.length > 0) { var options = ''; var defaultkey = ''; var defaultprice = ''; var bestpricefound = 0; @@ -1248,6 +1255,12 @@ if (!empty($object->thirdparty)) { $('#buying_price').hide(); } }); + + + // Execute js context Dolibarr Hooks + if (typeof Dolibarr != 'undefined') { + Dolibarr.executeHook('objectLineCreate:GetSupplierPrices', {'idprod': idProd, ajaxResultData : data, jsConf}); + } } }, 'json'); @@ -1283,6 +1296,11 @@ if (!empty($object->thirdparty)) { jQuery("#remise_percent").val(pbqpercent); } } else { jQuery("#pbq").val(''); } + + // Execute js context Dolibarr Hooks + if (typeof Dolibarr != 'undefined') { + Dolibarr.executeHook('objectLineCreate:CustomerPriceByQty', { pbq, pbqup, pbqbase, pbqqty, pbqpercent }); + } } // Deal with supplier ref price (idprodfournprice = int) @@ -1397,7 +1415,6 @@ if (!empty($object->thirdparty)) { jQuery('#dp_desc').text(description); } } - } else if (jQuery('#idprodfournprice').length > 0) { console.log("objectline_create.tpl #idprodfournprice is not an int but is a string so we set only few properties into page"); @@ -1465,6 +1482,10 @@ if (!empty($object->thirdparty)) { setforpredef(); } + // Execute js context Dolibarr Hooks + if (typeof Dolibarr != 'undefined') { + Dolibarr.executeHook('objectLineCreate:ProductSelectionChange'); + } }); /* Function to set fields visibility after selecting a free product */ From 8f0b7e3f063d51a7484f1a269a172dd7bc3550b7 Mon Sep 17 00:00:00 2001 From: Jon Bendtsen Date: Mon, 20 Apr 2026 22:04:17 +0200 Subject: [PATCH 30/53] NEW massaction sendEmail on the list of invoices for a given product (#37937) * NEW massaction for invoice list which contains a given product * This sends 1 email when tested with 1 selection, will have to cleanup * cleaning up my various debug messages and comments * fix pre-commit hook errors * PHPstan fixes * typecasting invoice id due to PHAN complaint * Redefine how selectedfields variable is defined * fix PHPstan and phan using advice from mdeweerd * directly, not saved as string * fix pre-commit fail * put in a string --------- Co-authored-by: Jon Bendtsen Co-authored-by: Laurent Destailleur --- htdocs/product/stats/facture.php | 141 +++++++++++++++++++++++++++++-- 1 file changed, 135 insertions(+), 6 deletions(-) diff --git a/htdocs/product/stats/facture.php b/htdocs/product/stats/facture.php index 04a154aadc2..2fccc12e21e 100644 --- a/htdocs/product/stats/facture.php +++ b/htdocs/product/stats/facture.php @@ -5,6 +5,7 @@ * Copyright (C) 2014 Juanjo Menent * Copyright (C) 2014 Florian Henry * Copyright (C) 2024 Frédéric France + * Copyright (C) 2026 Jon Bendtsen * * 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 @@ -32,6 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; /** * @var Conf $conf @@ -130,8 +132,29 @@ $result = restrictedArea($user, 'produit|service', $fieldvalue, 'product&product /* - * View + * Actions */ +$toselect = GETPOST('toselect', 'array:int'); +$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'invoicelist'; +$massaction = GETPOST('massaction', 'alpha'); +$diroutputmassaction = $conf->invoice->dir_output.'/temp/massgeneration/'.$user->id; + +if (GETPOST('cancel', 'alpha')) { + $action = 'list'; + $massaction = ''; +} +if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { + $massaction = ''; +} +$arrayfields = array( + 'f.ref' => array('label' => "Ref", 'checked' => '1', 'position' => 5), + 's.nom' => array('label' => "ThirdParty", 'checked' => '1', 'position' => 50), + 's.code_client' => array('label' => "CustomerCodeShort", 'checked' => '-1', 'position' => 52), + 'f.datef' => array('label' => "DateInvoice", 'checked' => '1', 'position' => 60), + 'd.qty' => array('label' => "Qty", 'checked' => '1', 'position' => 65), + 'd.total_ht' => array('label' => "AmountHT", 'checked' => '1', 'position' => 70), + 'f.fk_statut' => array('label' => "Status", 'checked' => '1', 'position' => 1000), +); $invoicestatic = new Facture($db); $societestatic = new Societe($db); @@ -139,6 +162,75 @@ $societestatic = new Societe($db); $form = new Form($db); $formother = new FormOther($db); + + +$arrayofmassactions = array( + 'presend' => img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"), +); +$massactionbutton = $form->selectMassAction('', $arrayofmassactions); +$arrayofselected = is_array($toselect) ? $toselect : array(); +$selectedfields = (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); + + +$totalarray = array(); +$totalarray['nbfield'] = 0; + +$parameters = array('socid' => $socid, 'arrayfields' => &$arrayfields); +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) { + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); +} +if (empty($reshook)) { + $objectclass = 'Facture'; + $objectlabel = 'Invoices'; + $permissiontoread = $user->hasRight("facture", "lire"); + $permissiontoadd = $user->hasRight("facture", "creer"); + $permissiontodelete = $user->hasRight("facture", "supprimer"); + $uploaddir = $conf->invoice->dir_output; + + if (isset($_POST['massaction'])) { + $massaction = $_POST['massaction']; + } + + if (isset($_POST['confirmmassaction']) && isset($_POST['massaction']) && $_POST['massaction'] == 'presend') { + global $arrayofselected; + + $toselect = is_array($_POST['toselect']) ? $_POST['toselect'] : array(); + $arrayofselected = array(); + + // Store only VALID IDs (those with emails) + foreach ($toselect as $invoice_id) { + $objecttmp = new Facture($db); + if ($objecttmp->fetch((int) $invoice_id) > 0) { + // Force loading the thirdparty object + if (empty($objecttmp->thirdparty) || !is_object($objecttmp->thirdparty)) { + $objecttmp->fetch_thirdparty(); + } + + // Only add to array if email exists + if (!empty($objecttmp->thirdparty->email)) { + // Store just the ID, not the object + $arrayofselected[] = $invoice_id; + } + } + } + + if (empty($arrayofselected)) { + setEventMessages($langs->trans("DefaultStatusEmptyMandatory").' '.$langs->trans("Select"), null, 'errors'); + header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); + exit; + } + } else { + include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; + } +} + +/* + * View + */ + + + if ($id > 0 || !empty($ref)) { $product = new Product($db); $result = $product->fetch($id, $ref); @@ -287,6 +379,14 @@ if ($id > 0 || !empty($ref)) { $result = $db->query($sql); if ($result) { $num = $db->num_rows($result); + // I am saving the result here, because some hooks a little later will change $result such that I can not get the contents + $all_rows = array(); + $num = $db->num_rows($result); + while ($row = $db->fetch_object($result)) { + $all_rows[] = $row; + } + $db->free($result); // Free immediately + $result = null; // Clear the variable $option .= '&id='.$product->id; @@ -297,6 +397,8 @@ if ($id > 0 || !empty($ref)) { // Add $param from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; // Add $param from hooks + '@phan-var-force string $param'; + /** @var string $param */ $parameters = array('param' => &$param); $reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $option .= $hookmanager->resPrint; @@ -311,7 +413,17 @@ if ($id > 0 || !empty($ref)) { } // @phan-suppress-next-line PhanPluginSuspiciousParamOrder - print_barre_liste($langs->trans("CustomersInvoices"), $page, $_SERVER["PHP_SELF"], $option, $sortfield, $sortorder, '', $num, $totalofrecords, '', 0, '', '', $limit, 0, 0, 1); + print_barre_liste($langs->trans("CustomersInvoices"), $page, $_SERVER["PHP_SELF"], $option, $sortfield, $sortorder, $massactionbutton, $num, $totalofrecords, '', 0, '', '', $limit, 0, 0, 1); + + if ($massaction == 'presend' && !empty($arrayofselected)) { + // Set variables expected by the template + $topicmail = "SendBillRef"; + $modelmail = "facture_send"; + $objecttmp = new Facture($db); + $trackid = 'inv'.$id; + + include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; + } if (!empty($page)) { $option .= '&page='.urlencode((string) ($page)); @@ -337,6 +449,8 @@ if ($id > 0 || !empty($ref)) { print '
'; print ''; print ''; + // Action column + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "s.rowid", "", $option, '', $sortfield, $sortorder); print_liste_field_titre("Company", $_SERVER["PHP_SELF"], "s.nom", "", $option, '', $sortfield, $sortorder); print_liste_field_titre("CustomerCode", $_SERVER["PHP_SELF"], "s.code_client", "", $option, '', $sortfield, $sortorder); @@ -352,8 +466,7 @@ if ($id > 0 || !empty($ref)) { if ($num > 0) { while ($i < min($num, $limit)) { - $objp = $db->fetch_object($result); - + $objp = $all_rows[$i]; if ($objp->type == Facture::TYPE_CREDIT_NOTE) { $objp->qty = -($objp->qty); } @@ -366,7 +479,24 @@ if ($id > 0 || !empty($ref)) { $societestatic->fetch($objp->socid); $paiement = $invoicestatic->getSommePaiement(); - print ''; + print ''; + + // Action column + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + print '\n"; @@ -401,7 +531,6 @@ if ($id > 0 || !empty($ref)) { } else { dol_print_error($db); } - $db->free($result); } } } else { From db81523f624b7bf41bf1e2b8cf9733a8940078b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 20 Apr 2026 22:07:01 +0200 Subject: [PATCH 31/53] make less sql request (#37919) * make less sql request * fix --------- Co-authored-by: Laurent Destailleur --- htdocs/product/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 6b5207a52f5..4d46b09d4bc 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -44,6 +44,7 @@ require '../main.inc.php'; /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Societe $mysoc * @var Translate $langs @@ -187,7 +188,6 @@ if ((string) $type == '0') { // Initialize a technical object to manage hooks. Note that conf->hooks_modules contains array of hooks $object = new Product($db); $hookmanager->initHooks(array('productservicelist')); -$extrafields = new ExtraFields($db); $form = new Form($db); $formcompany = new FormCompany($db); $formproduct = new FormProduct($db); From ca54b2a6ff44a668e2258f35090fc24457260124 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 20 Apr 2026 22:11:20 +0200 Subject: [PATCH 32/53] fix categories translations (#37912) * fix categories translations * fix categories translations * fix categories translations * fix categories translations * Update traduction.php * Update traduction.php * Update photos.php * fix categories translations * fix categories translations * fix categories translations * fix categories translations * fix categories translations * fix categories translations * fix categories translations * fix categories translations * fix categories translations * fix categories translations * fix categories translations * fix categories translations * fix categories translations * fix categories translations * fix categories translations * fix categories translations * fix categories translations * fix categories translations * fix categories translations * fix * fix --------- Co-authored-by: Laurent Destailleur --- .../admin/categorie_extrafields.php | 9 +- .../admin/categorie_lang_extrafields.php | 128 ++++++++++++++++++ htdocs/categories/card.php | 11 +- htdocs/categories/categorie_list.php | 21 +-- htdocs/categories/class/categorie.class.php | 38 ++++-- htdocs/categories/edit.php | 5 +- htdocs/categories/photos.php | 12 +- htdocs/categories/traduction.php | 76 +++++++---- htdocs/categories/viewcat.php | 5 +- .../facture/class/facture-rec.class.php | 2 +- htdocs/compta/facture/list.php | 2 +- htdocs/core/lib/categories.lib.php | 21 ++- htdocs/fourn/facture/list.php | 22 +-- htdocs/langs/en_US/categories.lang | 1 + htdocs/langs/en_US/products.lang | 1 + htdocs/product/card.php | 21 ++- 16 files changed, 276 insertions(+), 99 deletions(-) create mode 100644 htdocs/categories/admin/categorie_lang_extrafields.php diff --git a/htdocs/categories/admin/categorie_extrafields.php b/htdocs/categories/admin/categorie_extrafields.php index f730c09dc1d..48fbd3eacbe 100644 --- a/htdocs/categories/admin/categorie_extrafields.php +++ b/htdocs/categories/admin/categorie_extrafields.php @@ -3,7 +3,7 @@ * Copyright (C) 2003 Jean-Louis Bergamo * Copyright (C) 2004-2012 Laurent Destailleur * Copyright (C) 2012 Regis Houssin - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2026 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 @@ -27,21 +27,20 @@ // Load Dolibarr environment require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/categories.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; - /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT.'/core/lib/categories.lib.php'; + // Load translation files required by the page $langs->loadLangs(array('categories', 'admin')); -$extrafields = new ExtraFields($db); $form = new Form($db); // List of supported format diff --git a/htdocs/categories/admin/categorie_lang_extrafields.php b/htdocs/categories/admin/categorie_lang_extrafields.php new file mode 100644 index 00000000000..953bd871a59 --- /dev/null +++ b/htdocs/categories/admin/categorie_lang_extrafields.php @@ -0,0 +1,128 @@ + + * Copyright (C) 2003 Jean-Louis Bergamo + * Copyright (C) 2004-2011 Laurent Destailleur + * Copyright (C) 2012 Regis Houssin + * Copyright (C) 2014 Florian Henry + * Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2026 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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file admin/categorie_lang_extrafields.php + * \ingroup categorie + * \brief Page to setup extra fields of categorie lang + */ + +// Load Dolibarr environment +require '../../main.inc.php'; + +/** + * @var Conf $conf + * @var DoliDB $db + * @var ExtraFields $extrafields + * @var HookManager $hookmanager + * @var Translate $langs + * @var User $user + */ + +require_once DOL_DOCUMENT_ROOT.'/core/lib/categories.lib.php'; + +// Load translation files required by the page +$langs->loadLangs(array('admin', 'categories')); + +$form = new Form($db); + +// List of supported format +$tmptype2label = ExtraFields::$type2label; +$type2label = array(''); +foreach ($tmptype2label as $key => $val) { + $type2label[$key] = $langs->transnoentitiesnoconv($val); +} + +$action = GETPOST('action', 'aZ09'); +$attrname = GETPOST('attrname', 'alpha'); +$elementtype = 'categorie_lang'; // Must be the $table_element of the class that manage extrafield + +if (!$user->admin) { + accessforbidden(); +} + + +/* + * Actions + */ + +require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php'; + + + +/* + * View + */ + +$textobject = $langs->transnoentitiesnoconv("Category"); + +$help_url = ''; +$page_name = "CategoriesTranslationsExtrafields"; + +llxHeader('', $langs->trans($page_name), $help_url); + + +$linkback = ''.$langs->trans("BackToModuleList").''; +print load_fiche_titre($langs->trans($page_name), $linkback, 'title_setup'); + + +$head = categoriesadmin_prepare_head(); + +print dol_get_fiche_head($head, 'translationAttributes', $langs->trans($page_name), -1, 'categorie'); + +require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; + +print dol_get_fiche_end(); + + +// Buttons +if ($action != 'create' && $action != 'edit') { + print '
'; + print ''.$langs->trans("NewAttribute").''; + print "
"; +} + + +/* + * Creation of an optional field + */ +if ($action == 'create') { + print '
'; + print load_fiche_titre($langs->trans('NewAttribute')); + + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; +} + +/* + * Edition of an optional field + */ +if ($action == 'edit' && !empty($attrname)) { + print "
"; + print load_fiche_titre($langs->trans("FieldEdition", $attrname)); + + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; +} + +// End of page +llxFooter(); +$db->close(); diff --git a/htdocs/categories/card.php b/htdocs/categories/card.php index 0127c4a6ede..9d70b0a8ab8 100644 --- a/htdocs/categories/card.php +++ b/htdocs/categories/card.php @@ -5,7 +5,7 @@ * Copyright (C) 2007 Patrick Raguin * Copyright (C) 2013 Florian Henry * Copyright (C) 2015 Raphaël Doursenaud - * Copyright (C) 2020-2024 Frédéric France + * Copyright (C) 2020-2026 Frédéric France * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify @@ -30,18 +30,18 @@ // Load Dolibarr environment require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; - /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; + // Load translation files required by the page $langs->load("categories"); @@ -104,7 +104,6 @@ if (!GETPOSTISSET('parent') && $catorigin) { $object = new Categorie($db); -$extrafields = new ExtraFields($db); $extrafields->fetch_name_optionals_label($object->table_element); // Initialize a technical object to manage hooks. Note that conf->hooks_modules contains array array diff --git a/htdocs/categories/categorie_list.php b/htdocs/categories/categorie_list.php index c1ce32da04a..20fdef48fa7 100644 --- a/htdocs/categories/categorie_list.php +++ b/htdocs/categories/categorie_list.php @@ -1,6 +1,6 @@ - * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2024-2026 Frédéric France * Copyright (C) 2025-2026 MDW * * This program is free software; you can redistribute it and/or modify @@ -25,20 +25,21 @@ // Load Dolibarr environment require '../main.inc.php'; +/** + * @var Conf $conf + * @var DoliDB $db + * @var ExtraFields $extrafields + * @var HookManager $hookmanager + * @var Translate $langs + * @var User $user + */ + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/treeview.lib.php'; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; -/** - * @var Conf $conf - * @var DoliDB $db - * @var HookManager $hookmanager - * @var Translate $langs - * @var User $user - */ - // Load translation files required by the page $langs->loadLangs(array("accountancy", "agenda", "banks", "bills", "categories", "contracts", "interventions", "mrp")); $langs->loadLangs(array("knowledgemanagement", "members", "orders", "products", "stocks", "suppliers", "tickets")); @@ -84,7 +85,7 @@ $pagenext = $page + 1; // Initialize technical objects $object = new Categorie($db); -$extrafields = new ExtraFields($db); + $diroutputmassaction = $conf->category->dir_output.'/temp/massgeneration/'.$user->id; $hookmanager->initHooks(array($contextpage)); // Note that conf->hooks_modules contains array of activated contexes diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 53ccd935391..f33640e4732 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -663,11 +663,11 @@ class Categorie extends CommonObject /** * Update category * - * @param User $user Object user - * @param int $notrigger 1=Does not execute triggers, 0= execute triggers - * @return int 1 : OK - * -1 : SQL error - * -2 : invalid category + * @param User $user Object user + * @param int<0,1> $notrigger 1=Does not execute triggers, 0= execute triggers + * @return int<-2,1> 1 : OK + * -1 : SQL error + * -2 : invalid category */ public function update(User $user, $notrigger = 0) { @@ -706,6 +706,14 @@ class Categorie extends CommonObject dol_syslog(get_class($this)."::update", LOG_DEBUG); if ($this->db->query($sql)) { + // Multilangs + if (getDolGlobalInt('MAIN_MULTILANGS')) { + if ($this->setMultiLangs($user, $notrigger) < 0) { + $this->db->rollback(); + return -2; + } + } + $action = 'update'; // Actions on extra fields @@ -2167,35 +2175,37 @@ class Categorie extends CommonObject if ($key == $current_lang) { $sql2 = ''; - if ($this->db->num_rows($result)) { // if no line in database + if ($this->db->num_rows($result)) { // if there is already a description line for this language $sql2 = "UPDATE ".MAIN_DB_PREFIX."categorie_lang"; $sql2 .= " SET label = '".$this->db->escape($this->label)."',"; $sql2 .= " description = '".$this->db->escape($this->description)."'"; $sql2 .= " WHERE fk_category = ".((int) $this->id)." AND lang = '".$this->db->escape($key)."'"; - } elseif (isset($this->multilangs[$key])) { + } else { // if no line in database $sql2 = "INSERT INTO ".MAIN_DB_PREFIX."categorie_lang (fk_category, lang, label, description)"; $sql2 .= " VALUES(".((int) $this->id).", '".$this->db->escape($key)."', '".$this->db->escape($this->label)."'"; - $sql2 .= ", '".$this->db->escape($this->multilangs[$key]["description"])."')"; + $sql2 .= ", '".$this->db->escape($this->description)."')"; } dol_syslog(get_class($this).'::setMultiLangs', LOG_DEBUG); - if ($sql2 && !$this->db->query($sql2)) { + if (!$this->db->query($sql2)) { $this->error = $this->db->lasterror(); return -1; } - } elseif (isset($this->multilangs[$key])) { - if ($this->db->num_rows($result)) { // if no line in database + $this->multilangs[$key]["label"] = $this->label; + $this->multilangs[$key]["description"] = $this->description; + } elseif (isset($this->multilangs[$key])) { // if there is already a description line for this language + if ($this->db->num_rows($result)) { $sql2 = "UPDATE ".MAIN_DB_PREFIX."categorie_lang"; $sql2 .= " SET label='".$this->db->escape($this->multilangs[$key]["label"])."',"; $sql2 .= " description='".$this->db->escape($this->multilangs[$key]["description"])."'"; $sql2 .= " WHERE fk_category=".((int) $this->id)." AND lang='".$this->db->escape($key)."'"; - } else { + } else { // if no line in database $sql2 = "INSERT INTO ".MAIN_DB_PREFIX."categorie_lang (fk_category, lang, label, description)"; $sql2 .= " VALUES(".((int) $this->id).", '".$this->db->escape($key)."', '".$this->db->escape($this->multilangs[$key]["label"])."'"; $sql2 .= ",'".$this->db->escape($this->multilangs[$key]["description"])."')"; } - // on ne sauvegarde pas des champs vides - if ($this->multilangs[$key]["label"] || $this->multilangs[$key]["description"] || $this->multilangs[$key]["note"]) { + // We do not save if main fields are empty + if ($this->multilangs[$key]["label"] || $this->multilangs[$key]["description"]) { dol_syslog(get_class($this).'::setMultiLangs', LOG_DEBUG); } if (!$this->db->query($sql2)) { diff --git a/htdocs/categories/edit.php b/htdocs/categories/edit.php index 33d759d1bc9..fe084fd4906 100644 --- a/htdocs/categories/edit.php +++ b/htdocs/categories/edit.php @@ -3,7 +3,7 @@ * Copyright (C) 2006-2016 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2007 Patrick Raguin - * Copyright (C) 2020-2024 Frédéric France + * Copyright (C) 2020-2026 Frédéric France * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify @@ -29,12 +29,12 @@ // Load Dolibarr environment require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user @@ -82,7 +82,6 @@ if (is_numeric($type)) { $type = array_search($type, $object->MAP_ID); // For backward compatibility } -$extrafields = new ExtraFields($db); $extrafields->fetch_name_optionals_label($object->table_element); $error = 0; diff --git a/htdocs/categories/photos.php b/htdocs/categories/photos.php index c30e1eeb21b..f4fa2c44dd8 100644 --- a/htdocs/categories/photos.php +++ b/htdocs/categories/photos.php @@ -161,12 +161,18 @@ if ($object->id) { print '
'; print '
'; + if (($massactionbutton || $massaction) && $contextpage != 'poslist') { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + $selected = 0; + if (in_array($invoicestatic->id, $arrayofselected)) { + $selected = 1; + } + print ''; + } + print ''; print $invoicestatic->getNomUrl(1); print "
'; - // Description + // Label print ''; + // Description + // print ''; + // Color print '
'; - print $langs->trans("Description").''; - print dol_htmlentitiesbr($object->description); + print $langs->trans("Label").''; + print dol_htmlentitiesbr($object->label); print '
'; + // print $langs->trans("Description").''; + // print dol_htmlentitiesbr($object->description); + // print '
'; print $langs->trans("Color").''; diff --git a/htdocs/categories/traduction.php b/htdocs/categories/traduction.php index a66e333fdf4..29d364b5595 100644 --- a/htdocs/categories/traduction.php +++ b/htdocs/categories/traduction.php @@ -3,7 +3,7 @@ * Copyright (C) 2007 Rodolphe Quiedeville * Copyright (C) 2010-2016 Destailleur Laurent * Copyright (C) 2015 Raphaël Doursenaud - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2026 Frédéric France * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify @@ -29,20 +29,21 @@ // Load Dolibarr environment require '../main.inc.php'; +/** + * @var Conf $conf + * @var DoliDB $db + * @var ExtraFields $extrafields + * @var HookManager $hookmanager + * @var Translate $langs + * @var User $user + */ + require_once DOL_DOCUMENT_ROOT.'/core/lib/categories.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; -/** - * @var Conf $conf - * @var DoliDB $db - * @var HookManager $hookmanager - * @var Translate $langs - * @var User $user - */ - // Load translation files required by the page $langs->loadLangs(array('categories', 'languages', 'mrp')); @@ -63,6 +64,10 @@ if ($result <= 0) { dol_print_error($db, $object->error); exit; } +$extralabels = $extrafields->fetch_name_optionals_label("categorie_lang"); + +// Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context +$hookmanager->initHooks(array('categorietranslationcard', 'globalcard')); $type = $object->type; if (is_numeric($type)) { @@ -73,21 +78,28 @@ if (is_numeric($type)) { $result = restrictedArea($user, 'categorie', $id, '&category'); $permissiontoadd = $user->hasRight('categorie', 'creer'); - +$permissiontodelete = $user->hasRight('categorie', 'supprimer'); /* * Actions */ $error = 0; - +$parameters = [ + 'id' => $id, + 'ref' => $label, +]; +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) { + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); +} // return to translation view if cancelled -if ($cancel == $langs->trans("Cancel")) { +if (empty($reshook) && $cancel == $langs->trans("Cancel")) { $action = ''; } // delete a translation -if ($action == 'delete' && $langtodelete && $user->hasRight('categorie', 'creer')) { +if (empty($reshook) && $action == 'delete' && $langtodelete && $permissiontodelete) { $res = $object->delMultiLangs($langtodelete, $user); if ($res < 0) { setEventMessages($object->error, $object->errors, 'errors'); @@ -99,7 +111,7 @@ if ($action == 'delete' && $langtodelete && $user->hasRight('categorie', 'creer' } // validation of addition -if ($action == 'vadd' && $cancel != $langs->trans("Cancel") && $permissiontoadd) { +if (empty($reshook) && $action == 'vadd' && $cancel != $langs->trans("Cancel") && $permissiontoadd) { $object->fetch($id); $current_lang = $langs->getDefaultLang(); @@ -148,7 +160,7 @@ if ($action == 'vadd' && $cancel != $langs->trans("Cancel") && $permissiontoadd) } // validation of the edition -if ($action == 'vedit' && $cancel != $langs->trans("Cancel") && $permissiontoadd) { +if (empty($reshook) && $action == 'vedit' && $cancel != $langs->trans("Cancel") && $permissiontoadd) { $object->fetch($id); $current_lang = $langs->getDefaultLang(); @@ -164,6 +176,7 @@ if ($action == 'vedit' && $cancel != $langs->trans("Cancel") && $permissiontoadd if ($key == $current_lang) { $object->label = $libelle; $object->description = dol_htmlcleanlastbr($desc); + $object->update($user); } else { $object->multilangs[$key]["label"] = $libelle; $object->multilangs[$key]["description"] = dol_htmlcleanlastbr($desc); @@ -231,12 +244,18 @@ print '
'; print ''; -// Description +// Label print ''; +// Description +// print ''; + // Color print '
'; -print $langs->trans("Description").''; -print dol_htmlentitiesbr($object->description); +print $langs->trans("Label").''; +print dol_htmlentitiesbr($object->label); print '
'; +// print $langs->trans("Description").''; +// print dol_htmlentitiesbr($object->description); +// print '
'; print $langs->trans("Color").''; @@ -249,18 +268,19 @@ print ''; print dol_get_fiche_end(); - /* * Action bar */ print "\n
\n"; -if ($action == '') { - if ($user->hasRight('produit', 'creer') || $user->hasRight('service', 'creer')) { - print ''.$langs->trans('Add').''; +$parameters = array(); +$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been +if (empty($reshook)) { + if ($action == '' && $permissiontoadd) { + print ''.$langs->trans('Add').''; if ($cnt_trans > 0) { - print ''.$langs->trans('Update').''; + print ''.$langs->trans('Update').''; } } } @@ -268,7 +288,6 @@ if ($action == '') { print "\n
\n"; - if ($action == 'edit') { // WYSIWYG Editor require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; @@ -281,7 +300,8 @@ if ($action == 'edit') { if (!empty($object->multilangs)) { foreach ($object->multilangs as $key => $value) { - print "
".$langs->trans('Language_'.$key)." :
"; + $s = picto_from_langcode((string) $key); + print '
'.($s ? $s.' ' : '').''.$langs->trans('Language_'.$key).': ' . $langs->trans('Language_'.$key).' :
'; print ''; // Label @@ -314,7 +334,7 @@ if ($action == 'edit') { foreach ($object->multilangs as $key => $value) { $s = picto_from_langcode((string) $key); print '
'; - print ''; + print ''; print ''; print ''; if (getDolGlobalString('CATEGORY_USE_OTHER_FIELD_IN_TRANSLATION')) { @@ -333,12 +353,12 @@ if ($action == 'edit') { * Form to add a new translation */ -if ($action == 'add' && ($user->hasRight('produit', 'creer') || $user->hasRight('service', 'creer'))) { +if ($action == 'add' && $permissiontoadd) { //WYSIWYG Editor require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; print '
'; - print ''; + print ''; print ''; print ''; print ''; diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index 82fc95fa9eb..f33eb263c5c 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -8,7 +8,7 @@ * Copyright (C) 2020 Josep Lluís Amador * Copyright (C) 2022-2023 Solution Libre SAS * Copyright (C) 2024-2025 MDW - * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2024-2026 Frédéric France * Copyright (C) 2024-2025 Alexandre Spangaro * Copyright (C) 2023-2024 Charlene Benke * @@ -37,13 +37,13 @@ require '../main.inc.php'; /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user */ require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/categories.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; // Load translation files required by the page @@ -104,7 +104,6 @@ if (is_numeric($type)) { $type = array_search($type, $object->MAP_ID); // For backward compatibility } -$extrafields = new ExtraFields($db); $extrafields->fetch_name_optionals_label($object->table_element); /* diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 9c06f5b90cb..4b27fa89f96 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -6,7 +6,7 @@ * Copyright (C) 2012 Cedric Salvador * Copyright (C) 2013 Florian Henry * Copyright (C) 2015 Marcos García - * Copyright (C) 2017-2025 Frédéric France + * Copyright (C) 2017-2026 Frédéric France * Copyright (C) 2023 Nick Fragoulis * Copyright (C) 2024-2026 MDW * diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index e4cdd021dc7..6075962331e 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -47,6 +47,7 @@ require '../../main.inc.php'; /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Societe $mysoc * @var Translate $langs @@ -236,7 +237,6 @@ $error = 0; // Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context $object = new Facture($db); $hookmanager->initHooks(array($contextpage)); -$extrafields = new ExtraFields($db); // Fetch optionals attributes and labels $extrafields->fetch_name_optionals_label($object->table_element); diff --git a/htdocs/core/lib/categories.lib.php b/htdocs/core/lib/categories.lib.php index d312df286ea..217f949fcd0 100644 --- a/htdocs/core/lib/categories.lib.php +++ b/htdocs/core/lib/categories.lib.php @@ -1,7 +1,7 @@ * Copyright (C) 2024 MDW - * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2024-2026 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 @@ -86,9 +86,12 @@ function categories_prepare_head(Categorie $object, $type) */ function categoriesadmin_prepare_head() { - global $langs, $conf, $user, $db; + global $langs, $conf, $extrafields, $db; - $extrafields = new ExtraFields($db); + if (!is_object($extrafields)) { + require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; + $extrafields = new ExtraFields($db); + } $extrafields->fetch_name_optionals_label('categorie'); $langs->load("categories"); @@ -110,6 +113,18 @@ function categoriesadmin_prepare_head() $head[$h][2] = 'attributes_categories'; $h++; + // Multilangs Extrafields + if (getDolGlobalInt('MAIN_MULTILANGS')) { + $head[$h][0] = dolBuildUrl(DOL_URL_ROOT.'/categories/admin/categorie_lang_extrafields.php'); + $head[$h][1] = $langs->trans("CategoriesTranslationsExtrafields"); + $nbExtrafields = isset($extrafields->attributes['categorie_lang']['count']) ? $extrafields->attributes['categorie_lang']['count'] : 0; + if ($nbExtrafields > 0) { + $head[$h][1] .= ''.$nbExtrafields.''; + } + $head[$h][2] = 'translationAttributes'; + $h++; + } + // Show more tabs from modules // Entries must be declared in modules descriptor with line // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index f5e1c300c12..5985c78bf57 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -11,7 +11,7 @@ * Copyright (C) 2015-2016 Ferran Marcet * Copyright (C) 2017 Josep Lluís Amador * Copyright (C) 2018-2022 Charlene Benke - * Copyright (C) 2018-2024 Frédéric France + * Copyright (C) 2018-2026 Frédéric France * Copyright (C) 2019-2026 Alexandre Spangaro * Copyright (C) 2023 Nick Fragoulis * Copyright (C) 2023 Joachim Kueter @@ -39,6 +39,16 @@ // Load Dolibarr environment require '../../main.inc.php'; +/** + * @var Conf $conf + * @var DoliDB $db + * @var ExtraFields $extrafields + * @var HookManager $hookmanager + * @var Societe $mysoc + * @var Translate $langs + * @var User $user + */ + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; @@ -50,15 +60,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php'; -/** - * @var Conf $conf - * @var DoliDB $db - * @var HookManager $hookmanager - * @var Societe $mysoc - * @var Translate $langs - * @var User $user - */ - // Load translation files required by the page $langs->loadLangs(array('products', 'bills', 'companies', 'projects', 'banks')); @@ -177,7 +178,6 @@ $now = dol_now(); // Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context $object = new FactureFournisseur($db); $hookmanager->initHooks(array('supplierinvoicelist')); -$extrafields = new ExtraFields($db); $diroutputmassaction = getMultidirTemp($object).'/massgeneration/'.$user->id; diff --git a/htdocs/langs/en_US/categories.lang b/htdocs/langs/en_US/categories.lang index 48fb8d21421..d619c8904d1 100644 --- a/htdocs/langs/en_US/categories.lang +++ b/htdocs/langs/en_US/categories.lang @@ -107,3 +107,4 @@ CategorieListOfType=Categories (or tags) can be used to categorize the objects m NumberOfCategories=Number of tags/categories MyTag=My tag BackToCategoryTypes=Back to types of category +CategoriesTranslationsExtrafields=Categorie translation attributes extrafields diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index 9ff9bf0189c..a98519c895e 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -467,3 +467,4 @@ ProductType=Type of product UseBarCodeForProducts=Use barcode for products UseBarCodeForThirdParties=Use barcode for third parties NotSupportedOnKits=Not supported on kits +ProductLangExtrafieldsSetup=Product translations Extrafields diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 8a8ac4f64bc..f8028c55fc6 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -16,7 +16,7 @@ * Copyright (C) 2016-2022 Charlene Benke * Copyright (C) 2016 Meziane Sof * Copyright (C) 2017 Josep Lluís Amador - * Copyright (C) 2019-2025 Frédéric France + * Copyright (C) 2019-2026 Frédéric France * Copyright (C) 2019-2020 Thibault FOUCART * Copyright (C) 2020 Pierre Ardoin * Copyright (C) 2022 Vincent de Grandpré @@ -46,8 +46,16 @@ // Load Dolibarr environment require '../main.inc.php'; +/** + * @var Conf $conf + * @var DoliDB $db + * @var ExtraFields $extrafields + * @var HookManager $hookmanager + * @var Societe $mysoc + * @var Translate $langs + * @var User $user + */ require_once DOL_DOCUMENT_ROOT.'/core/class/canvas.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/genericobject.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; @@ -57,14 +65,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/modules/product/modules_product.class.php' require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; -/** - * @var Conf $conf - * @var DoliDB $db - * @var HookManager $hookmanager - * @var Societe $mysoc - * @var Translate $langs - * @var User $user - */ if (isModEnabled('propal')) { require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; } @@ -157,7 +157,6 @@ if ($result > 0) { $object = new Product($db); $object->type = $type; // so test later to fill $usercancxxx is correct -$extrafields = new ExtraFields($db); // fetch optionals attributes and labels $extrafields->fetch_name_optionals_label($object->table_element); From 19b8473d260644057daca093380981b653a197fc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 20 Apr 2026 22:17:42 +0200 Subject: [PATCH 33/53] Try a better fix #37791 and fix #37859 --- htdocs/core/class/commoninvoice.class.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index 7c3e0223ff4..92752e4e86c 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -915,6 +915,10 @@ abstract class CommonInvoice extends CommonObject */ public function getVentilExportCompta($mode = 0) { + if (!isModEnabled('accounting')) { + return 0; + } + $alreadydispatched = 0; $type = 'customer_invoice'; From ce3d82417ed20bdf3f859f421dab5bb03fc3c769 Mon Sep 17 00:00:00 2001 From: John BOTELLA <68917336+thersane-john@users.noreply.github.com> Date: Mon, 20 Apr 2026 22:22:06 +0200 Subject: [PATCH 34/53] New : js hook for setup options (#37940) Co-authored-by: Laurent Destailleur --- htdocs/core/js/lib_head.js.php | 14 +++++++++++++- .../dolibarr-js-context/dolibarr-context.umd.js | 14 ++++++++++++-- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/htdocs/core/js/lib_head.js.php b/htdocs/core/js/lib_head.js.php index d2958d65ce2..24a4501038d 100644 --- a/htdocs/core/js/lib_head.js.php +++ b/htdocs/core/js/lib_head.js.php @@ -694,6 +694,12 @@ function setConstant(url, code, input, entity, strict, forcereload, userid, toke }); } }); + + // Execute js context Dolibarr Hooks + if (typeof Dolibarr != 'undefined') { + Dolibarr.executeHook('setConstant', {url : saved_url, code, input, entity, strict, forcereload, userid, token, value, userconst}); + } + if (forcereload) { var url = window.location.href; @@ -726,7 +732,7 @@ function setConstant(url, code, input, entity, strict, forcereload, userid, toke //location.reload(); return false; } - }).fail(function(error) { console.log("Error, we force reload"); location.reload(); }); /* When it fails, we always force reload to have setEventErrorMessages in session visible */ + }).fail(function(error) { console.error("Error, we force reload"); location.reload(); }); /* When it fails, we always force reload to have setEventErrorMessages in session visible */ return true; } @@ -800,6 +806,12 @@ function delConstant(url, code, input, entity, strict, forcereload, userid, toke }); } }); + + // Execute js context Dolibarr Hooks + if (typeof Dolibarr != 'undefined') { + Dolibarr.executeHook('delConstant', {url : saved_url, code, input, entity, strict, forcereload, userid, token, userconst}); + } + if (forcereload) { var url = window.location.href; if (url.indexOf('dol_resetcache') < 0) { diff --git a/htdocs/public/includes/dolibarr-js-context/dolibarr-context.umd.js b/htdocs/public/includes/dolibarr-js-context/dolibarr-context.umd.js index 8823bcc684b..53675753c63 100644 --- a/htdocs/public/includes/dolibarr-js-context/dolibarr-context.umd.js +++ b/htdocs/public/includes/dolibarr-js-context/dolibarr-context.umd.js @@ -229,8 +229,18 @@ /** * Internal logger - * Only prints when debug mode is enabled - * @param {string} msg + * Outputs logs only when debug mode is enabled. + * + * Why use Dolibarr.log instead of console.log? + * Dolibarr.log avoids console noise caused by the Dolibarr core context + * or internal notices that can easily spam the console. + * Dolibarr.log is primarily intended to be used by the Dolibarr context itself, + * providing a unified logging mechanism across the application. + * + * This allows module developers to focus on their own logs (with console.log) + * without being distracted by unrelated global Dolibarr activity. + * + * @param {string} msg Log message */ log(msg) { if (_debug) console.log(`Dolibarr: ${msg}`); From 295bbc08ecd453feb1f483b3238c33c6d9430d3a Mon Sep 17 00:00:00 2001 From: MDW Date: Tue, 21 Apr 2026 02:28:35 +0200 Subject: [PATCH 35/53] Qual: Fix PHPStan and Phan notices (#37950) * Qual: Update GETPOST calls to handle hint array type # Qual: Update GETPOST calls to handle hint array type - Updated GETPOST calls for 'amounts' and 'multicurrency_amounts' to explicitly handle array inputs by adding the 'array' type parameter This fixes PHPStan notices where expressions expect an array. * Qual: Set type for status label mapping in LignePrelevement (PHPStan) # Qual: Set type for status label mapping in LignePrelevement (PHPStan) Added type hint to property `$labelStatus` * Qual: Add type hints to datec and datep properties in PaymentSocialContribution # Qual: Add type hints to datec and datep properties in PaymentSocialContribution Added type hints to datec and datep properties. * Qual: Add type hint to MIME mapping for image file extensions # Qual: Add type hint to MIME mapping for image file extensions Added type hint to `$image_types` * Qual: Better type hint for getAllItemsLinkedByObjectID method # Qual: Better type hint for getAllItemsLinkedByObjectID method The return type annotation for the getAllItemsLinkedByObjectID method has been updated from 'array|int' to 'string[]|int'. * Qual: Better type hint for fetchAll return value # Qual: Better type hint for fetchAll return value Suggest thet fetchAll returns list of objects * Qual: Remove array from return value hint * Qual: Add missing type hints to Notify * Qual: Cast resource IDs to integers in getAllResourcesOfWorkstation # Qual: Cast resource IDs to integers in getAllResourcesOfWorkstation Ensure returned value is list of ints as parent::getAllItemsLinkedByObjectID does not ensure value type. * Qual: Ensure correct return type for getAllGroupsOfWorkstation * Qual: Improve typing hints * Qual: Improve typing hints, ignore some notices * Qual: Fix argument type * Qual: Improve type hints * Qual: Improve typing hints * Qual: Add missing type hint * Qual: Update Phan baseline * Qual: Remove redundant exit (PHPStan, Phan) --- dev/tools/phan/baseline.txt | 1 - htdocs/compta/ajaxpayment.php | 6 +++--- .../class/ligneprelevement.class.php | 4 ++++ .../class/paymentsocialcontribution.class.php | 11 ++++++++-- htdocs/core/class/CMailFile.class.php | 1 + htdocs/core/class/cleadstatus.class.php | 4 ++-- htdocs/core/class/commonobject.class.php | 4 ++-- htdocs/core/class/notify.class.php | 20 ++++++++++--------- htdocs/core/class/rssparser.class.php | 14 +++++++++---- htdocs/core/db/mysqli.class.php | 2 +- .../connectors/php/config.inc.php | 2 +- htdocs/core/modules/modQuickMemo.class.php | 3 ++- htdocs/hrm/class/position.class.php | 6 +++--- htdocs/hrm/class/skill.class.php | 4 ++-- .../class/workstationresource.class.php | 2 +- .../class/workstationusergroup.class.php | 2 +- 16 files changed, 53 insertions(+), 33 deletions(-) diff --git a/dev/tools/phan/baseline.txt b/dev/tools/phan/baseline.txt index 62f3427736b..c0b4c86a907 100644 --- a/dev/tools/phan/baseline.txt +++ b/dev/tools/phan/baseline.txt @@ -72,7 +72,6 @@ return [ 'htdocs/core/class/html.formcompany.class.php' => ['PhanUndeclaredProperty'], 'htdocs/core/class/html.formmail.class.php' => ['PhanUndeclaredProperty'], 'htdocs/core/class/openid.class.php' => ['PhanTypeMismatchArgument'], - 'htdocs/core/class/rssparser.class.php' => ['PhanTypeMismatchArgument'], 'htdocs/core/class/timespent.class.php' => ['PhanUndeclaredMethod', 'PhanUndeclaredProperty'], 'htdocs/core/lib/admin.lib.php' => ['PhanUndeclaredProperty'], 'htdocs/core/lib/files.lib.php' => ['PhanUndeclaredProperty'], diff --git a/htdocs/compta/ajaxpayment.php b/htdocs/compta/ajaxpayment.php index 9e53db01e82..32f56331ba2 100644 --- a/htdocs/compta/ajaxpayment.php +++ b/htdocs/compta/ajaxpayment.php @@ -1,6 +1,6 @@ - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2026 MDW * Copyright (C) 2024-2026 Frédéric France * Copyright (C) 2026 Lenin Rivas * @@ -59,7 +59,7 @@ $langs->load('compta'); //init var $invoice_type = GETPOSTINT('invoice_type'); $amountPayment = GETPOST('amountPayment'); -$amounts = GETPOST('amounts'); // from text inputs : invoice amount payment (check required) +$amounts = GETPOST('amounts', 'array'); // from text inputs : invoice amount payment (check required) $remains = GETPOST('remains'); // from dolibarr's object (no need to check) $currentInvId = GETPOST('imgClicked'); // from DOM elements : imgId (equals invoice id) @@ -69,7 +69,7 @@ $amountPayment = $amountPayment != '' ? (is_numeric(price2num($amountPayment)) ? // Multicurrency LRR $multicurrency = GETPOSTINT('multicurrency'); $multicurrencyAmountPayment = GETPOST('multicurrency_amountPayment'); -$multicurrencyAmounts = GETPOST('multicurrency_amounts'); // from text inputs : invoice amount payment (check required) +$multicurrencyAmounts = GETPOST('multicurrency_amounts', 'array'); // from text inputs : invoice amount payment (check required) $multicurrencyRemains = GETPOST('multicurrency_remains'); // from dolibarr's object (no need to check) // Getting the posted keys=>values, sanitize the ones who are from text inputs diff --git a/htdocs/compta/prelevement/class/ligneprelevement.class.php b/htdocs/compta/prelevement/class/ligneprelevement.class.php index a470531a398..4a814b4a5f2 100644 --- a/htdocs/compta/prelevement/class/ligneprelevement.class.php +++ b/htdocs/compta/prelevement/class/ligneprelevement.class.php @@ -3,6 +3,7 @@ * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2010-2011 Juanjo Menent * Copyright (C) 2015 Marcos García + * Copyright (C) 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 @@ -66,6 +67,9 @@ class LignePrelevement */ public $db; + /** + * @var string[] Map status index to localized labels + */ public $labelStatus = array(); const STATUS_DRAFT = 0; diff --git a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php index 0b6182c94f4..ae49ad112c2 100644 --- a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php +++ b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2007 Laurent Destailleur * Copyright (C) 2022 Alexandre Spangaro * Copyright (C) 2024-2025 Frédéric France - * Copyright (C) 2024 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 @@ -59,7 +59,14 @@ class PaymentSocialContribution extends CommonObject */ public $fk_charge; + /** + * @var int|'' Date of creation + */ public $datec = ''; + + /** + * @var int|'' Date of payment + */ public $datep = ''; /** @@ -137,7 +144,7 @@ class PaymentSocialContribution extends CommonObject public $chid; /** - * @var int|string datepaye + * @var int|'' Payment date when creating */ public $datepaye; diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index d81b8d5ce98..efb970ee10f 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -189,6 +189,7 @@ class CMailFile public $html_images = array(); /** @var array */ public $images_encoded = array(); + /** @var array Filename extension to MIME mapping */ public $image_types = array( 'gif' => 'image/gif', 'jpg' => 'image/jpeg', diff --git a/htdocs/core/class/cleadstatus.class.php b/htdocs/core/class/cleadstatus.class.php index 6d131c0a3c4..43a745aa92c 100644 --- a/htdocs/core/class/cleadstatus.class.php +++ b/htdocs/core/class/cleadstatus.class.php @@ -1,7 +1,7 @@ * Copyright (C) 2020 Florian HENRY - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2026 MDW * Copyright (C) 2025 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -183,7 +183,7 @@ class CLeadStatus extends CommonDict * @param int $offset Offset * @param string $filter Filter USF * @param string $filtermode Filter mode (AND or OR) - * @return array|int int <0 if KO, array of pages if OK + * @return self[]|int int <0 if KO, array of pages if OK */ public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, $filter = '', $filtermode = 'AND') { diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 2386a7d0d18..16e78a972f5 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -4914,7 +4914,7 @@ abstract class CommonObject * @param string $field_select name of field we need to get a list * @param string $field_where name of field of object we need to get linked items * @param string $table_element name of association table - * @return array|int Array of record, -1 if empty + * @return string[]|int Array of record, -1 if empty */ public static function getAllItemsLinkedByObjectID($fk_object_where, $field_select, $field_where, $table_element) { @@ -4946,7 +4946,7 @@ abstract class CommonObject * @param int $fk_object_where id of object we need to get linked items * @param string $field_where name of field of object we need to get linked items * @param string $table_element name of association table - * @return array|int Array of record, -1 if empty + * @return int<-1,max> Array of records, -1 if empty argument */ public static function getCountOfItemsLinkedByObjectID($fk_object_where, $field_where, $table_element) { diff --git a/htdocs/core/class/notify.class.php b/htdocs/core/class/notify.class.php index ac91a67dce5..9fdc693b783 100644 --- a/htdocs/core/class/notify.class.php +++ b/htdocs/core/class/notify.class.php @@ -139,7 +139,9 @@ class Notify */ public $fk_project; - // This codes actions are defined into table llx_notify_def + /** + * @var string[] These codes actions are defined in table llx_notify_def + */ public static $arrayofnotifsupported = array( 'BILL_CANCEL', 'BILL_VALIDATE', @@ -185,10 +187,10 @@ class Notify * Return message that say how many notification (and to which email) will occurs on requested event. * This is to show confirmation messages before event is recorded. * - * @param string $action Id of action in llx_c_action_trigger - * @param int $socid Id of third party - * @param Object $object Object the notification is about - * @return string Message + * @param string $action Id of action in llx_c_action_trigger + * @param int $socid Id of third party + * @param ?CommonObject $object Object the notification is about + * @return string Message */ public function confirmMessage($action, $socid, $object) { @@ -451,10 +453,10 @@ class Notify * * @param string $notifcode Code of action in llx_c_action_trigger (new usage) or Id of action in llx_c_action_trigger (old usage) * @param int $socid Id of third party or 0 for all thirdparties or -1 for no thirdparties - * @param CommonObject $object Object the notification is about (need it to check threshold value of some notifications) + * @param ?CommonObject $object Object the notification is about (need it to check threshold value of some notifications) * @param int $userid Id of user or 0 for all users or -1 for no users - * @param array $scope Scope where to search - * @return array|int Return integer <0 if KO, array of notifications to send if OK + * @param string[] $scope Scope where to search + * @return array|-1 Return integer <0 if KO, array of notifications to send if OK */ public function getNotificationsArray($notifcode, $socid = 0, $object = null, $userid = 0, $scope = array('thirdparty', 'user', 'global')) { @@ -547,7 +549,7 @@ class Notify $newval2 = trim($obj->email); $isvalid = isValidEmail($newval2); if (empty($resarray[$newval2])) { - $resarray[$newval2] = array('type' => 'touser', 'code' => trim($obj->code), 'emaildesc' => 'User id '.$obj->rowid, 'email' => $newval2, 'userid' => $obj->rowid, 'isemailvalid' => $isvalid); + $resarray[$newval2] = array('type' => 'touser', 'code' => trim($obj->code), 'emaildesc' => 'User id '.$obj->rowid, 'email' => $newval2, 'userid' => (int) $obj->rowid, 'isemailvalid' => $isvalid); } } $i++; diff --git a/htdocs/core/class/rssparser.class.php b/htdocs/core/class/rssparser.class.php index c57011ab8ba..fd8e505d015 100644 --- a/htdocs/core/class/rssparser.class.php +++ b/htdocs/core/class/rssparser.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2026 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -99,6 +99,9 @@ class RssParser */ private $current_namespace; + /** + * @var array|array>> + */ public $items = array(); /** * @var array|array> @@ -811,11 +814,14 @@ class RssParser } } else { if (!empty($this->initem)) { - $this->concat($this->current_item[$el], $text); + // @phpstan-ignore-next-line argument.type + $this->concat($this->current_item[$el], $text); // @phan-suppress-current-line PhanTypeMismatchArgument } elseif (!empty($this->intextinput)) { - $this->concat($this->textinput[$el], $text); + // @phpstan-ignore-next-line argument.type + $this->concat($this->textinput[$el], $text); // @phan-suppress-current-line PhanTypeMismatchArgument } elseif (!empty($this->inimage)) { - $this->concat($this->image[$el], $text); + // @phpstan-ignore-next-line argument.type + $this->concat($this->image[$el], $text); // @phan-suppress-current-line PhanTypeMismatchArgument } elseif (!empty($this->inchannel)) { $this->concat($this->channel[$el], $text); } diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index 874f9437067..2a3bfa71561 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -1379,7 +1379,7 @@ if (class_exists('mysqli')) { } if (strpos($host, 'ssl://') === 0) { $host = substr($host, 6); - parent::options(MYSQLI_OPT_SSL_VERIFY_SERVER_CERT, false); + parent::options(MYSQLI_OPT_SSL_VERIFY_SERVER_CERT, 0); // Suppress false positive @phan-suppress-next-line PhanTypeMismatchArgumentInternalProbablyReal parent::ssl_set(null, null, "", null, null); $flags = MYSQLI_CLIENT_SSL; diff --git a/htdocs/core/filemanagerdol/connectors/php/config.inc.php b/htdocs/core/filemanagerdol/connectors/php/config.inc.php index 7cb8b015ec3..377646fe9a5 100644 --- a/htdocs/core/filemanagerdol/connectors/php/config.inc.php +++ b/htdocs/core/filemanagerdol/connectors/php/config.inc.php @@ -3,6 +3,7 @@ * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2010 Frederico Caldeira Knabben * Copyright (C) 2024 Frédéric France + * Copyright (C) 2026 MDW * * == BEGIN LICENSE == * @@ -52,7 +53,6 @@ $entity = ((!empty($_SESSION['dol_entity']) && $_SESSION['dol_entity'] > 1) ? $_ if (!empty($user->admin) && !$user->hasRight('website', 'write')) { accessforbidden('Need to be admin or having write permission on website module'); - exit; } diff --git a/htdocs/core/modules/modQuickMemo.class.php b/htdocs/core/modules/modQuickMemo.class.php index 6aebd38cd54..54996a88b71 100644 --- a/htdocs/core/modules/modQuickMemo.class.php +++ b/htdocs/core/modules/modQuickMemo.class.php @@ -3,6 +3,7 @@ * Copyright (C) 2018-2019 Nicolas ZABOURI * Copyright (C) 2019-2024 Frédéric France * Copyright (C) 2026 John BOTELLA + * Copyright (C) 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 @@ -98,7 +99,7 @@ class modQuickMemo extends DolibarrModules } $compatibleHooks = array_unique($compatibleHooks); // Security check - $compatibleHooks = array_filter($compatibleHooks, function (string $k) { + $compatibleHooks = array_filter($compatibleHooks, /** @return int|false */ static function (string $k) { return preg_match('/^[a-zA-Z0-9_]+$/', $k); }); diff --git a/htdocs/hrm/class/position.class.php b/htdocs/hrm/class/position.class.php index 6d55b21309a..a07389708e3 100644 --- a/htdocs/hrm/class/position.class.php +++ b/htdocs/hrm/class/position.class.php @@ -398,7 +398,7 @@ class Position extends CommonObject * @param string $filter Filter as an Universal Search string. * Example: '((client:=:1) OR ((client:>=:2) AND (client:<=:3))) AND (client:!=:8) AND (nom:like:'a%')' * @param string $filtermode No more used - * @return array|int int <0 if KO, array of pages if OK + * @return self[]|int int <0 if KO, array of pages if OK */ public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, $filter = '', $filtermode = 'AND') { @@ -985,7 +985,7 @@ class Position extends CommonObject /** * Create an array of lines * - * @return array|int array of lines if OK, <0 if KO + * @return CommonObject[]|int array of lines if OK, <0 if KO */ public function getLinesArray() { @@ -1063,7 +1063,7 @@ class Position extends CommonObject * getForUser * * @param int $userid id of user we need to get position list - * @return array|int of positions of user with for each of them the job fetched into that array + * @return self[]|int of positions of user with for each of them the job fetched into that array */ public function getForUser($userid) { diff --git a/htdocs/hrm/class/skill.class.php b/htdocs/hrm/class/skill.class.php index 5e7ed1d884f..aca7ccc0139 100644 --- a/htdocs/hrm/class/skill.class.php +++ b/htdocs/hrm/class/skill.class.php @@ -432,7 +432,7 @@ class Skill extends CommonObject /** * Load object lines in memory from the database * - * @return array|int Return integer <0 if KO, array of skill level found + * @return CommonObject[]|int Return integer <0 if KO, array of skill level found */ public function fetchLines() { @@ -991,7 +991,7 @@ class Skill extends CommonObject /** * Create an array of lines * - * @return array|int array of lines if OK, <0 if KO + * @return Skilldet[]|int array of lines if OK, <0 if KO */ public function getLinesArray() { diff --git a/htdocs/workstation/class/workstationresource.class.php b/htdocs/workstation/class/workstationresource.class.php index 5dc2ad8840c..b72bf804de1 100644 --- a/htdocs/workstation/class/workstationresource.class.php +++ b/htdocs/workstation/class/workstationresource.class.php @@ -95,7 +95,7 @@ class WorkstationResource extends CommonObject { global $db; $obj = new self($db); - return parent::getAllItemsLinkedByObjectID($fk_workstation, 'fk_resource', 'fk_workstation', $obj->table_element); + return array_map('intval', parent::getAllItemsLinkedByObjectID($fk_workstation, 'fk_resource', 'fk_workstation', $obj->table_element)); } /** diff --git a/htdocs/workstation/class/workstationusergroup.class.php b/htdocs/workstation/class/workstationusergroup.class.php index d3598ff50e6..9b62594540a 100644 --- a/htdocs/workstation/class/workstationusergroup.class.php +++ b/htdocs/workstation/class/workstationusergroup.class.php @@ -95,7 +95,7 @@ class WorkstationUserGroup extends CommonObject global $db; $obj = new self($db); - return parent::getAllItemsLinkedByObjectID($fk_workstation, 'fk_usergroup', 'fk_workstation', $obj->table_element); + return array_map('intval', parent::getAllItemsLinkedByObjectID($fk_workstation, 'fk_usergroup', 'fk_workstation', $obj->table_element)); } /** From 9bf8103dad76fc628e836f4c95bbe284ada7db29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 21 Apr 2026 11:47:12 +0200 Subject: [PATCH 36/53] clean code (#37947) * fix categories translations * fix categories translations * fix categories translations * fix categories translations * Update traduction.php * Update traduction.php * Update photos.php * fix categories translations * fix categories translations * fix categories translations * fix categories translations * fix categories translations * fix categories translations * fix categories translations * fix categories translations * fix categories translations * fix categories translations * fix categories translations * fix categories translations * fix categories translations * fix categories translations * fix categories translations * fix categories translations * fix categories translations * fix categories translations * fix categories translations * fix * fix * fix --------- Co-authored-by: Laurent Destailleur --- htdocs/core/class/commonobject.class.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 16e78a972f5..f41bc0c7bfc 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -6957,7 +6957,7 @@ abstract class CommonObject */ public function insertExtraFields($trigger = '', $userused = null) { - global $langs, $user; + global $langs, $extrafields, $user; if (getDolGlobalString('MAIN_EXTRAFIELDS_DISABLED') || empty($this->array_options)) { return 0; @@ -6971,8 +6971,10 @@ abstract class CommonObject // Check parameters $langs->load('admin'); - require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; - $extrafields = new ExtraFields($this->db); + if (!isset($extrafields) || !is_object($extrafields)) { + require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; + $extrafields = new ExtraFields($this->db); + } $target_extrafields = $extrafields->fetch_name_optionals_label($this->table_element); // Eliminate copied source object extra fields that do not exist in target object @@ -7436,7 +7438,7 @@ abstract class CommonObject */ public function updateExtraField($key, $trigger = null, $userused = null) { - global $langs, $user, $hookmanager; + global $langs, $user, $extrafields, $hookmanager; if (getDolGlobalString('MAIN_EXTRAFIELDS_DISABLED')) { return 0; @@ -7451,8 +7453,10 @@ abstract class CommonObject if (!empty($this->array_options) && isset($this->array_options["options_".$key])) { // Check parameters $langs->load('admin'); - require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; - $extrafields = new ExtraFields($this->db); + if (!isset($extrafields) || !is_object($extrafields)) { + require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; + $extrafields = new ExtraFields($this->db); + } $extrafields->fetch_name_optionals_label($this->table_element); $value = $this->array_options["options_".$key]; From 29aa7b2938d594dabce20557e5529cb2bcf3ebf1 Mon Sep 17 00:00:00 2001 From: Jon Bendtsen Date: Tue, 21 Apr 2026 11:48:00 +0200 Subject: [PATCH 37/53] UXUI Change mass mailing icon to bulk-mail (#37951) Co-authored-by: Jon Bendtsen --- htdocs/comm/mailing/class/mailing.class.php | 2 +- htdocs/comm/mailing/list.php | 2 +- htdocs/core/menus/standard/eldy.lib.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/comm/mailing/class/mailing.class.php b/htdocs/comm/mailing/class/mailing.class.php index fb053cfcf37..dcc05eb1e5f 100644 --- a/htdocs/comm/mailing/class/mailing.class.php +++ b/htdocs/comm/mailing/class/mailing.class.php @@ -47,7 +47,7 @@ class Mailing extends CommonObject /** * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png */ - public $picto = 'email'; + public $picto = 'mail-bulk'; /** * @var string Type of message ('email', 'sms') diff --git a/htdocs/comm/mailing/list.php b/htdocs/comm/mailing/list.php index 1c377402289..fd4fdbba541 100644 --- a/htdocs/comm/mailing/list.php +++ b/htdocs/comm/mailing/list.php @@ -486,7 +486,7 @@ if ($user->hasRight('mailing', 'creer')) { $newcardbutton .= dolGetButtonTitle($langs->trans('NewMailing'), '', 'fa fa-plus-circle', $url); } -print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_email', 0, $newcardbutton, '', $limit, 0, 0, 1); +print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1); // Add code for pre mass action (confirmation or email presend form) $topicmail = "SendMailingRef"; diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 13fe1f80e5c..8c12564b2e9 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -2588,7 +2588,7 @@ function get_left_menu_tools($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu $titleindex .= ' | '.$langs->trans("SMSings"); $titlenew .= ' | '.$langs->trans("NewSMSing"); } - $newmenu->add(dolBuildUrl('/comm/mailing/index.php', ['leftmenu' => 'mailing']), $titleindex, 0, $user->hasRight('mailing', 'lire'), '', $mainmenu, 'mailing', 15, '', '', '', img_picto('', 'email', 'class="paddingright pictofixedwidth"')); + $newmenu->add(dolBuildUrl('/comm/mailing/index.php', ['leftmenu' => 'mailing']), $titleindex, 0, $user->hasRight('mailing', 'lire'), '', $mainmenu, 'mailing', 15, '', '', '', img_picto('', 'mail-bulk', 'class="paddingright pictofixedwidth"')); $newmenu->add(dolBuildUrl('/comm/mailing/card.php', ['leftmenu' => 'mailing', 'action' => 'create']), $titlenew, 1, $user->hasRight('mailing', 'creer')); $newmenu->add(dolBuildUrl('/comm/mailing/list.php', ['leftmenu' => 'mailing']), $titlelist, 1, $user->hasRight('mailing', 'lire')); } From 59ea1f890d682d3b6ef18107211c27423be0f577 Mon Sep 17 00:00:00 2001 From: Jon Bendtsen Date: Tue, 21 Apr 2026 11:52:20 +0200 Subject: [PATCH 38/53] UXUI Improve public ticket message list (#37926) * Improve UXUI on public ticket interface * Use the style method to remove the border in border to preserve the edit pencil * Switching back to 2 column layout * reduce changes * Identical look'n'feel between just viewing the list and editing a new response * Attempt at fixing phan --------- Co-authored-by: Jon Bendtsen --- htdocs/core/class/html.formticket.class.php | 3 +-- htdocs/public/ticket/view.php | 8 +++++--- htdocs/ticket/class/actions_ticket.class.php | 19 ++++++++++++++----- 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index 4b05e87ba90..9e6c1fdf5d6 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -1910,7 +1910,7 @@ class FormTicket $formai = new FormAI($this->db); $formmail->withfckeditor = $ckeditorenabledforticket ? 1 : 0; - $formmail->withlayout = $ckeditorenabledforticket ? 'email' : ''; + $formmail->withlayout = (string) $ckeditorenabledforticket ? 'email' : ''; $formmail->withaiprompt = isModEnabled('ai') ? 'text' : ''; $formai = new FormAI($this->db); @@ -1922,7 +1922,6 @@ class FormTicket $htmlname = 'message'; $formai->substit = $this->substit; - //$formai->substit_lines = $this->substit_lines; // Fill $out $db = $this->db; diff --git a/htdocs/public/ticket/view.php b/htdocs/public/ticket/view.php index 56f8fab07a5..d02be87a5a1 100644 --- a/htdocs/public/ticket/view.php +++ b/htdocs/public/ticket/view.php @@ -255,7 +255,7 @@ llxHeaderTicket($langs->trans("Tickets"), "", 0, 0, $arrayofjs, $arrayofcss); if ($action == "view_ticket" || $action == "presend" || $action == "close" || $action == "confirm_public_close") { if ($display_ticket) { - print ''; + print ''; print '
'; // Confirmation close @@ -447,14 +447,16 @@ if ($action == "view_ticket" || $action == "presend" || $action == "close" || $a // Message list print '
'; + print '

'; print load_fiche_titre($langs->trans('TicketMessagesList'), '', 'conversation'); + print '

'; print '
'; $object->viewTicketMessages(false, true, $object->dao); print '
'; } else { - print ''; + print ''; print '
'; print ''; @@ -462,7 +464,7 @@ if ($action == "view_ticket" || $action == "presend" || $action == "close" || $a print '
'; } } else { - print ''; + print ''; print '
'; print '
'.$langs->trans("TicketPublicMsgViewLogIn").'
'; diff --git a/htdocs/ticket/class/actions_ticket.class.php b/htdocs/ticket/class/actions_ticket.class.php index db112e04084..cd02bcf4dc0 100644 --- a/htdocs/ticket/class/actions_ticket.class.php +++ b/htdocs/ticket/class/actions_ticket.class.php @@ -221,10 +221,10 @@ class ActionsTicket extends CommonHookActions print '
'.($s ? $s.' ' : '')." ".$langs->trans('Language_'.$key).": ".''.img_delete('', '').'
'.($s ? $s.' ' : '').' '.$langs->trans('Language_'.$key).': $object->id, 'action' => 'delete', 'langtodelete' => $key, 'type' => $type], true).'">'.img_delete('', '').'
'.$langs->trans('Label').''.($object->multilangs[$key]["label"] ?? '').'
'.$langs->trans('Description').''.($object->multilangs[$key]["description"] ?? '').'
'; print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; print ''; // Customer proposals @@ -550,7 +552,7 @@ function show_stats_for_company($product, $socid) } $langs->load("propal"); print ''."\n"; + print ''."\n"; // Lastname - print ''."\n"; + print ''."\n"; // EMail print ''; - print ''."\n"; + print ''."\n"; // Login if (!getDolGlobalString('ADHERENT_LOGIN_NOT_REQUIRED')) { From 3e7292111733f1aa33e583716cccc7453b12bf6e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 21 Apr 2026 14:50:10 +0200 Subject: [PATCH 43/53] FIX Conflict between the old default amount (set globaly) and default amount per type of membership. Keep only the second one. --- htdocs/adherents/admin/website.php | 16 ++-------------- htdocs/public/members/new.php | 18 ++---------------- htdocs/public/payment/newpayment.php | 5 ----- htdocs/public/payment/paymentok.php | 4 ---- 4 files changed, 4 insertions(+), 39 deletions(-) diff --git a/htdocs/adherents/admin/website.php b/htdocs/adherents/admin/website.php index a370280973c..a67de387d6e 100644 --- a/htdocs/adherents/admin/website.php +++ b/htdocs/adherents/admin/website.php @@ -75,11 +75,8 @@ if ($action == 'setMEMBER_ENABLE_PUBLIC') { if ($action == 'update') { $public = GETPOST('MEMBER_ENABLE_PUBLIC'); - if (GETPOST('MEMBER_NEWFORM_AMOUNT') !== '') { - $amount = price2num(GETPOST('MEMBER_NEWFORM_AMOUNT'), 'MT', 2); - } else { - $amount = ''; - } + $amount = ''; + $minamount = GETPOST('MEMBER_MIN_AMOUNT'); $publiccounters = GETPOST('MEMBER_COUNTERS_ARE_PUBLIC'); $showtable = GETPOST('MEMBER_SHOW_TABLE'); @@ -89,7 +86,6 @@ if ($action == 'update') { $forcemorphy = GETPOST('MEMBER_NEWFORM_FORCEMORPHY', 'aZ09'); $res = dolibarr_set_const($db, "MEMBER_ENABLE_PUBLIC", $public, 'chaine', 0, '', $conf->entity); - $res = dolibarr_set_const($db, "MEMBER_NEWFORM_AMOUNT", $amount, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "MEMBER_MIN_AMOUNT", $minamount, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "MEMBER_COUNTERS_ARE_PUBLIC", $publiccounters, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "MEMBER_SKIP_TABLE", $showtable ? 0 : 1, 'chaine', 0, '', $conf->entity); // Logic is reversed for retrocompatibility: "skip -> show" @@ -275,14 +271,6 @@ if (getDolGlobalString('MEMBER_ENABLE_PUBLIC')) { print $form->selectarray("MEMBER_NEWFORM_FORCEMORPHY", $morphys, $forcenature, $langs->trans("No"), 0, 0, '', 0, 0, 0, '', 'width200'); print "\n"; - // Amount - print '\n"; - // Min amount print ''; // Owner $out .= ''; // Type $out .= ''; print ''; + print $form->showPhoneInput($object->phone_pro, 'phone_pro', $object->country_id, 'object_phoning', 'maxwidth150 widthcentpercentminusx'); + print ''; if ($conf->browser->layout == 'phone') { print ''; } + print ''; print ''; + print $form->showPhoneInput($object->phone_perso, 'phone_perso', $object->country_id, 'object_phoning', 'maxwidth150 widthcentpercentminusx'); + print ''; print ''; print ''; print ''; + print $form->showPhoneInput($object->phone_mobile, 'phone_mobile', $object->country_id, 'object_phoning_mobile', 'maxwidth150 widthcentpercentminusx'); + print ''; if ($conf->browser->layout == 'phone') { print ''; } + print ''; print ''; + print $form->showPhoneInput($object->fax, 'fax', $object->country_id, 'object_phoning_fax', 'maxwidth150 widthcentpercentminusx'); + print ''; print ''; if (((isset($objsoc->typent_code) && $objsoc->typent_code == 'TE_PRIVATE') || getDolGlobalString('CONTACT_USE_COMPANY_ADDRESS')) && dol_strlen(trim($object->email)) == 0) { @@ -1072,27 +1074,29 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { // Phone print ''; print ''; + print $form->showPhoneInput($object->phone_pro, 'phone_pro', $object->country_id, 'object_phoning', 'maxwidth150', 80); + print ''; if ($conf->browser->layout == 'phone') { print ''; } - print ''; + + print ''; print ''; + print $form->showPhoneInput($object->phone_perso, 'phone_perso', $object->country_id, 'object_phoning', 'maxwidth150', 80); + print ''; print ''; print ''; + print $form->showPhoneInput($object->phone_mobile, 'phone_mobile', $object->country_id, 'object_phoning_mobile', 'maxwidth150', 80); + print ''; if ($conf->browser->layout == 'phone') { print ''; } + print ''; print ''; + print $form->showPhoneInput($object->fax, 'fax', $object->country_id, 'object_phoning_fax', 'maxwidth150', 80); + print ''; // EMail print ''; diff --git a/htdocs/core/ajax/getphonecode.php b/htdocs/core/ajax/getphonecode.php new file mode 100644 index 00000000000..b45c87829db --- /dev/null +++ b/htdocs/core/ajax/getphonecode.php @@ -0,0 +1,58 @@ + + * + * 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; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/core/ajax/getphonecode.php + * \brief Returns JSON phone_code for a given country_id + */ + +if (!defined('NOTOKENRENEWAL')) { + define('NOTOKENRENEWAL', '1'); // Disables token renewal +} +if (!defined('NOREQUIREMENU')) { + define('NOREQUIREMENU', '1'); +} +if (!defined('NOREQUIREAJAX')) { + define('NOREQUIREAJAX', '1'); +} + +// Load Dolibarr environment +require '../../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/phone.lib.php'; +/** + * @var DoliDB $db + * @var User $user + */ + +$country_id = GETPOSTINT('country_id'); + +// Security check - user must be logged in +if (empty($user->id)) { + http_response_code(403); + echo json_encode(array('error' => 'Not authorized')); + exit; +} + +/* + * View + */ + +top_httphead('application/json'); + +$phone_code = dol_get_phone_code_from_country($db, $country_id); + +echo json_encode(array('phone_code' => $phone_code)); diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index f841299868b..2edd9c39a4d 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -26,6 +26,7 @@ * Copyright (C) 2024-2026 MDW * Copyright (C) 2024 William Mead * Copyright (C) 2026 Lenin Rivas + * Copyright (C) 2026 Open-Dsi * * 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 @@ -98,6 +99,11 @@ class Form /** @var array */ public $cache_rule_for_lines_dates = array(); + /** + * @var bool Whether the shared phone input JS (country-sync) has been emitted + */ + private $phoneInputSharedJsLoaded = false; + /** * Constructor @@ -1114,6 +1120,285 @@ class Form return $out; } + /** + * Return a select list of country phone calling codes + * + * @param string $selected Pre-selected phone code value (e.g. "+33") + * @param string $htmlname Name of HTML select element + * @param string $morecss More CSS classes + * @param int $showempty Show empty option (1) or not (0) + * @param int $country_id_hint Country ID to prefer when multiple countries share a code + * @return string HTML select string + */ + public function selectPhoneCode($selected = '', $htmlname = 'phone_code', $morecss = 'maxwidth150', $showempty = 0, $country_id_hint = 0) + { + global $langs; + + $langs->load("dict"); + + $out = ''; + $codeArray = array(); + $favorite = array(); + $label = array(); + $atleastonefavorite = 0; + + $sql = "SELECT rowid, code, label, phone_code, favorite, trunk_prefix"; + $sql .= " FROM ".$this->db->prefix()."c_country"; + $sql .= " WHERE active > 0 AND phone_code IS NOT NULL AND phone_code != ''"; + + dol_syslog(get_class($this)."::selectPhoneCode", LOG_DEBUG); + $resql = $this->db->query($sql); + if ($resql) { + $num = $this->db->num_rows($resql); + $i = 0; + while ($i < $num) { + $obj = $this->db->fetch_object($resql); + + $translabel = ($obj->code && $langs->transnoentitiesnoconv("Country".$obj->code) != "Country".$obj->code) ? $langs->transnoentitiesnoconv("Country".$obj->code) : $obj->label; + + $codeArray[$i]['rowid'] = $obj->rowid; + $codeArray[$i]['code'] = $obj->code; + $codeArray[$i]['label'] = $translabel; + $codeArray[$i]['phone_code'] = '+'.$obj->phone_code; + $codeArray[$i]['favorite'] = $obj->favorite; + $codeArray[$i]['trunk_prefix'] = $obj->trunk_prefix; + $favorite[$i] = $obj->favorite; + $label[$i] = dol_string_unaccent($translabel); + $i++; + } + + $array1_sort_order = SORT_DESC; + $array2_sort_order = SORT_ASC; + array_multisort($favorite, $array1_sort_order, $label, $array2_sort_order, $codeArray); + + $out .= ''; + + // Picto + $out .= img_picto('', $picto, 'class="pictofixedwidth"'); + + // Phone code select (display-only name, not submitted as separate POST param) + $out .= $this->selectPhoneCode($selectedCode, $codename, 'maxwidth75 phone_code_select', 0, $country_id_hint); + + // Visible number input (no name — not POSTed) + $out .= ' 0) { + $out .= ' maxlength="'.$maxlength.'"'; + } + $out .= ' value="'.dol_escape_htmltag($numberValue).'">'; + + // Per-field JS to sync hidden field + $out .= $this->getPhoneInputFieldJs($htmlname, $codename); + + // Shared JS for country-sync (output once per page) + $out .= $this->getPhoneInputSharedJs($countrySelectorId); + + return $out; + } + + /** + * Return inline JS that syncs the hidden phone field from select + text input. + * + * Strips formatting chars and trunk prefix from the number, then builds + * the hidden value as "{code} {number}" or just "{number}" if no code. + * + * @param string $htmlname Base name (e.g. "phone_pro") + * @param string $codename Code select name (e.g. "phone_pro_code") + * @return string Inline '."\n"; + + return $out; + } + + /** + * Return inline JS for country-selector → phone code sync (output once per page). + * + * When the country select changes, fetches the phone code via AJAX and updates + * all .phone_code_select dropdowns, which in turn triggers per-field sync. + * + * @param string $countrySelectorId ID of the country select element + * @return string Inline '."\n"; + + return $out; + } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index 5b4b8cd17c6..851bab3f36c 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -4,6 +4,7 @@ * Copyright (C) 2012 Christophe Battarel * Copyright (C) 2024-2026 MDW * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2026 Open-Dsi * * 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 @@ -557,6 +558,11 @@ function ajax_combobox($htmlname, $events = array(), $minLengthToAutocomplete = }, templateSelection: function (selection) { /* Format visible output of selected value */ if (selection.id == \''.(dol_escape_js($idforemptyvalue)).'\') return \'\'+selection.text+\'\'; + if (selection.element && $(selection.element).attr("data-select-html") != undefined) { + if (typeof htmlEntityDecodeJs === "function") { + return htmlEntityDecodeJs($(selection.element).attr("data-select-html")); + } + } return selection.text; }, escapeMarkup: function(markup) { diff --git a/htdocs/core/lib/phone.lib.php b/htdocs/core/lib/phone.lib.php new file mode 100644 index 00000000000..bc241061382 --- /dev/null +++ b/htdocs/core/lib/phone.lib.php @@ -0,0 +1,160 @@ + + * + * 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; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/core/lib/phone.lib.php + * \ingroup core + * \brief Helper functions for phone number formatting + */ + +/** + * Parse a stored phone number into country code and number parts + * + * Stored format is "+{code} {number}" (e.g. "+33 644986885"). + * If no code is found, returns empty code and the full string as number. + * + * @param string $phone Stored phone number + * @return array{code:string,number:string} Array with 'code' and 'number' keys + */ +function dol_parse_phone($phone) +{ + $phone = trim((string) $phone); + if ($phone === '') { + return array('code' => '', 'number' => ''); + } + + if (strpos($phone, '+') === 0) { + $pos = strpos($phone, ' '); + if ($pos !== false) { + return array( + 'code' => substr($phone, 0, $pos), + 'number' => substr($phone, $pos + 1) + ); + } + // Phone starts with + but has no space: try to keep it as-is in code + return array('code' => '', 'number' => $phone); + } + + return array('code' => '', 'number' => $phone); +} + +/** + * Build a normalized phone string from code and number parts + * + * Strips formatting characters (spaces, dashes, dots, parentheses) from number. + * Also strips the national trunk prefix for the country matching $code + * (e.g. leading "0" for France, "8" for Russia, "06" for Hungary). + * Returns "+{code} {number}" or just the number if code is empty. + * + * @param DoliDB $db Database handler + * @param string $code Country calling code (e.g. "+33") + * @param string $number Phone number (may contain formatting) + * @return string Normalized phone string + */ +function dol_build_phone($db, $code, $number) +{ + $number = preg_replace('/[\s\-\.\(\)]/', '', trim((string) $number)); + $code = trim((string) $code); + + if ($number === '') { + return ''; + } + + if ($code !== '') { + // Strip national trunk prefix (e.g. leading "0" for France) + $sql = "SELECT trunk_prefix FROM ".$db->prefix()."c_country"; + $sql .= " WHERE phone_code = ".((int) ltrim($code, '+')); + $sql .= " AND trunk_prefix IS NOT NULL AND trunk_prefix != ''"; + $sql .= " LIMIT 1"; + $resql = $db->query($sql); + if ($resql) { + $obj = $db->fetch_object($resql); + if ($obj && isset($obj->trunk_prefix) && $obj->trunk_prefix !== '' && $obj->trunk_prefix !== null) { + $prefix = $obj->trunk_prefix; + if (strpos($number, $prefix) === 0) { + $number = substr($number, strlen($prefix)); + } + } + $db->free($resql); + } + } + + if ($code !== '') { + return $code.' '.$number; + } + + return $number; +} + +/** + * Get the national trunk prefix for a phone code + * + * @param DoliDB $db Database handler + * @param string $phone_code Phone code (e.g. "+33") + * @return string Trunk prefix (e.g. "0") or empty string + */ +function dol_get_trunk_prefix($db, $phone_code) +{ + $phone_code = trim((string) $phone_code); + if ($phone_code === '') { + return ''; + } + + $sql = "SELECT trunk_prefix FROM ".$db->prefix()."c_country"; + $sql .= " WHERE phone_code = ".((int) ltrim($phone_code, '+')); + $sql .= " AND trunk_prefix IS NOT NULL AND trunk_prefix != ''"; + $sql .= " LIMIT 1"; + $resql = $db->query($sql); + if ($resql) { + $obj = $db->fetch_object($resql); + if ($obj && isset($obj->trunk_prefix) && $obj->trunk_prefix !== '' && $obj->trunk_prefix !== null) { + $db->free($resql); + return $obj->trunk_prefix; + } + $db->free($resql); + } + + return ''; +} + +/** + * Get the phone calling code for a country + * + * @param DoliDB $db Database handler + * @param int $country_id Country rowid + * @return string Phone code (e.g. "+33") or empty string + */ +function dol_get_phone_code_from_country($db, $country_id) +{ + $country_id = (int) $country_id; + if ($country_id <= 0) { + return ''; + } + + $sql = "SELECT phone_code FROM ".$db->prefix()."c_country WHERE rowid = ".((int) $country_id); + $resql = $db->query($sql); + if ($resql) { + $obj = $db->fetch_object($resql); + if ($obj && !empty($obj->phone_code)) { + $db->free($resql); + return '+'.$obj->phone_code; + } + $db->free($resql); + } + + return ''; +} diff --git a/htdocs/install/mysql/data/llx_00_c_country.sql b/htdocs/install/mysql/data/llx_00_c_country.sql index 4a0e4035eb6..5d3c28c55ca 100644 --- a/htdocs/install/mysql/data/llx_00_c_country.sql +++ b/htdocs/install/mysql/data/llx_00_c_country.sql @@ -8,6 +8,7 @@ -- Copyright (C) 2014 Alexandre Spangaro -- Copyright (C) 2021-2022 Udo Tamm -- Copyright (C) 2025 Nick Fragoulis +-- Copyright (C) 2026 Open-Dsi -- -- 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 @@ -544,3 +545,381 @@ UPDATE llx_c_country SET eec = 1 WHERE code IN ('AT','BE','BG','CY','CZ','DE','D -- Source: https://www.europeanpaymentscouncil.eu/document-library/other/epc-list-sepa-scheme-countries -- Set field sepa UPDATE llx_c_country SET sepa = 1 WHERE code IN ('AD','AL','AT','AX','BE','BG','BL','CH','CY','CZ','DE','DK','EE','ES','FI','FR','GB','GF','GG','GI','GP','GR','HR','HU','IE','IM','IS','IT','JE','LI','LT','LU','LV','MC','MD','ME','MF','MK','MQ','MT','NL','NO','PL','PM','PT','RE','RO','RS','SE','SI','SK','SM','VA','YT'); + +-- Set field phone_code (ITU-T country calling codes) +UPDATE llx_c_country SET phone_code = 33 WHERE code = 'FR'; +UPDATE llx_c_country SET phone_code = 32 WHERE code = 'BE'; +UPDATE llx_c_country SET phone_code = 39 WHERE code = 'IT'; +UPDATE llx_c_country SET phone_code = 34 WHERE code = 'ES'; +UPDATE llx_c_country SET phone_code = 49 WHERE code = 'DE'; +UPDATE llx_c_country SET phone_code = 41 WHERE code = 'CH'; +UPDATE llx_c_country SET phone_code = 44 WHERE code = 'GB'; +UPDATE llx_c_country SET phone_code = 353 WHERE code = 'IE'; +UPDATE llx_c_country SET phone_code = 86 WHERE code = 'CN'; +UPDATE llx_c_country SET phone_code = 216 WHERE code = 'TN'; +UPDATE llx_c_country SET phone_code = 1 WHERE code = 'US'; +UPDATE llx_c_country SET phone_code = 212 WHERE code = 'MA'; +UPDATE llx_c_country SET phone_code = 213 WHERE code = 'DZ'; +UPDATE llx_c_country SET phone_code = 1 WHERE code = 'CA'; +UPDATE llx_c_country SET phone_code = 228 WHERE code = 'TG'; +UPDATE llx_c_country SET phone_code = 241 WHERE code = 'GA'; +UPDATE llx_c_country SET phone_code = 31 WHERE code = 'NL'; +UPDATE llx_c_country SET phone_code = 36 WHERE code = 'HU'; +UPDATE llx_c_country SET phone_code = 7 WHERE code = 'RU'; +UPDATE llx_c_country SET phone_code = 46 WHERE code = 'SE'; +UPDATE llx_c_country SET phone_code = 225 WHERE code = 'CI'; +UPDATE llx_c_country SET phone_code = 221 WHERE code = 'SN'; +UPDATE llx_c_country SET phone_code = 54 WHERE code = 'AR'; +UPDATE llx_c_country SET phone_code = 237 WHERE code = 'CM'; +UPDATE llx_c_country SET phone_code = 351 WHERE code = 'PT'; +UPDATE llx_c_country SET phone_code = 966 WHERE code = 'SA'; +UPDATE llx_c_country SET phone_code = 377 WHERE code = 'MC'; +UPDATE llx_c_country SET phone_code = 61 WHERE code = 'AU'; +UPDATE llx_c_country SET phone_code = 65 WHERE code = 'SG'; +UPDATE llx_c_country SET phone_code = 93 WHERE code = 'AF'; +UPDATE llx_c_country SET phone_code = 358 WHERE code = 'AX'; +UPDATE llx_c_country SET phone_code = 355 WHERE code = 'AL'; +UPDATE llx_c_country SET phone_code = 1684 WHERE code = 'AS'; +UPDATE llx_c_country SET phone_code = 376 WHERE code = 'AD'; +UPDATE llx_c_country SET phone_code = 244 WHERE code = 'AO'; +UPDATE llx_c_country SET phone_code = 1264 WHERE code = 'AI'; +UPDATE llx_c_country SET phone_code = 1268 WHERE code = 'AG'; +UPDATE llx_c_country SET phone_code = 374 WHERE code = 'AM'; +UPDATE llx_c_country SET phone_code = 297 WHERE code = 'AW'; +UPDATE llx_c_country SET phone_code = 43 WHERE code = 'AT'; +UPDATE llx_c_country SET phone_code = 994 WHERE code = 'AZ'; +UPDATE llx_c_country SET phone_code = 1242 WHERE code = 'BS'; +UPDATE llx_c_country SET phone_code = 973 WHERE code = 'BH'; +UPDATE llx_c_country SET phone_code = 880 WHERE code = 'BD'; +UPDATE llx_c_country SET phone_code = 1246 WHERE code = 'BB'; +UPDATE llx_c_country SET phone_code = 375 WHERE code = 'BY'; +UPDATE llx_c_country SET phone_code = 501 WHERE code = 'BZ'; +UPDATE llx_c_country SET phone_code = 229 WHERE code = 'BJ'; +UPDATE llx_c_country SET phone_code = 1441 WHERE code = 'BM'; +UPDATE llx_c_country SET phone_code = 975 WHERE code = 'BT'; +UPDATE llx_c_country SET phone_code = 591 WHERE code = 'BO'; +UPDATE llx_c_country SET phone_code = 387 WHERE code = 'BA'; +UPDATE llx_c_country SET phone_code = 267 WHERE code = 'BW'; +UPDATE llx_c_country SET phone_code = 55 WHERE code = 'BR'; +UPDATE llx_c_country SET phone_code = 246 WHERE code = 'IO'; +UPDATE llx_c_country SET phone_code = 673 WHERE code = 'BN'; +UPDATE llx_c_country SET phone_code = 359 WHERE code = 'BG'; +UPDATE llx_c_country SET phone_code = 226 WHERE code = 'BF'; +UPDATE llx_c_country SET phone_code = 257 WHERE code = 'BI'; +UPDATE llx_c_country SET phone_code = 855 WHERE code = 'KH'; +UPDATE llx_c_country SET phone_code = 238 WHERE code = 'CV'; +UPDATE llx_c_country SET phone_code = 1345 WHERE code = 'KY'; +UPDATE llx_c_country SET phone_code = 236 WHERE code = 'CF'; +UPDATE llx_c_country SET phone_code = 235 WHERE code = 'TD'; +UPDATE llx_c_country SET phone_code = 56 WHERE code = 'CL'; +UPDATE llx_c_country SET phone_code = 61 WHERE code = 'CX'; +UPDATE llx_c_country SET phone_code = 61 WHERE code = 'CC'; +UPDATE llx_c_country SET phone_code = 57 WHERE code = 'CO'; +UPDATE llx_c_country SET phone_code = 269 WHERE code = 'KM'; +UPDATE llx_c_country SET phone_code = 242 WHERE code = 'CG'; +UPDATE llx_c_country SET phone_code = 243 WHERE code = 'CD'; +UPDATE llx_c_country SET phone_code = 682 WHERE code = 'CK'; +UPDATE llx_c_country SET phone_code = 506 WHERE code = 'CR'; +UPDATE llx_c_country SET phone_code = 385 WHERE code = 'HR'; +UPDATE llx_c_country SET phone_code = 53 WHERE code = 'CU'; +UPDATE llx_c_country SET phone_code = 357 WHERE code = 'CY'; +UPDATE llx_c_country SET phone_code = 420 WHERE code = 'CZ'; +UPDATE llx_c_country SET phone_code = 45 WHERE code = 'DK'; +UPDATE llx_c_country SET phone_code = 253 WHERE code = 'DJ'; +UPDATE llx_c_country SET phone_code = 1767 WHERE code = 'DM'; +UPDATE llx_c_country SET phone_code = 1809 WHERE code = 'DO'; +UPDATE llx_c_country SET phone_code = 593 WHERE code = 'EC'; +UPDATE llx_c_country SET phone_code = 20 WHERE code = 'EG'; +UPDATE llx_c_country SET phone_code = 503 WHERE code = 'SV'; +UPDATE llx_c_country SET phone_code = 240 WHERE code = 'GQ'; +UPDATE llx_c_country SET phone_code = 291 WHERE code = 'ER'; +UPDATE llx_c_country SET phone_code = 372 WHERE code = 'EE'; +UPDATE llx_c_country SET phone_code = 251 WHERE code = 'ET'; +UPDATE llx_c_country SET phone_code = 500 WHERE code = 'FK'; +UPDATE llx_c_country SET phone_code = 298 WHERE code = 'FO'; +UPDATE llx_c_country SET phone_code = 679 WHERE code = 'FJ'; +UPDATE llx_c_country SET phone_code = 358 WHERE code = 'FI'; +UPDATE llx_c_country SET phone_code = 594 WHERE code = 'GF'; +UPDATE llx_c_country SET phone_code = 689 WHERE code = 'PF'; +UPDATE llx_c_country SET phone_code = 220 WHERE code = 'GM'; +UPDATE llx_c_country SET phone_code = 995 WHERE code = 'GE'; +UPDATE llx_c_country SET phone_code = 233 WHERE code = 'GH'; +UPDATE llx_c_country SET phone_code = 350 WHERE code = 'GI'; +UPDATE llx_c_country SET phone_code = 30 WHERE code = 'GR'; +UPDATE llx_c_country SET phone_code = 299 WHERE code = 'GL'; +UPDATE llx_c_country SET phone_code = 1473 WHERE code = 'GD'; +UPDATE llx_c_country SET phone_code = 1671 WHERE code = 'GU'; +UPDATE llx_c_country SET phone_code = 502 WHERE code = 'GT'; +UPDATE llx_c_country SET phone_code = 224 WHERE code = 'GN'; +UPDATE llx_c_country SET phone_code = 245 WHERE code = 'GW'; +UPDATE llx_c_country SET phone_code = 509 WHERE code = 'HT'; +UPDATE llx_c_country SET phone_code = 379 WHERE code = 'VA'; +UPDATE llx_c_country SET phone_code = 504 WHERE code = 'HN'; +UPDATE llx_c_country SET phone_code = 852 WHERE code = 'HK'; +UPDATE llx_c_country SET phone_code = 354 WHERE code = 'IS'; +UPDATE llx_c_country SET phone_code = 91 WHERE code = 'IN'; +UPDATE llx_c_country SET phone_code = 62 WHERE code = 'ID'; +UPDATE llx_c_country SET phone_code = 98 WHERE code = 'IR'; +UPDATE llx_c_country SET phone_code = 964 WHERE code = 'IQ'; +UPDATE llx_c_country SET phone_code = 972 WHERE code = 'IL'; +UPDATE llx_c_country SET phone_code = 1876 WHERE code = 'JM'; +UPDATE llx_c_country SET phone_code = 81 WHERE code = 'JP'; +UPDATE llx_c_country SET phone_code = 962 WHERE code = 'JO'; +UPDATE llx_c_country SET phone_code = 7 WHERE code = 'KZ'; +UPDATE llx_c_country SET phone_code = 254 WHERE code = 'KE'; +UPDATE llx_c_country SET phone_code = 686 WHERE code = 'KI'; +UPDATE llx_c_country SET phone_code = 850 WHERE code = 'KP'; +UPDATE llx_c_country SET phone_code = 82 WHERE code = 'KR'; +UPDATE llx_c_country SET phone_code = 965 WHERE code = 'KW'; +UPDATE llx_c_country SET phone_code = 996 WHERE code = 'KG'; +UPDATE llx_c_country SET phone_code = 856 WHERE code = 'LA'; +UPDATE llx_c_country SET phone_code = 371 WHERE code = 'LV'; +UPDATE llx_c_country SET phone_code = 961 WHERE code = 'LB'; +UPDATE llx_c_country SET phone_code = 266 WHERE code = 'LS'; +UPDATE llx_c_country SET phone_code = 231 WHERE code = 'LR'; +UPDATE llx_c_country SET phone_code = 218 WHERE code = 'LY'; +UPDATE llx_c_country SET phone_code = 423 WHERE code = 'LI'; +UPDATE llx_c_country SET phone_code = 370 WHERE code = 'LT'; +UPDATE llx_c_country SET phone_code = 352 WHERE code = 'LU'; +UPDATE llx_c_country SET phone_code = 853 WHERE code = 'MO'; +UPDATE llx_c_country SET phone_code = 389 WHERE code = 'MK'; +UPDATE llx_c_country SET phone_code = 261 WHERE code = 'MG'; +UPDATE llx_c_country SET phone_code = 265 WHERE code = 'MW'; +UPDATE llx_c_country SET phone_code = 60 WHERE code = 'MY'; +UPDATE llx_c_country SET phone_code = 960 WHERE code = 'MV'; +UPDATE llx_c_country SET phone_code = 223 WHERE code = 'ML'; +UPDATE llx_c_country SET phone_code = 356 WHERE code = 'MT'; +UPDATE llx_c_country SET phone_code = 692 WHERE code = 'MH'; +UPDATE llx_c_country SET phone_code = 222 WHERE code = 'MR'; +UPDATE llx_c_country SET phone_code = 230 WHERE code = 'MU'; +UPDATE llx_c_country SET phone_code = 262 WHERE code = 'YT'; +UPDATE llx_c_country SET phone_code = 52 WHERE code = 'MX'; +UPDATE llx_c_country SET phone_code = 691 WHERE code = 'FM'; +UPDATE llx_c_country SET phone_code = 373 WHERE code = 'MD'; +UPDATE llx_c_country SET phone_code = 976 WHERE code = 'MN'; +UPDATE llx_c_country SET phone_code = 1664 WHERE code = 'MS'; +UPDATE llx_c_country SET phone_code = 258 WHERE code = 'MZ'; +UPDATE llx_c_country SET phone_code = 95 WHERE code = 'MM'; +UPDATE llx_c_country SET phone_code = 264 WHERE code = 'NA'; +UPDATE llx_c_country SET phone_code = 674 WHERE code = 'NR'; +UPDATE llx_c_country SET phone_code = 977 WHERE code = 'NP'; +UPDATE llx_c_country SET phone_code = 599 WHERE code = 'CW'; +UPDATE llx_c_country SET phone_code = 1721 WHERE code = 'SX'; +UPDATE llx_c_country SET phone_code = 687 WHERE code = 'NC'; +UPDATE llx_c_country SET phone_code = 64 WHERE code = 'NZ'; +UPDATE llx_c_country SET phone_code = 505 WHERE code = 'NI'; +UPDATE llx_c_country SET phone_code = 227 WHERE code = 'NE'; +UPDATE llx_c_country SET phone_code = 234 WHERE code = 'NG'; +UPDATE llx_c_country SET phone_code = 683 WHERE code = 'NU'; +UPDATE llx_c_country SET phone_code = 672 WHERE code = 'NF'; +UPDATE llx_c_country SET phone_code = 1670 WHERE code = 'MP'; +UPDATE llx_c_country SET phone_code = 47 WHERE code = 'NO'; +UPDATE llx_c_country SET phone_code = 968 WHERE code = 'OM'; +UPDATE llx_c_country SET phone_code = 92 WHERE code = 'PK'; +UPDATE llx_c_country SET phone_code = 680 WHERE code = 'PW'; +UPDATE llx_c_country SET phone_code = 970 WHERE code = 'PS'; +UPDATE llx_c_country SET phone_code = 507 WHERE code = 'PA'; +UPDATE llx_c_country SET phone_code = 675 WHERE code = 'PG'; +UPDATE llx_c_country SET phone_code = 595 WHERE code = 'PY'; +UPDATE llx_c_country SET phone_code = 51 WHERE code = 'PE'; +UPDATE llx_c_country SET phone_code = 63 WHERE code = 'PH'; +UPDATE llx_c_country SET phone_code = 48 WHERE code = 'PL'; +UPDATE llx_c_country SET phone_code = 1787 WHERE code = 'PR'; +UPDATE llx_c_country SET phone_code = 974 WHERE code = 'QA'; +UPDATE llx_c_country SET phone_code = 40 WHERE code = 'RO'; +UPDATE llx_c_country SET phone_code = 250 WHERE code = 'RW'; +UPDATE llx_c_country SET phone_code = 290 WHERE code = 'SH'; +UPDATE llx_c_country SET phone_code = 1869 WHERE code = 'KN'; +UPDATE llx_c_country SET phone_code = 1758 WHERE code = 'LC'; +UPDATE llx_c_country SET phone_code = 508 WHERE code = 'PM'; +UPDATE llx_c_country SET phone_code = 1784 WHERE code = 'VC'; +UPDATE llx_c_country SET phone_code = 685 WHERE code = 'WS'; +UPDATE llx_c_country SET phone_code = 378 WHERE code = 'SM'; +UPDATE llx_c_country SET phone_code = 239 WHERE code = 'ST'; +UPDATE llx_c_country SET phone_code = 381 WHERE code = 'RS'; +UPDATE llx_c_country SET phone_code = 248 WHERE code = 'SC'; +UPDATE llx_c_country SET phone_code = 232 WHERE code = 'SL'; +UPDATE llx_c_country SET phone_code = 421 WHERE code = 'SK'; +UPDATE llx_c_country SET phone_code = 386 WHERE code = 'SI'; +UPDATE llx_c_country SET phone_code = 677 WHERE code = 'SB'; +UPDATE llx_c_country SET phone_code = 252 WHERE code = 'SO'; +UPDATE llx_c_country SET phone_code = 27 WHERE code = 'ZA'; +UPDATE llx_c_country SET phone_code = 94 WHERE code = 'LK'; +UPDATE llx_c_country SET phone_code = 249 WHERE code = 'SD'; +UPDATE llx_c_country SET phone_code = 597 WHERE code = 'SR'; +UPDATE llx_c_country SET phone_code = 47 WHERE code = 'SJ'; +UPDATE llx_c_country SET phone_code = 268 WHERE code = 'SZ'; +UPDATE llx_c_country SET phone_code = 963 WHERE code = 'SY'; +UPDATE llx_c_country SET phone_code = 886 WHERE code = 'TW'; +UPDATE llx_c_country SET phone_code = 992 WHERE code = 'TJ'; +UPDATE llx_c_country SET phone_code = 255 WHERE code = 'TZ'; +UPDATE llx_c_country SET phone_code = 66 WHERE code = 'TH'; +UPDATE llx_c_country SET phone_code = 670 WHERE code = 'TL'; +UPDATE llx_c_country SET phone_code = 690 WHERE code = 'TK'; +UPDATE llx_c_country SET phone_code = 676 WHERE code = 'TO'; +UPDATE llx_c_country SET phone_code = 1868 WHERE code = 'TT'; +UPDATE llx_c_country SET phone_code = 90 WHERE code = 'TR'; +UPDATE llx_c_country SET phone_code = 993 WHERE code = 'TM'; +UPDATE llx_c_country SET phone_code = 1649 WHERE code = 'TC'; +UPDATE llx_c_country SET phone_code = 688 WHERE code = 'TV'; +UPDATE llx_c_country SET phone_code = 256 WHERE code = 'UG'; +UPDATE llx_c_country SET phone_code = 380 WHERE code = 'UA'; +UPDATE llx_c_country SET phone_code = 971 WHERE code = 'AE'; +UPDATE llx_c_country SET phone_code = 598 WHERE code = 'UY'; +UPDATE llx_c_country SET phone_code = 998 WHERE code = 'UZ'; +UPDATE llx_c_country SET phone_code = 678 WHERE code = 'VU'; +UPDATE llx_c_country SET phone_code = 58 WHERE code = 'VE'; +UPDATE llx_c_country SET phone_code = 84 WHERE code = 'VN'; +UPDATE llx_c_country SET phone_code = 1284 WHERE code = 'VG'; +UPDATE llx_c_country SET phone_code = 1340 WHERE code = 'VI'; +UPDATE llx_c_country SET phone_code = 681 WHERE code = 'WF'; +UPDATE llx_c_country SET phone_code = 967 WHERE code = 'YE'; +UPDATE llx_c_country SET phone_code = 260 WHERE code = 'ZM'; +UPDATE llx_c_country SET phone_code = 263 WHERE code = 'ZW'; +UPDATE llx_c_country SET phone_code = 44 WHERE code = 'GG'; +UPDATE llx_c_country SET phone_code = 44 WHERE code = 'IM'; +UPDATE llx_c_country SET phone_code = 44 WHERE code = 'JE'; +UPDATE llx_c_country SET phone_code = 382 WHERE code = 'ME'; +UPDATE llx_c_country SET phone_code = 590 WHERE code = 'BL'; +UPDATE llx_c_country SET phone_code = 590 WHERE code = 'MF'; +UPDATE llx_c_country SET phone_code = 383 WHERE code = 'XK'; + +-- Set field trunk_prefix (national trunk prefix stripped in international format) +-- Trunk prefix '0' (~101 countries) +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'FR'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'BE'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'DE'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'CH'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'GB'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'IE'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'NL'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'SE'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'AT'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'GR'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'FI'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'HR'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'BA'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'BG'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'RO'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'RS'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'ME'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'MK'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'AL'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'SK'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'SI'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'LT'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'MD'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'UA'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'GE'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'XK'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'TR'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'CN'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'IN'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'ID'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'JP'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'KR'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'TH'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'VN'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'MY'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'PH'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'BD'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'PK'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'AF'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'IR'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'IQ'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'JO'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'LB'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'SA'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'AE'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'IL'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'SY'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'YE'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'AM'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'AZ'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'KH'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'LA'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'MM'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'NP'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'LK'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'TW'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'MN'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'KG'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'UZ'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'PS'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'KP'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'MA'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'DZ'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'EG'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'ZA'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'NG'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'GH'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'KE'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'ET'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'TZ'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'UG'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'SD'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'LY'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'NA'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'SL'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'ZM'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'ZW'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'ER'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'CD'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'AO'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'EH'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'AU'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'NZ'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'AR'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'BR'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'CU'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'VE'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'PE'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'EC'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'BO'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'PY'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'SR'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'GF'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'YT'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'PM'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'BL'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'MF'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'GG'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'JE'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'IM'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'AX'; +-- Trunk prefix '8' (post-Soviet countries) +UPDATE llx_c_country SET trunk_prefix = '8' WHERE code = 'RU'; +UPDATE llx_c_country SET trunk_prefix = '8' WHERE code = 'BY'; +UPDATE llx_c_country SET trunk_prefix = '8' WHERE code = 'KZ'; +UPDATE llx_c_country SET trunk_prefix = '8' WHERE code = 'TJ'; +UPDATE llx_c_country SET trunk_prefix = '8' WHERE code = 'TM'; +-- Trunk prefix '06' (Hungary) +UPDATE llx_c_country SET trunk_prefix = '06' WHERE code = 'HU'; +-- Trunk prefix '1' (NANP countries) +UPDATE llx_c_country SET trunk_prefix = '1' WHERE code = 'US'; +UPDATE llx_c_country SET trunk_prefix = '1' WHERE code = 'CA'; +UPDATE llx_c_country SET trunk_prefix = '1' WHERE code = 'PR'; +UPDATE llx_c_country SET trunk_prefix = '1' WHERE code = 'VI'; +UPDATE llx_c_country SET trunk_prefix = '1' WHERE code = 'GU'; +UPDATE llx_c_country SET trunk_prefix = '1' WHERE code = 'AS'; +UPDATE llx_c_country SET trunk_prefix = '1' WHERE code = 'MP'; +UPDATE llx_c_country SET trunk_prefix = '1' WHERE code = 'JM'; +UPDATE llx_c_country SET trunk_prefix = '1' WHERE code = 'BS'; +UPDATE llx_c_country SET trunk_prefix = '1' WHERE code = 'BB'; +UPDATE llx_c_country SET trunk_prefix = '1' WHERE code = 'AG'; +UPDATE llx_c_country SET trunk_prefix = '1' WHERE code = 'DM'; +UPDATE llx_c_country SET trunk_prefix = '1' WHERE code = 'GD'; +UPDATE llx_c_country SET trunk_prefix = '1' WHERE code = 'KN'; +UPDATE llx_c_country SET trunk_prefix = '1' WHERE code = 'LC'; +UPDATE llx_c_country SET trunk_prefix = '1' WHERE code = 'VC'; +UPDATE llx_c_country SET trunk_prefix = '1' WHERE code = 'TT'; +UPDATE llx_c_country SET trunk_prefix = '1' WHERE code = 'DO'; +UPDATE llx_c_country SET trunk_prefix = '1' WHERE code = 'AI'; +UPDATE llx_c_country SET trunk_prefix = '1' WHERE code = 'BM'; +UPDATE llx_c_country SET trunk_prefix = '1' WHERE code = 'VG'; +UPDATE llx_c_country SET trunk_prefix = '1' WHERE code = 'KY'; +UPDATE llx_c_country SET trunk_prefix = '1' WHERE code = 'MS'; +UPDATE llx_c_country SET trunk_prefix = '1' WHERE code = 'TC'; +UPDATE llx_c_country SET trunk_prefix = '1' WHERE code = 'SX'; +UPDATE llx_c_country SET trunk_prefix = '1' WHERE code = 'MH'; +UPDATE llx_c_country SET trunk_prefix = '1' WHERE code = 'FM'; diff --git a/htdocs/install/mysql/migration/22.0.0-23.0.0.sql b/htdocs/install/mysql/migration/22.0.0-23.0.0.sql index 07dee3352dd..c10522dd4b2 100644 --- a/htdocs/install/mysql/migration/22.0.0-23.0.0.sql +++ b/htdocs/install/mysql/migration/22.0.0-23.0.0.sql @@ -224,6 +224,8 @@ ALTER TABLE llx_prelevement_lignes ADD COLUMN bic varchar(11); -- 11 accordi ALTER TABLE llx_prelevement_lignes ADD COLUMN iban varchar(80); -- full iban. 34 according to ISO 13616 but we set 80 to allow to store it with encryption information ALTER TABLE llx_prelevement_lignes ADD COLUMN rum varchar(32); -- rum used +-- Add phone_code column to country table +ALTER TABLE llx_c_country ADD COLUMN phone_code integer; ALTER TABLE llx_product_customer_price CHANGE COLUMN localtax1_tx localtax1_tx varchar(20) DEFAULT '0'; ALTER TABLE llx_product_customer_price CHANGE COLUMN localtax2_tx localtax2_tx varchar(20) DEFAULT '0'; @@ -438,4 +440,262 @@ INSERT INTO llx_accounting_system (fk_country, pcg_version, label, active) VALUE INSERT INTO llx_accounting_system (fk_country, pcg_version, label, active) VALUES ( 4, 'PCG08-PYME-CAT', 'The PYME accountancy spanish plan in catalan language', 1); +-- Populate phone codes (ITU-T country calling codes) +UPDATE llx_c_country SET phone_code = 33 WHERE code = 'FR'; +UPDATE llx_c_country SET phone_code = 32 WHERE code = 'BE'; +UPDATE llx_c_country SET phone_code = 39 WHERE code = 'IT'; +UPDATE llx_c_country SET phone_code = 34 WHERE code = 'ES'; +UPDATE llx_c_country SET phone_code = 49 WHERE code = 'DE'; +UPDATE llx_c_country SET phone_code = 41 WHERE code = 'CH'; +UPDATE llx_c_country SET phone_code = 44 WHERE code = 'GB'; +UPDATE llx_c_country SET phone_code = 353 WHERE code = 'IE'; +UPDATE llx_c_country SET phone_code = 86 WHERE code = 'CN'; +UPDATE llx_c_country SET phone_code = 216 WHERE code = 'TN'; +UPDATE llx_c_country SET phone_code = 1 WHERE code = 'US'; +UPDATE llx_c_country SET phone_code = 212 WHERE code = 'MA'; +UPDATE llx_c_country SET phone_code = 213 WHERE code = 'DZ'; +UPDATE llx_c_country SET phone_code = 1 WHERE code = 'CA'; +UPDATE llx_c_country SET phone_code = 228 WHERE code = 'TG'; +UPDATE llx_c_country SET phone_code = 241 WHERE code = 'GA'; +UPDATE llx_c_country SET phone_code = 31 WHERE code = 'NL'; +UPDATE llx_c_country SET phone_code = 36 WHERE code = 'HU'; +UPDATE llx_c_country SET phone_code = 7 WHERE code = 'RU'; +UPDATE llx_c_country SET phone_code = 46 WHERE code = 'SE'; +UPDATE llx_c_country SET phone_code = 225 WHERE code = 'CI'; +UPDATE llx_c_country SET phone_code = 221 WHERE code = 'SN'; +UPDATE llx_c_country SET phone_code = 54 WHERE code = 'AR'; +UPDATE llx_c_country SET phone_code = 237 WHERE code = 'CM'; +UPDATE llx_c_country SET phone_code = 351 WHERE code = 'PT'; +UPDATE llx_c_country SET phone_code = 966 WHERE code = 'SA'; +UPDATE llx_c_country SET phone_code = 377 WHERE code = 'MC'; +UPDATE llx_c_country SET phone_code = 61 WHERE code = 'AU'; +UPDATE llx_c_country SET phone_code = 65 WHERE code = 'SG'; +UPDATE llx_c_country SET phone_code = 93 WHERE code = 'AF'; +UPDATE llx_c_country SET phone_code = 358 WHERE code = 'AX'; +UPDATE llx_c_country SET phone_code = 355 WHERE code = 'AL'; +UPDATE llx_c_country SET phone_code = 1684 WHERE code = 'AS'; +UPDATE llx_c_country SET phone_code = 376 WHERE code = 'AD'; +UPDATE llx_c_country SET phone_code = 244 WHERE code = 'AO'; +UPDATE llx_c_country SET phone_code = 1264 WHERE code = 'AI'; +UPDATE llx_c_country SET phone_code = 1268 WHERE code = 'AG'; +UPDATE llx_c_country SET phone_code = 374 WHERE code = 'AM'; +UPDATE llx_c_country SET phone_code = 297 WHERE code = 'AW'; +UPDATE llx_c_country SET phone_code = 43 WHERE code = 'AT'; +UPDATE llx_c_country SET phone_code = 994 WHERE code = 'AZ'; +UPDATE llx_c_country SET phone_code = 1242 WHERE code = 'BS'; +UPDATE llx_c_country SET phone_code = 973 WHERE code = 'BH'; +UPDATE llx_c_country SET phone_code = 880 WHERE code = 'BD'; +UPDATE llx_c_country SET phone_code = 1246 WHERE code = 'BB'; +UPDATE llx_c_country SET phone_code = 375 WHERE code = 'BY'; +UPDATE llx_c_country SET phone_code = 501 WHERE code = 'BZ'; +UPDATE llx_c_country SET phone_code = 229 WHERE code = 'BJ'; +UPDATE llx_c_country SET phone_code = 1441 WHERE code = 'BM'; +UPDATE llx_c_country SET phone_code = 975 WHERE code = 'BT'; +UPDATE llx_c_country SET phone_code = 591 WHERE code = 'BO'; +UPDATE llx_c_country SET phone_code = 387 WHERE code = 'BA'; +UPDATE llx_c_country SET phone_code = 267 WHERE code = 'BW'; +UPDATE llx_c_country SET phone_code = 55 WHERE code = 'BR'; +UPDATE llx_c_country SET phone_code = 246 WHERE code = 'IO'; +UPDATE llx_c_country SET phone_code = 673 WHERE code = 'BN'; +UPDATE llx_c_country SET phone_code = 359 WHERE code = 'BG'; +UPDATE llx_c_country SET phone_code = 226 WHERE code = 'BF'; +UPDATE llx_c_country SET phone_code = 257 WHERE code = 'BI'; +UPDATE llx_c_country SET phone_code = 855 WHERE code = 'KH'; +UPDATE llx_c_country SET phone_code = 238 WHERE code = 'CV'; +UPDATE llx_c_country SET phone_code = 1345 WHERE code = 'KY'; +UPDATE llx_c_country SET phone_code = 236 WHERE code = 'CF'; +UPDATE llx_c_country SET phone_code = 235 WHERE code = 'TD'; +UPDATE llx_c_country SET phone_code = 56 WHERE code = 'CL'; +UPDATE llx_c_country SET phone_code = 61 WHERE code = 'CX'; +UPDATE llx_c_country SET phone_code = 61 WHERE code = 'CC'; +UPDATE llx_c_country SET phone_code = 57 WHERE code = 'CO'; +UPDATE llx_c_country SET phone_code = 269 WHERE code = 'KM'; +UPDATE llx_c_country SET phone_code = 242 WHERE code = 'CG'; +UPDATE llx_c_country SET phone_code = 243 WHERE code = 'CD'; +UPDATE llx_c_country SET phone_code = 682 WHERE code = 'CK'; +UPDATE llx_c_country SET phone_code = 506 WHERE code = 'CR'; +UPDATE llx_c_country SET phone_code = 385 WHERE code = 'HR'; +UPDATE llx_c_country SET phone_code = 53 WHERE code = 'CU'; +UPDATE llx_c_country SET phone_code = 357 WHERE code = 'CY'; +UPDATE llx_c_country SET phone_code = 420 WHERE code = 'CZ'; +UPDATE llx_c_country SET phone_code = 45 WHERE code = 'DK'; +UPDATE llx_c_country SET phone_code = 253 WHERE code = 'DJ'; +UPDATE llx_c_country SET phone_code = 1767 WHERE code = 'DM'; +UPDATE llx_c_country SET phone_code = 1809 WHERE code = 'DO'; +UPDATE llx_c_country SET phone_code = 593 WHERE code = 'EC'; +UPDATE llx_c_country SET phone_code = 20 WHERE code = 'EG'; +UPDATE llx_c_country SET phone_code = 503 WHERE code = 'SV'; +UPDATE llx_c_country SET phone_code = 240 WHERE code = 'GQ'; +UPDATE llx_c_country SET phone_code = 291 WHERE code = 'ER'; +UPDATE llx_c_country SET phone_code = 372 WHERE code = 'EE'; +UPDATE llx_c_country SET phone_code = 251 WHERE code = 'ET'; +UPDATE llx_c_country SET phone_code = 500 WHERE code = 'FK'; +UPDATE llx_c_country SET phone_code = 298 WHERE code = 'FO'; +UPDATE llx_c_country SET phone_code = 679 WHERE code = 'FJ'; +UPDATE llx_c_country SET phone_code = 358 WHERE code = 'FI'; +UPDATE llx_c_country SET phone_code = 594 WHERE code = 'GF'; +UPDATE llx_c_country SET phone_code = 689 WHERE code = 'PF'; +UPDATE llx_c_country SET phone_code = 220 WHERE code = 'GM'; +UPDATE llx_c_country SET phone_code = 995 WHERE code = 'GE'; +UPDATE llx_c_country SET phone_code = 233 WHERE code = 'GH'; +UPDATE llx_c_country SET phone_code = 350 WHERE code = 'GI'; +UPDATE llx_c_country SET phone_code = 30 WHERE code = 'GR'; +UPDATE llx_c_country SET phone_code = 299 WHERE code = 'GL'; +UPDATE llx_c_country SET phone_code = 1473 WHERE code = 'GD'; +UPDATE llx_c_country SET phone_code = 1671 WHERE code = 'GU'; +UPDATE llx_c_country SET phone_code = 502 WHERE code = 'GT'; +UPDATE llx_c_country SET phone_code = 224 WHERE code = 'GN'; +UPDATE llx_c_country SET phone_code = 245 WHERE code = 'GW'; +UPDATE llx_c_country SET phone_code = 509 WHERE code = 'HT'; +UPDATE llx_c_country SET phone_code = 379 WHERE code = 'VA'; +UPDATE llx_c_country SET phone_code = 504 WHERE code = 'HN'; +UPDATE llx_c_country SET phone_code = 852 WHERE code = 'HK'; +UPDATE llx_c_country SET phone_code = 354 WHERE code = 'IS'; +UPDATE llx_c_country SET phone_code = 91 WHERE code = 'IN'; +UPDATE llx_c_country SET phone_code = 62 WHERE code = 'ID'; +UPDATE llx_c_country SET phone_code = 98 WHERE code = 'IR'; +UPDATE llx_c_country SET phone_code = 964 WHERE code = 'IQ'; +UPDATE llx_c_country SET phone_code = 972 WHERE code = 'IL'; +UPDATE llx_c_country SET phone_code = 1876 WHERE code = 'JM'; +UPDATE llx_c_country SET phone_code = 81 WHERE code = 'JP'; +UPDATE llx_c_country SET phone_code = 962 WHERE code = 'JO'; +UPDATE llx_c_country SET phone_code = 7 WHERE code = 'KZ'; +UPDATE llx_c_country SET phone_code = 254 WHERE code = 'KE'; +UPDATE llx_c_country SET phone_code = 686 WHERE code = 'KI'; +UPDATE llx_c_country SET phone_code = 850 WHERE code = 'KP'; +UPDATE llx_c_country SET phone_code = 82 WHERE code = 'KR'; +UPDATE llx_c_country SET phone_code = 965 WHERE code = 'KW'; +UPDATE llx_c_country SET phone_code = 996 WHERE code = 'KG'; +UPDATE llx_c_country SET phone_code = 856 WHERE code = 'LA'; +UPDATE llx_c_country SET phone_code = 371 WHERE code = 'LV'; +UPDATE llx_c_country SET phone_code = 961 WHERE code = 'LB'; +UPDATE llx_c_country SET phone_code = 266 WHERE code = 'LS'; +UPDATE llx_c_country SET phone_code = 231 WHERE code = 'LR'; +UPDATE llx_c_country SET phone_code = 218 WHERE code = 'LY'; +UPDATE llx_c_country SET phone_code = 423 WHERE code = 'LI'; +UPDATE llx_c_country SET phone_code = 370 WHERE code = 'LT'; +UPDATE llx_c_country SET phone_code = 352 WHERE code = 'LU'; +UPDATE llx_c_country SET phone_code = 853 WHERE code = 'MO'; +UPDATE llx_c_country SET phone_code = 389 WHERE code = 'MK'; +UPDATE llx_c_country SET phone_code = 261 WHERE code = 'MG'; +UPDATE llx_c_country SET phone_code = 265 WHERE code = 'GH'; +UPDATE llx_c_country SET phone_code = 350 WHERE code = 'GI'; +UPDATE llx_c_country SET phone_code = 30 WHERE code = 'MW'; +UPDATE llx_c_country SET phone_code = 60 WHERE code = 'MY'; +UPDATE llx_c_country SET phone_code = 960 WHERE code = 'MV'; +UPDATE llx_c_country SET phone_code = 223 WHERE code = 'ML'; +UPDATE llx_c_country SET phone_code = 356 WHERE code = 'MT'; +UPDATE llx_c_country SET phone_code = 692 WHERE code = 'MH'; +UPDATE llx_c_country SET phone_code = 222 WHERE code = 'MR'; +UPDATE llx_c_country SET phone_code = 230 WHERE code = 'MU'; +UPDATE llx_c_country SET phone_code = 262 WHERE code = 'YT'; +UPDATE llx_c_country SET phone_code = 52 WHERE code = 'MX'; +UPDATE llx_c_country SET phone_code = 691 WHERE code = 'FM'; +UPDATE llx_c_country SET phone_code = 373 WHERE code = 'MD'; +UPDATE llx_c_country SET phone_code = 976 WHERE code = 'MN'; +UPDATE llx_c_country SET phone_code = 1664 WHERE code = 'MS'; +UPDATE llx_c_country SET phone_code = 258 WHERE code = 'MZ'; +UPDATE llx_c_country SET phone_code = 95 WHERE code = 'MM'; +UPDATE llx_c_country SET phone_code = 264 WHERE code = 'NA'; +UPDATE llx_c_country SET phone_code = 674 WHERE code = 'NR'; +UPDATE llx_c_country SET phone_code = 977 WHERE code = 'NP'; +UPDATE llx_c_country SET phone_code = 599 WHERE code = 'CW'; +UPDATE llx_c_country SET phone_code = 1721 WHERE code = 'SX'; +UPDATE llx_c_country SET phone_code = 687 WHERE code = 'NC'; +UPDATE llx_c_country SET phone_code = 64 WHERE code = 'NZ'; +UPDATE llx_c_country SET phone_code = 505 WHERE code = 'NI'; +UPDATE llx_c_country SET phone_code = 227 WHERE code = 'NE'; +UPDATE llx_c_country SET phone_code = 234 WHERE code = 'NG'; +UPDATE llx_c_country SET phone_code = 683 WHERE code = 'NU'; +UPDATE llx_c_country SET phone_code = 672 WHERE code = 'NF'; +UPDATE llx_c_country SET phone_code = 1670 WHERE code = 'MP'; +UPDATE llx_c_country SET phone_code = 47 WHERE code = 'NO'; +UPDATE llx_c_country SET phone_code = 968 WHERE code = 'OM'; +UPDATE llx_c_country SET phone_code = 92 WHERE code = 'PK'; +UPDATE llx_c_country SET phone_code = 680 WHERE code = 'PW'; +UPDATE llx_c_country SET phone_code = 970 WHERE code = 'PS'; +UPDATE llx_c_country SET phone_code = 507 WHERE code = 'PA'; +UPDATE llx_c_country SET phone_code = 675 WHERE code = 'PG'; +UPDATE llx_c_country SET phone_code = 595 WHERE code = 'PY'; +UPDATE llx_c_country SET phone_code = 51 WHERE code = 'PE'; +UPDATE llx_c_country SET phone_code = 63 WHERE code = 'PH'; +UPDATE llx_c_country SET phone_code = 48 WHERE code = 'PL'; +UPDATE llx_c_country SET phone_code = 1787 WHERE code = 'PR'; +UPDATE llx_c_country SET phone_code = 974 WHERE code = 'QA'; +UPDATE llx_c_country SET phone_code = 40 WHERE code = 'RO'; +UPDATE llx_c_country SET phone_code = 250 WHERE code = 'RW'; +UPDATE llx_c_country SET phone_code = 290 WHERE code = 'SH'; +UPDATE llx_c_country SET phone_code = 1869 WHERE code = 'KN'; +UPDATE llx_c_country SET phone_code = 1758 WHERE code = 'LC'; +UPDATE llx_c_country SET phone_code = 508 WHERE code = 'PM'; +UPDATE llx_c_country SET phone_code = 1784 WHERE code = 'VC'; +UPDATE llx_c_country SET phone_code = 685 WHERE code = 'WS'; +UPDATE llx_c_country SET phone_code = 378 WHERE code = 'SM'; +UPDATE llx_c_country SET phone_code = 239 WHERE code = 'ST'; +UPDATE llx_c_country SET phone_code = 381 WHERE code = 'RS'; +UPDATE llx_c_country SET phone_code = 248 WHERE code = 'SC'; +UPDATE llx_c_country SET phone_code = 232 WHERE code = 'SL'; +UPDATE llx_c_country SET phone_code = 421 WHERE code = 'SK'; +UPDATE llx_c_country SET phone_code = 386 WHERE code = 'SI'; +UPDATE llx_c_country SET phone_code = 677 WHERE code = 'SB'; +UPDATE llx_c_country SET phone_code = 252 WHERE code = 'SO'; +UPDATE llx_c_country SET phone_code = 27 WHERE code = 'ZA'; +UPDATE llx_c_country SET phone_code = 94 WHERE code = 'LK'; +UPDATE llx_c_country SET phone_code = 249 WHERE code = 'SD'; +UPDATE llx_c_country SET phone_code = 597 WHERE code = 'SR'; +UPDATE llx_c_country SET phone_code = 47 WHERE code = 'SJ'; +UPDATE llx_c_country SET phone_code = 268 WHERE code = 'SZ'; +UPDATE llx_c_country SET phone_code = 963 WHERE code = 'SY'; +UPDATE llx_c_country SET phone_code = 886 WHERE code = 'TW'; +UPDATE llx_c_country SET phone_code = 992 WHERE code = 'TJ'; +UPDATE llx_c_country SET phone_code = 255 WHERE code = 'TZ'; +UPDATE llx_c_country SET phone_code = 66 WHERE code = 'TH'; +UPDATE llx_c_country SET phone_code = 670 WHERE code = 'TL'; +UPDATE llx_c_country SET phone_code = 690 WHERE code = 'TK'; +UPDATE llx_c_country SET phone_code = 676 WHERE code = 'TO'; +UPDATE llx_c_country SET phone_code = 1868 WHERE code = 'TT'; +UPDATE llx_c_country SET phone_code = 90 WHERE code = 'TR'; +UPDATE llx_c_country SET phone_code = 993 WHERE code = 'TM'; +UPDATE llx_c_country SET phone_code = 1649 WHERE code = 'TC'; +UPDATE llx_c_country SET phone_code = 688 WHERE code = 'TV'; +UPDATE llx_c_country SET phone_code = 256 WHERE code = 'UG'; +UPDATE llx_c_country SET phone_code = 380 WHERE code = 'UA'; +UPDATE llx_c_country SET phone_code = 971 WHERE code = 'AE'; +UPDATE llx_c_country SET phone_code = 598 WHERE code = 'UY'; +UPDATE llx_c_country SET phone_code = 998 WHERE code = 'UZ'; +UPDATE llx_c_country SET phone_code = 678 WHERE code = 'VU'; +UPDATE llx_c_country SET phone_code = 58 WHERE code = 'VE'; +UPDATE llx_c_country SET phone_code = 84 WHERE code = 'VN'; +UPDATE llx_c_country SET phone_code = 1284 WHERE code = 'VG'; +UPDATE llx_c_country SET phone_code = 1340 WHERE code = 'VI'; +UPDATE llx_c_country SET phone_code = 681 WHERE code = 'WF'; +UPDATE llx_c_country SET phone_code = 967 WHERE code = 'YE'; +UPDATE llx_c_country SET phone_code = 260 WHERE code = 'ZM'; +UPDATE llx_c_country SET phone_code = 263 WHERE code = 'ZW'; +UPDATE llx_c_country SET phone_code = 44 WHERE code = 'GG'; +UPDATE llx_c_country SET phone_code = 44 WHERE code = 'IM'; +UPDATE llx_c_country SET phone_code = 44 WHERE code = 'JE'; +UPDATE llx_c_country SET phone_code = 382 WHERE code = 'ME'; +UPDATE llx_c_country SET phone_code = 590 WHERE code = 'BL'; +UPDATE llx_c_country SET phone_code = 590 WHERE code = 'MF'; +UPDATE llx_c_country SET phone_code = 383 WHERE code = 'XK'; + +-- Add trunk_prefix column to llx_c_country +ALTER TABLE llx_c_country ADD COLUMN trunk_prefix varchar(5); + +-- Populate trunk_prefix for countries with trunk prefix '0' +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code IN ('FR','BE','DE','CH','GB','IE','NL','SE','AT','GR','FI','HR','BA','BG','RO','RS','ME','MK','AL','SK','SI','LT','MD','UA','GE','XK','TR','CN','IN','ID','JP','KR','TH','VN','MY','PH','BD','PK','AF','IR','IQ','JO','LB','SA','AE','IL','SY','YE','AM','AZ','KH','LA','MM','NP','LK','TW','MN','KG','UZ','PS','KP','MA','DZ','EG','ZA','NG','GH','KE','ET','TZ','UG','SD','LY','NA','SL','ZM','ZW','ER','CD','AO','EH','AU','NZ','AR','BR','CU','VE','PE','EC','BO','PY','SR','GF','YT','PM','BL','MF','GG','JE','IM','AX'); +-- Populate trunk_prefix for post-Soviet countries with trunk prefix '8' +UPDATE llx_c_country SET trunk_prefix = '8' WHERE code IN ('RU','BY','KZ','TJ','TM'); +-- Populate trunk_prefix for Hungary with trunk prefix '06' +UPDATE llx_c_country SET trunk_prefix = '06' WHERE code = 'HU'; +-- Populate trunk_prefix for NANP countries with trunk prefix '1' +UPDATE llx_c_country SET trunk_prefix = '1' WHERE code IN ('US','CA','PR','VI','GU','AS','MP','JM','BS','BB','AG','DM','GD','KN','LC','VC','TT','DO','AI','BM','VG','KY','MS','TC','SX','MH','FM'); + +-- Strip formatting sugar from existing phone numbers in llx_socpeople +UPDATE llx_socpeople SET phone = REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(phone, ' ', ''), '-', ''), '.', ''), '(', ''), ')', '') WHERE phone IS NOT NULL AND phone != ''; +UPDATE llx_socpeople SET phone_perso = REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(phone_perso, ' ', ''), '-', ''), '.', ''), '(', ''), ')', '') WHERE phone_perso IS NOT NULL AND phone_perso != ''; +UPDATE llx_socpeople SET phone_mobile = REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(phone_mobile, ' ', ''), '-', ''), '.', ''), '(', ''), ')', '') WHERE phone_mobile IS NOT NULL AND phone_mobile != ''; +UPDATE llx_socpeople SET fax = REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(fax, ' ', ''), '-', ''), '.', ''), '(', ''), ')', '') WHERE fax IS NOT NULL AND fax != ''; + -- end of migration diff --git a/htdocs/install/mysql/tables/llx_c_country.sql b/htdocs/install/mysql/tables/llx_c_country.sql index f7936deefe1..5e2bd0bf9a3 100644 --- a/htdocs/install/mysql/tables/llx_c_country.sql +++ b/htdocs/install/mysql/tables/llx_c_country.sql @@ -3,6 +3,7 @@ -- Copyright (C) 2004 Laurent Destailleur -- Copyright (C) 2014 Alexandre Spangaro -- Copyright (C) 2022 Juanjo Menent +-- Copyright (C) 2026 Open-Dsi -- -- 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 @@ -29,5 +30,7 @@ create table llx_c_country eec tinyint DEFAULT 0 NOT NULL, sepa tinyint DEFAULT 0 NOT NULL, active tinyint DEFAULT 1 NOT NULL, - favorite tinyint DEFAULT 0 NOT NULL + favorite tinyint DEFAULT 0 NOT NULL, + phone_code integer, + trunk_prefix varchar(5) )ENGINE=innodb; diff --git a/htdocs/langs/en_US/companies.lang b/htdocs/langs/en_US/companies.lang index 9fcda8b5a2d..017a086f1b7 100644 --- a/htdocs/langs/en_US/companies.lang +++ b/htdocs/langs/en_US/companies.lang @@ -458,6 +458,8 @@ PaymentTermsSupplier=Payment Term - Vendor PaymentTypeBoth=Payment Type - Customer and Vendor MulticurrencyUsed=Use Multicurrency MulticurrencyCurrency=Currency +PhoneCode=Phone code +TrunkPrefix=Trunk prefix InEEC=Europe (EEC) RestOfEurope=Rest of Europe (EEC) OutOfEurope=Out of Europe (EEC) diff --git a/htdocs/langs/fr_FR/companies.lang b/htdocs/langs/fr_FR/companies.lang index 394b059f9f4..21bf748b59f 100644 --- a/htdocs/langs/fr_FR/companies.lang +++ b/htdocs/langs/fr_FR/companies.lang @@ -458,6 +458,8 @@ PaymentTermsSupplier=Conditions de paiement - fournisseur PaymentTypeBoth=Type de paiement - Client et fournisseur MulticurrencyUsed=Utiliser plusieurs devises MulticurrencyCurrency=Devise +PhoneCode=Indicatif tél. +TrunkPrefix=Préfixe trunk InEEC=Union Européenne (UE) RestOfEurope=Reste de l'Union Européenne (UE) OutOfEurope=Hors Union Européenne (UE) From 6e28078e7528f5756073e35f035af1ded6763dde Mon Sep 17 00:00:00 2001 From: Thatoo Date: Tue, 21 Apr 2026 16:31:59 +0200 Subject: [PATCH 49/53] Correct new.php (member) JS script of Minimum amount and subscription's amount formula description (#37834) * Correct JS of Minimum amount and subscription's amount formula description per membership type * Update new.php typo --- htdocs/public/members/new.php | 43 +++++++++++++++-------------------- 1 file changed, 18 insertions(+), 25 deletions(-) diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index 0473ebc9e47..05927f454b3 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -1201,23 +1201,22 @@ if (getDolGlobalString('MEMBER_SKIP_TABLE') || getDolGlobalString('MEMBER_NEWFOR print ''; // Add JS to manage the background of amount depending on type - if ($conf->use_javascript_ajax) { - $typeid = getDolGlobalInt('MEMBER_NEWFORM_FORCETYPE', GETPOSTINT('typeid')); - $adht = new AdherentType($db); - $adht->fetch($typeid); - $caneditamountbytype = $adht->caneditamountByType(1); // Load the array of caneditamount per type - $minimumamountbytype = $adht->minimumamountbytype(1); // Load the array of minimum amount per type - $amountbytype = $adht->amountByType(1); // Load the array of amount per type - $amountformuladescriptionbytype = $adht->amountformuladescriptionbytype(1); // Load the array of amount ormula description per type - // Common PHP → JS variables - $caneditamountbytype_json = json_encode($caneditamountbytype); - $minimumamountbytype_json = json_encode($minimumamountbytype); - $amountbytype_json = json_encode($amountbytype); - $amountformuladescriptionbytype_json = json_encode($amountformuladescriptionbytype); - $currencysymbol = $langs->getCurrencySymbol($conf->currency); + $typeid = getDolGlobalInt('MEMBER_NEWFORM_FORCETYPE', GETPOSTINT('typeid')); + $adht = new AdherentType($db); + $adht->fetch($typeid); + $caneditamountbytype = $adht->caneditamountByType(1); // Load the array of caneditamount per type + $minimumamountbytype = $adht->minimumamountbytype(1); // Load the array of minimum amount per type + $amountbytype = $adht->amountByType(1); // Load the array of amount per type + $amountformuladescriptionbytype = $adht->amountformuladescriptionbytype(1); // Load the array of amount ormula description per type + // Common PHP → JS variables + $caneditamountbytype_json = json_encode($caneditamountbytype); + $minimumamountbytype_json = json_encode($minimumamountbytype); + $amountbytype_json = json_encode($amountbytype); + $amountformuladescriptionbytype_json = json_encode($amountformuladescriptionbytype); + $currencysymbol = $langs->getCurrencySymbol($conf->currency); + if ($conf->use_javascript_ajax) { print '
'; - print ''; print ''; if ($show_author) { print ''; } print ''; + $ticket_message_nr = 1; foreach ($this->dao->cache_msgs_ticket as $id => $arraymsgs) { if (!$arraymsgs['private'] || ($arraymsgs['private'] == "1" && $show_private) ) { //print ''; - print ''; + print ''; print ''; @@ -334,7 +339,10 @@ class ActionsTicket extends CommonHookActions } elseif (isset($arraymsgs['fk_contact_author'])) { $contactstat = new Contact($this->db); $res = $contactstat->fetch(0, null, '', $arraymsgs['fk_contact_author']); - if ($res) { + if ($res == 2) { + print img_picto('', 'email', 'class="pictofixedwidth"'); + print $arraymsgs['fk_contact_author']; + } elseif ($res) { print img_picto('', 'contact', 'class="pictofixedwidth"'); print $contactstat->getNomUrl(0, 'nolink'); } else { @@ -347,7 +355,7 @@ class ActionsTicket extends CommonHookActions } print ''; - print ''; + print ''; print ''; print $arraymsgs['message']; @@ -427,6 +435,7 @@ class ActionsTicket extends CommonHookActions print ''; print ''; } + $ticket_message_nr++; } print '
'; + print '
'; print $langs->trans('InitialMessage'); if ($action != 'edit_message_init' && $permissiontoadd && !in_array($object->status, $closeStatuses)) { - print ''; + print ''; print ''.img_edit($langs->trans('Modify')).''; } print '
'; @@ -303,22 +303,27 @@ class ActionsTicket extends CommonHookActions print '
'; + print '

'; print $langs->trans('TicketMessagesList'); + print '

'; print '
'; + print '

'; print $langs->trans('Author'); + print '

'; print '
'; print img_picto('', 'object_action', 'class="paddingright"').dol_print_date($arraymsgs['datep'], 'dayhour'); print '
'; From 3b579d648b53929943b4fc3c51865e4c09f8a996 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 21 Apr 2026 13:24:51 +0200 Subject: [PATCH 39/53] Look and feel v24 --- dev/tools/codespell/codespell-ignore.txt | 1 + htdocs/admin/pdf_other.php | 8 ++--- htdocs/core/lib/functions.lib.php | 10 +++--- htdocs/core/lib/product.lib.php | 36 ++++++++++--------- htdocs/product/stats/bom.php | 9 +++-- htdocs/product/stats/card.php | 3 +- htdocs/product/stats/commande.php | 10 +++--- htdocs/product/stats/commande_fournisseur.php | 23 ++++++------ htdocs/product/stats/contrat.php | 11 +++--- htdocs/product/stats/expedition.php | 10 +++--- htdocs/product/stats/facture.php | 35 +++++++++--------- htdocs/product/stats/facture_fournisseur.php | 10 +++--- htdocs/product/stats/facturerec.php | 10 +++--- htdocs/product/stats/mo.php | 10 +++--- htdocs/product/stats/propal.php | 18 +++++----- htdocs/product/stats/reception.php | 12 ++++--- htdocs/product/stats/supplier_proposal.php | 10 +++--- htdocs/theme/eldy/global.inc.php | 8 +---- htdocs/theme/md/style.css.php | 7 +--- 19 files changed, 130 insertions(+), 111 deletions(-) diff --git a/dev/tools/codespell/codespell-ignore.txt b/dev/tools/codespell/codespell-ignore.txt index b00028f0999..feb181252f6 100644 --- a/dev/tools/codespell/codespell-ignore.txt +++ b/dev/tools/codespell/codespell-ignore.txt @@ -101,6 +101,7 @@ activ addin amountin alltime +Referers # other blacklists diff --git a/htdocs/admin/pdf_other.php b/htdocs/admin/pdf_other.php index 6f51b283fc9..04f4fd52cda 100644 --- a/htdocs/admin/pdf_other.php +++ b/htdocs/admin/pdf_other.php @@ -260,7 +260,7 @@ print ''; print ''; if (isModEnabled('propal')) { - print '
'; + print '
'; print load_fiche_titre($langs->trans("Proposal"), '', 'proposal'); print '
'; @@ -350,7 +350,7 @@ if (isModEnabled('propal')) { } if (isModEnabled('order')) { - print '
'; + print '
'; $langs->load("orders"); print load_fiche_titre($langs->trans('CustomersOrders'), '', 'order'); @@ -430,7 +430,7 @@ if (isModEnabled('order')) { } if (isModEnabled('contract')) { - print '
'; + print '
'; print load_fiche_titre($langs->trans("Contract"), '', 'contract'); print '
'; @@ -474,7 +474,7 @@ if (isModEnabled('contract')) { if (isModEnabled('invoice')) { - print '
'; + print '
'; print load_fiche_titre($langs->trans("Invoices"), '', 'bill'); diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 9348efab129..7f57029ba2b 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1765,9 +1765,10 @@ function dol_buildpath($path, $type = 0, $returnemptyifnotfound = 0) * @param string $url Relative path to file * @param array $params params for the http query * @param bool $addtoken does we need to add token + * @param string $anchor Add an anchor #xxx at end of URL * @return string path */ -function dolBuildUrl($url, $params = [], $addtoken = false) +function dolBuildUrl($url, $params = [], $addtoken = false, $anchor = '') { global $db, $hookmanager; @@ -1790,13 +1791,12 @@ function dolBuildUrl($url, $params = [], $addtoken = false) if ($addtoken) { $params = array_merge($params, ['token' => newToken()]); } - // TODO TO REMOVE - if (getDolGlobalString('MAIN_DEBUG_DOL_BUILDURL')) { - $params = array_merge($params, ['debug' => 'debug']); - } if ($params) { $url .= '?' . http_build_query($params); } + if ($anchor) { + $url .= '#' . preg_replace('/[^a-z]/i', '', $anchor); + } return $url; } diff --git a/htdocs/core/lib/product.lib.php b/htdocs/core/lib/product.lib.php index 639a33fe26f..f91f6d98431 100644 --- a/htdocs/core/lib/product.lib.php +++ b/htdocs/core/lib/product.lib.php @@ -535,10 +535,12 @@ function show_stats_for_company($product, $socid) $nblines = 0; print '
'.$langs->trans("Referers").''.$langs->trans("NbOfThirdParties").''.$langs->trans("NbOfObjectReferers").''.$langs->trans("TotalQuantity").''; + print $form->textwithpicto($langs->trans("Referers"), $langs->trans("ClinkOnALinkOfColumn", $langs->transnoentitiesnoconv("Referers"))); + print ''.$langs->trans("NbOfThirdParties").''.$langs->trans("NbOfObjectReferers").''.$langs->trans("TotalQuantity").'
'; - print ''.img_object('', 'propal', 'class="pictofixedwidth"').$langs->trans("Proposals").''; + print ''.img_object('', 'propal', 'class="pictofixedwidth"').$langs->trans("Proposals").''; print ''; print $product->stats_propale['customers']; print ''; @@ -569,7 +571,7 @@ function show_stats_for_company($product, $socid) } $langs->load("supplier_proposal"); print '
'; - print ''.img_object('', 'supplier_proposal', 'class="pictofixedwidth"').$langs->trans("SupplierProposals").''; + print ''.img_object('', 'supplier_proposal', 'class="pictofixedwidth"').$langs->trans("SupplierProposals").''; print ''; print $product->stats_proposal_supplier['suppliers']; print ''; @@ -588,7 +590,7 @@ function show_stats_for_company($product, $socid) } $langs->load("orders"); print '
'; - print ''.img_object('', 'order', 'class="pictofixedwidth"').$langs->trans("CustomersOrders").''; + print ''.img_object('', 'order', 'class="pictofixedwidth"').$langs->trans("CustomersOrders").''; print ''; print $product->stats_commande['customers']; print ''; @@ -607,7 +609,7 @@ function show_stats_for_company($product, $socid) } $langs->load("orders"); print '
'; - print ''.img_object('', 'supplier_order', 'class="pictofixedwidth"').$langs->trans("SuppliersOrders").''; + print ''.img_object('', 'supplier_order', 'class="pictofixedwidth"').$langs->trans("SuppliersOrders").''; print ''; print $product->stats_commande_fournisseur['suppliers']; print ''; @@ -626,7 +628,7 @@ function show_stats_for_company($product, $socid) } $langs->load("bills"); print '
'; - print ''.img_object('', 'bill', 'class="pictofixedwidth"').$langs->trans("CustomersInvoices").''; + print ''.img_object('', 'bill', 'class="pictofixedwidth"').$langs->trans("CustomersInvoices").''; print ''; print $product->stats_facture['customers']; print ''; @@ -645,7 +647,7 @@ function show_stats_for_company($product, $socid) } $langs->load("bills"); print '
'; - print ''.img_object('', 'bill', 'class="pictofixedwidth"').$langs->trans("RecurringInvoiceTemplate").''; + print ''.img_object('', 'bill', 'class="pictofixedwidth"').$langs->trans("RecurringInvoiceTemplate").''; print ''; print $product->stats_facturerec['customers']; print ''; @@ -664,7 +666,7 @@ function show_stats_for_company($product, $socid) } $langs->load("bills"); print '
'; - print ''.img_object('', 'supplier_invoice', 'class="pictofixedwidth"').$langs->trans("SuppliersInvoices").''; + print ''.img_object('', 'supplier_invoice', 'class="pictofixedwidth"').$langs->trans("SuppliersInvoices").''; print ''; print $product->stats_facture_fournisseur['suppliers']; print ''; @@ -684,7 +686,7 @@ function show_stats_for_company($product, $socid) } $langs->load("bills"); print '
'; - print ''.img_object('', 'bill', 'class="pictofixedwidth"').$langs->trans("RecurringInvoiceTemplate").''; + print ''.img_object('', 'bill', 'class="pictofixedwidth"').$langs->trans("RecurringInvoiceTemplate").''; print ''; print $product->stats_facturefournrec['customers']; print ''; @@ -705,7 +707,7 @@ function show_stats_for_company($product, $socid) } $langs->load("sendings"); print '
'; - print ''.img_object('', 'shipment', 'class="pictofixedwidth"').$langs->trans("Shipments").''; + print ''.img_object('', 'shipment', 'class="pictofixedwidth"').$langs->trans("Shipments").''; print ''; print $product->stats_expedition['customers']; print ''; @@ -725,7 +727,7 @@ function show_stats_for_company($product, $socid) } $langs->load("receptions"); print '
'; - print ''.img_object('', 'reception', 'class="pictofixedwidth"').$langs->trans("Receptions").''; + print ''.img_object('', 'reception', 'class="pictofixedwidth"').$langs->trans("Receptions").''; print ''; print $product->stats_reception['suppliers']; print ''; @@ -745,7 +747,7 @@ function show_stats_for_company($product, $socid) } $langs->load("contracts"); print '
'; - print ''.img_object('', 'contract', 'class="pictofixedwidth"').$langs->trans("Contracts").''; + print ''.img_object('', 'contract', 'class="pictofixedwidth"').$langs->trans("Contracts").''; print ''; print $product->stats_contrat['customers']; print ''; @@ -766,7 +768,7 @@ function show_stats_for_company($product, $socid) $langs->load("mrp"); print '
'; - print ''.img_object('', 'bom', 'class="pictofixedwidth"').$langs->trans("BOM").''; + print ''.img_object('', 'bom', 'class="pictofixedwidth"').$langs->trans("BOM").''; print ''; print ''; @@ -790,7 +792,7 @@ function show_stats_for_company($product, $socid) } $langs->load("mrp"); print '
'; - print ''.img_object('', 'mrp', 'class="pictofixedwidth"').$langs->trans("MO").''; + print ''.img_object('', 'mrp', 'class="pictofixedwidth"').$langs->trans("MO").''; print ''; print $form->textwithpicto((string) $product->stats_mo['customers_toconsume'], $langs->trans("ToConsume")); print ' '; diff --git a/htdocs/product/stats/bom.php b/htdocs/product/stats/bom.php index 215472d88f2..21c3b392c56 100644 --- a/htdocs/product/stats/bom.php +++ b/htdocs/product/stats/bom.php @@ -46,6 +46,9 @@ $langs->loadLangs(array('mrp', 'products', 'companies')); $id = GETPOSTINT('id'); $ref = GETPOST('ref', 'alpha'); +$search_month = GETPOSTINT('search_month'); +$search_year = GETPOSTINT('search_year'); + // Security check $fieldvalue = (!empty($id) ? $id : (!empty($ref) ? $ref : '')); $fieldtype = (!empty($ref) ? 'ref' : 'rowid'); @@ -124,8 +127,8 @@ if ($id > 0 || !empty($ref)) { print '
'; - print '
'; - print ''; + print '
'; + print '
'; $nboflines = show_stats_for_company($product, $socid); @@ -288,8 +291,10 @@ if ($id > 0 || !empty($ref)) { $option .= '&search_year='.urlencode((string) $search_year); } + print ''; print ''."\n"; print ''; + print ''; if (!empty($sortfield)) { print ''; } diff --git a/htdocs/product/stats/card.php b/htdocs/product/stats/card.php index 4c07c970a41..fee419d3cc7 100644 --- a/htdocs/product/stats/card.php +++ b/htdocs/product/stats/card.php @@ -198,6 +198,7 @@ if ((!($id > 0) && empty($ref)) || $notab) { if ($result || !($id > 0)) { print ''; print ''; + print ''; if (empty($id) || $notab) { print ''; } @@ -255,7 +256,7 @@ if ($result || !($id > 0)) { print ''; print '
'; - print '
'; + print '
'; print '
'; print '
'; diff --git a/htdocs/product/stats/commande.php b/htdocs/product/stats/commande.php index 0bebe84e284..b85ab10ebe4 100644 --- a/htdocs/product/stats/commande.php +++ b/htdocs/product/stats/commande.php @@ -141,8 +141,8 @@ if ($id > 0 || !empty($ref)) { print '
'; - print '
'; - print ''; + print '
'; + print '
'; $nboflines = show_stats_for_company($product, $socid); @@ -228,8 +228,10 @@ if ($id > 0 || !empty($ref)) { $option .= '&search_status='.urlencode($search_status); } + print ''; print ''."\n"; print ''; + print ''; if (!empty($sortfield)) { print ''; } @@ -252,8 +254,8 @@ if ($id > 0 || !empty($ref)) { print $langs->trans('Status'); $formorder->selectOrderStatus($search_status, 1, 'search_status'); print '
'; - print ''; - print ''; + print ''; + print ''; print '
'; print ''; print ''; diff --git a/htdocs/product/stats/commande_fournisseur.php b/htdocs/product/stats/commande_fournisseur.php index 0a7bd876c23..33056df6b75 100644 --- a/htdocs/product/stats/commande_fournisseur.php +++ b/htdocs/product/stats/commande_fournisseur.php @@ -27,12 +27,6 @@ * \brief Statistics for supplier orders by product */ require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; -require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formorder.class.php'; - /** * @var Conf $conf * @var DoliDB $db @@ -40,6 +34,11 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formorder.class.php'; * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; +require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formorder.class.php'; // Load translation files required by the page $langs->loadLangs(array('orders', 'products', 'companies', 'sendings')); @@ -142,8 +141,8 @@ if ($id > 0 || !empty($ref)) { print '
'; - print '
'; - print '
'; + print '
'; + print '
'; $nboflines = show_stats_for_company($product, $socid); @@ -222,11 +221,13 @@ if ($id > 0 || !empty($ref)) { } if ($search_status != '') { - $param .= '&search_status='.urlencode($search_status); + $option .= '&search_status='.urlencode($search_status); } + print ''; print ''."\n"; print ''; + print ''; if (!empty($sortfield)) { print ''; } @@ -249,8 +250,8 @@ if ($id > 0 || !empty($ref)) { print $langs->trans('Status'); $formorder->selectSupplierOrderStatus($search_status, 1, 'search_status'); print '
'; - print ''; - print ''; + print ''; + print ''; print '
'; print ''; print ''; diff --git a/htdocs/product/stats/contrat.php b/htdocs/product/stats/contrat.php index 5a845a64cfb..3b72c112e57 100644 --- a/htdocs/product/stats/contrat.php +++ b/htdocs/product/stats/contrat.php @@ -45,6 +45,9 @@ $langs->loadLangs(array('contracts', 'products', 'companies')); $id = GETPOSTINT('id'); $ref = GETPOST('ref', 'alpha'); +$search_month = GETPOSTINT('search_month'); +$search_year = GETPOSTINT('search_year'); + // Security check $fieldvalue = (!empty($id) ? $id : (!empty($ref) ? $ref : '')); $fieldtype = (!empty($ref) ? 'ref' : 'rowid'); @@ -124,8 +127,8 @@ if ($id > 0 || !empty($ref)) { print '
'; - print '
'; - print '
'; + print '
'; + print '
'; $nboflines = show_stats_for_company($product, $socid); @@ -187,17 +190,17 @@ if ($id > 0 || !empty($ref)) { if ($limit > 0 && $limit != $conf->liste_limit) { $option .= '&limit='.((int) $limit); } - /* if (!empty($search_month)) { $option .= '&search_month='.urlencode($search_month); } if (!empty($search_year)) { $option .= '&search_year='.urlencode((string) ($search_year)); } - */ + print ''; print ''."\n"; print ''; + print ''; if (!empty($sortfield)) { print ''; } diff --git a/htdocs/product/stats/expedition.php b/htdocs/product/stats/expedition.php index e6f2d8e48bb..5059fb4b3de 100644 --- a/htdocs/product/stats/expedition.php +++ b/htdocs/product/stats/expedition.php @@ -135,8 +135,8 @@ if ($id > 0 || !empty($ref)) { print '
'; - print '
'; - print '
'; + print '
'; + print '
'; $nboflines = show_stats_for_company($product, $socid); @@ -204,8 +204,10 @@ if ($id > 0 || !empty($ref)) { $option .= '&search_year='.urlencode((string) ($search_year)); } + print ''; print ''."\n"; print ''; + print ''; if (!empty($sortfield)) { print ''; } @@ -226,8 +228,8 @@ if ($id > 0 || !empty($ref)) { print $langs->trans('Month').': '; print $langs->trans('Year').':'.$formother->selectyear(($search_year ? (string) $search_year : '-1'), 'search_year', 1, 20, 5); print '
'; - print ''; - print ''; + print ''; + print ''; print '
'; print ''; print ''; diff --git a/htdocs/product/stats/facture.php b/htdocs/product/stats/facture.php index 2fccc12e21e..e94345c3865 100644 --- a/htdocs/product/stats/facture.php +++ b/htdocs/product/stats/facture.php @@ -29,12 +29,6 @@ // Load Dolibarr environment require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; -require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; - /** * @var Conf $conf * @var DoliDB $db @@ -42,6 +36,11 @@ require_once DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; +require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; // Load translation files required by the page $langs->loadLangs(array('companies', 'bills', 'products', 'supplier_proposal')); @@ -134,6 +133,7 @@ $result = restrictedArea($user, 'produit|service', $fieldvalue, 'product&product /* * Actions */ + $toselect = GETPOST('toselect', 'array:int'); $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'invoicelist'; $massaction = GETPOST('massaction', 'alpha'); @@ -225,12 +225,11 @@ if (empty($reshook)) { } } + /* * View */ - - if ($id > 0 || !empty($ref)) { $product = new Product($db); $result = $product->fetch($id, $ref); @@ -281,8 +280,8 @@ if ($id > 0 || !empty($ref)) { print '
'; - print '
'; - print '
'; + print '
'; + print '
'; $nboflines = show_stats_for_company($product, $socid); @@ -294,7 +293,7 @@ if ($id > 0 || !empty($ref)) { print dol_get_fiche_end(); if ($showmessage && $nboflines > 1) { - print ''.$langs->trans("ClinkOnALinkOfColumn", $langs->transnoentitiesnoconv("Referers")).''; + // Nothing shown } elseif ($user->hasRight('facture', 'lire')) { $sql = "SELECT DISTINCT s.nom as name, s.rowid as socid, s.code_client,"; $sql .= " f.ref, f.datef, f.paye, f.type, f.fk_statut as statut, f.rowid as facid,"; @@ -403,8 +402,10 @@ if ($id > 0 || !empty($ref)) { $reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $option .= $hookmanager->resPrint; + print ''; print ''."\n"; print ''; + print ''; if (!empty($sortfield)) { print ''; } @@ -439,8 +440,8 @@ if ($id > 0 || !empty($ref)) { print $hookmanager->resPrint; print '
'; - print ''; - print ''; + print ''; + print ''; print '
'; print ''; print ''; @@ -497,14 +498,14 @@ if ($id > 0 || !empty($ref)) { } } - print '\n"; - print ''; - print "\n"; + print ''; + print '\n"; print '"; - print '\n"; + print '\n"; print '\n"; print ''; // Fields from hook diff --git a/htdocs/product/stats/facture_fournisseur.php b/htdocs/product/stats/facture_fournisseur.php index 2ea447de01e..e8d6b18311c 100644 --- a/htdocs/product/stats/facture_fournisseur.php +++ b/htdocs/product/stats/facture_fournisseur.php @@ -136,8 +136,8 @@ if ($id > 0 || !empty($ref)) { print '
'; - print '
'; - print '
'; + print ''; print $invoicestatic->getNomUrl(1); print "'.$societestatic->getNomUrl(1).'".$objp->code_client."'.$societestatic->getNomUrl(1).''.dolPrintHTML($objp->code_client)."'; print dol_print_date($db->jdate($objp->datef), 'dayhour')."'.$objp->qty."'.dolPrintHTML($objp->qty)."'.price($objp->total_ht)."'.$invoicestatic->LibStatut($objp->paye, $objp->statut, 5, $paiement, $objp->type).'
'; + print '
'; + print '
'; $nboflines = show_stats_for_company($product, $socid); @@ -208,8 +208,10 @@ if ($id > 0 || !empty($ref)) { $option .= '&search_year='.urlencode((string) ($search_year)); } + print ''; print ''."\n"; print ''; + print ''; if (!empty($sortfield)) { print ''; } @@ -230,8 +232,8 @@ if ($id > 0 || !empty($ref)) { print $langs->trans('Month').': '; print $langs->trans('Year').':'.$formother->selectyear(($search_year ? (string) $search_year : '-1'), 'search_year', 1, 20, 5); print '
'; - print ''; - print ''; + print ''; + print ''; print '
'; print ''; print ''; diff --git a/htdocs/product/stats/facturerec.php b/htdocs/product/stats/facturerec.php index 04040fad093..0ca60eaa224 100644 --- a/htdocs/product/stats/facturerec.php +++ b/htdocs/product/stats/facturerec.php @@ -150,8 +150,8 @@ if ($id > 0 || !empty($ref)) { print '
'; - print '
'; - print '
'; + print '
'; + print '
'; $nboflines = show_stats_for_company($product, $socid); @@ -224,8 +224,10 @@ if ($id > 0 || !empty($ref)) { $option .= '&search_year='.urlencode((string) ($search_year)); } + print ''; print ''."\n"; print ''; + print ''; if (!empty($sortfield)) { print ''; } @@ -246,8 +248,8 @@ if ($id > 0 || !empty($ref)) { print $langs->trans('Month').': '; print $langs->trans('Year').':'.$formother->selectyear(($search_year ? (string) $search_year : '-1'), 'search_year', 1, 20, 5); print '
'; - print ''; - print ''; + print ''; + print ''; print '
'; print ''; print ''; diff --git a/htdocs/product/stats/mo.php b/htdocs/product/stats/mo.php index f94a7a4fcc4..6ac05302b49 100644 --- a/htdocs/product/stats/mo.php +++ b/htdocs/product/stats/mo.php @@ -136,8 +136,8 @@ if ($id > 0 || !empty($ref)) { print '
'; - print '
'; - print '
'; + print '
'; + print '
'; $nboflines = show_stats_for_company($product, $socid); @@ -205,8 +205,10 @@ if ($id > 0 || !empty($ref)) { $option .= '&search_year='.urlencode((string) ($search_year)); } + print ''; print ''."\n"; print ''; + print ''; print ''; print ''; @@ -223,8 +225,8 @@ if ($id > 0 || !empty($ref)) { print $langs->trans('Month').': '; print $langs->trans('Year').':'.$formother->selectyear(($search_year ? (string) $search_year : '-1'), 'search_year', 1, 20, 5); print '
'; - print ''; - print ''; + print ''; + print ''; print '
'; print ''; print ''; diff --git a/htdocs/product/stats/propal.php b/htdocs/product/stats/propal.php index b9f6d82d6fc..ecdd012de03 100644 --- a/htdocs/product/stats/propal.php +++ b/htdocs/product/stats/propal.php @@ -137,8 +137,8 @@ if ($id > 0 || !empty($ref)) { print '
'; - print '
'; - print '
'; + print '
'; + print '
'; $nboflines = show_stats_for_company($product, $socid); @@ -214,8 +214,10 @@ if ($id > 0 || !empty($ref)) { $option .= '&search_year='.urlencode((string) ($search_year)); } + print ''; print ''."\n"; print ''; + print ''; if (!empty($sortfield)) { print ''; } @@ -236,8 +238,8 @@ if ($id > 0 || !empty($ref)) { print $langs->trans('Month').': '; print $langs->trans('Year').':'.$formother->selectyear(($search_year ? (string) $search_year : '-1'), 'search_year', 1, 20, 5); print '
'; - print ''; - print ''; + print ''; + print ''; print '
'; print ''; print ''; @@ -271,12 +273,12 @@ if ($id > 0 || !empty($ref)) { print '\n"; - print ''; + print ''; print '"; - print "\n"; - print ''."\n"; - print ''; + print '\n"; + print ''."\n"; + print ''; print "\n"; $i++; } diff --git a/htdocs/product/stats/reception.php b/htdocs/product/stats/reception.php index bfde1cee7cc..55384805d5f 100644 --- a/htdocs/product/stats/reception.php +++ b/htdocs/product/stats/reception.php @@ -134,8 +134,8 @@ if ($id > 0 || !empty($ref)) { print '
'; - print '
'; - print '
'; print $propalstatic->getNomUrl(1); print "'.$societestatic->getNomUrl(1).''.$societestatic->getNomUrl(1).''; print dol_print_date($db->jdate($objp->datep), 'dayhour')."".$objp->qty."'.price($objp->amount).''.$propalstatic->LibStatut($objp->statut, 5).''.$objp->qty."'.price($objp->amount).''.$propalstatic->LibStatut($objp->statut, 5).'
'; + print '
'; + print '
'; $nboflines = show_stats_for_company($product, $socid); @@ -203,8 +203,10 @@ if ($id > 0 || !empty($ref)) { $option .= '&search_year='.urlencode((string) ($search_year)); } - print ''."\n"; + print ''; + print ''."\n"; print ''; + print ''; if (!empty($sortfield)) { print ''; } @@ -225,8 +227,8 @@ if ($id > 0 || !empty($ref)) { print $langs->trans('Month').': '; print $langs->trans('Year').':'.$formother->selectyear(($search_year ? (string) $search_year : '-1'), 'search_year', 1, 20, 5); print '
'; - print ''; - print ''; + print ''; + print ''; print '
'; print ''; print ''; diff --git a/htdocs/product/stats/supplier_proposal.php b/htdocs/product/stats/supplier_proposal.php index 9bde87ea5b6..7466efa9a2c 100644 --- a/htdocs/product/stats/supplier_proposal.php +++ b/htdocs/product/stats/supplier_proposal.php @@ -134,8 +134,8 @@ if ($id > 0 || !empty($ref)) { print '
'; - print '
'; - print '
'; + print '
'; + print '
'; $nboflines = show_stats_for_company($product, $socid); @@ -207,8 +207,10 @@ if ($id > 0 || !empty($ref)) { $option .= '&search_year='.urlencode((string) ($search_year)); } + print ''; print ''."\n"; print ''; + print ''; if (!empty($sortfield)) { print ''; } @@ -229,8 +231,8 @@ if ($id > 0 || !empty($ref)) { print $langs->trans('Month').': '; print $langs->trans('Year').':'.$formother->selectyear(($search_year ? (string) $search_year : '-1'), 'search_year', 1, 20, 5); print '
'; - print ''; - print ''; + print ''; + print ''; print '
'; print ''; print ''; diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 7fab412a06a..92033e6b2f3 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -838,7 +838,7 @@ input.pageplusone { .hmirror { transform: scale(-1, 1); } -.undertopmenu { +.anchorundermenu { scroll-margin-top: 80px; } @@ -4407,12 +4407,6 @@ span.tabspan { width: 100%; } -#undertopmenu { - background-repeat: repeat-x; - margin-top: px; -} - - .paddingrightonly { border-collapse: collapse; border: 0px; diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 66d529060ea..90680705af2 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -987,7 +987,7 @@ input.pageplusone { .hmirror { transform: scale(-1, 1); } -.undertopmenu { +.anchorundermenu { scroll-margin-top: 80px; } @@ -4437,11 +4437,6 @@ a.tabTitle { width: 100%; } -#undertopmenu { - background-repeat: repeat-x; - margin-top: px; -} - .paddingrightonly { border-collapse: collapse; border: 0px; From 88d9d1301f72ac77f414f19347b4d8fd82dbc2af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 21 Apr 2026 13:31:24 +0200 Subject: [PATCH 40/53] clean code (#37953) * clean code * clean code * clean code --- htdocs/adherents/admin/member_extrafields.php | 3 +-- .../admin/member_type_extrafields.php | 3 +-- htdocs/adherents/card.php | 3 ++- htdocs/adherents/cartes/carte.php | 2 +- htdocs/adherents/list.php | 5 +++-- htdocs/adherents/subscription.php | 4 ++-- htdocs/adherents/subscription/list.php | 12 +++++----- htdocs/adherents/type.php | 4 ++-- htdocs/bookmarks/list.php | 7 +++--- htdocs/commande/card.php | 22 +++++++++---------- htdocs/commande/list.php | 20 ++++++++--------- htdocs/commande/list_det.php | 2 +- 12 files changed, 43 insertions(+), 44 deletions(-) diff --git a/htdocs/adherents/admin/member_extrafields.php b/htdocs/adherents/admin/member_extrafields.php index bb3199e16b5..c7813559af2 100644 --- a/htdocs/adherents/admin/member_extrafields.php +++ b/htdocs/adherents/admin/member_extrafields.php @@ -29,11 +29,11 @@ // Load Dolibarr environment require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user @@ -42,7 +42,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; // Load translation files required by the page $langs->loadLangs(array("admin", "members")); -$extrafields = new ExtraFields($db); $form = new Form($db); // List of supported format diff --git a/htdocs/adherents/admin/member_type_extrafields.php b/htdocs/adherents/admin/member_type_extrafields.php index de9c3b6e90f..476db2b3820 100644 --- a/htdocs/adherents/admin/member_type_extrafields.php +++ b/htdocs/adherents/admin/member_type_extrafields.php @@ -32,6 +32,7 @@ /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user @@ -40,12 +41,10 @@ // Load Dolibarr environment require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; // Load translation files required by the page $langs->loadLangs(array("admin", "members")); -$extrafields = new ExtraFields($db); $form = new Form($db); // List of supported format diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 8e91a54f486..28d0c8744da 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -36,6 +36,7 @@ require '../main.inc.php'; /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Societe $mysoc * @var Translate $langs @@ -85,7 +86,7 @@ if (isModEnabled('mailmanspip')) { } $object = new Adherent($db); -$extrafields = new ExtraFields($db); + $upload_dir = null; // fetch optionals attributes and labels diff --git a/htdocs/adherents/cartes/carte.php b/htdocs/adherents/cartes/carte.php index 191cccae92c..95f21f1844d 100644 --- a/htdocs/adherents/cartes/carte.php +++ b/htdocs/adherents/cartes/carte.php @@ -29,6 +29,7 @@ require '../../main.inc.php'; /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user @@ -60,7 +61,6 @@ $mesg = ''; $adherentstatic = new Adherent($db); $object = new Adherent($db); -$extrafields = new ExtraFields($db); // Fetch optionals attributes and labels $extrafields->fetch_name_optionals_label($object->table_element); diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index 46433eeca21..04188bc9e1c 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -36,6 +36,7 @@ require '../main.inc.php'; /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user @@ -85,7 +86,7 @@ $search_categ = GETPOST("search_categ", 'intcomma'); $search_morphy = GETPOST("search_morphy", 'alpha'); $search_import_key = trim(GETPOST("search_import_key", 'alpha')); -$socid = GETPOSTINT('socid'); +$socid = GETPOSTINT('socid'); if (GETPOSTINT('catid') && empty($search_categ)) { $search_categ = GETPOSTINT('catid'); } @@ -136,7 +137,7 @@ $object = new Adherent($db); // Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context $hookmanager->initHooks(array('memberlist')); -$extrafields = new ExtraFields($db); + $diroutputmassaction = $conf->member->dir_output.'/temp/massgeneration/'.$user->id; // Fetch optionals attributes and labels diff --git a/htdocs/adherents/subscription.php b/htdocs/adherents/subscription.php index ef829fe6268..b56879b06b8 100644 --- a/htdocs/adherents/subscription.php +++ b/htdocs/adherents/subscription.php @@ -34,6 +34,7 @@ require '../main.inc.php'; /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Societe $mysoc * @var Translate $langs @@ -44,7 +45,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php'; @@ -84,7 +84,7 @@ if (!$sortorder) { } $object = new Adherent($db); -$extrafields = new ExtraFields($db); + $adht = new AdherentType($db); // fetch optionals attributes and labels diff --git a/htdocs/adherents/subscription/list.php b/htdocs/adherents/subscription/list.php index 0208ae3c228..c6b42441c8f 100644 --- a/htdocs/adherents/subscription/list.php +++ b/htdocs/adherents/subscription/list.php @@ -28,19 +28,20 @@ // Load Dolibarr environment require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; -require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php'; -require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; - /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; +require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php'; +require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; + $langs->loadLangs(array("members", "companies", "banks")); $action = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'; // The action 'create'/'add', 'edit'/'update', 'view', ... @@ -88,7 +89,6 @@ if (!$sortfield) { // Initialize a technical objects $object = new Subscription($db); -$extrafields = new ExtraFields($db); $hookmanager->initHooks(array('subscriptionlist')); // Fetch optionals attributes and labels diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index 2c992b71f81..feb3600e675 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -36,6 +36,7 @@ require '../main.inc.php'; /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user @@ -43,7 +44,6 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; // Load translation files required by the page @@ -103,7 +103,7 @@ $mail_valid = GETPOST("mail_valid", 'restricthtml'); // Initialize a technical object $object = new AdherentType($db); -$extrafields = new ExtraFields($db); + $hookmanager->initHooks(array('membertypecard', 'globalcard')); // Fetch optionals attributes and labels diff --git a/htdocs/bookmarks/list.php b/htdocs/bookmarks/list.php index 579cc7889a0..4b56bf866a5 100644 --- a/htdocs/bookmarks/list.php +++ b/htdocs/bookmarks/list.php @@ -25,16 +25,17 @@ // Load Dolibarr environment require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/bookmarks/class/bookmark.class.php'; - /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT.'/bookmarks/class/bookmark.class.php'; + // Load translation files required by the page $langs->loadLangs(array('other', 'admin')); @@ -74,7 +75,7 @@ if (!$sortorder) { // Initialize Objects $object = new Bookmark($db); -$extrafields = new ExtraFields($db); + $arrayfields = array(); $hookmanager->initHooks(array('bookmarklist')); // Note that conf->hooks_modules contains array diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 3325059ceba..1396fa3b993 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -40,8 +40,17 @@ // Load Dolibarr environment require '../main.inc.php'; +/** + * @var Conf $conf + * @var DoliDB $db + * @var ExtraFields $extrafields + * @var HookManager $hookmanager + * @var Societe $mysoc + * @var Translate $langs + * @var User $user + */ + require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php'; -require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php'; require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/html.formorder.class.php'; @@ -68,15 +77,6 @@ if (isModEnabled('variants')) { } -/** - * @var Conf $conf - * @var DoliDB $db - * @var HookManager $hookmanager - * @var Societe $mysoc - * @var Translate $langs - * @var User $user - */ - // Load translation files required by the page $langs->loadLangs(array('orders', 'sendings', 'companies', 'bills', 'propal', 'products', 'other')); @@ -141,8 +141,6 @@ $hookmanager->initHooks(array('ordercard', 'globalcard')); $result = restrictedArea($user, 'commande', $id); $object = new Commande($db); -$extrafields = new ExtraFields($db); - // fetch optionals attributes and labels $extrafields->fetch_name_optionals_label($object->table_element); diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 4009819a727..96a3ac42980 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -42,6 +42,15 @@ // Load Dolibarr environment require '../main.inc.php'; +/** + * @var Conf $conf + * @var DoliDB $db + * @var ExtraFields $extrafields + * @var HookManager $hookmanager + * @var Translate $langs + * @var User $user + */ + require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php'; @@ -62,14 +71,6 @@ if (isModEnabled('category')) { require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcategory.class.php'; } -/** - * @var Conf $conf - * @var DoliDB $db - * @var HookManager $hookmanager - * @var Translate $langs - * @var User $user - */ - // Load translation files required by the page $langs->loadLangs(array('orders', 'sendings', 'companies', 'compta', 'bills', 'stocks', 'products')); @@ -81,7 +82,7 @@ $confirm = GETPOST('confirm', 'alpha'); $toselect = GETPOST('toselect', 'array:int'); $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'orderlist'; $optioncss = GETPOST('optioncss', 'alpha'); -$mode = GETPOST('mode', 'aZ'); // The output mode ('list', 'kanban', 'hierarchy', 'calendar', ...) +$mode = GETPOST('mode', 'aZ'); // The output mode ('list', 'kanban', 'hierarchy', 'calendar', ...) if (getDolGlobalInt('MAIN_SEE_SUBORDINATES')) { $userschilds = $user->getAllChildIds(); @@ -196,7 +197,6 @@ $show_shippable_command = GETPOST('show_shippable_command', 'aZ09'); // Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context $object = new Commande($db); $hookmanager->initHooks(array('orderlist')); -$extrafields = new ExtraFields($db); // fetch optionals attributes and labels $extrafields->fetch_name_optionals_label($object->table_element); diff --git a/htdocs/commande/list_det.php b/htdocs/commande/list_det.php index a49c22142d1..f3a207fdd6a 100644 --- a/htdocs/commande/list_det.php +++ b/htdocs/commande/list_det.php @@ -39,6 +39,7 @@ require '../main.inc.php'; /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user @@ -167,7 +168,6 @@ $show_shippable_command = GETPOST('show_shippable_command', 'aZ09'); // Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context $object = new Commande($db); $hookmanager->initHooks(array('orderlistdetail')); -$extrafields = new ExtraFields($db); // fetch optionals attributes and labels $extrafields->fetch_name_optionals_label($object->table_element); From 38fa9222a0b9b6d5e42da9e205cd07835cc6ecd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charl=C3=A8ne=20Benke?= <1179011+defrance@users.noreply.github.com> Date: Tue, 21 Apr 2026 13:43:37 +0200 Subject: [PATCH 41/53] Change batch number validation to 'alpha' (#37952) batch number can contain more thing that alphanum value --- htdocs/product/stock/product.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index f0d9f424d50..4b160504d78 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -83,7 +83,7 @@ $fieldid = GETPOSTISSET("ref") ? 'ref' : 'rowid'; $d_eatby = dol_mktime(0, 0, 0, GETPOSTINT('eatbymonth'), GETPOSTINT('eatbyday'), GETPOSTINT('eatbyyear')); $d_sellby = dol_mktime(0, 0, 0, GETPOSTINT('sellbymonth'), GETPOSTINT('sellbyday'), GETPOSTINT('sellbyyear')); $pdluoid = GETPOSTINT('pdluoid'); -$batchnumber = GETPOST('batch_number', 'aZ09comma'); +$batchnumber = GETPOST('batch_number', 'alpha'); if (!empty($batchnumber)) { $batchnumber = trim($batchnumber); } From 08bd331d0bcaf3e19e7488be885d9f3cc2d37600 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 21 Apr 2026 14:32:55 +0200 Subject: [PATCH 42/53] FIX option MEMBER_SEARCH_MEMBER_PUBLIC_FORM_CREATE --- htdocs/adherents/admin/website.php | 7 +++++-- htdocs/langs/en_US/members.lang | 5 +++-- htdocs/public/members/new.php | 10 +++++++--- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/htdocs/adherents/admin/website.php b/htdocs/adherents/admin/website.php index 57d9950b901..a370280973c 100644 --- a/htdocs/adherents/admin/website.php +++ b/htdocs/adherents/admin/website.php @@ -107,6 +107,9 @@ if ($action == 'update') { } else { $res = dolibarr_set_const($db, "MEMBER_NEWFORM_FORCEMORPHY", $forcemorphy, 'chaine', 0, '', $conf->entity); } + if (GETPOSTISSET('MEMBER_SEARCH_MEMBER_PUBLIC_FORM_CREATE')) { + $res = dolibarr_set_const($db, "MEMBER_SEARCH_MEMBER_PUBLIC_FORM_CREATE", GETPOST('MEMBER_SEARCH_MEMBER_PUBLIC_FORM_CREATE') == 'yes' ? 1 : 0, 'chaine', 0, '', $conf->entity); + } if (!($res > 0)) { $error++; @@ -321,9 +324,9 @@ if (getDolGlobalString('MEMBER_ENABLE_PUBLIC')) { // Search a member after member creation form print '\n"; print '
'; - print $langs->trans("MEMBER_SEARCH_MEMBER_PUBLIC_FORM_CREATE"); + print $form->textwithpicto($langs->trans("MEMBER_SEARCH_MEMBER_PUBLIC_FORM_CREATE"), $langs->trans("MEMBER_SEARCH_MEMBER_PUBLIC_FORM_CREATEDesc")); print ''; - print $form->selectyesno("MEMBER_SEARCH_MEMBER_PUBLIC_FORM_CREATE"); // Reverse the logic "hide -> show" for retrocompatibility + print $form->selectyesno("MEMBER_SEARCH_MEMBER_PUBLIC_FORM_CREATE", getDolGlobalInt("MEMBER_SEARCH_MEMBER_PUBLIC_FORM_CREATE")); // Reverse the logic "hide -> show" for retrocompatibility print "
'; diff --git a/htdocs/langs/en_US/members.lang b/htdocs/langs/en_US/members.lang index da563c950f1..9416b02272c 100644 --- a/htdocs/langs/en_US/members.lang +++ b/htdocs/langs/en_US/members.lang @@ -262,5 +262,6 @@ ConfirmMergeMembers=Are you sure you want to merge the chosen member with the cu ErrorMembersMerge=There was an error when merging the members. Please check the log. Changes have been reverted. ConfirmCreateMember=Confirm create member CorrespondingMemberFound=Corresponding member found -CorrespondingMemberFoundQuestion=A member has been found with the given information.
Do you want to renew your membership? -MEMBER_SEARCH_MEMBER_PUBLIC_FORM_CREATE=Searches for a member matching the information entered in the public member creation form. If a member is found, redirects the user to the membership payment form +CorrespondingMemberFoundQuestion=A member has been found with the given information.
Do you want to renew your membership? (if not nothing will be recorded) +MEMBER_SEARCH_MEMBER_PUBLIC_FORM_CREATE=Suggest to just record the subscription (without creating a new member) if an existing member is found +MEMBER_SEARCH_MEMBER_PUBLIC_FORM_CREATEDesc=A search is done on login, company name + email (for legal entity), or full name + email (for individual). If a member is already found, the form suggest to record a renewal of subscription. diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index 16a47afe396..a184f2a035a 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -228,9 +228,13 @@ if ($reshook < 0) { } // Verify if we can find member + if (empty($reshook) && getDolGlobalInt("MEMBER_SEARCH_MEMBER_PUBLIC_FORM_CREATE") && $action == 'add' && !GETPOSTISSET("nofetchmember")) { // Test on permission not required here $memberfound = false; + if (!getDolGlobalString('ADHERENT_LOGIN_NOT_REQUIRED') && GETPOSTISSET('login')) { + // Note that this allow to guess anonymous ID already used. But this is not a problem as it is an anonymous pseudonym. + // If we try to new account and option MEMBER_SEARCH_MEMBER_PUBLIC_FORM_CREATE was off, we also get the same error. $sql = "SELECT rowid as id"; $sql .= " FROM ".MAIN_DB_PREFIX."adherent as a"; $sql .= " WHERE a.login = '".$db->escape(GETPOST('login'))."'"; @@ -868,14 +872,14 @@ if (getDolGlobalString('MEMBER_SKIP_TABLE') || getDolGlobalString('MEMBER_NEWFOR } // Firstname - print '
'.$langs->trans("Firstname").'
'.$langs->trans("Firstname").'
'.$langs->trans("Lastname").'
'.$langs->trans("Lastname").'
'.(getDolGlobalString('ADHERENT_MAIL_REQUIRED') ? '' : '').$langs->trans("EMail").(getDolGlobalString('ADHERENT_MAIL_REQUIRED') ? '' : '').''.img_picto('', 'object_email').'
'.img_picto('', 'object_email').'
'; - print $langs->trans("DefaultAmount"); - print ''; - print ''; - print ' '.$langs->getCurrencySymbol($mysoc->currency_code).''; - print "
'; print $langs->trans("MinimumAmount"); diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index a184f2a035a..0473ebc9e47 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -30,7 +30,6 @@ * \brief Example of form to add a new member * * Note that you can add following constant to change behaviour of page - * MEMBER_NEWFORM_AMOUNT Default amount for auto-subscribe form * MEMBER_MIN_AMOUNT Minimum amount * MEMBER_NEWFORM_PAYONLINE Suggest payment with 'all', 'paypal', 'paybox', 'stripe', ... * MEMBER_NEWFORM_DOLIBARRTURNOVER Show field turnover (specific for dolibarr foundation) @@ -586,7 +585,7 @@ if (empty($reshook) && $action == 'add') { // Test on permission not required he if (getDolGlobalString('MEMBER_NEWFORM_PAYONLINE') && getDolGlobalString('MEMBER_NEWFORM_PAYONLINE') != '-1') { if (empty($adht->caneditamount)) { // If edition of amount not allowed - // TODO Check amount is same than the amount required for the type of member or if not defined as the default amount into $conf->global->MEMBER_NEWFORM_AMOUNT + // TODO Check amount is same than the amount required for the type of member // It is not so important because a test is done on return of payment validation. } @@ -985,7 +984,7 @@ if (getDolGlobalString('MEMBER_SKIP_TABLE') || getDolGlobalString('MEMBER_NEWFOR $amountbytype = $adht->amountByType(1); // Load the array of amount per type $minimumamountbytype = $adht->minimumamountbytype(1); // Load the array of minimum amount per type foreach ($amountbytype as $k => $v) { - $amount = max(0, (float) $v, (float) getDolGlobalInt("MEMBER_MIN_AMOUNT"), (float) getDolGlobalInt("MEMBER_NEWFORM_AMOUNT"), $minimumamountbytype[$k]); + $amount = max(0, (float) $v, (float) getDolGlobalInt("MEMBER_MIN_AMOUNT"), $minimumamountbytype[$k]); $amountbytype[$k] = $amount; } @@ -995,10 +994,6 @@ if (getDolGlobalString('MEMBER_SKIP_TABLE') || getDolGlobalString('MEMBER_NEWFOR // Set amount for the subscription from the type and options: // - First check the amount of the member type. $amount = empty($amountbytype[$typeid]) ? 0 : $amountbytype[$typeid]; - // - If not found, take the default amount only if the user is authorized to edit it - if (empty($amount) && getDolGlobalString('MEMBER_NEWFORM_AMOUNT')) { - $amount = getDolGlobalString('MEMBER_NEWFORM_AMOUNT'); - } // - If not set, we accept to have amount defined as parameter (for backward compatibility). if (empty($amount)) { $amount = (GETPOST('amount') ? price2num(GETPOST('amount', 'alpha'), 'MT', 2) : ''); @@ -1020,7 +1015,6 @@ if (getDolGlobalString('MEMBER_SKIP_TABLE') || getDolGlobalString('MEMBER_NEWFOR } // TODO Move this into previous hook if (getDolGlobalString('MEMBER_NEWFORM_DOLIBARRTURNOVER')) { - // Do not set a default amount MEMBER_NEWFORM_AMOUNT if you use MEMBER_NEWFORM_DOLIBARRTURNOVER $s = $langs->trans("AreYouAPreferredPartner", '{s1}'); $s = str_replace('{s1}', 'Peferred Partner', $s); print '
'; @@ -1151,10 +1145,6 @@ if (getDolGlobalString('MEMBER_SKIP_TABLE') || getDolGlobalString('MEMBER_NEWFOR } print ''; - if (empty($amount) && getDolGlobalString('MEMBER_NEWFORM_AMOUNT')) { - $amount = getDolGlobalString('MEMBER_NEWFORM_AMOUNT'); - } - $amountformuladescription = $amountformuladescriptionbytype[$typeid]; $showedamount = $amount > 0 ? $amount : 0; @@ -1400,10 +1390,6 @@ if (getDolGlobalString('MEMBER_SKIP_TABLE') || getDolGlobalString('MEMBER_NEWFOR // - First check the amount of the member type. $amount = empty($amountbytype[$objp->rowid]) ? 0 : $amountbytype[$objp->rowid]; $minimumamount = empty($minimumamountbytype[$objp->rowid]) ? 0 : $minimumamountbytype[$objp->rowid]; - // - If not found, take the default amount only if the user is authorized to edit it - if (empty($amount) && getDolGlobalString('MEMBER_NEWFORM_AMOUNT')) { - $amount = getDolGlobalString('MEMBER_NEWFORM_AMOUNT'); - } // - If not set, we accept to have amount defined as parameter (for backward compatibility). if (empty($amount)) { $amount = (GETPOST('amount') ? price2num(GETPOST('amount', 'alpha'), 'MT', 2) : ''); diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index b59bd626460..35ca20809d8 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -1834,7 +1834,6 @@ if ($source == 'member' || $source == 'membersubscription') { $pp = 1; } - // Do not set a default amount MEMBER_NEWFORM_AMOUNT if you use MEMBER_NEWFORM_DOLIBARRTURNOVER $s = $langs->trans("AreYouAPreferredPartner", '{s1}'); $s = str_replace('{s1}', 'Peferred Partner', $s); print '
'; @@ -1963,10 +1962,6 @@ if ($source == 'member' || $source == 'membersubscription') { // Set amount for the subscription from the the type and options: // - First check the amount of the member type if there is no previous payment. $amount = ($member->last_subscription_amount ? $member->last_subscription_amount : (empty($amountbytype[$typeid]) ? 0 : $amountbytype[$typeid])); - // - If not found, take the default amount - if (empty($amount) && getDolGlobalString('MEMBER_NEWFORM_AMOUNT')) { - $amount = getDolGlobalString('MEMBER_NEWFORM_AMOUNT'); - } // - If an amount was posted from the form (for example from page with types of membership) if ($caneditamount && !GETPOST('reload') && GETPOSTISSET('amount') && GETPOSTFLOAT('amount', 'MT') > 0) { diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index 2f18408163b..44033a471cb 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -620,10 +620,6 @@ if ($ispaymentok) { // Set amount for the subscription: // - First check the amount of the member type. $amountexpected = empty($amountbytype[$typeid]) ? 0 : $amountbytype[$typeid]; - // - If not found, take the default amount - if (empty($amountexpected) && getDolGlobalString('MEMBER_NEWFORM_AMOUNT')) { - $amountexpected = getDolGlobalString('MEMBER_NEWFORM_AMOUNT'); - } // - If not set, we accept to have amount defined as parameter (for backward compatibility). //if (empty($amount)) { // $amount = (GETPOST('amount') ? price2num(GETPOST('amount', 'alpha'), 'MT', 2) : ''); From 32c0b08d66daafed981d1f280ae19ddd10356f30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 21 Apr 2026 14:54:15 +0200 Subject: [PATCH 44/53] clean code (#37955) * clean code * clean code * clean code * clean code * clean code * clean code * clean code --- htdocs/accountancy/admin/fiscalyear_card.php | 2 +- htdocs/accountancy/admin/template/card.php | 2 +- htdocs/accountancy/admin/template/list.php | 2 +- htdocs/admin/agenda_extrafields.php | 7 +++-- htdocs/admin/bank_extrafields.php | 7 +++-- htdocs/admin/bank_payments_extrafields.php | 9 +++---- htdocs/admin/bankline_extrafields.php | 9 +++---- htdocs/admin/bom_extrafields.php | 9 +++---- htdocs/admin/bomline_extrafields.php | 9 +++---- htdocs/admin/delivery_extrafields.php | 11 +++----- htdocs/admin/deliverydet_extrafields.php | 10 +++---- htdocs/admin/ecm_directories_extrafields.php | 11 +++----- htdocs/admin/ecm_files_extrafields.php | 11 +++----- htdocs/admin/emailcollector_card.php | 27 ++++++++++--------- htdocs/admin/emailcollector_list.php | 6 +++-- ...ventorganization_confbooth_extrafields.php | 9 +++---- ...nization_confboothattendee_extrafields.php | 9 +++---- htdocs/admin/expedition_extrafields.php | 11 +++----- htdocs/admin/expeditiondet_extrafields.php | 10 +++---- htdocs/admin/expensereport_extrafields.php | 9 +++---- htdocs/admin/holiday_extrafields.php | 9 +++---- htdocs/admin/knowledgerecord_extrafields.php | 10 +++---- htdocs/admin/mails_senderprofile_list.php | 6 +++-- htdocs/admin/mrp_extrafields.php | 9 +++---- htdocs/admin/mrp_production_extrafields.php | 9 +++---- htdocs/admin/order_extrafields.php | 10 +++---- htdocs/admin/orderdet_extrafields.php | 10 +++---- htdocs/admin/reception_extrafields.php | 11 +++----- .../admin/receptiondet_batch_extrafields.php | 14 ++++------ htdocs/admin/resource_extrafields.php | 10 +++---- htdocs/admin/subtotals.php | 12 ++++----- htdocs/admin/taxes.php | 12 ++++----- htdocs/admin/ticket_extrafields.php | 11 ++++---- htdocs/admin/user.php | 8 +++--- htdocs/admin/usergroup.php | 12 ++++----- htdocs/admin/workstation_extrafields.php | 10 +++---- htdocs/asset/accountancy_codes.php | 15 ++++++----- htdocs/asset/agenda.php | 6 +++-- htdocs/asset/model/note.php | 11 ++++---- htdocs/product/stats/contrat.php | 12 ++++----- 40 files changed, 173 insertions(+), 214 deletions(-) diff --git a/htdocs/accountancy/admin/fiscalyear_card.php b/htdocs/accountancy/admin/fiscalyear_card.php index 3639749d2da..6de0f000241 100644 --- a/htdocs/accountancy/admin/fiscalyear_card.php +++ b/htdocs/accountancy/admin/fiscalyear_card.php @@ -28,6 +28,7 @@ require '../../main.inc.php'; /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user @@ -54,7 +55,6 @@ $error = 0; // Initialize a technical objects $object = new Fiscalyear($db); -$extrafields = new ExtraFields($db); // Load object include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be 'include', not 'include_once'. diff --git a/htdocs/accountancy/admin/template/card.php b/htdocs/accountancy/admin/template/card.php index fb27fefa6a7..7ec97fe55b5 100644 --- a/htdocs/accountancy/admin/template/card.php +++ b/htdocs/accountancy/admin/template/card.php @@ -28,6 +28,7 @@ require '../../../main.inc.php'; /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user @@ -60,7 +61,6 @@ $backtopageforcancel = GETPOST('backtopageforcancel', 'alpha'); // Initialize technical objects $object = new BookkeepingTemplate($db); -$extrafields = new ExtraFields($db); $diroutputmassaction = $conf->accounting->dir_output . '/temp/massgeneration/' . $user->id; $hookmanager->initHooks(array($object->element . 'card', 'globalcard')); diff --git a/htdocs/accountancy/admin/template/list.php b/htdocs/accountancy/admin/template/list.php index af12705b243..7ded35fb391 100644 --- a/htdocs/accountancy/admin/template/list.php +++ b/htdocs/accountancy/admin/template/list.php @@ -29,6 +29,7 @@ require '../../../main.inc.php'; /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user @@ -68,7 +69,6 @@ $pagenext = $page + 1; // Initialize technical objects $object = new BookkeepingTemplate($db); -$extrafields = new ExtraFields($db); $diroutputmassaction = $conf->accounting->dir_output.'/temp/massgeneration/'.$user->id; $hookmanager->initHooks(array($contextpage)); diff --git a/htdocs/admin/agenda_extrafields.php b/htdocs/admin/agenda_extrafields.php index 8a581ac0fa3..899b5a4fcc5 100644 --- a/htdocs/admin/agenda_extrafields.php +++ b/htdocs/admin/agenda_extrafields.php @@ -29,17 +29,17 @@ // Load Dolibarr environment require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; - /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php'; + if (!$user->admin) { accessforbidden(); } @@ -47,7 +47,6 @@ if (!$user->admin) { // Load translation files required by the page $langs->loadLangs(array('admin', 'other', 'agenda')); -$extrafields = new ExtraFields($db); $form = new Form($db); // List of supported format diff --git a/htdocs/admin/bank_extrafields.php b/htdocs/admin/bank_extrafields.php index 17ff1082230..b0d6961617c 100644 --- a/htdocs/admin/bank_extrafields.php +++ b/htdocs/admin/bank_extrafields.php @@ -29,21 +29,20 @@ // Load Dolibarr environment require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; - /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php'; + // Load translation files required by the page $langs->loadLangs(array('banks', 'admin')); -$extrafields = new ExtraFields($db); $form = new Form($db); // List of supported format diff --git a/htdocs/admin/bank_payments_extrafields.php b/htdocs/admin/bank_payments_extrafields.php index b4ca2483f2c..cf69d6f2c8d 100644 --- a/htdocs/admin/bank_payments_extrafields.php +++ b/htdocs/admin/bank_payments_extrafields.php @@ -5,7 +5,7 @@ * Copyright (C) 2012 Regis Houssin * Copyright (C) 2014 Florian Henry * Copyright (C) 2015 Jean-François Ferry - * Copyright (C) 2022-2025 Frédéric France + * Copyright (C) 2022-2026 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 @@ -30,21 +30,20 @@ // Load Dolibarr environment require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; - /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php'; + // Load translation files required by the page $langs->loadLangs(array("admin", "companies", "bills", "other", "banks")); -$extrafields = new ExtraFields($db); $form = new Form($db); // List of supported format diff --git a/htdocs/admin/bankline_extrafields.php b/htdocs/admin/bankline_extrafields.php index d8c812d08d4..d5b58630116 100644 --- a/htdocs/admin/bankline_extrafields.php +++ b/htdocs/admin/bankline_extrafields.php @@ -5,7 +5,7 @@ * Copyright (C) 2012 Regis Houssin * Copyright (C) 2014 Florian Henry * Copyright (C) 2015 Jean-François Ferry - * Copyright (C) 2022-2024 Frédéric France + * Copyright (C) 2022-2026 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 @@ -30,21 +30,20 @@ // Load Dolibarr environment require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; - /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php'; + // Load translation files required by the page $langs->loadLangs(array("admin", "companies", "bills", "other", "banks")); -$extrafields = new ExtraFields($db); $form = new Form($db); // List of supported format diff --git a/htdocs/admin/bom_extrafields.php b/htdocs/admin/bom_extrafields.php index 01d9ca59dbe..dbba8557312 100644 --- a/htdocs/admin/bom_extrafields.php +++ b/htdocs/admin/bom_extrafields.php @@ -5,7 +5,7 @@ * Copyright (C) 2012 Regis Houssin * Copyright (C) 2014 Florian Henry * Copyright (C) 2015 Jean-François Ferry - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2026 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 @@ -29,21 +29,20 @@ // Load Dolibarr environment require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/bom/lib/bom.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; - /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT.'/bom/lib/bom.lib.php'; + // Load translation files required by the page $langs->loadLangs(array('mrp', 'admin')); -$extrafields = new ExtraFields($db); $form = new Form($db); // List of supported format diff --git a/htdocs/admin/bomline_extrafields.php b/htdocs/admin/bomline_extrafields.php index 8c5126c0ab8..a1fa9a25267 100644 --- a/htdocs/admin/bomline_extrafields.php +++ b/htdocs/admin/bomline_extrafields.php @@ -6,7 +6,7 @@ * Copyright (C) 2012 Regis Houssin * Copyright (C) 2014 Florian Henry * Copyright (C) 2015 Jean-François Ferry - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2026 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 @@ -29,21 +29,20 @@ */ require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT . '/bom/lib/bom.lib.php'; -require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php'; - /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT . '/bom/lib/bom.lib.php'; + // Load translation files required by the page $langs->loadLangs(array('mrp', 'admin')); -$extrafields = new ExtraFields($db); $form = new Form($db); // List of supported format diff --git a/htdocs/admin/delivery_extrafields.php b/htdocs/admin/delivery_extrafields.php index 7153e8b2588..10c258affc7 100644 --- a/htdocs/admin/delivery_extrafields.php +++ b/htdocs/admin/delivery_extrafields.php @@ -6,7 +6,7 @@ * Copyright (C) 2012 Florian Henry * Copyright (C) 2013 Philippe Grand * Copyright (C) 2015 Claudio Aschieri - * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2024-2026 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 @@ -30,18 +30,17 @@ // Load Dolibarr environment require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/expedition.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; - - /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT.'/core/lib/expedition.lib.php'; + if (!$user->admin) { accessforbidden(); } @@ -49,8 +48,6 @@ if (!$user->admin) { // Load translation files required by the page $langs->loadLangs(array('admin', 'other', 'sendings')); - -$extrafields = new ExtraFields($db); $form = new Form($db); // List of supported format diff --git a/htdocs/admin/deliverydet_extrafields.php b/htdocs/admin/deliverydet_extrafields.php index d778b547d18..5bf5ae9fd0b 100644 --- a/htdocs/admin/deliverydet_extrafields.php +++ b/htdocs/admin/deliverydet_extrafields.php @@ -7,7 +7,7 @@ * Copyright (C) 2013 Philippe Grand * Copyright (C) 2013 Florian Henry * Copyright (C) 2015 Claudio Aschieri - * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2024-2026 Frédéric France * * * This program is free software; you can redistribute it and/or modify @@ -32,18 +32,17 @@ // Load Dolibarr environment require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/expedition.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; - - /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT.'/core/lib/expedition.lib.php'; + if (!$user->admin) { accessforbidden(); } @@ -51,7 +50,6 @@ if (!$user->admin) { // Load translation files required by the page $langs->loadLangs(array('admin', 'other', 'sendings')); -$extrafields = new ExtraFields($db); $form = new Form($db); // List of supported format diff --git a/htdocs/admin/ecm_directories_extrafields.php b/htdocs/admin/ecm_directories_extrafields.php index aaba4e1bf38..c4b6ca1c718 100644 --- a/htdocs/admin/ecm_directories_extrafields.php +++ b/htdocs/admin/ecm_directories_extrafields.php @@ -6,7 +6,7 @@ * Copyright (C) 2012 Florian Henry * Copyright (C) 2013 Philippe Grand * Copyright (C) 2015 Claudio Aschieri - * Copyright (C) 2020-2025 Frédéric France + * Copyright (C) 2020-2026 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 @@ -30,18 +30,17 @@ // Load Dolibarr environment require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/ecm.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; - - /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT.'/core/lib/ecm.lib.php'; + if (!$user->admin) { accessforbidden(); } @@ -49,8 +48,6 @@ if (!$user->admin) { // Load translation files required by the page $langs->loadLangs(array('admin', 'other', 'ecm')); - -$extrafields = new ExtraFields($db); $form = new Form($db); // List of supported format diff --git a/htdocs/admin/ecm_files_extrafields.php b/htdocs/admin/ecm_files_extrafields.php index c99dc245924..62f36b8b7e3 100644 --- a/htdocs/admin/ecm_files_extrafields.php +++ b/htdocs/admin/ecm_files_extrafields.php @@ -6,7 +6,7 @@ * Copyright (C) 2012 Florian Henry * Copyright (C) 2013 Philippe Grand * Copyright (C) 2015 Claudio Aschieri - * Copyright (C) 2020-2025 Frédéric France + * Copyright (C) 2020-2026 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 @@ -30,18 +30,17 @@ // Load Dolibarr environment require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/ecm.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; - - /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT.'/core/lib/ecm.lib.php'; + if (!$user->admin) { accessforbidden(); } @@ -49,8 +48,6 @@ if (!$user->admin) { // Load translation files required by the page $langs->loadLangs(array('admin', 'other', 'ecm')); - -$extrafields = new ExtraFields($db); $form = new Form($db); // List of supported format diff --git a/htdocs/admin/emailcollector_card.php b/htdocs/admin/emailcollector_card.php index 48f803595e2..6280141c458 100644 --- a/htdocs/admin/emailcollector_card.php +++ b/htdocs/admin/emailcollector_card.php @@ -2,7 +2,7 @@ /* Copyright (C) 2018 Laurent Destailleur * Copyright (C) 2022 Charlene Benke * Copyright (C) 2024 MDW - * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2024-2026 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 @@ -26,6 +26,15 @@ // Load Dolibarr environment require '../main.inc.php'; +/** + * @var Conf $conf + * @var DoliDB $db + * @var ExtraFields $extrafields + * @var HookManager $hookmanager + * @var Translate $langs + * @var User $user + */ + require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/events.class.php'; @@ -44,14 +53,6 @@ use Webklex\PHPIMAP\Exceptions\ConnectionFailedException; use OAuth\Common\Storage\DoliStorage; use OAuth\Common\Consumer\Credentials; -/** - * @var Conf $conf - * @var DoliDB $db - * @var HookManager $hookmanager - * @var Translate $langs - * @var User $user - */ - if (!$user->admin) { accessforbidden(); } @@ -64,10 +65,10 @@ $langs->loadLangs(array("admin", "mails", "other")); // Get parameters $id = GETPOSTINT('id'); -$ref = GETPOST('ref', 'alpha'); +$ref = GETPOST('ref', 'alpha'); $action = GETPOST('action', 'aZ09'); -$confirm = GETPOST('confirm', 'alpha'); -$cancel = GETPOST('cancel', 'alpha'); +$confirm = GETPOST('confirm', 'alpha'); +$cancel = GETPOST('cancel', 'alpha'); $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'emailcollectorcard'; // To manage different context of search $backtopage = GETPOST('backtopage', 'alpha'); @@ -75,7 +76,7 @@ $operationid = GETPOSTINT('operationid'); // Initialize a technical objects $object = new EmailCollector($db); -$extrafields = new ExtraFields($db); + $diroutputmassaction = $conf->emailcollector->dir_output.'/temp/massgeneration/'.$user->id; $hookmanager->initHooks(array('emailcollectorcard')); // Note that conf->hooks_modules contains array diff --git a/htdocs/admin/emailcollector_list.php b/htdocs/admin/emailcollector_list.php index 0804c08b499..c63e9c66690 100644 --- a/htdocs/admin/emailcollector_list.php +++ b/htdocs/admin/emailcollector_list.php @@ -1,7 +1,7 @@ * Copyright (C) 2024 Alexandre Spangaro - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2026 Frédéric France * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify @@ -29,10 +29,12 @@ require '../main.inc.php'; /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user */ + require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/events.class.php'; @@ -77,7 +79,7 @@ $pagenext = $page + 1; // Initialize a technical objects $object = new EmailCollector($db); -$extrafields = new ExtraFields($db); + $diroutputmassaction = $conf->emailcollector->dir_output.'/temp/massgeneration/'.$user->id; $hookmanager->initHooks(array('emailcollectorlist')); // Note that conf->hooks_modules contains array diff --git a/htdocs/admin/eventorganization_confbooth_extrafields.php b/htdocs/admin/eventorganization_confbooth_extrafields.php index 8cef64b5db8..eea0bc383ba 100644 --- a/htdocs/admin/eventorganization_confbooth_extrafields.php +++ b/htdocs/admin/eventorganization_confbooth_extrafields.php @@ -1,6 +1,6 @@ - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2026 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 @@ -24,21 +24,20 @@ // Load Dolibarr environment require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/eventorganization.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; - /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT.'/core/lib/eventorganization.lib.php'; + // Load translation files required by the page $langs->loadLangs(array('eventorganization', 'admin')); -$extrafields = new ExtraFields($db); $form = new Form($db); // List of supported format diff --git a/htdocs/admin/eventorganization_confboothattendee_extrafields.php b/htdocs/admin/eventorganization_confboothattendee_extrafields.php index d33db8b1863..2c436b0f912 100644 --- a/htdocs/admin/eventorganization_confboothattendee_extrafields.php +++ b/htdocs/admin/eventorganization_confboothattendee_extrafields.php @@ -5,7 +5,7 @@ * Copyright (C) 2012 Regis Houssin * Copyright (C) 2014 Florian Henry * Copyright (C) 2015 Jean-François Ferry - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2026 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 @@ -27,21 +27,20 @@ * \brief Page to setup extra fields of conferenceorboothattendee */ require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/eventorganization.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; - /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT.'/core/lib/eventorganization.lib.php'; + // Load translation files required by the page $langs->loadLangs(array('eventorganization', 'admin')); -$extrafields = new ExtraFields($db); $form = new Form($db); // List of supported format diff --git a/htdocs/admin/expedition_extrafields.php b/htdocs/admin/expedition_extrafields.php index 63cb11e4335..c32d710f432 100644 --- a/htdocs/admin/expedition_extrafields.php +++ b/htdocs/admin/expedition_extrafields.php @@ -6,7 +6,7 @@ * Copyright (C) 2012 Florian Henry * Copyright (C) 2013 Philippe Grand * Copyright (C) 2015 Claudio Aschieri - * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2024-2026 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 @@ -30,18 +30,17 @@ // Load Dolibarr environment require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/expedition.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; - - /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT.'/core/lib/expedition.lib.php'; + if (!$user->admin) { accessforbidden(); } @@ -49,8 +48,6 @@ if (!$user->admin) { // Load translation files required by the page $langs->loadLangs(array('admin', 'other', 'sendings')); - -$extrafields = new ExtraFields($db); $form = new Form($db); // List of supported format diff --git a/htdocs/admin/expeditiondet_extrafields.php b/htdocs/admin/expeditiondet_extrafields.php index b8d2d5f0093..b2ada94d6a8 100644 --- a/htdocs/admin/expeditiondet_extrafields.php +++ b/htdocs/admin/expeditiondet_extrafields.php @@ -7,7 +7,7 @@ * Copyright (C) 2013 Philippe Grand * Copyright (C) 2013 Florian Henry * Copyright (C) 2015 Claudio Aschieri - * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2024-2026 Frédéric France * * * This program is free software; you can redistribute it and/or modify @@ -32,18 +32,17 @@ // Load Dolibarr environment require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/expedition.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; - - /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT.'/core/lib/expedition.lib.php'; + if (!$user->admin) { accessforbidden(); } @@ -51,7 +50,6 @@ if (!$user->admin) { // Load translation files required by the page $langs->loadLangs(array('admin', 'other', 'sendings')); -$extrafields = new ExtraFields($db); $form = new Form($db); // List of supported format diff --git a/htdocs/admin/expensereport_extrafields.php b/htdocs/admin/expensereport_extrafields.php index c3690d4a80c..9b43a03bbf1 100644 --- a/htdocs/admin/expensereport_extrafields.php +++ b/htdocs/admin/expensereport_extrafields.php @@ -5,7 +5,7 @@ * Copyright (C) 2012 Regis Houssin * Copyright (C) 2012 Florian Henry * Copyright (C) 2013 Philippe Grand - * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2024-2026 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 @@ -29,17 +29,17 @@ // Load Dolibarr environment require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/expensereport.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; - /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT.'/core/lib/expensereport.lib.php'; + if (!$user->admin) { accessforbidden(); } @@ -47,7 +47,6 @@ if (!$user->admin) { // Load translation files required by the page $langs->loadLangs(array('admin', 'errors', 'trips', 'other')); -$extrafields = new ExtraFields($db); $form = new Form($db); // List of supported format diff --git a/htdocs/admin/holiday_extrafields.php b/htdocs/admin/holiday_extrafields.php index eb052884c32..e3c8329c9e3 100644 --- a/htdocs/admin/holiday_extrafields.php +++ b/htdocs/admin/holiday_extrafields.php @@ -5,7 +5,7 @@ * Copyright (C) 2012 Regis Houssin * Copyright (C) 2012 Florian Henry * Copyright (C) 2013 Philippe Grand - * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2024-2026 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 @@ -29,17 +29,17 @@ // Load Dolibarr environment require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/holiday.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; - /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT.'/core/lib/holiday.lib.php'; + if (!$user->admin) { accessforbidden(); } @@ -47,7 +47,6 @@ if (!$user->admin) { // Load translation files required by the page $langs->loadLangs(array('admin', 'errors', 'holiday', 'other')); -$extrafields = new ExtraFields($db); $form = new Form($db); // List of supported format diff --git a/htdocs/admin/knowledgerecord_extrafields.php b/htdocs/admin/knowledgerecord_extrafields.php index d5fbaed92de..04ff49ab83d 100644 --- a/htdocs/admin/knowledgerecord_extrafields.php +++ b/htdocs/admin/knowledgerecord_extrafields.php @@ -5,7 +5,7 @@ * Copyright (C) 2012 Regis Houssin * Copyright (C) 2014 Florian Henry * Copyright (C) 2015 Jean-François Ferry - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2026 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 @@ -29,22 +29,20 @@ // Load Dolibarr environment require '../main.inc.php'; - -require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; -require_once DOL_DOCUMENT_ROOT.'/knowledgemanagement/lib/knowledgemanagement.lib.php'; - /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT.'/knowledgemanagement/lib/knowledgemanagement.lib.php'; + // Load translation files required by the page $langs->loadLangs(array('knowledgemanagement', 'admin')); -$extrafields = new ExtraFields($db); $form = new Form($db); // List of supported format diff --git a/htdocs/admin/mails_senderprofile_list.php b/htdocs/admin/mails_senderprofile_list.php index a6fd6e20dff..18f2aa5807d 100644 --- a/htdocs/admin/mails_senderprofile_list.php +++ b/htdocs/admin/mails_senderprofile_list.php @@ -1,7 +1,7 @@ * Copyright (C) 2018 Ferran Marcet - * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2024-2026 Frédéric France * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify @@ -29,10 +29,12 @@ require '../main.inc.php'; /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user */ + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; @@ -70,7 +72,7 @@ $pagenext = $page + 1; // Initialize a technical objects $object = new EmailSenderProfile($db); -$extrafields = new ExtraFields($db); + $diroutputmassaction = $conf->admin->dir_output.'/temp/massgeneration/'.$user->id; $hookmanager->initHooks(array('emailsenderprofilelist')); // Note that conf->hooks_modules contains array diff --git a/htdocs/admin/mrp_extrafields.php b/htdocs/admin/mrp_extrafields.php index 066fb9fe0bc..a2c7065ecbd 100644 --- a/htdocs/admin/mrp_extrafields.php +++ b/htdocs/admin/mrp_extrafields.php @@ -6,7 +6,7 @@ * Copyright (C) 2014 Florian Henry * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2024 MDW - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2026 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 @@ -30,21 +30,20 @@ // Load Dolibarr environment require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/mrp/lib/mrp.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; - /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT.'/mrp/lib/mrp.lib.php'; + // Load translation files required by the page $langs->loadLangs(array('mrp', 'admin')); -$extrafields = new ExtraFields($db); $form = new Form($db); // List of supported format diff --git a/htdocs/admin/mrp_production_extrafields.php b/htdocs/admin/mrp_production_extrafields.php index 9febcda909e..3dde686582f 100644 --- a/htdocs/admin/mrp_production_extrafields.php +++ b/htdocs/admin/mrp_production_extrafields.php @@ -5,7 +5,7 @@ * Copyright (C) 2012 Regis Houssin * Copyright (C) 2014 Florian Henry * Copyright (C) 2015 Jean-François Ferry - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2026 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 @@ -29,21 +29,20 @@ // Load Dolibarr environment require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/mrp/lib/mrp.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; - /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT.'/mrp/lib/mrp.lib.php'; + // Load translation files required by the page $langs->loadLangs(array('mrp', 'admin')); -$extrafields = new ExtraFields($db); $form = new Form($db); // List of supported format diff --git a/htdocs/admin/order_extrafields.php b/htdocs/admin/order_extrafields.php index feaba5590ef..f1e34cd0da3 100644 --- a/htdocs/admin/order_extrafields.php +++ b/htdocs/admin/order_extrafields.php @@ -5,7 +5,7 @@ * Copyright (C) 2012 Regis Houssin * Copyright (C) 2012 Florian Henry * Copyright (C) 2013 Philippe Grand - * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2024-2026 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 @@ -29,18 +29,17 @@ // Load Dolibarr environment require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/order.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; - - /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT.'/core/lib/order.lib.php'; + if (!$user->admin) { accessforbidden(); } @@ -48,7 +47,6 @@ if (!$user->admin) { // Load translation files required by the page $langs->loadLangs(array('admin', 'other', 'orders')); -$extrafields = new ExtraFields($db); $form = new Form($db); // List of supported format diff --git a/htdocs/admin/orderdet_extrafields.php b/htdocs/admin/orderdet_extrafields.php index 636f2fd264d..f6a3a676f5e 100644 --- a/htdocs/admin/orderdet_extrafields.php +++ b/htdocs/admin/orderdet_extrafields.php @@ -6,7 +6,7 @@ * Copyright (C) 2012 Florian Henry * Copyright (C) 2013 Philippe Grand * Copyright (C) 2013 Florian Henry - * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2024-2026 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 @@ -30,18 +30,17 @@ // Load Dolibarr environment require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/order.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; - - /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT.'/core/lib/order.lib.php'; + if (!$user->admin) { accessforbidden(); } @@ -49,7 +48,6 @@ if (!$user->admin) { // Load translation files required by the page $langs->loadlangs(array('admin', 'other', 'orders')); -$extrafields = new ExtraFields($db); $form = new Form($db); // List of supported format diff --git a/htdocs/admin/reception_extrafields.php b/htdocs/admin/reception_extrafields.php index 26103d779a9..96407bc6351 100644 --- a/htdocs/admin/reception_extrafields.php +++ b/htdocs/admin/reception_extrafields.php @@ -7,7 +7,7 @@ * Copyright (C) 2013 Philippe Grand * Copyright (C) 2015 Claudio Aschieri * Copyright (C) 2018 Quentin Vial-Gouteyron - * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2024-2026 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 @@ -31,26 +31,23 @@ // Load Dolibarr environment require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/reception.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; - - /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT.'/core/lib/reception.lib.php'; + if (!$user->admin) { accessforbidden(); } $langs->loadLangs(array("admin", "other", "receptions", "sendings")); - -$extrafields = new ExtraFields($db); $form = new Form($db); // List of supported format diff --git a/htdocs/admin/receptiondet_batch_extrafields.php b/htdocs/admin/receptiondet_batch_extrafields.php index 93864b69edd..73270c31b83 100644 --- a/htdocs/admin/receptiondet_batch_extrafields.php +++ b/htdocs/admin/receptiondet_batch_extrafields.php @@ -8,7 +8,7 @@ * Copyright (C) 2013 Florian Henry * Copyright (C) 2015 Claudio Aschieri * Copyright (C) 2018 Quentin Vial-Gouteyron - * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2024-2026 Frédéric France * * * This program is free software; you can redistribute it and/or modify @@ -33,27 +33,23 @@ // Load Dolibarr environment require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/reception.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; - - /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT.'/core/lib/reception.lib.php'; + if (!$user->admin) { accessforbidden(); } -$langs->load("admin"); -$langs->load("other"); -$langs->load("receptions"); +$langs->loadLangs(["admin", "other", "receptions"]); -$extrafields = new ExtraFields($db); $form = new Form($db); // List of supported format diff --git a/htdocs/admin/resource_extrafields.php b/htdocs/admin/resource_extrafields.php index 6d3b3806d82..4f0ca407645 100644 --- a/htdocs/admin/resource_extrafields.php +++ b/htdocs/admin/resource_extrafields.php @@ -4,7 +4,7 @@ * Copyright (C) 2004-2013 Laurent Destailleur * Copyright (C) 2012 Regis Houssin * Copyright (C) 2016 Florian Henry - * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2024-2026 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 @@ -28,18 +28,17 @@ // Load Dolibarr environment require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/resource.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; - - /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT.'/core/lib/resource.lib.php'; + if (!$user->admin) { accessforbidden(); } @@ -47,7 +46,6 @@ if (!$user->admin) { // Load translation files required by the page $langs->loadLangs(array('admin', 'other', 'resource')); -$extrafields = new ExtraFields($db); $form = new Form($db); // List of supported format diff --git a/htdocs/admin/subtotals.php b/htdocs/admin/subtotals.php index 924ae671178..85037b98af3 100644 --- a/htdocs/admin/subtotals.php +++ b/htdocs/admin/subtotals.php @@ -3,7 +3,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2012-2013 Juanjo Menent * Copyright (C) 2019 Christophe Battarel - * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2024-2026 Frédéric France * Copyright (C) 2024 MDW * Copyright (C) 2025 Charlene Benke * @@ -29,11 +29,6 @@ // Load Dolibarr environment require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php'; -require_once DOL_DOCUMENT_ROOT . '/core/lib/doleditor.lib.php'; -require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php'; -require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php'; - /** * @var Conf $conf * @var DoliDB $db @@ -43,6 +38,11 @@ require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php'; * @var User $user */ +require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php'; +require_once DOL_DOCUMENT_ROOT . '/core/lib/doleditor.lib.php'; +require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php'; +require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php'; + // Load translation files required by the page $langs->loadLangs(array('main', 'admin', 'subtotals', 'errors')); $action = GETPOST('action', 'aZ09'); diff --git a/htdocs/admin/taxes.php b/htdocs/admin/taxes.php index b3c3b60a579..206ce16e180 100644 --- a/htdocs/admin/taxes.php +++ b/htdocs/admin/taxes.php @@ -5,7 +5,7 @@ * Copyright (C) 2011-2013 Juanjo Menent * Copyright (C) 2015-2022 Alexandre Spangaro * Copyright (C) 2023 Joachim Kueter - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2026 Frédéric France * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify @@ -30,11 +30,6 @@ // Load Dolibarr environment require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; -if (isModEnabled('accounting')) { - require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php'; -} - /** * @var Conf $conf * @var DoliDB $db @@ -43,6 +38,11 @@ if (isModEnabled('accounting')) { * @var User $user */ +require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; +if (isModEnabled('accounting')) { + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php'; +} + // Load translation files required by the page $langs->loadLangs(array('admin', 'objects', 'companies', 'products')); diff --git a/htdocs/admin/ticket_extrafields.php b/htdocs/admin/ticket_extrafields.php index 5cfba7fd924..9c989c8e543 100644 --- a/htdocs/admin/ticket_extrafields.php +++ b/htdocs/admin/ticket_extrafields.php @@ -1,6 +1,6 @@ - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2026 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 @@ -24,22 +24,21 @@ // Load Dolibarr environment require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT."/core/lib/ticket.lib.php"; -require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; - /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT."/core/lib/ticket.lib.php"; +require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; + // Load translation files required by the page $langs->loadLangs(array('ticket', 'admin')); -$extrafields = new ExtraFields($db); $form = new Form($db); // List of supported format diff --git a/htdocs/admin/user.php b/htdocs/admin/user.php index 5cf7b347ea2..b0dcc265497 100644 --- a/htdocs/admin/user.php +++ b/htdocs/admin/user.php @@ -6,7 +6,7 @@ * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2005-2011 Regis Houssin * Copyright (C) 2015 Juanjo Menent - * Copyright (C) 2020-2025 Frédéric France + * Copyright (C) 2020-2026 Frédéric France * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify @@ -34,20 +34,18 @@ require '../main.inc.php'; /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user */ + require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; - // Load translation files required by the page $langs->loadLangs(array('admin', 'members', 'users')); -$extrafields = new ExtraFields($db); // may be used by some inc.php files - $action = GETPOST('action', 'aZ09'); $backtopage = GETPOST('backtopage', 'alpha'); $modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php diff --git a/htdocs/admin/usergroup.php b/htdocs/admin/usergroup.php index 7c0303b34dd..e23b607935c 100644 --- a/htdocs/admin/usergroup.php +++ b/htdocs/admin/usergroup.php @@ -7,7 +7,7 @@ * Copyright (C) 2005-2011 Regis Houssin * Copyright (C) 2015 Juanjo Menent * Copyright (C) 2024-2025 MDW - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2026 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 @@ -31,26 +31,24 @@ // Load Dolibarr environment require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; - /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; + // Load translation files required by the page $langs->loadLangs(array("admin", "members", "users")); if (!$user->admin) { accessforbidden(); } -$extrafields = new ExtraFields($db); - $action = GETPOST('action', 'aZ09'); $value = GETPOST('value', 'alpha'); $modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php diff --git a/htdocs/admin/workstation_extrafields.php b/htdocs/admin/workstation_extrafields.php index 193bd173afc..65756b04928 100644 --- a/htdocs/admin/workstation_extrafields.php +++ b/htdocs/admin/workstation_extrafields.php @@ -5,7 +5,7 @@ * Copyright (C) 2012 Regis Houssin * Copyright (C) 2014 Florian Henry * Copyright (C) 2015 Jean-François Ferry - * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2024-2026 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 @@ -29,22 +29,20 @@ // Load Dolibarr environment require "../main.inc.php"; - -require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; -require_once DOL_DOCUMENT_ROOT.'/workstation/lib/workstation.lib.php'; - /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT.'/workstation/lib/workstation.lib.php'; + // Load translation files required by the page $langs->loadLangs(array('workstation', 'admin')); -$extrafields = new ExtraFields($db); $form = new Form($db); // List of supported format diff --git a/htdocs/asset/accountancy_codes.php b/htdocs/asset/accountancy_codes.php index 82c6f58207b..5aa4a793c83 100644 --- a/htdocs/asset/accountancy_codes.php +++ b/htdocs/asset/accountancy_codes.php @@ -1,7 +1,7 @@ * Copyright (C) 2018 Alexandre Spangaro - * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2024-2026 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 @@ -25,19 +25,20 @@ // Load Dolibarr environment require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT . '/core/lib/asset.lib.php'; -require_once DOL_DOCUMENT_ROOT . '/asset/class/asset.class.php'; -require_once DOL_DOCUMENT_ROOT . '/asset/class/assetaccountancycodes.class.php'; -require_once DOL_DOCUMENT_ROOT . '/asset/class/assetdepreciationoptions.class.php'; - /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT . '/core/lib/asset.lib.php'; +require_once DOL_DOCUMENT_ROOT . '/asset/class/asset.class.php'; +require_once DOL_DOCUMENT_ROOT . '/asset/class/assetaccountancycodes.class.php'; +require_once DOL_DOCUMENT_ROOT . '/asset/class/assetdepreciationoptions.class.php'; + // Load translation files required by the page $langs->loadLangs(array("assets", "companies")); @@ -53,7 +54,7 @@ $backtopageforcancel = GETPOST('backtopageforcancel', 'alpha'); $object = new Asset($db); $assetaccountancycodes = new AssetAccountancyCodes($db); $assetdepreciationoptions = new AssetDepreciationOptions($db); -$extrafields = new ExtraFields($db); + $diroutputmassaction = $conf->asset->dir_output . '/temp/massgeneration/' . $user->id; $hookmanager->initHooks(array('assetaccountancycodes', 'globalcard')); // Note that conf->hooks_modules contains array // Fetch optionals attributes and labels diff --git a/htdocs/asset/agenda.php b/htdocs/asset/agenda.php index a8a8b3d0e21..f2a58bb0798 100644 --- a/htdocs/asset/agenda.php +++ b/htdocs/asset/agenda.php @@ -1,6 +1,6 @@ - * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2024-2026 Frédéric France * Copyright (C) 2025 Alexandre Spangaro * * This program is free software; you can redistribute it and/or modify @@ -28,10 +28,12 @@ require '../main.inc.php'; /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user */ + require_once DOL_DOCUMENT_ROOT.'/core/lib/asset.lib.php'; require_once DOL_DOCUMENT_ROOT.'/asset/class/asset.class.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; @@ -79,7 +81,7 @@ if (!$sortorder) { // Initialize a technical objects $object = new Asset($db); -$extrafields = new ExtraFields($db); + $diroutputmassaction = $conf->asset->dir_output.'/temp/massgeneration/'.$user->id; $hookmanager->initHooks(array('assetagenda', 'globalcard')); // Note that conf->hooks_modules contains array // Fetch optionals attributes and labels diff --git a/htdocs/asset/model/note.php b/htdocs/asset/model/note.php index 5fa63a2f7a8..25b3f88aeac 100644 --- a/htdocs/asset/model/note.php +++ b/htdocs/asset/model/note.php @@ -1,7 +1,7 @@ * Copyright (C) 2018 Alexandre Spangaro - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2026 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 @@ -25,17 +25,18 @@ // Load Dolibarr environment require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT . '/core/lib/asset.lib.php'; -require_once DOL_DOCUMENT_ROOT . '/asset/class/assetmodel.class.php'; - /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT . '/core/lib/asset.lib.php'; +require_once DOL_DOCUMENT_ROOT . '/asset/class/assetmodel.class.php'; + // Load translation files required by the page $langs->loadLangs(array("assets", "companies")); @@ -48,7 +49,7 @@ $backtopage = GETPOST('backtopage', 'alpha'); // Initialize a technical objects $object = new AssetModel($db); -$extrafields = new ExtraFields($db); + $diroutputmassaction = $conf->asset->dir_output . '/temp/massgeneration/' . $user->id; $hookmanager->initHooks(array('assetmodelnote', 'globalcard')); // Note that conf->hooks_modules contains array // Fetch optionals attributes and labels diff --git a/htdocs/product/stats/contrat.php b/htdocs/product/stats/contrat.php index 3b72c112e57..db950f7bbe2 100644 --- a/htdocs/product/stats/contrat.php +++ b/htdocs/product/stats/contrat.php @@ -27,10 +27,6 @@ // Load Dolibarr environment require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; -require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; - /** * @var Conf $conf * @var DoliDB $db @@ -39,6 +35,10 @@ require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; * @var User $user */ +require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; +require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; + // Load translation files required by the page $langs->loadLangs(array('contracts', 'products', 'companies')); @@ -191,10 +191,10 @@ if ($id > 0 || !empty($ref)) { $option .= '&limit='.((int) $limit); } if (!empty($search_month)) { - $option .= '&search_month='.urlencode($search_month); + $option .= '&search_month='.urlencode((string) $search_month); } if (!empty($search_year)) { - $option .= '&search_year='.urlencode((string) ($search_year)); + $option .= '&search_year='.urlencode((string) $search_year); } print ''; From 522a6daad9c6b1f4621e6bd2718c37f953de01b0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 21 Apr 2026 14:55:18 +0200 Subject: [PATCH 45/53] Fix ci --- htdocs/product/stats/contrat.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/stats/contrat.php b/htdocs/product/stats/contrat.php index 3b72c112e57..27ea898c5ee 100644 --- a/htdocs/product/stats/contrat.php +++ b/htdocs/product/stats/contrat.php @@ -191,7 +191,7 @@ if ($id > 0 || !empty($ref)) { $option .= '&limit='.((int) $limit); } if (!empty($search_month)) { - $option .= '&search_month='.urlencode($search_month); + $option .= '&search_month='.urlencode((string) $search_month); } if (!empty($search_year)) { $option .= '&search_year='.urlencode((string) ($search_year)); From fe9eba416592f76a78d53c7bf3a856f9953d12fc Mon Sep 17 00:00:00 2001 From: sonikf <93765174+sonikf@users.noreply.github.com> Date: Tue, 21 Apr 2026 13:37:17 +0000 Subject: [PATCH 46/53] fix regression (#37956) Co-authored-by: Laurent Destailleur --- htdocs/expedition/card.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 48bea0dda78..e3b9bcf2b53 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -126,12 +126,12 @@ $extrafields->fetch_name_optionals_label($objectorder->table_element_line); // Load object. Make an object->fetch include DOL_DOCUMENT_ROOT . '/core/actions_fetchobject.inc.php'; // Must be 'include', not 'include_once' -if (empty($origin) && !empty($object->origin_type)) { +if (empty($origin) && !empty($object->origin_type) && $object->origin_id > 0) { $origin = $object->origin_type; -} elseif (empty($origin) && !empty($object->origin)) { - $origin = (string) $object->origin; // Cast to string because origin is type hinted as object too. +} elseif (empty($origin) && is_string($object->origin) && $object->origin !== '' && $object->origin_id > 0) { + $origin = $object->origin; } -if (empty($origin_id) && !empty($object->origin_id)) { +if (empty($origin_id) && $object->origin_id > 0) { $origin_id = $object->origin_id; } $origin_type = is_string($origin) ? $origin : ''; From 906ec585ee97ef2c9e4442f4004b0bb5b2502f59 Mon Sep 17 00:00:00 2001 From: John BOTELLA <68917336+thersane-john@users.noreply.github.com> Date: Tue, 21 Apr 2026 15:37:35 +0200 Subject: [PATCH 47/53] Fix php warning ['search_filtert'] not exist (#37957) Co-authored-by: Laurent Destailleur --- htdocs/core/lib/company.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 40102d9ef02..a01ba3dd70d 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -2385,7 +2385,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = null, $nopr $out .= ''; - $out .= $form->select_dolusers(($filters['search_filtert'] > 0 ? $filters['search_filtert'] : ''), 'search_filtert', 1, null, 0, '', '', '0', 0, 0, '', 2, '', 'minwidth100 maxwidth250 widthcentpercentminusx'); + $out .= $form->select_dolusers((isset($filters['search_filtert']) && $filters['search_filtert'] > 0 ? $filters['search_filtert'] : ''), 'search_filtert', 1, null, 0, '', '', '0', 0, 0, '', 2, '', 'minwidth100 maxwidth250 widthcentpercentminusx'); $out .= ''; From 029a1fbc1bb5cdd64d862bcb26225a3fa1a06d9d Mon Sep 17 00:00:00 2001 From: Florian Charlaix Date: Tue, 21 Apr 2026 16:15:38 +0200 Subject: [PATCH 48/53] NEW #37727 phone input with country code (#37728) * New phone input with country code * CI fixes * Assure AJAX CSRF check * Fix SQL migration typo * Remove unnecessary CSRFCHECK_WITH_TOKEN in getphonecode.php AJAX endpoint --- htdocs/admin/dict.php | 20 +- htdocs/contact/card.php | 40 +- htdocs/core/ajax/getphonecode.php | 58 +++ htdocs/core/class/html.form.class.php | 285 +++++++++++++ htdocs/core/lib/ajax.lib.php | 6 + htdocs/core/lib/phone.lib.php | 160 ++++++++ .../install/mysql/data/llx_00_c_country.sql | 379 ++++++++++++++++++ .../install/mysql/migration/22.0.0-23.0.0.sql | 260 ++++++++++++ htdocs/install/mysql/tables/llx_c_country.sql | 5 +- htdocs/langs/en_US/companies.lang | 2 + htdocs/langs/fr_FR/companies.lang | 2 + 11 files changed, 1191 insertions(+), 26 deletions(-) create mode 100644 htdocs/core/ajax/getphonecode.php create mode 100644 htdocs/core/lib/phone.lib.php diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index e362285bd91..8ca2705348a 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -12,7 +12,7 @@ * Copyright (C) 2015 Ferran Marcet * Copyright (C) 2016 Raphaël Doursenaud * Copyright (C) 2019-2026 Frédéric France - * Copyright (C) 2020-2022 Open-Dsi + * Copyright (C) 2020-2026 Open-Dsi * Copyright (C) 2024-2025 Charlene Benke * Copyright (C) 2024 MDW * @@ -270,7 +270,7 @@ $tabsql = array(); $tabsql[DICT_FORME_JURIDIQUE] = "SELECT f.rowid as rowid, f.code, f.libelle, c.code as country_code, c.label as country, f.active FROM ".MAIN_DB_PREFIX."c_forme_juridique as f, ".MAIN_DB_PREFIX."c_country as c WHERE f.fk_pays=c.rowid"; $tabsql[DICT_DEPARTEMENTS] = "SELECT d.rowid as rowid, d.code_departement as code, d.nom as libelle, d.fk_region as region_id, r.nom as region, c.code as country_code, c.label as country, d.active FROM ".MAIN_DB_PREFIX."c_departements as d, ".MAIN_DB_PREFIX."c_regions as r, ".MAIN_DB_PREFIX."c_country as c WHERE d.fk_region=r.code_region and r.fk_pays=c.rowid and r.active=1 and c.active=1"; $tabsql[DICT_REGIONS] = "SELECT r.rowid as rowid, r.code_region as code, r.nom as libelle, r.fk_pays as country_id, c.code as country_code, c.label as country, r.active FROM ".MAIN_DB_PREFIX."c_regions as r, ".MAIN_DB_PREFIX."c_country as c WHERE r.fk_pays=c.rowid and c.active=1"; -$tabsql[DICT_COUNTRY] = "SELECT c.rowid as rowid, c.code, c.label, c.active, c.favorite, c.eec, c.sepa FROM ".MAIN_DB_PREFIX."c_country AS c"; +$tabsql[DICT_COUNTRY] = "SELECT c.rowid as rowid, c.code, c.label, c.phone_code, c.trunk_prefix, c.active, c.favorite, c.eec, c.sepa FROM ".MAIN_DB_PREFIX."c_country AS c"; $tabsql[DICT_CIVILITY] = "SELECT c.rowid as rowid, c.code as code, c.label, c.active FROM ".MAIN_DB_PREFIX."c_civility AS c"; $tabsql[DICT_ACTIONCOMM] = "SELECT a.id as rowid, a.code as code, a.libelle AS libelle, a.type, a.active, a.module, a.color, a.position FROM ".MAIN_DB_PREFIX."c_actioncomm AS a"; $tabsql[DICT_CHARGESOCIALES] = "SELECT a.id as rowid, a.code as code, a.libelle AS libelle, a.accountancy_code as accountancy_code, c.code as country_code, c.label as country, a.fk_pays as country_id, a.active FROM ".MAIN_DB_PREFIX."c_chargesociales AS a, ".MAIN_DB_PREFIX."c_country as c WHERE a.fk_pays = c.rowid and c.active = 1"; @@ -364,7 +364,7 @@ $tabfield = array(); $tabfield[DICT_FORME_JURIDIQUE] = "code,libelle,country"; $tabfield[DICT_DEPARTEMENTS] = "code,libelle,region_id,region,country"; // "code,libelle,region,country_code-country" $tabfield[DICT_REGIONS] = "code,libelle,country_id,country"; -$tabfield[DICT_COUNTRY] = "code,label"; +$tabfield[DICT_COUNTRY] = "code,label,phone_code,trunk_prefix"; $tabfield[DICT_CIVILITY] = "code,label"; $tabfield[DICT_ACTIONCOMM] = "code,libelle,type,color,position"; $tabfield[DICT_CHARGESOCIALES] = "code,libelle,country,accountancy_code"; @@ -411,7 +411,7 @@ $tabfieldvalue = array(); $tabfieldvalue[DICT_FORME_JURIDIQUE] = "code,libelle,country"; $tabfieldvalue[DICT_DEPARTEMENTS] = "code,libelle,region"; // "code,libelle,region" $tabfieldvalue[DICT_REGIONS] = "code,libelle,country"; -$tabfieldvalue[DICT_COUNTRY] = "code,label"; +$tabfieldvalue[DICT_COUNTRY] = "code,label,phone_code,trunk_prefix"; $tabfieldvalue[DICT_CIVILITY] = "code,label"; $tabfieldvalue[DICT_ACTIONCOMM] = "code,libelle,type,color,position"; $tabfieldvalue[DICT_CHARGESOCIALES] = "code,libelle,country,accountancy_code"; @@ -458,7 +458,7 @@ $tabfieldinsert = array(); $tabfieldinsert[DICT_FORME_JURIDIQUE] = "code,libelle,fk_pays"; $tabfieldinsert[DICT_DEPARTEMENTS] = "code_departement,nom,fk_region"; $tabfieldinsert[DICT_REGIONS] = "code_region,nom,fk_pays"; -$tabfieldinsert[DICT_COUNTRY] = "code,label"; +$tabfieldinsert[DICT_COUNTRY] = "code,label,phone_code,trunk_prefix"; $tabfieldinsert[DICT_CIVILITY] = "code,label"; $tabfieldinsert[DICT_ACTIONCOMM] = "code,libelle,type,color,position"; $tabfieldinsert[DICT_CHARGESOCIALES] = "code,libelle,fk_pays,accountancy_code"; @@ -613,7 +613,7 @@ $tabcomplete = array( 'picto' => 'region', 'help' => array('code' => $langs->trans("EnterAnyCode")) ), - 'c_country' => array('picto' => 'country', 'help' => array('code' => $langs->trans("EnterAnyCode"))), + 'c_country' => array('picto' => 'country', 'help' => array('code' => $langs->trans("EnterAnyCode"), 'phone_code' => 'e.g. 33', 'trunk_prefix' => 'e.g. 0')), 'c_civility' => array('picto' => 'contact', 'help' => array('code' => $langs->trans("EnterAnyCode"))), 'c_actioncomm' => array('picto' => 'action', 'help' => array('code' => $langs->trans("EnterAnyCode"), 'color' => $langs->trans("ColorFormat"), 'position' => $langs->trans("PositionIntoComboList"))), 'c_chargesociales' => array('picto' => 'bill', 'help' => array('code' => $langs->trans("EnterAnyCode"))), @@ -2117,6 +2117,12 @@ if ($id > 0) { if ($value == 'country') { $valuetoshow = $langs->trans("Country"); } + if ($value == 'phone_code') { + $valuetoshow = $langs->trans("PhoneCode"); + } + if ($value == 'trunk_prefix') { + $valuetoshow = $langs->trans("TrunkPrefix"); + } if ($value == 'department_buyer') { $valuetoshow = $langs->trans('DepartmentBuyer'); } @@ -2434,7 +2440,7 @@ if ($id > 0) { //var_dump($fieldlist); $class = ''; $showfield = 1; - $valuetoshow = empty($obj->$value) ? '' : $obj->$value; + $valuetoshow = (isset($obj->$value) && $obj->$value !== null && $obj->$value !== '') ? $obj->$value : ''; $titletoshow = ''; if ($value == 'entity') { diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index f8c6f00940c..dc1c24d232d 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -10,7 +10,7 @@ * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2018-2025 Frédéric France * Copyright (C) 2019 Josep Lluís Amador - * Copyright (C) 2020 Open-Dsi + * Copyright (C) 2020-2026 Open-Dsi * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify @@ -793,28 +793,30 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { // Phone / Fax print '
'.$form->editfieldkey('PhonePro', 'phone_pro', '', $object, 0).''; - print img_picto('', 'object_phoning', 'class="pictofixedwidth"'); - print '
'.$form->editfieldkey('PhonePerso', 'phone_perso', '', $object, 0).''; - print img_picto('', 'object_phoning', 'class="pictofixedwidth"'); - print '
'.$form->editfieldkey('PhoneMobile', 'phone_mobile', '', $object, 0).''; - print img_picto('', 'object_phoning_mobile', 'class="pictofixedwidth"'); - print '
'.$form->editfieldkey('Fax', 'fax', '', $object, 0).''; - print img_picto('', 'object_phoning_fax', 'class="pictofixedwidth"'); - print '
'.$form->editfieldkey('PhonePro', 'phone_pro', GETPOST('phone_pro', 'alpha'), $object, 0).''; - print img_picto('', 'object_phoning', 'class="pictofixedwidth"'); - print '
'.$form->editfieldkey('PhonePerso', 'fax', GETPOST('phone_perso', 'alpha'), $object, 0).''.$form->editfieldkey('PhonePerso', 'phone_perso', GETPOST('phone_perso', 'alpha'), $object, 0).''; - print img_picto('', 'object_phoning', 'class="pictofixedwidth"'); - print '
'.$form->editfieldkey('PhoneMobile', 'phone_mobile', GETPOST('phone_mobile', 'alpha'), $object, 0, 'string', '').''; - print img_picto('', 'object_phoning_mobile', 'class="pictofixedwidth"'); - print '
'.$form->editfieldkey('Fax', 'fax', GETPOST('fax', 'alpha'), $object, 0).''; - print img_picto('', 'object_phoning_fax', 'class="pictofixedwidth"'); - print '
'.$form->editfieldkey('EMail', 'email', GETPOST('email', 'alpha'), $object, 0, 'string', '', (int) (getDolGlobalInt('SOCIETE_EMAIL_MANDATORY'))).'