diff --git a/htdocs/core/boxes/box_external_rss.php b/htdocs/core/boxes/box_external_rss.php index 698cd6504a2..7e5a746a8d1 100644 --- a/htdocs/core/boxes/box_external_rss.php +++ b/htdocs/core/boxes/box_external_rss.php @@ -158,7 +158,6 @@ class box_external_rss extends ModeleBoxes $title = preg_replace("/([[:alnum:]])\?([[:alnum:]])/", "\\1'\\2", $title); // Manage issue of quotes improperly (de)coded in utf-8 $title = preg_replace("/^\s+/", "", $title); // Remove leading whitespace - $this->info_box_contents["$href"] = "$title"; $tooltip = $title; $description = !empty($item['description']) ? $item['description'] : ''; 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 .= ''; 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) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index aae73201717..9ca3eb7abab 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -7482,7 +7482,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 ' 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"); @@ -270,141 +275,147 @@ 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 - $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 ''; + 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 ''; diff --git a/htdocs/ticket/class/actions_ticket.class.php b/htdocs/ticket/class/actions_ticket.class.php index 2a54f797e0a..cc7e302db74 100644 --- a/htdocs/ticket/class/actions_ticket.class.php +++ b/htdocs/ticket/class/actions_ticket.class.php @@ -216,6 +216,9 @@ 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); + } $doleditor = new DolEditor('message_initial', $msg, '100%', 250, 'dolibarr_details', 'In', true, $uselocalbrowser, $ckeditorenabledforticket, ROWS_9, '95%'); $doleditor->Create(); } else { diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 8f40a7c02ac..70aba99dcea 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'); 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/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/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 */