From 757401afb4d31ba226042c19aa4cadab9216e0f5 Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Tue, 19 Mar 2024 17:48:06 +0100 Subject: [PATCH 01/13] Add Button+ in Notification section for company --- htdocs/societe/notify/card.php | 228 +++++++++++++++++---------------- 1 file changed, 116 insertions(+), 112 deletions(-) diff --git a/htdocs/societe/notify/card.php b/htdocs/societe/notify/card.php index ee49f1ceb48..dece4029629 100644 --- a/htdocs/societe/notify/card.php +++ b/htdocs/societe/notify/card.php @@ -247,6 +247,7 @@ if ($result > 0) { $param = ''; $newcardbutton = ''; + $newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', $_SERVER["PHP_SELF"].'?socid='.$object->id.'&action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $user->rights->societe->creer); $titlelist = $langs->trans("ListOfActiveNotifications"); @@ -271,138 +272,141 @@ if ($result > 0) { print "\n"; // Line to add a new subscription - $listofemails = $object->thirdparty_and_contact_email_array(); - if (count($listofemails) > 0) { - $actions = array(); + if ($action == 'create') { + $listofemails = $object->thirdparty_and_contact_email_array(); + if (count($listofemails) > 0) { + $actions = array(); - // Load array of available notifications - $notificationtrigger = new InterfaceNotification($db); - $listofmanagedeventfornotification = $notificationtrigger->getListOfManagedEvents(); + // Load array of available notifications + $notificationtrigger = new InterfaceNotification($db); + $listofmanagedeventfornotification = $notificationtrigger->getListOfManagedEvents(); - foreach ($listofmanagedeventfornotification as $managedeventfornotification) { - $label = ($langs->trans("Notify_".$managedeventfornotification['code']) != "Notify_".$managedeventfornotification['code'] ? $langs->trans("Notify_".$managedeventfornotification['code']) : $managedeventfornotification['label']); - $actions[$managedeventfornotification['rowid']] = $label; + foreach ($listofmanagedeventfornotification as $managedeventfornotification) { + $label = ($langs->trans("Notify_".$managedeventfornotification['code']) != "Notify_".$managedeventfornotification['code'] ? $langs->trans("Notify_".$managedeventfornotification['code']) : $managedeventfornotification['label']); + $actions[$managedeventfornotification['rowid']] = $label; + } + + $newlistofemails = array(); + foreach ($listofemails as $tmpkey => $tmpval) { + $labelhtml = str_replace(array('<', '>'), array(' - ', ''), $tmpval); + $newlistofemails[$tmpkey] = array('label' => dol_string_nohtmltag($tmpval), 'id' => $tmpkey, 'data-html' => $labelhtml); + } + + print ''; + print ''; + print img_picto('', 'contact', '', false, 0, 0, '', 'paddingright'); + print $form->selectarray("contactid", $newlistofemails, '', 1, 0, 0, '', 0, 0, 0, '', 'minwidth100imp maxwidthonsmartphone'); + print ''; + print ''; + print img_picto('', 'object_action', '', false, 0, 0, '', 'paddingright'); + print $form->selectarray("actionid", $actions, '', 1, 0, 0, '', 0, 0, 0, '', 'minwidth100imp maxwidthonsmartphone'); + print ''; + print ''; + $type = array('email' => $langs->trans("EMail")); + print $form->selectarray("typeid", $type, '', 0, 0, 0, '', 0, 0, 0, '', 'minwidth75imp'); + print ''; + print ''; + print ''; + } else { + print ''; + print $langs->trans("YouMustCreateContactFirst"); + print ''; } - - $newlistofemails = array(); - foreach ($listofemails as $tmpkey => $tmpval) { - $labelhtml = str_replace(array('<', '>'), array(' - ', ''), $tmpval); - $newlistofemails[$tmpkey] = array('label' => dol_string_nohtmltag($tmpval), 'id' => $tmpkey, 'data-html' => $labelhtml); - } - - print ''; - print ''; - print img_picto('', 'contact', '', false, 0, 0, '', 'paddingright'); - print $form->selectarray("contactid", $newlistofemails, '', 1, 0, 0, '', 0, 0, 0, '', 'minwidth100imp maxwidthonsmartphone'); - print ''; - print ''; - print img_picto('', 'object_action', '', false, 0, 0, '', 'paddingright'); - print $form->selectarray("actionid", $actions, '', 1, 0, 0, '', 0, 0, 0, '', 'minwidth100imp maxwidthonsmartphone'); - print ''; - print ''; - $type = array('email' => $langs->trans("EMail")); - print $form->selectarray("typeid", $type, '', 0, 0, 0, '', 0, 0, 0, '', 'minwidth75imp'); - print ''; - print ''; - print ''; } else { - print ''; - print $langs->trans("YouMustCreateContactFirst"); - print ''; - } + if ($num) { + $i = 0; + $contactstatic = new Contact($db); - if ($num) { - $i = 0; + while ($i < $num) { + $obj = $db->fetch_object($resql); - $contactstatic = new Contact($db); + $contactstatic->id = $obj->contactid; + $contactstatic->lastname = $obj->lastname; + $contactstatic->firstname = $obj->firstname; - while ($i < $num) { - $obj = $db->fetch_object($resql); + print ''; + print ''.$contactstatic->getNomUrl(1); + if ($obj->type == 'email') { + if (isValidEmail($obj->email)) { + print ' <'.$obj->email.'>'; + } else { + $langs->load("errors"); + print ' '.img_warning().' '.$langs->trans("ErrorBadEMail", $obj->email).''; + } + } + print ''; + print ''; + $label = ($langs->trans("Notify_".$obj->code) != "Notify_".$obj->code ? $langs->trans("Notify_".$obj->code) : $obj->label); + print img_picto('', 'object_action', '', false, 0, 0, '', 'paddingright').$label; + print ''; + print ''; + if ($obj->type == 'email') { + print $langs->trans("Email"); + } + if ($obj->type == 'sms') { + print $langs->trans("SMS"); + } + print ''; + print ''.img_delete().''; + print ''; + $i++; + } + $db->free($resql); + } - $contactstatic->id = $obj->contactid; - $contactstatic->lastname = $obj->lastname; - $contactstatic->firstname = $obj->firstname; - - print ''; - print ''.$contactstatic->getNomUrl(1); - if ($obj->type == 'email') { - if (isValidEmail($obj->email)) { - print ' <'.$obj->email.'>'; - } else { + // List of notifications enabled for fixed email + /* + foreach($conf->global as $key => $val) + { + if (! preg_match('/^NOTIFICATION_FIXEDEMAIL_(.*)/', $key, $reg)) continue; + print ''; + $listtmp=explode(',',$val); + $first=1; + foreach($listtmp as $keyemail => $valemail) + { + if (! $first) print ', '; + $first=0; + $valemail=trim($valemail); + //print $keyemail.' - '.$valemail.' - '.$reg[1].'
'; + if (isValidEmail($valemail, 1)) + { + if ($valemail == '__SUPERVISOREMAIL__') print $valemail; + else print ' <'.$valemail.'>'; + } + else + { $langs->load("errors"); - print ' '.img_warning().' '.$langs->trans("ErrorBadEMail", $obj->email).''; + print ' '.img_warning().' '.$langs->trans("ErrorBadEMail",$valemail).'; } } print ''; - print ''; - $label = ($langs->trans("Notify_".$obj->code) != "Notify_".$obj->code ? $langs->trans("Notify_".$obj->code) : $obj->label); - print img_picto('', 'object_action', '', false, 0, 0, '', 'paddingright').$label; + print ''; + $notifcode=preg_replace('/_THRESHOLD_.*$/','',$reg[1]); + $notifcodecond=preg_replace('/^.*_(THRESHOLD_)/','$1',$reg[1]); + $label=($langs->trans("Notify_".$notifcode)!="Notify_".$notifcode?$langs->trans("Notify_".$notifcode):$notifcode); + print $label; + if (preg_match('/^THRESHOLD_HIGHER_(.*)$/',$notifcodecond,$regcond) && ($regcond[1] > 0)) + { + print ' - '.$langs->trans("IfAmountHigherThan",$regcond[1]); + } print ''; print ''; - if ($obj->type == 'email') { - print $langs->trans("Email"); - } - if ($obj->type == 'sms') { - print $langs->trans("SMS"); - } + print $langs->trans("Email"); print ''; - print ''.img_delete().''; + print ''.$langs->trans("SeeModuleSetup", $langs->transnoentitiesnoconv("Module600Name")).''; print ''; - $i++; - } - $db->free($resql); + }*/ + + /*if ($user->admin) + { + print ''; + print '+ '.$langs->trans("SeeModuleSetup", $langs->transnoentitiesnoconv("Module600Name")).''; + print ''; + }*/ } - // List of notifications enabled for fixed email - /* - foreach($conf->global as $key => $val) - { - if (! preg_match('/^NOTIFICATION_FIXEDEMAIL_(.*)/', $key, $reg)) continue; - print ''; - $listtmp=explode(',',$val); - $first=1; - foreach($listtmp as $keyemail => $valemail) - { - if (! $first) print ', '; - $first=0; - $valemail=trim($valemail); - //print $keyemail.' - '.$valemail.' - '.$reg[1].'
'; - if (isValidEmail($valemail, 1)) - { - if ($valemail == '__SUPERVISOREMAIL__') print $valemail; - else print ' <'.$valemail.'>'; - } - else - { - $langs->load("errors"); - print ' '.img_warning().' '.$langs->trans("ErrorBadEMail",$valemail).'; - } - } - print ''; - print ''; - $notifcode=preg_replace('/_THRESHOLD_.*$/','',$reg[1]); - $notifcodecond=preg_replace('/^.*_(THRESHOLD_)/','$1',$reg[1]); - $label=($langs->trans("Notify_".$notifcode)!="Notify_".$notifcode?$langs->trans("Notify_".$notifcode):$notifcode); - print $label; - if (preg_match('/^THRESHOLD_HIGHER_(.*)$/',$notifcodecond,$regcond) && ($regcond[1] > 0)) - { - print ' - '.$langs->trans("IfAmountHigherThan",$regcond[1]); - } - print ''; - print ''; - print $langs->trans("Email"); - print ''; - print ''.$langs->trans("SeeModuleSetup", $langs->transnoentitiesnoconv("Module600Name")).''; - print ''; - }*/ - /*if ($user->admin) - { - print ''; - print '+ '.$langs->trans("SeeModuleSetup", $langs->transnoentitiesnoconv("Module600Name")).''; - print ''; - }*/ print ''; print ''; From c56077deccbaa01ae300bfca2f6edfd7ad5c338e Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Tue, 19 Mar 2024 17:57:01 +0100 Subject: [PATCH 02/13] add cancel button for close form --- htdocs/societe/notify/card.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/htdocs/societe/notify/card.php b/htdocs/societe/notify/card.php index dece4029629..d01a7e7517f 100644 --- a/htdocs/societe/notify/card.php +++ b/htdocs/societe/notify/card.php @@ -84,6 +84,10 @@ if ($reshook < 0) { if (empty($reshook)) { $error = 0; + if (GETPOST('cancel', 'alpha')) { + $action = ''; + } + // Add a notification if ($action == 'add') { if (empty($contactid)) { @@ -269,6 +273,8 @@ if ($result > 0) { print_liste_field_titre("Action", $_SERVER["PHP_SELF"], "", '', $param, 'width="35%"', $sortfield, $sortorder); print_liste_field_titre("Type", $_SERVER["PHP_SELF"], "n.type", '', $param, 'width="10%"', $sortfield, $sortorder); print_liste_field_titre(''); + print_liste_field_titre(''); + print "\n"; // Line to add a new subscription @@ -306,6 +312,7 @@ if ($result > 0) { print $form->selectarray("typeid", $type, '', 0, 0, 0, '', 0, 0, 0, '', 'minwidth75imp'); print ''; print ''; + print ''; print ''; } else { print ''; From 903d9d52de2fb458b3a732782ab4dff96ac2db9b Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 20 Mar 2024 04:26:16 +0100 Subject: [PATCH 03/13] Fix Expected an object instance & duplicate assignment # Fix Expected an object instance & duplicate assignment Fix: ticket.class.php: PhanTypeExpectedObjectOrClassName: Expected an object instance or the name of a class but saw expression $classname with type ''|string Fix: ticket.class.php: PhanPluginRedundantAssignment: Assigning '' to variable $sendtocc which already has that value --- htdocs/ticket/class/ticket.class.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 8f40a7c02ac..f1bf6a7ce19 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -2430,7 +2430,7 @@ class Ticket extends CommonObject } } - if ($filefound) { + if ($classname !== '') { $result = dol_include_once($reldir."core/modules/ticket/".$modele.'.php'); $modTicket = new $classname(); @@ -2992,7 +2992,6 @@ class Ticket extends CommonObject $array_receiver = array_merge($array_receiver, $this->getInfosTicketExternalContact(1)); } - $sendtocc = ""; if ($send_internal_cc) { $sendtocc = getDolGlobalString('TICKET_NOTIFICATION_EMAIL_FROM'); } else { From a58eb10ceaf392c647a326e325d32bf39c0a4ca5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Wed, 20 Mar 2024 08:41:27 +0100 Subject: [PATCH 04/13] fix phpstan in workstation class --- htdocs/workstation/class/workstationresource.class.php | 7 ++++--- htdocs/workstation/class/workstationusergroup.class.php | 7 ++++--- phpstan.neon.dist | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/htdocs/workstation/class/workstationresource.class.php b/htdocs/workstation/class/workstationresource.class.php index 1b92e15ed02..e38de9938a5 100644 --- a/htdocs/workstation/class/workstationresource.class.php +++ b/htdocs/workstation/class/workstationresource.class.php @@ -2,6 +2,7 @@ /* Copyright (C) 2017 Laurent Destailleur * Copyright (C) 2020 Gauthier VERDOL * Copyright (C) 2024 MDW + * Copyright (C) 2024 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 @@ -18,7 +19,7 @@ */ /** - * \file class/workstationresource.class.php + * \file htdocs/workstation/class/workstationresource.class.php * \ingroup workstation * \brief This file is a CRUD class file for WorkstationResource (Create/Read/Update/Delete) */ @@ -39,8 +40,8 @@ class WorkstationResource extends CommonObject * @var array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( - 'fk_workstation' => array('type' => 'integer'), - 'fk_resource' => array('type' => 'integer') + 'fk_workstation' => array('type' => 'integer', 'label' => 'Workstation', 'enabled' => 1, 'position' => 10, 'visible' => 1), + 'fk_resource' => array('type' => 'integer', 'label' => 'UserGroup', 'enabled' => 1, 'position' => 20, 'visible' => 1), ); /** diff --git a/htdocs/workstation/class/workstationusergroup.class.php b/htdocs/workstation/class/workstationusergroup.class.php index 56c17415242..a3c73facdcc 100644 --- a/htdocs/workstation/class/workstationusergroup.class.php +++ b/htdocs/workstation/class/workstationusergroup.class.php @@ -2,6 +2,7 @@ /* Copyright (C) 2017 Laurent Destailleur * Copyright (C) 2020 Gauthier VERDOL * Copyright (C) 2024 MDW + * Copyright (C) 2024 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 @@ -18,7 +19,7 @@ */ /** - * \file class/workstationusergroup.class.php + * \file htdocs/workstation/class/workstationusergroup.class.php * \ingroup workstation * \brief This file is a CRUD class file for WorkstationUserGroup (Create/Read/Update/Delete) */ @@ -38,8 +39,8 @@ class WorkstationUserGroup extends CommonObject * @var array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( - 'fk_workstation' => array('type' => 'integer'), - 'fk_usergroup' => array('type' => 'integer') + 'fk_workstation' => array('type' => 'integer', 'label' => 'Workstation', 'enabled' => 1, 'position' => 10, 'visible' => 1), + 'fk_usergroup' => array('type' => 'integer', 'label' => 'UserGroup', 'enabled' => 1, 'position' => 20, 'visible' => 1), ); /** diff --git a/phpstan.neon.dist b/phpstan.neon.dist index c354dfd5d84..4bb2cf6eaed 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -9,7 +9,7 @@ parameters: # minimumNumberOfJobsPerProcess: 2 # default is 2 # buffer: 134217728 # 128 MB # Not documented customRulesetUsed: true - level: 2 + level: 3 fileExtensions: - php paths: From 9d45df30cc3dffdea3d2a929654962901827435e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Wed, 20 Mar 2024 08:42:04 +0100 Subject: [PATCH 05/13] fix phpstan in workstation class --- phpstan.neon.dist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 4bb2cf6eaed..c354dfd5d84 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -9,7 +9,7 @@ parameters: # minimumNumberOfJobsPerProcess: 2 # default is 2 # buffer: 134217728 # 128 MB # Not documented customRulesetUsed: true - level: 3 + level: 2 fileExtensions: - php paths: From dcc01e58e2b9b74d51942439afbd401eed21ae9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Wed, 20 Mar 2024 08:46:16 +0100 Subject: [PATCH 06/13] fix phpstan in workstation class --- htdocs/workstation/class/workstation.class.php | 4 ++-- htdocs/workstation/lib/workstation.lib.php | 3 ++- htdocs/workstation/lib/workstation_workstation.lib.php | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/htdocs/workstation/class/workstation.class.php b/htdocs/workstation/class/workstation.class.php index fe291337135..c4b4cecc710 100644 --- a/htdocs/workstation/class/workstation.class.php +++ b/htdocs/workstation/class/workstation.class.php @@ -1,7 +1,7 @@ * Copyright (C) 2020 Gauthier VERDOL - * Copyright (C) 2023-2024 Frédéric France + * Copyright (C) 2023-2024 Frédéric France * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify @@ -19,7 +19,7 @@ */ /** - * \file class/workstation.class.php + * \file htdocs/workstation/class/workstation.class.php * \ingroup workstation * \brief This file is a CRUD class file for Workstation (Create/Read/Update/Delete) */ diff --git a/htdocs/workstation/lib/workstation.lib.php b/htdocs/workstation/lib/workstation.lib.php index 8250a85adda..5cca71a1738 100644 --- a/htdocs/workstation/lib/workstation.lib.php +++ b/htdocs/workstation/lib/workstation.lib.php @@ -1,5 +1,6 @@ + * Copyright (C) 2024 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 @@ -16,7 +17,7 @@ */ /** - * \file workstation/lib/workstation.lib.php + * \file htdocs/workstation/lib/workstation.lib.php * \ingroup workstation * \brief Library files with common functions for Workstation */ diff --git a/htdocs/workstation/lib/workstation_workstation.lib.php b/htdocs/workstation/lib/workstation_workstation.lib.php index 7f66f8ded4e..e044de7566d 100644 --- a/htdocs/workstation/lib/workstation_workstation.lib.php +++ b/htdocs/workstation/lib/workstation_workstation.lib.php @@ -1,5 +1,6 @@ + * Copyright (C) 2024 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 @@ -16,7 +17,7 @@ */ /** - * \file lib/workstation_workstation.lib.php + * \file htdocs/workstation/lib/workstation_workstation.lib.php * \ingroup workstation * \brief Library files with common functions for Workstation */ From 7bbde7d9507769b91433d46bcbd78966b477d6f9 Mon Sep 17 00:00:00 2001 From: Eric Seigne Date: Wed, 20 Mar 2024 09:01:51 +0100 Subject: [PATCH 07/13] replace br to new lines if ckeditor is not enabled on ticket --- htdocs/ticket/class/actions_ticket.class.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/ticket/class/actions_ticket.class.php b/htdocs/ticket/class/actions_ticket.class.php index d1ade28f68f..71459a557e9 100644 --- a/htdocs/ticket/class/actions_ticket.class.php +++ b/htdocs/ticket/class/actions_ticket.class.php @@ -213,6 +213,9 @@ class ActionsTicket include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $uselocalbrowser = true; $ckeditorenabledforticket = getDolGlobalString('FCKEDITOR_ENABLE_TICKET'); + if(!$ckeditorenabledforticket){ + $msg = dol_string_nohtmltag($msg,2); + } $doleditor = new DolEditor('message_initial', $msg, '100%', 250, 'dolibarr_details', 'In', true, $uselocalbrowser, $ckeditorenabledforticket, ROWS_9, '95%'); $doleditor->Create(); } else { From 73436bc62582fe872bc2df26f309b1900eb6ef3c Mon Sep 17 00:00:00 2001 From: iouston <4319513+iouston@users.noreply.github.com> Date: Wed, 20 Mar 2024 10:15:10 +0100 Subject: [PATCH 08/13] update filter example ((s.client IN (1,3) AND s.status=1)) give an sql error bad syntax on filter use ((s.client:IN:1,2,3) AND (s.status:=:1)) is ok --- htdocs/core/class/html.form.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 6850bdb80b8..0c62d6e7e2a 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1302,7 +1302,7 @@ class Form * * @param string $selected Preselected type * @param string $htmlname Name of field in form - * @param string $filter Optional filters criteras. WARNING: To avoid SQL injection, only few chars [.a-z0-9 =<>()] are allowed here (example: 's.rowid <> x', 's.client IN (1,3)'). Do not use a filter coming from input of users. + * @param string $filter Optional filters criteras. WARNING: To avoid SQL injection, only few chars [.a-z0-9 =<>()] are allowed here. Example: ((s.client:IN:1,3) AND (s.status:=:1)). Do not use a filter coming from input of users. * @param string $showempty Add an empty field (Can be '1' or text key to use on empty line like 'SelectThirdParty') * @param int $showtype Show third party type in combolist (customer, prospect or supplier) * @param int $forcecombo Force to load all values and output a standard combobox (with no beautification) From 536004c898e240ce0d67fcc518f940da4c97880a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 20 Mar 2024 10:43:51 +0100 Subject: [PATCH 09/13] Fix phpstan warnings --- htdocs/ticket/class/ticket.class.php | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 8f40a7c02ac..c40be3db94f 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -2419,18 +2419,16 @@ class Ticket extends CommonObject // Search template files $file = ''; $classname = ''; - $filefound = 0; $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); foreach ($dirmodels as $reldir) { $file = dol_buildpath($reldir."core/modules/ticket/".$modele.'.php', 0); if (file_exists($file)) { - $filefound = 1; $classname = $modele; break; } } - if ($filefound) { + if ($classname) { $result = dol_include_once($reldir."core/modules/ticket/".$modele.'.php'); $modTicket = new $classname(); @@ -2992,11 +2990,9 @@ class Ticket extends CommonObject $array_receiver = array_merge($array_receiver, $this->getInfosTicketExternalContact(1)); } - $sendtocc = ""; + $sendtocc = ''; if ($send_internal_cc) { $sendtocc = getDolGlobalString('TICKET_NOTIFICATION_EMAIL_FROM'); - } else { - $sendtocc = ''; } $from = getDolGlobalString('TICKET_NOTIFICATION_EMAIL_FROM'); From 702309de09ada722b500254360bb17327ee33158 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 20 Mar 2024 10:52:07 +0100 Subject: [PATCH 10/13] Doc --- htdocs/core/lib/functions.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 6cd87882385..8d73e91b520 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -7481,7 +7481,7 @@ function picto_required() * - you can decide to convert line feed into a space * * @param string $stringtoclean String to clean - * @param integer $removelinefeed 1=Replace all new lines by 1 space, 0=Only ending new lines are removed others are replaced with \n, 2=Ending new lines are removed but others are kept with a same number of \n than nb of
when there is both "...
\n..." + * @param integer $removelinefeed 1=Replace all new lines by 1 space, 0=Only ending new lines are removed others are replaced with \n, 2=The ending new line is removed but others are kept with the same number of \n than the nb of
when there is both "...
\n..." * @param string $pagecodeto Encoding of input/output string * @param integer $strip_tags 0=Use internal strip, 1=Use strip_tags() php function (bugged when text contains a < char that is not for a html tag or when tags is not closed like ' Date: Wed, 20 Mar 2024 10:52:37 +0100 Subject: [PATCH 11/13] Update actions_ticket.class.php --- htdocs/ticket/class/actions_ticket.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/ticket/class/actions_ticket.class.php b/htdocs/ticket/class/actions_ticket.class.php index 12594b946a5..cc7e302db74 100644 --- a/htdocs/ticket/class/actions_ticket.class.php +++ b/htdocs/ticket/class/actions_ticket.class.php @@ -216,8 +216,8 @@ class ActionsTicket extends CommonHookActions include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $uselocalbrowser = true; $ckeditorenabledforticket = getDolGlobalString('FCKEDITOR_ENABLE_TICKET'); - if(!$ckeditorenabledforticket){ - $msg = dol_string_nohtmltag($msg,2); + if (!$ckeditorenabledforticket) { + $msg = dol_string_nohtmltag($msg, 2); } $doleditor = new DolEditor('message_initial', $msg, '100%', 250, 'dolibarr_details', 'In', true, $uselocalbrowser, $ckeditorenabledforticket, ROWS_9, '95%'); $doleditor->Create(); From 5b2cb4b06375823c963bdbb7307dbe8e741d1d1b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 20 Mar 2024 11:24:16 +0100 Subject: [PATCH 12/13] Fix remove bad entry into array of the rss box --- htdocs/core/boxes/box_external_rss.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/core/boxes/box_external_rss.php b/htdocs/core/boxes/box_external_rss.php index 8bc4943e50b..70786334fa6 100644 --- a/htdocs/core/boxes/box_external_rss.php +++ b/htdocs/core/boxes/box_external_rss.php @@ -167,7 +167,6 @@ class box_external_rss extends ModeleBoxes $title = preg_replace("/([[:alnum:]])\?([[:alnum:]])/", "\\1'\\2", $title); // Gere probleme des apostrophes mal codee/decodee par utf8 $title = preg_replace("/^\s+/", "", $title); // Supprime espaces de debut - $this->info_box_contents["$href"] = "$title"; $tooltip = $title; $description = !empty($item['description']) ? $item['description'] : ''; From b18d65c09c3d0f18395ea8e0c6dc13dc9206fc0b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 20 Mar 2024 11:26:25 +0100 Subject: [PATCH 13/13] Fix warning --- htdocs/core/boxes/modules_boxes.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/boxes/modules_boxes.php b/htdocs/core/boxes/modules_boxes.php index 11af741a6a4..3d5a5bb8760 100644 --- a/htdocs/core/boxes/modules_boxes.php +++ b/htdocs/core/boxes/modules_boxes.php @@ -295,7 +295,7 @@ class ModeleBoxes // Can't be abstract as it is instantiated to build "empty" bo if ($nblines) { // Loop on each record foreach (array_keys($contents) as $i) { - if (isset($contents[$i])) { + if (isset($contents[$i]) && is_array($contents[$i])) { // TR if (isset($contents[$i][0]['tr'])) { $out .= '';