From 856793b1879594376a73e9f32101807344ebf7dd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 28 Dec 2022 02:47:37 +0100 Subject: [PATCH 1/4] Fix scrutinizer warnings --- htdocs/admin/security.php | 4 ++-- htdocs/variants/combinations.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/admin/security.php b/htdocs/admin/security.php index 33344363cf7..e30e50769bb 100644 --- a/htdocs/admin/security.php +++ b/htdocs/admin/security.php @@ -56,8 +56,8 @@ if ($action == 'activate_encrypt') { $db->begin(); - // On old version a bug created the constant into user entity, so we delete it to be sure, such entry won't exists. We want it in entity 0 or nowhere. - dolibarr_del_const($db, "DATABASE_PWD_ENCRYPTED", "1", 'chaine', 0, '', $conf->entity); + // On old version, a bug created the constant into user entity, so we delete it to be sure such entry won't exists. We want it in entity 0 or nowhere. + dolibarr_del_const($db, "DATABASE_PWD_ENCRYPTED", $conf->entity); // We set entity=0 (all) because DATABASE_PWD_ENCRYPTED is a setup into conf file, so always shared for everybody $entityforall = 0; dolibarr_set_const($db, "DATABASE_PWD_ENCRYPTED", "1", 'chaine', 0, '', $entityforall); diff --git a/htdocs/variants/combinations.php b/htdocs/variants/combinations.php index 2d706699447..6949ccb183f 100644 --- a/htdocs/variants/combinations.php +++ b/htdocs/variants/combinations.php @@ -496,7 +496,7 @@ if (!empty($id) || !empty($ref)) { } if ($action == 'add') { - $prodattr_all = $prodattr->fetchAll(1); + $prodattr_all = $prodattr->fetchAll(); if (!$selected) { $selected = $prodattr_all[key($prodattr_all)]->id; From d68a737f141203582e502da2117ba04a35cef3f2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 28 Dec 2022 03:14:27 +0100 Subject: [PATCH 2/4] FIX "Only variables can be passed by reference" --- htdocs/projet/activity/perday.php | 3 ++- htdocs/projet/activity/permonth.php | 3 ++- htdocs/projet/activity/perweek.php | 3 ++- htdocs/user/vcard.php | 25 +++++++++++++++---------- 4 files changed, 21 insertions(+), 13 deletions(-) diff --git a/htdocs/projet/activity/perday.php b/htdocs/projet/activity/perday.php index 2e322ac2c3f..6a818e59bab 100644 --- a/htdocs/projet/activity/perday.php +++ b/htdocs/projet/activity/perday.php @@ -222,7 +222,8 @@ if ($action == 'addtime' && $user->rights->projet->lire && GETPOST('assigntask') $listofprojcontact = $project->liste_type_contact('internal'); if (count($listofprojcontact)) { - $typeforprojectcontact = reset(array_keys($listofprojcontact)); + $tmparray = array_keys($listofprojcontact); + $typeforprojectcontact = reset($tmparray); $result = $project->add_contact($idfortaskuser, $typeforprojectcontact, 'internal'); } } diff --git a/htdocs/projet/activity/permonth.php b/htdocs/projet/activity/permonth.php index c013c07c23a..e21c5f4fb7a 100644 --- a/htdocs/projet/activity/permonth.php +++ b/htdocs/projet/activity/permonth.php @@ -167,7 +167,8 @@ if ($action == 'addtime' && $user->rights->projet->lire && GETPOST('assigntask') $listofprojcontact = $project->liste_type_contact('internal'); if (count($listofprojcontact)) { - $typeforprojectcontact = reset(array_keys($listofprojcontact)); + $tmparray = array_keys($listofprojcontact); + $typeforprojectcontact = reset($tmparray); $result = $project->add_contact($idfortaskuser, $typeforprojectcontact, 'internal'); } } diff --git a/htdocs/projet/activity/perweek.php b/htdocs/projet/activity/perweek.php index d41dcc39494..82b62a744f9 100644 --- a/htdocs/projet/activity/perweek.php +++ b/htdocs/projet/activity/perweek.php @@ -229,7 +229,8 @@ if ($action == 'addtime' && $user->rights->projet->lire && GETPOST('assigntask') $listofprojcontact = $project->liste_type_contact('internal'); if (count($listofprojcontact)) { - $typeforprojectcontact = reset(array_keys($listofprojcontact)); + $tmparray = array_keys($listofprojcontact); + $typeforprojectcontact = reset($tmparray); $result = $project->add_contact($idfortaskuser, $typeforprojectcontact, 'internal'); } } diff --git a/htdocs/user/vcard.php b/htdocs/user/vcard.php index 44b7fda1e05..6e7035d99ec 100644 --- a/htdocs/user/vcard.php +++ b/htdocs/user/vcard.php @@ -99,18 +99,23 @@ if ($company->id) { } elseif (empty(trim($user2->email))) { // when user e-mail is empty, use only company e-mail $v->setEmail($company->email, "TYPE=WORK"); - } elseif (strtolower(end(explode("@", $user2->email))) == strtolower(end(explode("@", $company->email)))) { - // when e-mail domain of user and company are the same, use user e-mail at first (and company e-mail at second) - $v->setEmail($user2->email, "TYPE=WORK"); - - // support by Microsoft Outlook (2019 and possible earlier) - $v->setEmail($company->email, 'INTERNET'); } else { - // when e-mail of user and company complete different use company e-mail at first (and user e-mail at second) - $v->setEmail($company->email, "TYPE=WORK"); + $tmpuser2 = explode("@", trim($user2->email)); + $tmpcompany = explode("@", trim($company->email)); - // support by Microsoft Outlook (2019 and possible earlier) - $v->setEmail($user2->email, 'INTERNET'); + if (strtolower(end($tmpuser2)) == strtolower(end($tmpcompany))) { + // when e-mail domain of user and company are the same, use user e-mail at first (and company e-mail at second) + $v->setEmail($user2->email, "TYPE=WORK"); + + // support by Microsoft Outlook (2019 and possible earlier) + $v->setEmail($company->email, 'INTERNET'); + } else { + // when e-mail of user and company complete different use company e-mail at first (and user e-mail at second) + $v->setEmail($company->email, "TYPE=WORK"); + + // support by Microsoft Outlook (2019 and possible earlier) + $v->setEmail($user2->email, 'INTERNET'); + } } // Si user lie a un tiers non de type "particulier" From 4277509ddde835ee2fd594de8f0456fff9be2495 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 28 Dec 2022 03:48:29 +0100 Subject: [PATCH 3/4] Fix warnings --- htdocs/core/modules/DolibarrModules.class.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index f6ee9da7d60..ded997926c8 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -232,10 +232,13 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it */ public $export_label; + public $export_icon; + public $export_permission; public $export_fields_array; public $export_TypeFields_array; // Array of key=>type where type can be 'Numeric', 'Date', 'Text', 'Boolean', 'Status', 'List:xxx:login:rowid' public $export_entities_array; + public $export_help_array; public $export_special_array; // special or computed field public $export_dependencies_array; public $export_sql_start; From c26747b15a8b6493d59c9302c4449becab687a95 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 28 Dec 2022 03:59:29 +0100 Subject: [PATCH 4/4] Fix warnings --- htdocs/core/modules/DolibarrModules.class.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index ded997926c8..f88a05bd12b 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -258,6 +258,17 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it */ public $import_label; + public $import_icon; + + public $import_entities_array; + public $import_tables_array; + public $import_fields_array; + public $import_fieldshidden_array; + public $import_convertvalue_array; + public $import_regex_array; + public $import_examplevalues_array; + public $import_updatekeys_array; + /** * @var string Module constant name