From 0b605bffba0ef2dec0fb9b609780b2d5e0a0c5c7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 15 Sep 2025 22:26:19 +0200 Subject: [PATCH 01/11] CSS --- htdocs/theme/eldy/global.inc.php | 4 ++++ htdocs/theme/md/style.css.php | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index c530ac04000..abc1f286a76 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -927,6 +927,10 @@ div.floatright { display:inline-block !important; } +.displaycontent +{ + display:content; +} .largenumber { font-size: 1.4em; } diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 0daa116e08f..129e82f61c5 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -1114,6 +1114,10 @@ div.floatright { display:inline-block !important; } +.displaycontent +{ + display:content; +} .largenumber { font-size: 1.4em; } From 9095bc46eff845ac14a52da812d9932e5ceadd09 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 15 Sep 2025 22:26:56 +0200 Subject: [PATCH 02/11] Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop From 8a87de9112fe59a55841c9baf487352d333153a7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 15 Sep 2025 22:44:11 +0200 Subject: [PATCH 03/11] CSS --- htdocs/index.php | 4 +++- htdocs/theme/eldy/global.inc.php | 4 ++-- htdocs/theme/md/style.css.php | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/htdocs/index.php b/htdocs/index.php index 693001813e7..3019468f4c0 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -690,11 +690,13 @@ if (!getDolGlobalString('MAIN_DISABLE_GLOBAL_WORKBOARD') && getDolGlobalInt('MAI $openedDashBoard .= ''; $openedDashBoard .= ' '."\n"; diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 3ae54eb5055..e31905ab1b1 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -927,9 +927,9 @@ div.floatright { display:inline-block !important; } -.displaycontent +.displaycontents { - display:content; + display:contents !important; } .largenumber { font-size: 1.4em; diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 37b64e4d3a1..4f3274c0a05 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -1114,9 +1114,9 @@ div.floatright { display:inline-block !important; } -.displaycontent +.displaycontents { - display:content; + display:contents !important; } .largenumber { font-size: 1.4em; From d685f1e5295c1e0d74426c3b96a1bd7eb13a5e75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 15 Sep 2025 22:45:42 +0200 Subject: [PATCH 04/11] fix CI (#35353) * fix CI * Update header.tpl.php * Update style.css.php * Update webportal.main.inc.php * Update files.lib.php --- htdocs/core/lib/files.lib.php | 10 +++++----- htdocs/public/webportal/css/style.css.php | 4 ++++ htdocs/public/webportal/tpl/header.tpl.php | 1 + htdocs/public/webportal/webportal.main.inc.php | 7 +++++++ 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 7dc0ec5a4ae..37dc1df4f6a 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -2435,11 +2435,11 @@ function addFileIntoDatabaseIndex($dir, $file, $fullpathorig = '', $mode = 'uplo /** * Delete files into database index using search criteria. * - * @param string $dir Directory name (full real path without ending /) - * @param string $file File name - * @param string $mode How file was created ('uploaded', 'generated', ...) - * @param Object $object object used for entity - * @return int Return integer <0 if KO, 0 if nothing done, >0 if OK + * @param string $dir Directory name (full real path without ending /) + * @param string $file File name + * @param string $mode How file was created ('uploaded', 'generated', ...) + * @param ?CommonObject $object object used for entity + * @return int Return integer <0 if KO, 0 if nothing done, >0 if OK */ function deleteFilesIntoDatabaseIndex($dir, $file, $mode = 'uploaded', $object = null) { diff --git a/htdocs/public/webportal/css/style.css.php b/htdocs/public/webportal/css/style.css.php index 1a17074ba7e..7b9e95d82de 100644 --- a/htdocs/public/webportal/css/style.css.php +++ b/htdocs/public/webportal/css/style.css.php @@ -48,12 +48,16 @@ session_cache_limiter('public'); require_once __DIR__.'/../webportal.main.inc.php'; // __DIR__ allow this script to be included in custom themes /** * @var Conf $conf + * @var Translate $langs * * @var string $dolibarr_nocache */ $fontlist = 'arial,tahoma,verdana,helvetica'; $colorbacktitle1 = '#fff'; +$langs->load("main", 0, 1); +$right = ($langs->trans("DIRECTION") == 'rtl' ? 'left' : 'right'); +$left = ($langs->trans("DIRECTION") == 'rtl' ? 'right' : 'left'); // Define css type top_httphead('text/css'); diff --git a/htdocs/public/webportal/tpl/header.tpl.php b/htdocs/public/webportal/tpl/header.tpl.php index a45754a286e..374bf3a3811 100644 --- a/htdocs/public/webportal/tpl/header.tpl.php +++ b/htdocs/public/webportal/tpl/header.tpl.php @@ -17,6 +17,7 @@ /** * @var Context $context Object context for webportal + * @var Translate $langs */ // Protection to avoid direct call of template diff --git a/htdocs/public/webportal/webportal.main.inc.php b/htdocs/public/webportal/webportal.main.inc.php index 1997cbda9bc..87143cc1234 100644 --- a/htdocs/public/webportal/webportal.main.inc.php +++ b/htdocs/public/webportal/webportal.main.inc.php @@ -88,7 +88,14 @@ require_once DOL_DOCUMENT_ROOT . '/webportal/class/webportalpartnership.class.ph * @var DoliDB $db * @var HookManager $hookmanager * @var Translate $langs + * + * @var string $sessionname + * @var string $sessiontimeout */ +' +@phan-var-force string $sessionname +@phan-var-force string $sessiontimeout +'; // Init session. Name of session is specific to WEBPORTAL instance. // Must be done after the include of filefunc.inc.php so global variables of conf file are defined (like $dolibarr_main_instance_unique_id or $dolibarr_main_force_https). // Note: the function dol_getprefix is defined into functions.lib.php but may have been defined to return a different key to manage another area to protect. From 7d7994aa1d9a60141e59d2f3d6223977ca51a553 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 15 Sep 2025 23:28:18 +0200 Subject: [PATCH 05/11] Clean code --- htdocs/bom/tpl/objectline_create.tpl.php | 4 ++-- htdocs/comm/propal/card.php | 2 +- htdocs/commande/card.php | 2 +- htdocs/compta/facture/card.php | 2 +- htdocs/core/tpl/objectline_create.tpl.php | 4 ++-- htdocs/fourn/commande/card.php | 2 +- htdocs/fourn/facture/card.php | 2 +- htdocs/variants/combinations.php | 2 +- 8 files changed, 10 insertions(+), 10 deletions(-) diff --git a/htdocs/bom/tpl/objectline_create.tpl.php b/htdocs/bom/tpl/objectline_create.tpl.php index 5a5acba1527..8adc8dfe24a 100644 --- a/htdocs/bom/tpl/objectline_create.tpl.php +++ b/htdocs/bom/tpl/objectline_create.tpl.php @@ -149,9 +149,9 @@ if (isModEnabled("product") || isModEnabled("service")) { $statustoshow = -1; if (getDolGlobalString('ENTREPOT_EXTRA_STATUS')) { // hide products in closed warehouse, but show products for internal transfer - print $form->select_produits(GETPOSTINT('idprod'), (($filtertype == 1) ? 'idprodservice' : 'idprod'), $filtertype, getDolGlobalInt('PRODUIT_LIMIT_SIZE'), 0, $statustoshow, 2, '', 1, array(), 0, '1', 0, 'maxwidth500 widthcentpercentminusx', 0, 'warehouseopen,warehouseinternal', (string) GETPOSTINT('combinations'), 1); + print $form->select_produits(GETPOSTINT('idprod'), (($filtertype == 1) ? 'idprodservice' : 'idprod'), $filtertype, getDolGlobalInt('PRODUIT_LIMIT_SIZE'), 0, $statustoshow, 2, '', 1, array(), 0, '1', 0, 'maxwidth500 widthcentpercentminusx', 0, 'warehouseopen,warehouseinternal', GETPOST('combinations', 'array:alphanohtml'), 1); } else { - print $form->select_produits(GETPOSTINT('idprod'), (($filtertype == 1) ? 'idprodservice' : 'idprod'), $filtertype, getDolGlobalInt('PRODUIT_LIMIT_SIZE'), 0, $statustoshow, 2, '', 1, array(), 0, '1', 0, 'maxwidth500 widthcentpercentminusx', 0, '', (string) GETPOSTINT('combinations'), 1); + print $form->select_produits(GETPOSTINT('idprod'), (($filtertype == 1) ? 'idprodservice' : 'idprod'), $filtertype, getDolGlobalInt('PRODUIT_LIMIT_SIZE'), 0, $statustoshow, 2, '', 1, array(), 0, '1', 0, 'maxwidth500 widthcentpercentminusx', 0, '', GETPOST('combinations', 'array:alphanohtml'), 1); } $urltocreateproduct = DOL_URL_ROOT.'/product/card.php?action=create'.(($filtertype == 1) ? '&leftmenu=service&type=1' : '&leftmenu=product&type=0').'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id); print ''; diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 0c27bb1adb3..367fe2f967d 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1284,7 +1284,7 @@ if (empty($reshook)) { } if (!$error && isModEnabled('variants') && $prod_entry_mode != 'free') { - if ($combinations = GETPOST('combinations', 'array')) { + if ($combinations = GETPOST('combinations', 'array:alphanohtml')) { //Check if there is a product with the given combination $prodcomb = new ProductCombination($db); diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 6c21106f2e6..46aeeb3075f 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1043,7 +1043,7 @@ if (empty($reshook)) { } if (!$error && isModEnabled('variants') && $prod_entry_mode != 'free') { - if ($combinations = GETPOST('combinations', 'array')) { + if ($combinations = GETPOST('combinations', 'array:alphanothtml')) { //Check if there is a product with the given combination $prodcomb = new ProductCombination($db); diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 914643f7c9c..6423db11f95 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -2556,7 +2556,7 @@ if (empty($reshook)) { } if (!$error && isModEnabled('variants') && $prod_entry_mode != 'free') { - if ($combinations = GETPOST('combinations', 'array')) { + if ($combinations = GETPOST('combinations', 'array:alphanothtml')) { //Check if there is a product with the given combination $prodcomb = new ProductCombination($db); diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index b4389fbbbc3..433305a80b8 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -290,9 +290,9 @@ if ($nolinesbefore) { } if (getDolGlobalString('ENTREPOT_EXTRA_STATUS')) { // hide products in closed warehouse, but show products for internal transfer - $form->select_produits(GETPOSTINT('idprod'), 'idprod', $filtertype, getDolGlobalInt('PRODUIT_LIMIT_SIZE'), $buyer->price_level, $statustoshow, 2, '', 1, array(), $buyer->id, $labelforradio, 0, 'maxwidth500 widthcentpercentminusx', 0, $statuswarehouse, GETPOST('combinations', 'array')); + $form->select_produits(GETPOSTINT('idprod'), 'idprod', $filtertype, getDolGlobalInt('PRODUIT_LIMIT_SIZE'), $buyer->price_level, $statustoshow, 2, '', 1, array(), $buyer->id, $labelforradio, 0, 'maxwidth500 widthcentpercentminusx', 0, $statuswarehouse, GETPOST('combinations', 'array:alphanothtml')); } else { - $form->select_produits(GETPOSTINT('idprod'), 'idprod', $filtertype, getDolGlobalInt('PRODUIT_LIMIT_SIZE'), $buyer->price_level, $statustoshow, 2, '', 1, array(), $buyer->id, $labelforradio, 0, 'maxwidth500 widthcentpercentminusx', 0, '', GETPOST('combinations', 'array')); + $form->select_produits(GETPOSTINT('idprod'), 'idprod', $filtertype, getDolGlobalInt('PRODUIT_LIMIT_SIZE'), $buyer->price_level, $statustoshow, 2, '', 1, array(), $buyer->id, $labelforradio, 0, 'maxwidth500 widthcentpercentminusx', 0, '', GETPOST('combinations', 'array:alphanothtml')); } if (getDolGlobalString('MAIN_AUTO_OPEN_SELECT2_ON_FOCUS_FOR_CUSTOMER_PRODUCTS')) { ?> diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index a51f5cf13d9..0e3dd54412b 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -479,7 +479,7 @@ if (empty($reshook)) { } if (!$error && isModEnabled('variants') && $prod_entry_mode != 'free') { - if ($combinations = GETPOST('combinations', 'array')) { + if ($combinations = GETPOST('combinations', 'array:alphanothtml')) { //Check if there is a product with the given combination $prodcomb = new ProductCombination($db); diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 783093cc694..9bd8bb9acc6 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1699,7 +1699,7 @@ if (empty($reshook)) { } if (!$error && isModEnabled('variants') && $prod_entry_mode != 'free') { - if ($combinations = GETPOST('combinations', 'array')) { + if ($combinations = GETPOST('combinations', 'array:alphanothtml')) { //Check if there is a product with the given combination $prodcomb = new ProductCombination($db); diff --git a/htdocs/variants/combinations.php b/htdocs/variants/combinations.php index 444bf419574..1c54a6113de 100644 --- a/htdocs/variants/combinations.php +++ b/htdocs/variants/combinations.php @@ -875,7 +875,7 @@ if (!empty($id) || !empty($ref)) { $aaa = ''; if (count($productCombinations)) { - $aaa = ''; $aaa .= ' '; $aaa .= ' '; $aaa .= ' '; From f03f54d406c8240c7aa91bfa246ae32e992e77f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 16 Sep 2025 00:54:59 +0200 Subject: [PATCH 06/11] clean code (#35350) * clean code * clean code * clean code * clean code * clean code * clean code * clean code --- dev/build/phpstan/phpstan-baseline.neon | 36 ------------------- htdocs/salaries/class/salary.class.php | 48 +++++++++++-------------- 2 files changed, 21 insertions(+), 63 deletions(-) diff --git a/dev/build/phpstan/phpstan-baseline.neon b/dev/build/phpstan/phpstan-baseline.neon index da4ecbdb44d..5dc51a035c4 100644 --- a/dev/build/phpstan/phpstan-baseline.neon +++ b/dev/build/phpstan/phpstan-baseline.neon @@ -17670,42 +17670,6 @@ parameters: count: 2 path: ../../../htdocs/salaries/class/paymentsalary.class.php - - - message: '#^Call to function method_exists\(\) with \$this\(Salary\) and ''LibStatut'' will always evaluate to true\.$#' - identifier: function.alreadyNarrowedType - count: 1 - path: ../../../htdocs/salaries/class/salary.class.php - - - - message: '#^Call to function method_exists\(\) with \$this\(Salary\) and ''getNomUrl'' will always evaluate to true\.$#' - identifier: function.alreadyNarrowedType - count: 1 - path: ../../../htdocs/salaries/class/salary.class.php - - - - message: '#^Call to function property_exists\(\) with \$this\(Salary\) and ''amount'' will always evaluate to true\.$#' - identifier: function.alreadyNarrowedType - count: 1 - path: ../../../htdocs/salaries/class/salary.class.php - - - - message: '#^Call to function property_exists\(\) with \$this\(Salary\) and ''type_payment'' will always evaluate to true\.$#' - identifier: function.alreadyNarrowedType - count: 1 - path: ../../../htdocs/salaries/class/salary.class.php - - - - message: '#^Method Salary\:\:getSommePaiement\(\) return type has no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: ../../../htdocs/salaries/class/salary.class.php - - - - message: '#^Negated boolean expression is always true\.$#' - identifier: booleanNot.alwaysTrue - count: 2 - path: ../../../htdocs/salaries/class/salary.class.php - - message: '#^Negated boolean expression is always false\.$#' identifier: booleanNot.alwaysFalse diff --git a/htdocs/salaries/class/salary.class.php b/htdocs/salaries/class/salary.class.php index d8f26b229fc..220efd493b7 100644 --- a/htdocs/salaries/class/salary.class.php +++ b/htdocs/salaries/class/salary.class.php @@ -2,7 +2,7 @@ /* Copyright (C) 2011-2022 Alexandre Spangaro * Copyright (C) 2014 Juanjo Menent * Copyright (C) 2021 Gauthier VERDOL - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2025 Frédéric France * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify @@ -253,11 +253,9 @@ class Salary extends CommonObject } // Update extrafield - if (!$error) { - $result = $this->insertExtraFields(); - if ($result < 0) { - $error++; - } + $result = $this->insertExtraFields(); + if ($result < 0) { + $error++; } if (!$notrigger) { @@ -340,7 +338,7 @@ class Salary extends CommonObject $this->status = $obj->paye; $this->fk_bank = $obj->fk_bank; $this->fk_user_author = $obj->fk_user_author; - $this->fk_user_modif = $obj->fk_user_modif; + $this->fk_user_modif = $obj->fk_user_modif; $this->fk_account = $obj->fk_account; $this->accountid = $obj->fk_account; @@ -485,11 +483,9 @@ class Salary extends CommonObject if ($this->id > 0) { // Update extrafield - if (!$error) { - $result = $this->insertExtraFields(); - if ($result < 0) { - $error++; - } + $result = $this->insertExtraFields(); + if ($result < 0) { + $error++; } // Call trigger @@ -656,7 +652,7 @@ class Salary extends CommonObject * Return amount of payments already done * * @param int $multicurrency Return multicurrency_amount instead of amount. -1=Return both. - * @return float|int|array Amount of payment already done, <0 and set ->error if KO + * @return float|int|array{} Amount of payment already done, <0 and set ->error if KO */ public function getSommePaiement($multicurrency = 0) { @@ -873,33 +869,31 @@ class Salary extends CommonObject $return .= img_picto('', $this->picto); $return .= ''; $return .= '
'; - $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).''; + $return .= '' . $this->getNomUrl(1) . ''; if ($selected >= 0) { $return .= ''; } if (!empty($arraydata['user']) && is_object($arraydata['user'])) { $user = $arraydata['user']; '@phan-var-force User $user'; + /** @var User $user */ $return .= '
'.$user->getNomUrl(empty($arraydata['user']->photo) ? 1 : -1, '', 0, 0, 16, 0, '', 'maxwidth100').''; } - if (property_exists($this, 'amount')) { - $return .= '
'.price($this->amount).''; - if (property_exists($this, 'type_payment') && !empty($this->type_payment)) { - $return .= ' '; - if ($langs->trans("PaymentTypeShort".$this->type_payment) != "PaymentTypeShort".$this->type_payment) { - $return .= $langs->trans("PaymentTypeShort".$this->type_payment); - } elseif ($langs->trans("PaymentType".$this->type_payment) != "PaymentType".$this->type_payment) { - $return .= $langs->trans("PaymentType".$this->type_payment); - } - $return .= ''; + $return .= '
'.price($this->amount).''; + if (!empty($this->type_payment)) { + $return .= ' '; + if ($langs->trans("PaymentTypeShort".$this->type_payment) != "PaymentTypeShort".$this->type_payment) { + $return .= $langs->trans("PaymentTypeShort".$this->type_payment); + } elseif ($langs->trans("PaymentType".$this->type_payment) != "PaymentType".$this->type_payment) { + $return .= $langs->trans("PaymentType".$this->type_payment); } + $return .= ''; } - if (method_exists($this, 'LibStatut')) { - $return .= '
'.$this->getLibStatut(3, isset($this->alreadypaid) ? $this->alreadypaid : $this->totalpaid).'
'; - } + $return .= '
'.$this->getLibStatut(3, isset($this->alreadypaid) ? $this->alreadypaid : $this->totalpaid).'
'; $return .= '
'; $return .= ''; $return .= ''; + return $return; } From 83407ec49f6d87b0b6b6811ce938c13bbb89b35c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 16 Sep 2025 00:55:58 +0200 Subject: [PATCH 07/11] clean code (#35355) --- htdocs/comm/action/list.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index db0a8e1a3f3..9f1a9e3573f 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -746,12 +746,12 @@ $viewmode .= ''; $tmpforcreatebutton = dol_getdate(dol_now('tzuserrel'), true); -$newparam = '&month='.str_pad((string) $month, 2, "0", STR_PAD_LEFT).'&year='.$tmpforcreatebutton['year']; +$newparam = '?month='.str_pad((string) $month, 2, "0", STR_PAD_LEFT).'&year='.$tmpforcreatebutton['year']; $url = DOL_URL_ROOT.'/comm/action/card.php?action=create'; $url .= '&apyear='.$tmpforcreatebutton['year'].'&apmonth='.$tmpforcreatebutton['mon'].'&apday='.$tmpforcreatebutton['mday']; $url .= '&aphour='.$tmpforcreatebutton['hours'].'&apmin='.$tmpforcreatebutton['minutes']; -$url .= '&backtopage='.urlencode($_SERVER["PHP_SELF"].($newparam ? '?'.$newparam : '')); +$url .= '&backtopage='.urlencode($_SERVER["PHP_SELF"].$newparam); $newcardbutton = dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', $url, '', (int) ($user->hasRight('agenda', 'myactions', 'create') || $user->hasRight('agenda', 'allactions', 'create'))); From 8e1cf72de0b279edc374bf5fceb278b86178a9d4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 16 Sep 2025 00:56:18 +0200 Subject: [PATCH 08/11] Debug v23 --- htdocs/admin/bom.php | 56 +++++++++++++---------- htdocs/bom/tpl/objectline_create.tpl.php | 20 +++----- htdocs/bom/tpl/objectline_edit.tpl.php | 1 - htdocs/core/class/html.formfile.class.php | 1 + htdocs/core/lib/admin.lib.php | 2 +- htdocs/install/mysql/migration/repair.sql | 5 ++ htdocs/install/repair.php | 8 ++-- htdocs/langs/en_US/mrp.lang | 1 + 8 files changed, 50 insertions(+), 44 deletions(-) diff --git a/htdocs/admin/bom.php b/htdocs/admin/bom.php index 1ca413f7a76..b92c320d96f 100644 --- a/htdocs/admin/bom.php +++ b/htdocs/admin/bom.php @@ -144,24 +144,15 @@ if ($action == 'updateMask') { // by calling method canBeActivated dolibarr_set_const($db, "BOM_ADDON", $value, 'chaine', 0, '', $conf->entity); -} elseif ($action == 'set_BOM_DRAFT_WATERMARK') { +} elseif ($action == 'updateother') { $draft = GETPOST("BOM_DRAFT_WATERMARK"); $res = dolibarr_set_const($db, "BOM_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity); - if (!($res > 0)) { $error++; } - if (!$error) { - setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - } else { - setEventMessages($langs->trans("Error"), null, 'errors'); - } -} elseif ($action == 'set_BOM_FREE_TEXT') { $freetext = GETPOST("BOM_FREE_TEXT", 'restricthtml'); // No alpha here, we want exact string - $res = dolibarr_set_const($db, "BOM_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity); - if (!($res > 0)) { $error++; } @@ -458,14 +449,35 @@ print ''; print "
"; print load_fiche_titre($langs->trans("OtherOptions"), '', ''); +print '
'; +print ''; +print ''; + print '
'; print ''; print ''; print ''; -print ''; -print "\n"; +print ''; print "\n"; +if (getDolGlobalString('MAIN_FEATURES_LEVEL') >= 1) { + print '\n"; +} + + $substitutionarray = pdf_getSubstitutionArray($langs, null, null, 2); $substitutionarray['__(AnyTranslationKey)__'] = $langs->trans("Translation"); $htmltext = ''.$langs->trans("AvailableVariables").':
'; @@ -474,9 +486,6 @@ foreach ($substitutionarray as $key => $val) { } $htmltext .= '
'; -print ''; -print ''; -print ''; print '\n"; -print ''; -//Use draft Watermark +// Use draft Watermark -print ''; -print ''; -print ''; print '\n"; -print ''; print '
'.$langs->trans("Parameter").' 
'; + print $langs->trans("BOM_SUB_BOM"); + print ''; + if ($conf->use_javascript_ajax) { + print ajax_constantonoff('BOM_SUB_BOM'); + } else { + if (!getDolGlobalString('BOM_SUB_BOM')) { + print ''.img_picto($langs->trans("Disabled"), 'off').''; + } else { + print ''.img_picto($langs->trans("Enabled"), 'on').''; + } + } + + print "
'; print $form->textwithpicto($langs->trans("FreeLegalTextOnBOMs"), $langs->trans("AddCRIfTooLong").'

'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'
'; $variablename = 'BOM_FREE_TEXT'; @@ -487,27 +496,24 @@ if (!getDolGlobalString('PDF_ALLOW_HTML_FOR_FREE_TEXT')) { $doleditor = new DolEditor($variablename, getDolGlobalString($variablename), '', 80, 'dolibarr_notes'); print $doleditor->Create(); } -print '
'; -print ''; print "
'; print $form->textwithpicto($langs->trans("WatermarkOnDraftBOMs"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').'
'; print '
'; print ''; -print ''; -print ''; print "
'; + +print '
'; + print '
'; + +print ''; + print '
'; diff --git a/htdocs/bom/tpl/objectline_create.tpl.php b/htdocs/bom/tpl/objectline_create.tpl.php index 8adc8dfe24a..e31b8bced9b 100644 --- a/htdocs/bom/tpl/objectline_create.tpl.php +++ b/htdocs/bom/tpl/objectline_create.tpl.php @@ -23,26 +23,26 @@ * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * - * Need to have the following variables defined: - * $object (invoice, order, ...) - * $conf - * $langs - * $forceall (0 by default, 1 for supplier invoices/orders) */ require_once DOL_DOCUMENT_ROOT."/product/class/html.formproduct.class.php"; /** * @var CommonObject $this - * @var CommonObject $object + * @var CommonObject $object Invoice, order, ... * @var ExtraFields $extrafields * @var Form $form * @var Societe $buyer * @var Translate $langs * * @var string $action + * @var int $forceall (0 by default, 1 for supplier invoices/orders) */ +' +@phan-var-force CommonObject $this +@phan-var-force CommonObject $object +@phan-var-force Societe $buyer +'; // Protection to avoid direct call of template if (empty($object) || !is_object($object)) { @@ -50,12 +50,6 @@ if (empty($object) || !is_object($object)) { exit; } -' -@phan-var-force CommonObject $this -@phan-var-force CommonObject $object -@phan-var-force Societe $buyer -'; - global $forceall, $forcetoshowtitlelines, $filtertype; if (empty($forceall)) { diff --git a/htdocs/bom/tpl/objectline_edit.tpl.php b/htdocs/bom/tpl/objectline_edit.tpl.php index 2d478c53ede..820891f7b26 100644 --- a/htdocs/bom/tpl/objectline_edit.tpl.php +++ b/htdocs/bom/tpl/objectline_edit.tpl.php @@ -102,7 +102,6 @@ $coldisplay++; - '; if (count($arraysql)) { - print ' - '.$langs->trans("ShowHideDetails").''; + print ' - '.$langs->trans("ShowHideDetails").''; } else { print ' - '.$langs->trans("ScriptIsEmpty").''; } diff --git a/htdocs/install/mysql/migration/repair.sql b/htdocs/install/mysql/migration/repair.sql index 1c7744380d3..30f7e0a6eb6 100644 --- a/htdocs/install/mysql/migration/repair.sql +++ b/htdocs/install/mysql/migration/repair.sql @@ -585,6 +585,11 @@ UPDATE llx_facturedet SET situation_percent = 100 WHERE situation_percent IS NUL DELETE FROM llx_rights_def WHERE module = 'hrm' AND perms = 'employee'; +-- Clean templates that does not exists +DELETE FROM llx_document_model WHERE TYPE = 'bom' AND nom = 'alpha'; +DELETE FROM llx_const WHERE name = 'BOM_ADDON_PDF' AND value = 'alpha'; +DELETE FROM llx_const WHERE name = 'MRP_MO_ADDON_PDF' AND value = 'alpha'; + -- Sequence to fix the content of llx_bank.amount_main_currency (value was empty and should not for payment on bank account with a different currency so when amount_main_currency is different than amount) -- Note: amount is amount in the currency of the bank account diff --git a/htdocs/install/repair.php b/htdocs/install/repair.php index fffd7496612..e8da1972f18 100644 --- a/htdocs/install/repair.php +++ b/htdocs/install/repair.php @@ -134,11 +134,11 @@ $db = getDoliDBInstance($conf->db->type, $conf->db->host, $conf->db->user, $conf if ($db->connected) { print ''; - print $langs->trans("ServerConnection")." : $dolibarr_main_db_host".$langs->trans("OK").""; + print $langs->trans("ServerConnection")." : ".$dolibarr_main_db_host.''.$langs->trans("OK").""; dolibarr_install_syslog("repair: ".$langs->transnoentities("ServerConnection").": ".$dolibarr_main_db_host.$langs->transnoentities("OK")); $ok = 1; } else { - print "".$langs->trans("ErrorFailedToConnectToDatabase", $dolibarr_main_db_name)."".$langs->transnoentities("Error").""; + print "".$langs->trans("ErrorFailedToConnectToDatabase", $dolibarr_main_db_name).''.$langs->transnoentities("Error").""; dolibarr_install_syslog("repair: ".$langs->transnoentities("ErrorFailedToConnectToDatabase", $dolibarr_main_db_name)); $ok = 0; } @@ -146,11 +146,11 @@ if ($db->connected) { if ($ok) { if ($db->database_selected) { print ''; - print $langs->trans("DatabaseConnection")." : ".$dolibarr_main_db_name."".$langs->trans("OK").""; + print $langs->trans("DatabaseConnection")." : ".$dolibarr_main_db_name.''.$langs->trans("OK").""; dolibarr_install_syslog("repair: database connection successful: ".$dolibarr_main_db_name); $ok = 1; } else { - print "".$langs->trans("ErrorFailedToConnectToDatabase", $dolibarr_main_db_name)."".$langs->trans("Error").""; + print "".$langs->trans("ErrorFailedToConnectToDatabase", $dolibarr_main_db_name).''.$langs->trans("Error").""; dolibarr_install_syslog("repair: ".$langs->transnoentities("ErrorFailedToConnectToDatabase", $dolibarr_main_db_name)); $ok = 0; } diff --git a/htdocs/langs/en_US/mrp.lang b/htdocs/langs/en_US/mrp.lang index b66dcb7ebe5..bf7fbce1079 100644 --- a/htdocs/langs/en_US/mrp.lang +++ b/htdocs/langs/en_US/mrp.lang @@ -169,3 +169,4 @@ ErrorModifyMoDateStart = You must choose a start date earlier than the current s ErrorModifyMoDateEnd = You must choose an end date later than the start date. %s ErrorCancelMo=Error updating cancellation ErrorModifyMoDate=Error updating date modification +BOM_SUB_BOM=Use sub-boms From 21428606858f741cf83204bdd688af2d9d3c368c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 16 Sep 2025 01:14:43 +0200 Subject: [PATCH 09/11] Fix warning --- htdocs/webservices/server_actioncomm.php | 1 + htdocs/webservices/server_category.php | 1 + htdocs/webservices/server_contact.php | 1 + htdocs/webservices/server_invoice.php | 1 + htdocs/webservices/server_order.php | 1 + htdocs/webservices/server_payment.php | 1 + htdocs/webservices/server_productorservice.php | 1 + htdocs/webservices/server_supplier_invoice.php | 1 + htdocs/webservices/server_thirdparty.php | 1 + htdocs/webservices/server_user.php | 1 + 10 files changed, 10 insertions(+) diff --git a/htdocs/webservices/server_actioncomm.php b/htdocs/webservices/server_actioncomm.php index d68830e135a..c1c46beb43d 100644 --- a/htdocs/webservices/server_actioncomm.php +++ b/htdocs/webservices/server_actioncomm.php @@ -76,6 +76,7 @@ $server->soap_defencoding = 'UTF-8'; $server->decode_utf8 = false; $ns = 'http://www.dolibarr.org/ns/'; $server->configureWSDL('WebServicesDolibarrActionComm', $ns); +// @phan-suppress-next-line PhanUndeclaredProperty $server->wsdl->schemaTargetNamespace = $ns; diff --git a/htdocs/webservices/server_category.php b/htdocs/webservices/server_category.php index 8e4745aa536..76c9225bb9e 100644 --- a/htdocs/webservices/server_category.php +++ b/htdocs/webservices/server_category.php @@ -71,6 +71,7 @@ $server->soap_defencoding = 'UTF-8'; $server->decode_utf8 = false; $ns = 'http://www.dolibarr.org/ns/'; $server->configureWSDL('WebServicesDolibarrCategorie', $ns); +// @phan-suppress-next-line PhanUndeclaredProperty $server->wsdl->schemaTargetNamespace = $ns; diff --git a/htdocs/webservices/server_contact.php b/htdocs/webservices/server_contact.php index 46e682c4e6f..78d89bc2c3a 100644 --- a/htdocs/webservices/server_contact.php +++ b/htdocs/webservices/server_contact.php @@ -73,6 +73,7 @@ $server->soap_defencoding = 'UTF-8'; $server->decode_utf8 = false; $ns = 'http://www.dolibarr.org/ns/'; $server->configureWSDL('WebServicesDolibarrContact', $ns); +// @phan-suppress-next-line PhanUndeclaredProperty $server->wsdl->schemaTargetNamespace = $ns; diff --git a/htdocs/webservices/server_invoice.php b/htdocs/webservices/server_invoice.php index 352651c5ece..8e59d3ee646 100644 --- a/htdocs/webservices/server_invoice.php +++ b/htdocs/webservices/server_invoice.php @@ -78,6 +78,7 @@ $server->soap_defencoding = 'UTF-8'; $server->decode_utf8 = false; $ns = 'http://www.dolibarr.org/ns/'; $server->configureWSDL('WebServicesDolibarrInvoice', $ns); +// @phan-suppress-next-line PhanUndeclaredProperty $server->wsdl->schemaTargetNamespace = $ns; diff --git a/htdocs/webservices/server_order.php b/htdocs/webservices/server_order.php index 06909b5cb71..6c2e90ea54d 100644 --- a/htdocs/webservices/server_order.php +++ b/htdocs/webservices/server_order.php @@ -76,6 +76,7 @@ $server->soap_defencoding = 'UTF-8'; $server->decode_utf8 = false; $ns = 'http://www.dolibarr.org/ns/'; $server->configureWSDL('WebServicesDolibarrOrder', $ns); +// @phan-suppress-next-line PhanUndeclaredProperty $server->wsdl->schemaTargetNamespace = $ns; diff --git a/htdocs/webservices/server_payment.php b/htdocs/webservices/server_payment.php index f056b3786fc..43275a01200 100644 --- a/htdocs/webservices/server_payment.php +++ b/htdocs/webservices/server_payment.php @@ -82,6 +82,7 @@ $server->soap_defencoding = 'UTF-8'; $server->decode_utf8 = false; $ns = 'http://www.dolibarr.org/ns/'; $server->configureWSDL('WebServicesDolibarrPayment', $ns); +// @phan-suppress-next-line PhanUndeclaredProperty $server->wsdl->schemaTargetNamespace = $ns; diff --git a/htdocs/webservices/server_productorservice.php b/htdocs/webservices/server_productorservice.php index c969c155984..d39ac1a0388 100644 --- a/htdocs/webservices/server_productorservice.php +++ b/htdocs/webservices/server_productorservice.php @@ -81,6 +81,7 @@ $server->soap_defencoding = 'UTF-8'; $server->decode_utf8 = false; $ns = 'http://www.dolibarr.org/ns/'; $server->configureWSDL('WebServicesDolibarrProductOrService', $ns); +// @phan-suppress-next-line PhanUndeclaredProperty $server->wsdl->schemaTargetNamespace = $ns; diff --git a/htdocs/webservices/server_supplier_invoice.php b/htdocs/webservices/server_supplier_invoice.php index 205d9956a9c..b0c0602cf31 100644 --- a/htdocs/webservices/server_supplier_invoice.php +++ b/htdocs/webservices/server_supplier_invoice.php @@ -74,6 +74,7 @@ $server->soap_defencoding = 'UTF-8'; $server->decode_utf8 = false; $ns = 'http://www.dolibarr.org/ns/'; $server->configureWSDL('WebServicesDolibarrSupplierInvoice', $ns); +// @phan-suppress-next-line PhanUndeclaredProperty $server->wsdl->schemaTargetNamespace = $ns; diff --git a/htdocs/webservices/server_thirdparty.php b/htdocs/webservices/server_thirdparty.php index 6bb25399f4a..11eaed849d2 100644 --- a/htdocs/webservices/server_thirdparty.php +++ b/htdocs/webservices/server_thirdparty.php @@ -76,6 +76,7 @@ $server->soap_defencoding = 'UTF-8'; $server->decode_utf8 = false; $ns = 'http://www.dolibarr.org/ns/'; $server->configureWSDL('WebServicesDolibarrThirdParty', $ns); +// @phan-suppress-next-line PhanUndeclaredProperty $server->wsdl->schemaTargetNamespace = $ns; diff --git a/htdocs/webservices/server_user.php b/htdocs/webservices/server_user.php index 0728ddedaaf..b8c9461497e 100644 --- a/htdocs/webservices/server_user.php +++ b/htdocs/webservices/server_user.php @@ -76,6 +76,7 @@ $server->soap_defencoding = 'UTF-8'; $server->decode_utf8 = false; $ns = 'http://www.dolibarr.org/ns/'; $server->configureWSDL('WebServicesDolibarrUser', $ns); +// @phan-suppress-next-line PhanUndeclaredProperty $server->wsdl->schemaTargetNamespace = $ns; From ea7152a818e7512c77b79be28ac3a0bd2ac0e24c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 16 Sep 2025 01:23:16 +0200 Subject: [PATCH 10/11] Fix phan --- htdocs/commande/card.php | 2 +- htdocs/compta/facture/card.php | 2 +- htdocs/core/tpl/objectline_create.tpl.php | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 46aeeb3075f..93313068dec 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1043,7 +1043,7 @@ if (empty($reshook)) { } if (!$error && isModEnabled('variants') && $prod_entry_mode != 'free') { - if ($combinations = GETPOST('combinations', 'array:alphanothtml')) { + if ($combinations = GETPOST('combinations', 'array:alphanohtml')) { //Check if there is a product with the given combination $prodcomb = new ProductCombination($db); diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 6423db11f95..d3f03ad3a10 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -2556,7 +2556,7 @@ if (empty($reshook)) { } if (!$error && isModEnabled('variants') && $prod_entry_mode != 'free') { - if ($combinations = GETPOST('combinations', 'array:alphanothtml')) { + if ($combinations = GETPOST('combinations', 'array:alphanohtml')) { //Check if there is a product with the given combination $prodcomb = new ProductCombination($db); diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index 433305a80b8..8a66293e272 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -290,9 +290,9 @@ if ($nolinesbefore) { } if (getDolGlobalString('ENTREPOT_EXTRA_STATUS')) { // hide products in closed warehouse, but show products for internal transfer - $form->select_produits(GETPOSTINT('idprod'), 'idprod', $filtertype, getDolGlobalInt('PRODUIT_LIMIT_SIZE'), $buyer->price_level, $statustoshow, 2, '', 1, array(), $buyer->id, $labelforradio, 0, 'maxwidth500 widthcentpercentminusx', 0, $statuswarehouse, GETPOST('combinations', 'array:alphanothtml')); + $form->select_produits(GETPOSTINT('idprod'), 'idprod', $filtertype, getDolGlobalInt('PRODUIT_LIMIT_SIZE'), $buyer->price_level, $statustoshow, 2, '', 1, array(), $buyer->id, $labelforradio, 0, 'maxwidth500 widthcentpercentminusx', 0, $statuswarehouse, GETPOST('combinations', 'array:alphanohtml')); } else { - $form->select_produits(GETPOSTINT('idprod'), 'idprod', $filtertype, getDolGlobalInt('PRODUIT_LIMIT_SIZE'), $buyer->price_level, $statustoshow, 2, '', 1, array(), $buyer->id, $labelforradio, 0, 'maxwidth500 widthcentpercentminusx', 0, '', GETPOST('combinations', 'array:alphanothtml')); + $form->select_produits(GETPOSTINT('idprod'), 'idprod', $filtertype, getDolGlobalInt('PRODUIT_LIMIT_SIZE'), $buyer->price_level, $statustoshow, 2, '', 1, array(), $buyer->id, $labelforradio, 0, 'maxwidth500 widthcentpercentminusx', 0, '', GETPOST('combinations', 'array:alphanohtml')); } if (getDolGlobalString('MAIN_AUTO_OPEN_SELECT2_ON_FOCUS_FOR_CUSTOMER_PRODUCTS')) { ?> From 4c4b34451015ddf78caf70850cf5aedf021a1503 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 16 Sep 2025 10:16:09 +0200 Subject: [PATCH 11/11] fix CI (#35359) * fix CI * Update card.php --- htdocs/fourn/commande/card.php | 2 +- htdocs/fourn/facture/card.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 0e3dd54412b..7220f811025 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -479,7 +479,7 @@ if (empty($reshook)) { } if (!$error && isModEnabled('variants') && $prod_entry_mode != 'free') { - if ($combinations = GETPOST('combinations', 'array:alphanothtml')) { + if ($combinations = GETPOST('combinations', 'array:alphanohtml')) { //Check if there is a product with the given combination $prodcomb = new ProductCombination($db); diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 9bd8bb9acc6..93abc63d0bc 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1699,7 +1699,7 @@ if (empty($reshook)) { } if (!$error && isModEnabled('variants') && $prod_entry_mode != 'free') { - if ($combinations = GETPOST('combinations', 'array:alphanothtml')) { + if ($combinations = GETPOST('combinations', 'array:alphanohtml')) { //Check if there is a product with the given combination $prodcomb = new ProductCombination($db);