From 82271a766de18048b57abf5761500cbcb42605b8 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Mon, 5 Jun 2023 08:49:16 +0200 Subject: [PATCH 01/16] fix: delete bookmark button link --- htdocs/bookmarks/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/bookmarks/card.php b/htdocs/bookmarks/card.php index e8075833d22..7bebdcb2af7 100644 --- a/htdocs/bookmarks/card.php +++ b/htdocs/bookmarks/card.php @@ -332,7 +332,7 @@ if ($id > 0 && !preg_match('/^add/i', $action)) { // Remove if ($permissiontodelete && $action != 'edit') { - print ''.$langs->trans("Delete").''."\n"; + print ''.$langs->trans("Delete").''."\n"; } print ''; From e9c17980f92aa985f1b0744b31f92c61c4d12580 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 5 Jun 2023 23:59:33 +0200 Subject: [PATCH 02/16] Trans --- htdocs/langs/en_US/help.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/help.lang b/htdocs/langs/en_US/help.lang index d699cb56fd2..17a6104d59a 100644 --- a/htdocs/langs/en_US/help.lang +++ b/htdocs/langs/en_US/help.lang @@ -11,7 +11,7 @@ TypeOfSupport=Type of support TypeSupportCommunauty=Community (free) TypeSupportCommercial=Commercial TypeOfHelp=Type -NeedHelpCenter=Need help or support? +NeedHelpCenter=Need support? Efficiency=Efficiency TypeHelpOnly=Help only TypeHelpDev=Help+Development From d376d960575cd0e1ba095060c4a874b5af96458d Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 7 Jun 2023 15:38:05 +0200 Subject: [PATCH 03/16] FIX ability to disable forcing focus on select2 to avoid side effects --- htdocs/core/js/lib_head.js.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/core/js/lib_head.js.php b/htdocs/core/js/lib_head.js.php index 8c4d958abac..5664541cc00 100644 --- a/htdocs/core/js/lib_head.js.php +++ b/htdocs/core/js/lib_head.js.php @@ -1299,6 +1299,9 @@ $(document).ready(function() { * * TODO: Recheck with the select2 GH issue and remove once this is fixed on their side */ +global->MAIN_DISABLE_SELECT2_FOCUS_PROTECTION) && !defined('DISABLE_SELECT2_FOCUS_PROTECTION')) { +?> $(document).on('select2:open', () => { console.log("Execute the focus (click on combo or use space when on component"); let allFound = document.querySelectorAll('.select2-container--open .select2-search__field'); @@ -1308,5 +1311,6 @@ $(document).on('select2:open', () => { },0); }); }); + // End of lib_head.js.php From 648f0ce892d87d1e506165561cc53581612e6fea Mon Sep 17 00:00:00 2001 From: Can Arslan Date: Wed, 7 Jun 2023 13:51:26 -0600 Subject: [PATCH 04/16] Fix cstate class for use by custom modules --- htdocs/core/class/cstate.class.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/htdocs/core/class/cstate.class.php b/htdocs/core/class/cstate.class.php index 46e60b2f7fd..fe5f6b53974 100644 --- a/htdocs/core/class/cstate.class.php +++ b/htdocs/core/class/cstate.class.php @@ -292,4 +292,20 @@ class Cstate // extends CommonObject return 1; } } + + /** + * Return a link to the object card (with optionaly the picto) + * + * @param int $withpicto Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto) + * @param string $option On what the link point to ('nolink', ...) + * @param int $notooltip 1=Disable tooltip + * @param string $morecss Add more css on link + * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking + * @return string String with URL + */ + public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1) + { + global $langs; + return $langs->trans($this->name); + } } From d853a8f2207acacbc1de0c7c7690533dc7344969 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 8 Jun 2023 10:16:58 +0200 Subject: [PATCH 05/16] Fix phpcs --- htdocs/core/js/lib_head.js.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/core/js/lib_head.js.php b/htdocs/core/js/lib_head.js.php index 5664541cc00..ab4b39ec872 100644 --- a/htdocs/core/js/lib_head.js.php +++ b/htdocs/core/js/lib_head.js.php @@ -1301,7 +1301,7 @@ $(document).ready(function() { */ global->MAIN_DISABLE_SELECT2_FOCUS_PROTECTION) && !defined('DISABLE_SELECT2_FOCUS_PROTECTION')) { -?> + ?> $(document).on('select2:open', () => { console.log("Execute the focus (click on combo or use space when on component"); let allFound = document.querySelectorAll('.select2-container--open .select2-search__field'); @@ -1311,6 +1311,8 @@ $(document).on('select2:open', () => { },0); }); }); - + // End of lib_head.js.php From ddec6c20e04ec158f52cf87e72e4dbc599aeee75 Mon Sep 17 00:00:00 2001 From: hystepik Date: Thu, 8 Jun 2023 16:37:51 +0200 Subject: [PATCH 06/16] Fix : fields switched in establishement creation --- htdocs/hrm/class/establishment.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/hrm/class/establishment.class.php b/htdocs/hrm/class/establishment.class.php index 05bd8d47cf8..0801f510f10 100644 --- a/htdocs/hrm/class/establishment.class.php +++ b/htdocs/hrm/class/establishment.class.php @@ -192,8 +192,8 @@ class Establishment extends CommonObject $sql .= ", address"; $sql .= ", zip"; $sql .= ", town"; - $sql .= ", status"; $sql .= ", fk_country"; + $sql .= ", status"; $sql .= ", entity"; $sql .= ", datec"; $sql .= ", fk_user_author"; From 1946b6ac8a7be788605778b165934bb24d0bb8af Mon Sep 17 00:00:00 2001 From: hystepik Date: Thu, 8 Jun 2023 17:21:13 +0200 Subject: [PATCH 07/16] Fix : javascript fatal error on dolgraph --- htdocs/core/class/dolgraph.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/dolgraph.class.php b/htdocs/core/class/dolgraph.class.php index 8fad21d5e3b..362d61e5325 100644 --- a/htdocs/core/class/dolgraph.class.php +++ b/htdocs/core/class/dolgraph.class.php @@ -1351,7 +1351,7 @@ class DolGraph // Add a callback to change label to show only positive value if (is_array($this->tooltipsLabels) || is_array($this->tooltipsTitles)) { - $this->stringtoshow .= ', tooltips: { mode: \'nearest\', + $this->stringtoshow .= 'tooltips: { mode: \'nearest\', callbacks: {'; if (is_array($this->tooltipsTitles)) { $this->stringtoshow .=' From 180b3a6315785bc10c604cc1dc7ff42b1104b212 Mon Sep 17 00:00:00 2001 From: hystepik Date: Thu, 8 Jun 2023 21:34:19 +0200 Subject: [PATCH 08/16] fix php 8.1 warnings with strict mode --- htdocs/adherents/subscription/list.php | 2 +- htdocs/comm/action/class/actioncomm.class.php | 4 ++-- htdocs/comm/action/index.php | 4 ++-- htdocs/core/class/html.form.class.php | 2 +- htdocs/core/lib/functions.lib.php | 2 +- htdocs/hrm/establishment/card.php | 1 + htdocs/hrm/establishment/info.php | 2 +- htdocs/resource/class/html.formresource.class.php | 2 +- 8 files changed, 10 insertions(+), 9 deletions(-) diff --git a/htdocs/adherents/subscription/list.php b/htdocs/adherents/subscription/list.php index 9a2243f4fea..5060a0224b6 100644 --- a/htdocs/adherents/subscription/list.php +++ b/htdocs/adherents/subscription/list.php @@ -715,7 +715,7 @@ while ($i < $imaxinloop) { // Label if (!empty($arrayfields['t.libelle']['checked'])) { - print ''; + print ''; print dol_escape_htmltag(dolGetFirstLineOfText($obj->note_private)); print ''; if (!$i) { diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 8879e48edd6..c62ab5a96af 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -1860,11 +1860,11 @@ class ActionComm extends CommonObject $imgpicto = img_picto('', 'object_phoning', $color, false, 0, 0, '', 'paddingright'); } elseif ($this->type_code == 'AC_FAX') { $imgpicto = img_picto('', 'object_phoning_fax', $color, false, 0, 0, '', 'paddingright'); - } elseif ($this->type_code == 'AC_EMAIL' || $this->type_code == 'AC_EMAIL_IN' || preg_match('/_SENTBYMAIL/', $this->code)) { + } elseif ($this->type_code == 'AC_EMAIL' || $this->type_code == 'AC_EMAIL_IN' || (!empty($this->code) && preg_match('/_SENTBYMAIL/', $this->code))) { $imgpicto = img_picto('', 'object_email', $color, false, 0, 0, '', 'paddingright'); } elseif ($this->type_code == 'AC_INT') { $imgpicto = img_picto('', 'object_intervention', $color, false, 0, 0, '', 'paddingright'); - } elseif (preg_match('/^TICKET_MSG/', $this->code)) { + } elseif (!empty($this->code) && preg_match('/^TICKET_MSG/', $this->code)) { $imgpicto = img_picto('', 'object_conversation', $color, false, 0, 0, '', 'paddingright'); } elseif ($this->type != 'systemauto') { $imgpicto = img_picto('', 'user-cog', $color, false, 0, 0, '', 'paddingright'); diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index d9089f03c14..34a93aa0197 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -584,7 +584,7 @@ if (!empty($conf->use_javascript_ajax)) { // If javascript on // Local calendar $s .= '
'.$langs->trans("LocalAgenda").'  
'; - if ($user->rights->holiday->read) { + if ($user->hasRight("holiday", "read")) { // Holiday calendar $s .= '
rights->holiday->read) { +if ($user->hasRight("holiday", "read")) { // LEAVE-HOLIDAY CALENDAR $sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.statut, x.rowid, x.date_debut as date_start, x.date_fin as date_end, x.halfday, x.statut as status"; $sql .= " FROM ".MAIN_DB_PREFIX."holiday as x, ".MAIN_DB_PREFIX."user as u"; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 27a62cfe2d2..ffc96b1808d 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -9754,7 +9754,7 @@ class Form $nophoto = '/public/theme/common/nophoto.png'; $defaultimg = 'identicon'; // For gravatar if (in_array($modulepart, array('societe', 'userphoto', 'contact', 'memberphoto'))) { // For modules that need a special image when photo not found - if ($modulepart == 'societe' || ($modulepart == 'memberphoto' && strpos($object->morphy, 'mor')) !== false) { + if ($modulepart == 'societe' || ($modulepart == 'memberphoto' && !empty($object->morphy) && strpos($object->morphy, 'mor')) !== false) { $nophoto = 'company'; } else { $nophoto = '/public/theme/common/user_anonymous.png'; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index e35c9e86e3e..7573b8be21c 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -6775,7 +6775,7 @@ function yn($yesno, $case = 1, $color = 0) $result = 'unknown'; $classname = ''; - if ($yesno == 1 || strtolower($yesno) == 'yes' || strtolower($yesno) == 'true') { // A mettre avant test sur no a cause du == 0 + if ($yesno == 1 || (isset($yesno) && (strtolower($yesno) == 'yes' || strtolower($yesno) == 'true'))) { // A mettre avant test sur no a cause du == 0 $result = $langs->trans('yes'); if ($case == 1 || $case == 3) { $result = $langs->trans("Yes"); diff --git a/htdocs/hrm/establishment/card.php b/htdocs/hrm/establishment/card.php index 8e00473bca2..57750c1b683 100644 --- a/htdocs/hrm/establishment/card.php +++ b/htdocs/hrm/establishment/card.php @@ -54,6 +54,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be includ $permissiontoread = $user->admin; $permissiontoadd = $user->admin; // Used by the include of actions_addupdatedelete.inc.php +$permissiontodelete = $user->admin; $upload_dir = $conf->hrm->multidir_output[isset($object->entity) ? $object->entity : 1]; // Security check - Protection if external user diff --git a/htdocs/hrm/establishment/info.php b/htdocs/hrm/establishment/info.php index 1a9ba129f10..b0caa25ca97 100644 --- a/htdocs/hrm/establishment/info.php +++ b/htdocs/hrm/establishment/info.php @@ -78,7 +78,7 @@ if ($id > 0 || !empty($ref)) { } $permissiontoread = $user->admin; -$permissiontoadd = $user->rights->hrm->write; // Used by the include of actions_addupdatedelete.inc.php +$permissiontoadd = $user->hasRight('hrm', 'write'); // Used by the include of actions_addupdatedelete.inc.php $upload_dir = $conf->hrm->multidir_output[isset($object->entity) ? $object->entity : 1]; // Security check - Protection if external user diff --git a/htdocs/resource/class/html.formresource.class.php b/htdocs/resource/class/html.formresource.class.php index 5f8c27dab4f..527fa93a483 100644 --- a/htdocs/resource/class/html.formresource.class.php +++ b/htdocs/resource/class/html.formresource.class.php @@ -212,7 +212,7 @@ class FormResource print '