From 79a8533f53ebd0cdf1b47512466d1d4d8329d3eb Mon Sep 17 00:00:00 2001 From: MDW Date: Sat, 23 Mar 2024 15:01:09 +0100 Subject: [PATCH 01/12] Qual: Enable PhanTypeInvalidPropertyName --- dev/tools/phan/config.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tools/phan/config.php b/dev/tools/phan/config.php index 5de8de7375475..11437a6f442b9 100644 --- a/dev/tools/phan/config.php +++ b/dev/tools/phan/config.php @@ -483,7 +483,7 @@ // 'PhanTypeInvalidRightOperandOfAdd', // 'PhanPluginDescriptionlessCommentOnPrivateProperty', // 'PhanUndeclaredVariableDim', // Array initialisation on undeclared var: $abc['x']='ab' - 'PhanTypeInvalidPropertyName', + // 'PhanTypeInvalidPropertyName', 'PhanPluginDuplicateCatchStatementBody', 'PhanPluginUndeclaredVariableIsset', // 'PhanTypeInvalidUnaryOperandIncOrDec', From 04b3ed0c7e2b6d7bc5bfddf7175f6d0fae301784 Mon Sep 17 00:00:00 2001 From: MDW Date: Sat, 23 Mar 2024 15:03:00 +0100 Subject: [PATCH 02/12] Fix extrafeild typo --- dev/tools/codespell/codespell-dict.txt | 1 + htdocs/comm/mailing/class/html.formadvtargetemailing.class.php | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/dev/tools/codespell/codespell-dict.txt b/dev/tools/codespell/codespell-dict.txt index 047de65a4a87b..ad8c0ecf6173f 100644 --- a/dev/tools/codespell/codespell-dict.txt +++ b/dev/tools/codespell/codespell-dict.txt @@ -15,6 +15,7 @@ dolibar->dolibarr dolibarrr->dolibarr dollibar->dolibarr dollibarr->dolibarr +extrafeild->extrafield thoose->those # fiche->card mot de passe->password diff --git a/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php b/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php index 266a2396d1ef1..161b4143af447 100644 --- a/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php +++ b/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2019 Frédéric France + * Copyright (C) 2024 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 @@ -278,7 +279,7 @@ public function multiselectselectLanguage($htmlname = '', $selected_array = arra } /** - * Return multiselect list of entities for extrafeild type sellist + * Return multiselect list of entities for extrafield type sellist * * @param string $htmlname control name * @param array $sqlqueryparam array From 43addc08cb2db000b23c60d01cc5615c6e2f6ff5 Mon Sep 17 00:00:00 2001 From: MDW Date: Sat, 23 Mar 2024 15:03:52 +0100 Subject: [PATCH 03/12] Add PHPdoc typing --- htdocs/core/class/html.form.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 8baf4c7c86a11..d0ec228705667 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -8786,8 +8786,8 @@ public static function selectArrayFilter($htmlname, $array, $id = '', $moreparam * Show a multiselect form from an array. WARNING: Use this only for short lists. * * @param string $htmlname Name of select - * @param array $array Array(key=>value) or Array(key=>array('id'=>key, 'label'=>value, 'color'=> , 'picto'=> , 'labelhtml'=> )) - * @param array $selected Array of keys preselected + * @param array $array Array(key=>value) or Array(key=>array('id'=>key, 'label'=>value, 'color'=> , 'picto'=> , 'labelhtml'=> )) + * @param string[] $selected Array of keys preselected * @param int $key_in_label 1 to show key like in "[key] value" * @param int $value_as_key 1 to use value as key * @param string $morecss Add more css style From daf2d36bcd4ad0da77e03ba12748cc4a59c6afb1 Mon Sep 17 00:00:00 2001 From: MDW Date: Sat, 23 Mar 2024 15:18:44 +0100 Subject: [PATCH 04/12] PHPdoc typing --- .../comm/mailing/class/html.formadvtargetemailing.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php b/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php index 161b4143af447..6a6e00b65edc6 100644 --- a/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php +++ b/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php @@ -282,8 +282,8 @@ public function multiselectselectLanguage($htmlname = '', $selected_array = arra * Return multiselect list of entities for extrafield type sellist * * @param string $htmlname control name - * @param array $sqlqueryparam array - * @param array $selected_array array + * @param array $sqlqueryparam array + * @param string[] $selected_array array * * @return string HTML combo */ From 20582bd9ec8d133bc7b52e6d70d46adfb86c7751 Mon Sep 17 00:00:00 2001 From: MDW Date: Sat, 23 Mar 2024 15:28:25 +0100 Subject: [PATCH 05/12] PHPdoc typing --- htdocs/install/upgrade2.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index d4daa58f943a7..68cbd675b321d 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -2778,9 +2778,9 @@ function migrate_project_task_actors($db, $langs, $conf) * @param Translate $langs Object langs * @param Conf $conf Object conf * @param string $table Table name - * @param int $fk_source Id of element source + * @param string $fk_source Id of element source (name of field) * @param string $sourcetype Type of element source - * @param int $fk_target Id of element target + * @param string $fk_target Id of element target * @param string $targettype Type of element target * @return void */ From 2982465f566af2a5aae5a3908747aadcbb8d5d0b Mon Sep 17 00:00:00 2001 From: MDW Date: Sat, 23 Mar 2024 15:43:50 +0100 Subject: [PATCH 06/12] Extra test to fix PhanTypeInvalidPropertyName --- htdocs/reception/note.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/reception/note.php b/htdocs/reception/note.php index 4514847180acb..b86e05c369f77 100644 --- a/htdocs/reception/note.php +++ b/htdocs/reception/note.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2008 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2013 Florian Henry + * Copyright (C) 2024 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 From 02960415cb8726ff3759a0ac4e1c49721210e3f6 Mon Sep 17 00:00:00 2001 From: MDW Date: Sat, 23 Mar 2024 16:02:39 +0100 Subject: [PATCH 07/12] Fix global typing of menumanager as MenuManager --- dev/tools/phan/config.php | 2 +- dev/tools/phan/config_extended.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dev/tools/phan/config.php b/dev/tools/phan/config.php index 11437a6f442b9..0d14ae43f2d50 100644 --- a/dev/tools/phan/config.php +++ b/dev/tools/phan/config.php @@ -270,7 +270,7 @@ 'langs' => '\Translate', 'leftmenu' => 'string', 'mainmenu' => 'string', - 'menumanager' => 'string', + 'menumanager' => '\MenuManager', 'mysoc' => '\Societe', 'nblines' => '\int', 'obj' => '\CommonObject', // Deprecated diff --git a/dev/tools/phan/config_extended.php b/dev/tools/phan/config_extended.php index 6fdb39c0621f3..f5ed4df6b2cce 100644 --- a/dev/tools/phan/config_extended.php +++ b/dev/tools/phan/config_extended.php @@ -210,7 +210,7 @@ 'dolibarr_main_data_root' => 'string', 'dolibarr_main_authentication' => 'string', 'dolibarr_main_demo' => 'string', - 'menumanager' => 'string', + 'menumanager' => '\MenuManager', 'errormsg' => 'string', 'form' => '\Form', 'object_rights' => 'int|stdClass', From 18891a44d4611b75cb6ff516df009c54f53561e0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 23 Mar 2024 16:29:23 +0100 Subject: [PATCH 08/12] Update bank.php --- htdocs/user/bank.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/user/bank.php b/htdocs/user/bank.php index 0fa0d805d2823..44577d24e8a19 100644 --- a/htdocs/user/bank.php +++ b/htdocs/user/bank.php @@ -495,7 +495,7 @@ } // Personal email - if ($user->hasRight('hrm', 'read_personal_information', 'read') || $user->hasRight('hrm', 'write_personal_information', 'write') || $permissiontosimpleedit) { + if ($user->hasRight('hrm', 'read_personal_information', 'read') || $user->hasRight('hrm', 'write_personal_information', 'write') || ) { print ''; print ''; print $form->editfieldkey("UserPersonalEmail", 'personal_email', $object->personal_email, $object, $user->hasRight('user', 'user', 'creer') || $user->hasRight('hrm', 'write_personal_information', 'write')); @@ -506,7 +506,7 @@ } // Personal phone - if ($user->hasRight('hrm', 'read_personal_information', 'read') || $user->hasRight('hrm', 'write_personal_information', 'write') || $permissiontosimpleedit) { + if ($user->hasRight('hrm', 'read_personal_information', 'read') || $user->hasRight('hrm', 'write_personal_information', 'write') || ) { print ''; print ''; print $form->editfieldkey("UserPersonalMobile", 'personal_mobile', $object->personal_mobile, $object, $user->hasRight('user', 'user', 'creer') || $user->hasRight('hrm', 'write_personal_information', 'write')); From 182bccaf04dc035a0709f2fe2920df3d1e449573 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 23 Mar 2024 17:27:40 +0100 Subject: [PATCH 09/12] Fix regression --- htdocs/user/bank.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/user/bank.php b/htdocs/user/bank.php index 44577d24e8a19..0fa0d805d2823 100644 --- a/htdocs/user/bank.php +++ b/htdocs/user/bank.php @@ -495,7 +495,7 @@ } // Personal email - if ($user->hasRight('hrm', 'read_personal_information', 'read') || $user->hasRight('hrm', 'write_personal_information', 'write') || ) { + if ($user->hasRight('hrm', 'read_personal_information', 'read') || $user->hasRight('hrm', 'write_personal_information', 'write') || $permissiontosimpleedit) { print ''; print ''; print $form->editfieldkey("UserPersonalEmail", 'personal_email', $object->personal_email, $object, $user->hasRight('user', 'user', 'creer') || $user->hasRight('hrm', 'write_personal_information', 'write')); @@ -506,7 +506,7 @@ } // Personal phone - if ($user->hasRight('hrm', 'read_personal_information', 'read') || $user->hasRight('hrm', 'write_personal_information', 'write') || ) { + if ($user->hasRight('hrm', 'read_personal_information', 'read') || $user->hasRight('hrm', 'write_personal_information', 'write') || $permissiontosimpleedit) { print ''; print ''; print $form->editfieldkey("UserPersonalMobile", 'personal_mobile', $object->personal_mobile, $object, $user->hasRight('user', 'user', 'creer') || $user->hasRight('hrm', 'write_personal_information', 'write')); From e4a45f6f1ea426bda664c5499f754a8c532d7fdf Mon Sep 17 00:00:00 2001 From: MDW Date: Sat, 23 Mar 2024 15:38:16 +0100 Subject: [PATCH 10/12] Extra test to fix PhanTypeInvalidPropertyName --- htdocs/reception/contact.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/reception/contact.php b/htdocs/reception/contact.php index a91f2b97e1c8c..e67a1434cba10 100644 --- a/htdocs/reception/contact.php +++ b/htdocs/reception/contact.php @@ -2,6 +2,7 @@ /* Copyright (C) 2005 Patrick Rouillon * Copyright (C) 2005-2011 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2024 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 From c9ddf52f4f6ca78d19b254c8e1a3727802862ca7 Mon Sep 17 00:00:00 2001 From: MDW Date: Sat, 23 Mar 2024 15:42:42 +0100 Subject: [PATCH 11/12] Extra test to fix PhanTypeInvalidPropertyName --- htdocs/reception/document.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/reception/document.php b/htdocs/reception/document.php index 6f8637113f9e8..f27cd7d668798 100644 --- a/htdocs/reception/document.php +++ b/htdocs/reception/document.php @@ -5,6 +5,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2017 Ferran Marcet + * Copyright (C) 2024 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 From f357056590a91a75f20c2e049c72c5db520c4a60 Mon Sep 17 00:00:00 2001 From: MDW Date: Sat, 23 Mar 2024 15:41:26 +0100 Subject: [PATCH 12/12] Extra test to fix PhanTypeInvalidPropertyName --- htdocs/reception/dispatch.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/reception/dispatch.php b/htdocs/reception/dispatch.php index 594eb588288fa..c3a549bf52032 100644 --- a/htdocs/reception/dispatch.php +++ b/htdocs/reception/dispatch.php @@ -94,7 +94,7 @@ if ($origin == 'order_supplier' && $object->origin_object->id && (isModEnabled("fournisseur") && !getDolGlobalString('MAIN_USE_NEW_SUPPLIERMOD') || isModEnabled("supplier_order"))) { $origin_id = $object->origin_object->id; $objectsrc = new CommandeFournisseur($db); - $objectsrc->fetch($object->origin_object->id); + $objectsrc->fetch($origin_id); } }