From 5ec53692893fefca39c548d90166c507b430665e Mon Sep 17 00:00:00 2001 From: Eric Seigne Date: Tue, 27 Feb 2024 00:09:35 +0100 Subject: [PATCH 01/38] conver conf->global to getDolGlobalString --- htdocs/ticket/agenda.php | 6 +- htdocs/ticket/card.php | 22 +++--- htdocs/ticket/class/actions_ticket.class.php | 2 +- htdocs/ticket/class/cticketcategory.class.php | 6 +- htdocs/ticket/class/ticket.class.php | 68 ++++++++++--------- htdocs/ticket/contact.php | 4 +- htdocs/ticket/css/styles.css.php | 2 +- htdocs/ticket/document.php | 4 +- htdocs/ticket/index.php | 6 +- htdocs/ticket/list.php | 20 +++--- htdocs/ticket/messaging.php | 6 +- htdocs/ticket/stats/index.php | 2 +- htdocs/ticket/tpl/linkedobjectblock.tpl.php | 2 +- 13 files changed, 78 insertions(+), 72 deletions(-) diff --git a/htdocs/ticket/agenda.php b/htdocs/ticket/agenda.php index 39d25c3a215..0aeba552204 100644 --- a/htdocs/ticket/agenda.php +++ b/htdocs/ticket/agenda.php @@ -99,7 +99,7 @@ if ($user->socid > 0 && ($object->fk_soc != $user->socid)) { accessforbidden(); } // or for unauthorized internals users -if (!$user->socid && (!empty($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY) && $object->fk_user_assign != $user->id) && !$user->rights->ticket->manage) { +if (!$user->socid && (!empty(getDolGlobalString('TICKET_LIMIT_VIEW_ASSIGNED_ONLY')) && $object->fk_user_assign != $user->id) && !$user->rights->ticket->manage) { accessforbidden(); } @@ -147,7 +147,7 @@ $userstat = new User($db); $formticket = new FormTicket($db); $title = $langs->trans("Ticket").' - '.$object->ref.' '.$object->name; -if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/ticketnameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) { +if (!empty(getDolGlobalString('MAIN_HTML_TITLE')) && preg_match('/ticketnameonly/', getDolGlobalString('MAIN_HTML_TITLE')) && $object->name) { $title = $object->ref.' '.$object->name.' - '.$langs->trans("Info"); } $help_url = 'EN:Module_Agenda_En|FR:Module_Agenda|DE:Modul_Terminplanung'; @@ -165,7 +165,7 @@ if ($socid > 0) { print dol_get_fiche_end(); } -if (!$user->socid && !empty($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY)) { +if (!$user->socid && !empty(getDolGlobalString('TICKET_LIMIT_VIEW_ASSIGNED_ONLY'))) { $object->next_prev_filter = "te.fk_user_assign = ".((int) $user->id); } elseif ($user->socid > 0) { $object->next_prev_filter = "te.fk_soc = ".((int) $user->socid); diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index 1e2c849060d..0e5129f367b 100755 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -274,14 +274,14 @@ if (empty($reshook)) { } // Auto mark as read if created from backend - if (!empty($conf->global->TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND) && $user->rights->ticket->write) { + if (!empty(getDolGlobalString('TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND')) && $user->rights->ticket->write) { if ( ! $object->markAsRead($user) > 0) { setEventMessages($object->error, $object->errors, 'errors'); } } // Auto assign user - if (!empty($conf->global->TICKET_AUTO_ASSIGN_USER_CREATE)) { + if (!empty(getDolGlobalString('TICKET_AUTO_ASSIGN_USER_CREATE'))) { $result = $object->assignUser($user, $user->id, 1); $object->add_contact($user->id, "SUPPORTTEC", 'internal'); } @@ -742,7 +742,7 @@ if ($action == 'create' || $action == 'presend') { $formticket->withfromsocid = $socid ? $socid : $user->socid; $formticket->withfromcontactid = $contactid ? $contactid : ''; $formticket->withtitletopic = 1; - $formticket->withnotifytiersatcreate = ($notifyTiers ? 1 : (empty($conf->global->TICKET_CHECK_NOTIFY_THIRDPARTY_AT_CREATION) ? 0 : 1)); + $formticket->withnotifytiersatcreate = ($notifyTiers ? 1 : (empty(getDolGlobalString('TICKET_CHECK_NOTIFY_THIRDPARTY_AT_CREATION')) ? 0 : 1)); $formticket->withusercreate = 0; $formticket->withref = 1; $formticket->fk_user_create = $user->id; @@ -808,7 +808,7 @@ if ($action == 'create' || $action == 'presend') { || $action == 'editsubject' || $action == 'edit_extras' || $action == 'update_extras' || $action == 'edit_extrafields' || $action == 'set_extrafields' || $action == 'classify' || $action == 'sel_contract' || $action == 'edit_message_init' || $action == 'set_status' || $action == 'dellink') { if ($res > 0) { // or for unauthorized internals users - if (!$user->socid && (!empty($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY) && $object->fk_user_assign != $user->id) && !$user->rights->ticket->manage) { + if (!$user->socid && (!empty(getDolGlobalString('TICKET_LIMIT_VIEW_ASSIGNED_ONLY')) && $object->fk_user_assign != $user->id) && !$user->rights->ticket->manage) { accessforbidden('', 0, 1); } @@ -824,7 +824,7 @@ if ($action == 'create' || $action == 'presend') { } // Default select all or no contact - $default = (!empty($conf->global->TICKET_NOTIFY_AT_CLOSING)) ? -2 : -3; + $default = (!empty(getDolGlobalString('TICKET_NOTIFY_AT_CLOSING'))) ? -2 : -3; $formquestion = array( array( 'name' => 'contactid', @@ -930,7 +930,7 @@ if ($action == 'create' || $action == 'presend') { print dol_get_fiche_end(); } - if (!$user->socid && !empty($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY)) { + if (!$user->socid && !empty(getDolGlobalString('TICKET_LIMIT_VIEW_ASSIGNED_ONLY'))) { $object->next_prev_filter = "te.fk_user_assign = ".((int) $user->id); } elseif ($user->socid > 0) { $object->next_prev_filter = "te.fk_soc = ".((int) $user->socid); @@ -1142,7 +1142,7 @@ if ($action == 'create' || $action == 'presend') { print ''; print $form->textwithpicto($langs->trans("TicketDurationAuto"), $langs->trans("TicketDurationAutoInfos"), 1); print ''; - print $foundinter ? convertSecondToTime($timing, 'all', $conf->global->MAIN_DURATION_OF_WORKDAY) : ''; + print $foundinter ? convertSecondToTime($timing, 'all', getDolGlobalString('MAIN_DURATION_OF_WORKDAY')) : ''; print ''; } @@ -1289,7 +1289,7 @@ if ($action == 'create' || $action == 'presend') { } - if (!empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) { + if (!empty(getDolGlobalString('MAIN_DISABLE_CONTACTS_TAB'))) { print load_fiche_titre($langs->trans('Contacts'), '', 'title_companies.png'); print '
'; @@ -1335,7 +1335,7 @@ if ($action == 'create' || $action == 'presend') { echo $companystatic->getNomUrl(-1); } if ($tab[$i]['socid'] < 0) { - echo $conf->global->MAIN_INFO_SOCIETE_NOM; + echo getDolGlobalString('MAIN_INFO_SOCIETE_NOM'); } if (!$tab[$i]['socid']) { echo ' '; @@ -1537,7 +1537,7 @@ if ($action == 'create' || $action == 'presend') { } // Show messages on card (Note: this is a duplicate of the view Events/Agenda but on the main tab) - if (!empty($conf->global->TICKET_SHOW_MESSAGES_ON_CARD)) { + if (!empty(getDolGlobalString('TICKET_SHOW_MESSAGES_ON_CARD'))) { $param = '&id='.$object->id; if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.$contextpage; @@ -1590,7 +1590,7 @@ if ($action == 'create' || $action == 'presend') { print showDirectPublicLink($object).'
'; print '
'; - if (empty($conf->global->TICKET_SHOW_MESSAGES_ON_CARD)) { + if (empty(getDolGlobalString('TICKET_SHOW_MESSAGES_ON_CARD'))) { print '
'; $MAXEVENT = 10; diff --git a/htdocs/ticket/class/actions_ticket.class.php b/htdocs/ticket/class/actions_ticket.class.php index cc0a02dd294..d1ade28f68f 100644 --- a/htdocs/ticket/class/actions_ticket.class.php +++ b/htdocs/ticket/class/actions_ticket.class.php @@ -212,7 +212,7 @@ class ActionsTicket $msg = GETPOSTISSET('message_initial') ? GETPOST('message_initial', 'restricthtml') : $object->message; include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $uselocalbrowser = true; - $ckeditorenabledforticket = $conf->global->FCKEDITOR_ENABLE_TICKET; + $ckeditorenabledforticket = getDolGlobalString('FCKEDITOR_ENABLE_TICKET'); $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/cticketcategory.class.php b/htdocs/ticket/class/cticketcategory.class.php index f10309d08ca..5aa4378b394 100644 --- a/htdocs/ticket/class/cticketcategory.class.php +++ b/htdocs/ticket/class/cticketcategory.class.php @@ -73,7 +73,7 @@ class CTicketCategory extends CommonObject * Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)" * 'label' the translation key. * 'picto' is code of a picto to show before value in forms - * 'enabled' is a condition when the field must be managed (Example: 1 or '$conf->global->MY_SETUP_PARAM) + * 'enabled' is a condition when the field must be managed (Example: 1 or 'getDolGlobalString('MY_SETUP_PARAM')) * 'position' is the sort order of field. * 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0). * 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). 5=Visible on list and view only (not create/not update). Using a negative value means field is not shown by default on list but can be selected for viewing) @@ -186,7 +186,7 @@ class CTicketCategory extends CommonObject $this->db = $db; - if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) { + if (empty(getDolGlobalString('MAIN_SHOW_TECHNICAL_ID')) && isset($this->fields['rowid'])) { $this->fields['rowid']['visible'] = 0; } if (!isModEnabled('multicompany') && isset($this->fields['entity'])) { @@ -530,7 +530,7 @@ class CTicketCategory extends CommonObject $linkclose = ''; if (empty($notooltip)) { - if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { + if (!empty(getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER'))) { $label = $langs->trans("ShowMyObject"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 601806e023b..bbb67a2d53b 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -272,7 +272,7 @@ class Ticket extends CommonObject * Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)" * 'label' the translation key. * 'picto' is code of a picto to show before value in forms - * 'enabled' is a condition when the field must be managed (Example: 1 or '$conf->global->MY_SETUP_PARAM) + * 'enabled' is a condition when the field must be managed (Example: 1 or 'getDolGlobalString('MY_SETUP_PARAM')) * 'position' is the sort order of field. * 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0). * 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). 5=Visible on list and view only (not create/not update). Using a negative value means field is not shown by default on list but can be selected for viewing) @@ -542,7 +542,7 @@ class Ticket extends CommonObject $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."ticket"); } - if (!$error && !empty($conf->global->TICKET_ADD_AUTHOR_AS_CONTACT)) { + if (!$error && !empty(getDolGlobalString('TICKET_ADD_AUTHOR_AS_CONTACT'))) { // add creator as contributor if ($this->add_contact($user->id, 'CONTRIBUTOR', 'internal') < 0) { $error++; @@ -1530,7 +1530,7 @@ class Ticket extends CommonObject $linkclose = ''; if (empty($notooltip)) { - if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { + if (!empty(getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER'))) { $label = $langs->trans("ShowTicket"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } @@ -1825,7 +1825,7 @@ class Ticket extends CommonObject $error = 0; // Valid and close fichinter linked - if (isModEnabled('ficheinter') && !empty($conf->global->WORKFLOW_TICKET_CLOSE_INTERVENTION)) { + if (isModEnabled('ficheinter') && !empty(getDolGlobalString('WORKFLOW_TICKET_CLOSE_INTERVENTION'))) { dol_syslog("We have closed the ticket, so we close all linked interventions"); $this->fetchObjectLinked($this->id, $this->element, null, 'fichinter'); if ($this->linkedObjectsIds) { @@ -2285,7 +2285,7 @@ class Ticket extends CommonObject global $conf; $defaultref = ''; - $modele = empty($conf->global->TICKET_ADDON) ? 'mod_ticket_simple' : $conf->global->TICKET_ADDON; + $modele = getDolGlobalString('TICKET_ADDON','mod_ticket_simple'); // Search template files $file = ''; @@ -2547,7 +2547,7 @@ class Ticket extends CommonObject * * Send emails to assigned users (public area notification) */ - if (!empty($conf->global->TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_ENABLED)) { + if (!empty(getDolGlobalString('TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_ENABLED'))) { // Retrieve internal contact datas $internal_contacts = $object->getInfosTicketInternalContact(1); @@ -2580,22 +2580,22 @@ class Ticket extends CommonObject } if (empty($sendto)) { - if (!empty($conf->global->TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL)) { - $sendto[$conf->global->TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL] = $conf->global->TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL; - } elseif (!empty($conf->global->TICKET_NOTIFICATION_EMAIL_TO)) { - $sendto[$conf->global->TICKET_NOTIFICATION_EMAIL_TO] = $conf->global->TICKET_NOTIFICATION_EMAIL_TO; + if (!empty(getDolGlobalString('TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL'))) { + $sendto[getDolGlobalString('TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL')] = getDolGlobalString('TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL'); + } elseif (!empty(getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO'))) { + $sendto[getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO')] = getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO'); } } // Add global email address recipient - if (!empty($conf->global->TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS) && - !empty($conf->global->TICKET_NOTIFICATION_EMAIL_TO) && !array_key_exists($conf->global->TICKET_NOTIFICATION_EMAIL_TO, $sendto) - ) { - $sendto[$conf->global->TICKET_NOTIFICATION_EMAIL_TO] = $conf->global->TICKET_NOTIFICATION_EMAIL_TO; + if (!empty(getDolGlobalString('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS')) && + !empty(getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO')) && !array_key_exists(getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO'), $sendto) + ){ + $sendto[getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO')] = getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO'); } if (!empty($sendto)) { - $label_title = empty($conf->global->MAIN_APPLICATION_TITLE) ? $mysoc->name : $conf->global->MAIN_APPLICATION_TITLE; + $label_title = getDolGlobalString('MAIN_APPLICATION_TITLE', $mysoc->name); $subject = '['.$label_title.'- ticket #'.$object->track_id.'] '.$langs->trans('TicketNewMessage'); // Message send @@ -2644,7 +2644,7 @@ class Ticket extends CommonObject $sendto = array(); if (is_array($internal_contacts) && count($internal_contacts) > 0) { // Set default subject - $label_title = empty($conf->global->MAIN_APPLICATION_TITLE) ? $mysoc->name : $conf->global->MAIN_APPLICATION_TITLE; + $label_title = getDolGlobalString('MAIN_APPLICATION_TITLE', $mysoc->name); $appli = $label_title; $subject = GETPOST('subject', 'alphanohtml') ? GETPOST('subject', 'alphanohtml') : '['.$appli.' - '.$langs->trans("Ticket").' #'.$object->track_id.'] '.$langs->trans('TicketNewMessage'); @@ -2691,9 +2691,9 @@ class Ticket extends CommonObject $message .= '
'.$langs->trans('TicketNotificationEmailBodyInfosTrackUrlinternal').' : '.$object->track_id.'
'; // Add global email address recipient - if ($conf->global->TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS && !array_key_exists($conf->global->TICKET_NOTIFICATION_EMAIL_TO, $sendto)) { - if (!empty($conf->global->TICKET_NOTIFICATION_EMAIL_TO)) { - $sendto[$conf->global->TICKET_NOTIFICATION_EMAIL_TO] = $conf->global->TICKET_NOTIFICATION_EMAIL_TO; + if (getDolGlobalString('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS') && !array_key_exists(getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO'), $sendto)) { + if (!empty(getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO'))) { + $sendto[getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO')] = getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO'); } } @@ -2725,7 +2725,7 @@ class Ticket extends CommonObject $sendto = array(); if (is_array($external_contacts) && count($external_contacts) > 0) { // Get default subject for email to external contacts - $label_title = empty($conf->global->MAIN_APPLICATION_TITLE) ? $mysoc->name : $conf->global->MAIN_APPLICATION_TITLE; + $label_title = getDolGlobalString('MAIN_APPLICATION_TITLE', $mysoc->name); $appli = $mysoc->name; $subject = GETPOST('subject') ? GETPOST('subject') : '['.$appli.' - '.$langs->trans("Ticket").' #'.$object->track_id.'] '.$langs->trans('TicketNewMessage'); @@ -2763,8 +2763,13 @@ class Ticket extends CommonObject } // If public interface is not enable, use link to internal page into mail - $url_public_ticket = (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE) ? - (!empty($conf->global->TICKET_URL_PUBLIC_INTERFACE) ? $conf->global->TICKET_URL_PUBLIC_INTERFACE.'/view.php' : dol_buildpath('/public/ticket/view.php', 2)) : dol_buildpath('/ticket/card.php', 2)).'?track_id='.$object->track_id; + $url_public_ticket = ""; + if(!empty(getDolGlobalString('TICKET_ENABLE_PUBLIC_INTERFACE'))) { + $url_public_ticket = getDolGlobalString('TICKET_ENABLE_PUBLIC_INTERFACE') . '/view.php'; + }else { + $url_public_ticket = dol_buildpath('/public/ticket/view.php', 2); + } + $url_public_ticket .= '?track_id='.$object->track_id; $message .= '
'.$langs->trans('TicketNewEmailBodyInfosTrackUrlCustomer').' : '.$object->track_id.'
'; // Build final message @@ -2786,9 +2791,9 @@ class Ticket extends CommonObject } // Add global email address recipient - if ($conf->global->TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS && !array_key_exists($conf->global->TICKET_NOTIFICATION_EMAIL_TO, $sendto)) { - if (!empty($conf->global->TICKET_NOTIFICATION_EMAIL_TO)) { - $sendto[$conf->global->TICKET_NOTIFICATION_EMAIL_TO] = $conf->global->TICKET_NOTIFICATION_EMAIL_TO; + if (getDolGlobalString('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS') && !array_key_exists(getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO'), $sendto)) { + if (!empty(getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO'))) { + $sendto[getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO')] = getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO'); } } @@ -2830,7 +2835,7 @@ class Ticket extends CommonObject * * @param string $subject Email subject * @param string $message Email message - * @param int $send_internal_cc Receive a copy on internal email ($conf->global->TICKET_NOTIFICATION_EMAIL_FROM) + * @param int $send_internal_cc Receive a copy on internal email (getDolGlobalString('TICKET_NOTIFICATION_EMAIL_FROM') * @param array $array_receiver Array of receiver. exemple array('name' => 'John Doe', 'email' => 'john@doe.com', etc...) * @param array $filename_list List of files to attach (full path of filename on file system) * @param array $mimetype_list List of MIME type of attached files @@ -2841,7 +2846,7 @@ class Ticket extends CommonObject { global $conf, $langs; - if ($conf->global->TICKET_DISABLE_ALL_MAILS) { + if (getDolGlobalString('TICKET_DISABLE_ALL_MAILS')) { dol_syslog(get_class($this).'::sendTicketMessageByEmail: Emails are disable into ticket setup by option TICKET_DISABLE_ALL_MAILS', LOG_WARNING); return false; } @@ -2857,11 +2862,12 @@ class Ticket extends CommonObject $array_receiver = array_merge($array_receiver, $this->getInfosTicketExternalContact(1)); } + $sendtocc = ""; if ($send_internal_cc) { - $sendtocc = $conf->global->TICKET_NOTIFICATION_EMAIL_FROM; + $sendtocc = getDolGlobalString('TICKET_NOTIFICATION_EMAIL_FROM'); } - $from = $conf->global->TICKET_NOTIFICATION_EMAIL_FROM; + $from = getDolGlobalString('TICKET_NOTIFICATION_EMAIL_FROM'); $is_sent = false; if (is_array($array_receiver) && count($array_receiver) > 0) { foreach ($array_receiver as $key => $receiver) { @@ -2874,7 +2880,7 @@ class Ticket extends CommonObject $old_MAIN_MAIL_AUTOCOPY_TO = getDolGlobalString('MAIN_MAIL_AUTOCOPY_TO'); - if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) { + if (!empty(getDolGlobalString('TICKET_DISABLE_MAIL_AUTOCOPY_TO'))) { $conf->global->MAIN_MAIL_AUTOCOPY_TO = ''; } @@ -2907,7 +2913,7 @@ class Ticket extends CommonObject } } - if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) { + if (!empty(getDolGlobalString('TICKET_DISABLE_MAIL_AUTOCOPY_TO'))) { $conf->global->MAIN_MAIL_AUTOCOPY_TO = $old_MAIN_MAIL_AUTOCOPY_TO; } } diff --git a/htdocs/ticket/contact.php b/htdocs/ticket/contact.php index ba678ae2dca..a3e86cf6d51 100644 --- a/htdocs/ticket/contact.php +++ b/htdocs/ticket/contact.php @@ -72,7 +72,7 @@ if ($user->socid > 0 && ($object->fk_soc != $user->socid)) { accessforbidden(); } // or for unauthorized internals users -if (!$user->socid && (!empty($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY) && $object->fk_user_assign != $user->id) && !$user->rights->ticket->manage) { +if (!$user->socid && (!empty(getDolGlobalString('TICKET_LIMIT_VIEW_ASSIGNED_ONLY')) && $object->fk_user_assign != $user->id) && !$user->rights->ticket->manage) { accessforbidden(); } @@ -194,7 +194,7 @@ if ($id > 0 || !empty($track_id) || !empty($ref)) { print dol_get_fiche_end(); } - if (!$user->socid && !empty($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY)) { + if (!$user->socid && !empty(getDolGlobalString('TICKET_LIMIT_VIEW_ASSIGNED_ONLY'))) { $object->next_prev_filter = "te.fk_user_assign ='".((int) $user->id); } elseif ($user->socid > 0) { $object->next_prev_filter = "te.fk_soc = ".((int) $user->socid); diff --git a/htdocs/ticket/css/styles.css.php b/htdocs/ticket/css/styles.css.php index 2ebc3420a14..2337ad760c2 100644 --- a/htdocs/ticket/css/styles.css.php +++ b/htdocs/ticket/css/styles.css.php @@ -65,7 +65,7 @@ html { html { global->TICKET_SHOW_MODULE_LOGO)) { +if (!empty(getDolGlobalString('TICKET_SHOW_MODULE_LOGO'))) { print 'background: url("../public/img/bg_ticket.png") no-repeat 95% 90%;'; } ?> diff --git a/htdocs/ticket/document.php b/htdocs/ticket/document.php index 23e0b00882c..899336e58d5 100644 --- a/htdocs/ticket/document.php +++ b/htdocs/ticket/document.php @@ -87,7 +87,7 @@ if ($user->socid > 0 && ($object->fk_soc != $user->socid)) { accessforbidden(); } // or for unauthorized internals users -if (!$user->socid && !empty($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY) && $object->fk_user_assign != $user->id && empty($user->rights->ticket->manage)) { +if (!$user->socid && !empty(getDolGlobalString('TICKET_LIMIT_VIEW_ASSIGNED_ONLY')) && $object->fk_user_assign != $user->id && empty($user->rights->ticket->manage)) { accessforbidden(); } @@ -132,7 +132,7 @@ if ($object->id) { print dol_get_fiche_end(); } - if (!$user->socid && !empty($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY)) { + if (!$user->socid && !empty(getDolGlobalString('TICKET_LIMIT_VIEW_ASSIGNED_ONLY')) { $object->next_prev_filter = "te.fk_user_assign = ".((int) $user->id); } elseif ($user->socid > 0) { $object->next_prev_filter = "te.fk_soc = ".((int) $user->socid); diff --git a/htdocs/ticket/index.php b/htdocs/ticket/index.php index 35e11b9f1f5..20391fe1286 100644 --- a/htdocs/ticket/index.php +++ b/htdocs/ticket/index.php @@ -57,7 +57,7 @@ $userid = $user->id; $nowarray = dol_getdate(dol_now(), true); $nowyear = $nowarray['year']; $year = GETPOST('year', 'int') > 0 ? GETPOST('year', 'int') : $nowyear; -$startyear = $year - (empty($conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS) ? 2 : max(1, min(10, $conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS))); +$startyear = $year - (empty(getDolGlobalString('MAIN_STATS_GRAPHS_SHOW_N_YEARS')) ? 2 : max(1, min(10, getDolGlobalString('MAIN_STATS_GRAPHS_SHOW_N_YEARS')))); $endyear = $year; // Initialize objects @@ -171,7 +171,7 @@ if ($user->socid > 0) { $sql .= " AND t.fk_soc= ".((int) $user->socid); } else { // For internals users, - if (!empty($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY) && !$user->rights->ticket->manage) { + if (!empty(getDolGlobalString('TICKET_LIMIT_VIEW_ASSIGNED_ONLY')) && !$user->rights->ticket->manage) { $sql .= " AND t.fk_user_assign = ".((int) $user->id); } } @@ -346,7 +346,7 @@ if (!empty($user->rights->ticket->read)) { $sql .= " AND t.fk_soc= ".((int) $user->socid); } else { // Restricted to assigned user only - if (!empty($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY) && !$user->rights->ticket->manage) { + if (!empty(getDolGlobalString('TICKET_LIMIT_VIEW_ASSIGNED_ONLY')) && !$user->rights->ticket->manage) { $sql .= " AND t.fk_user_assign = ".((int) $user->id); } } diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index d0b25421b37..2fb395b2745 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -446,9 +446,9 @@ if ($search_dateclose_end) { $sql .= " AND t.date_close <= '".$db->idate($search_dateclose_end)."'"; } -if (!$user->socid && ($mode == "mine" || (!$user->admin && $conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY))) { +if (!$user->socid && ($mode == "mine" || (!$user->admin && getDolGlobalString('TICKET_LIMIT_VIEW_ASSIGNED_ONLY')))) { $sql .= " AND (t.fk_user_assign = ".((int) $user->id); - if (empty($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY)) { + if (empty(getDolGlobalString('TICKET_LIMIT_VIEW_ASSIGNED_ONLY'))) { $sql .= " OR t.fk_user_create = ".((int) $user->id); } $sql .= ")"; @@ -497,7 +497,7 @@ if (!$resql) { $num = $db->num_rows($resql); // Direct jump if only one record found -if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) { +if ($num == 1 && !empty(getDolGlobalString('MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE')) && $search_all && !$page) { $obj = $db->fetch_object($resql); $id = $obj->rowid; header("Location: ".DOL_URL_ROOT.'/ticket/card.php?id='.$id); @@ -780,7 +780,7 @@ if ($massaction == 'presendonclose') { "name" => "massaction", "value" => "close" ]); - $selectedchoice = (!empty($conf->global->TICKET_NOTIFY_AT_CLOSING)) ? "yes" : "no"; + $selectedchoice = (!empty(getDolGlobalString('TICKET_NOTIFY_AT_CLOSING'))) ? "yes" : "no"; print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassTicketClosingSendEmail"), $langs->trans("ConfirmMassTicketClosingSendEmailQuestion"), 'confirm_send_close', $hidden_form, $selectedchoice, 0, 200, 500, 1); } @@ -1135,19 +1135,19 @@ while ($i < $imaxinloop) { // display a warning on untreated tickets $is_open = ($object->status != Ticket::STATUS_CLOSED && $object->status != Ticket::STATUS_CANCELED ); - $should_show_warning = (!empty($conf->global->TICKET_DELAY_SINCE_LAST_RESPONSE) || !empty($conf->global->TICKET_DELAY_BEFORE_FIRST_RESPONSE)); + $should_show_warning = (!empty(getDolGlobalString('TICKET_DELAY_SINCE_LAST_RESPONSE')) || !empty(getDolGlobalString('TICKET_DELAY_BEFORE_FIRST_RESPONSE'))); if ($is_open && $should_show_warning) { $date_last_msg_sent = (int) $object->date_last_msg_sent; $hour_diff = ($now - $date_last_msg_sent) / 3600 ; - if (!empty($conf->global->TICKET_DELAY_BEFORE_FIRST_RESPONSE && $date_last_msg_sent == 0)) { + if (!empty(getDolGlobalString('TICKET_DELAY_BEFORE_FIRST_RESPONSE') && $date_last_msg_sent == 0)) { $creation_date = $object->datec; $hour_diff_creation = ($now - $creation_date) / 3600 ; - if ($hour_diff_creation > $conf->global->TICKET_DELAY_BEFORE_FIRST_RESPONSE) { - print " " . img_picto($langs->trans('Late') . ' : ' . $langs->trans('TicketsDelayForFirstResponseTooLong', $conf->global->TICKET_DELAY_BEFORE_FIRST_RESPONSE), 'warning', 'style="color: red;"', false, 0, 0, '', ''); + if ($hour_diff_creation > getDolGlobalString('TICKET_DELAY_BEFORE_FIRST_RESPONSE')) { + print " " . img_picto($langs->trans('Late') . ' : ' . $langs->trans('TicketsDelayForFirstResponseTooLong', getDolGlobalString('TICKET_DELAY_BEFORE_FIRST_RESPONSE')), 'warning', 'style="color: red;"', false, 0, 0, '', ''); } - } elseif (!empty($conf->global->TICKET_DELAY_SINCE_LAST_RESPONSE) && $hour_diff > $conf->global->TICKET_DELAY_SINCE_LAST_RESPONSE) { - print " " . img_picto($langs->trans('Late') . ' : ' . $langs->trans('TicketsDelayFromLastResponseTooLong', $conf->global->TICKET_DELAY_SINCE_LAST_RESPONSE), 'warning'); + } elseif (!empty(getDolGlobalString('TICKET_DELAY_SINCE_LAST_RESPONSE')) && $hour_diff > getDolGlobalString('TICKET_DELAY_SINCE_LAST_RESPONSE')) { + print " " . img_picto($langs->trans('Late') . ' : ' . $langs->trans('TicketsDelayFromLastResponseTooLong', getDolGlobalString('TICKET_DELAY_SINCE_LAST_RESPONSE')), 'warning'); } } } else { // Example: key=fk_soc, obj->key=123 val=array('type'=>'integer', ... diff --git a/htdocs/ticket/messaging.php b/htdocs/ticket/messaging.php index e0926da74f0..875ff695b33 100644 --- a/htdocs/ticket/messaging.php +++ b/htdocs/ticket/messaging.php @@ -96,7 +96,7 @@ if ($user->socid > 0 && ($object->fk_soc != $user->socid)) { accessforbidden(); } // or for unauthorized internals users -if (!$user->socid && (!empty($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY) && $object->fk_user_assign != $user->id) && !$user->rights->ticket->manage) { +if (!$user->socid && (!empty(getDolGlobalString('TICKET_LIMIT_VIEW_ASSIGNED_ONLY')) && $object->fk_user_assign != $user->id) && !$user->rights->ticket->manage) { accessforbidden(); } @@ -144,7 +144,7 @@ $userstat = new User($db); $formticket = new FormTicket($db); $title = $langs->trans("Ticket").' - '.$object->ref.' '.$object->name; -if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/ticketnameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) { +if (!empty(getDolGlobalString('MAIN_HTML_TITLE')) && preg_match('/ticketnameonly/', getDolGlobalString('MAIN_HTML_TITLE')) && $object->name) { $title = $object->ref.' '.$object->name.' - '.$langs->trans("Info"); } $help_url = 'FR:DocumentationModuleTicket'; @@ -161,7 +161,7 @@ if ($socid > 0) { print dol_get_fiche_end(); } -if (!$user->socid && !empty($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY)) { +if (!$user->socid && !empty(getDolGlobalString('TICKET_LIMIT_VIEW_ASSIGNED_ONLY'))) { $object->next_prev_filter = "te.fk_user_assign = ".((int) $user->id); } elseif ($user->socid > 0) { $object->next_prev_filter = "te.fk_soc = ".((int) $user->socid); diff --git a/htdocs/ticket/stats/index.php b/htdocs/ticket/stats/index.php index afc2a685048..e3438354cb1 100644 --- a/htdocs/ticket/stats/index.php +++ b/htdocs/ticket/stats/index.php @@ -47,7 +47,7 @@ if ($user->socid > 0) { $nowyear = dol_print_date(dol_now('gmt'), "%Y", 'gmt'); $year = GETPOST('year') > 0 ? GETPOST('year', 'int') : $nowyear; -$startyear = $year - (empty($conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS) ? 2 : max(1, min(10, $conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS))); +$startyear = $year - (empty(getDolGlobalString('MAIN_STATS_GRAPHS_SHOW_N_YEARS')) ? 2 : max(1, min(10, getDolGlobalString('MAIN_STATS_GRAPHS_SHOW_N_YEARS')))); $endyear = $year; // Load translation files required by the page diff --git a/htdocs/ticket/tpl/linkedobjectblock.tpl.php b/htdocs/ticket/tpl/linkedobjectblock.tpl.php index 4ba36894379..8fa875b8fb2 100644 --- a/htdocs/ticket/tpl/linkedobjectblock.tpl.php +++ b/htdocs/ticket/tpl/linkedobjectblock.tpl.php @@ -47,7 +47,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) { ?> trans("Ticket"); ?> - global->MAIN_ENABLE_IMPORT_LINKED_OBJECT_LINES) { + getNomUrl(0, '', 0, 1).'&action=selectlines" data-element="'.$objectlink->element.'" data-id="'.$objectlink->id.'" > From 9d2402549663c7b8d453c96f14e40c2afa2decd2 Mon Sep 17 00:00:00 2001 From: Eric Seigne Date: Tue, 27 Feb 2024 00:24:22 +0100 Subject: [PATCH 02/38] use TICKET_URL_PUBLIC_INTERFACE --- htdocs/core/lib/ticket.lib.php | 2 +- .../interface_50_modTicket_TicketEmail.class.php | 3 ++- htdocs/public/ticket/create_ticket.php | 4 ++-- htdocs/public/ticket/index.php | 4 +++- htdocs/public/ticket/list.php | 6 ++++-- htdocs/public/ticket/view.php | 10 +++++++--- htdocs/ticket/class/ticket.class.php | 8 +------- 7 files changed, 20 insertions(+), 17 deletions(-) diff --git a/htdocs/core/lib/ticket.lib.php b/htdocs/core/lib/ticket.lib.php index 0e6ddfba0b5..b3cacc90040 100644 --- a/htdocs/core/lib/ticket.lib.php +++ b/htdocs/core/lib/ticket.lib.php @@ -162,7 +162,7 @@ function showDirectPublicLink($object) $email = CMailFile::getValidAddress($object->origin_email, 2); $url = ''; if ($email) { - $url = dol_buildpath('/public/ticket/view.php', 3).'?track_id='.$object->track_id.'&email='.$email; + $url = getDolGlobalString('TICKET_URL_PUBLIC_INTERFACE', dol_buildpath('/public/ticket/', 3)).'?track_id='.$object->track_id.'&email='.$email; } $out = ''; diff --git a/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php b/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php index f18526a9d19..f3e3f150e6b 100644 --- a/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php +++ b/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php @@ -417,7 +417,8 @@ class InterfaceTicketEmail extends DolibarrTriggers $message = dol_nl2br($message); } $message_customer .= '

'.$langs->trans('Message').' :

'.$message.'


'; - $url_public_ticket = ($conf->global->TICKET_URL_PUBLIC_INTERFACE ? $conf->global->TICKET_URL_PUBLIC_INTERFACE.'/view.php' : dol_buildpath('/public/ticket/view.php', 2)).'?track_id='.$object->track_id; + + $url_public_ticket = getDolGlobalString('TICKET_URL_PUBLIC_INTERFACE', dol_buildpath('/public/ticket/', 2)).'?track_id='.$object->track_id; $message_customer .= '

'.$langs->trans($see_ticket).' : '.$url_public_ticket.'

'; $message_customer .= '

'.$langs->trans('TicketEmailPleaseDoNotReplyToThisEmail').'

'; diff --git a/htdocs/public/ticket/create_ticket.php b/htdocs/public/ticket/create_ticket.php index 464f43cb1a7..ee8d7f8a4d5 100644 --- a/htdocs/public/ticket/create_ticket.php +++ b/htdocs/public/ticket/create_ticket.php @@ -110,7 +110,7 @@ if ($reshook < 0) { // Add file in email form if (empty($reshook)) { if ($cancel) { - $backtopage = DOL_URL_ROOT.'/public/ticket/index.php'; + $backtopage = getDolGlobalString('TICKET_URL_PUBLIC_INTERFACE', DOL_URL_ROOT.'/public/ticket/'); header("Location: ".$backtopage); exit; @@ -391,7 +391,7 @@ if (empty($reshook)) { $message = ($conf->global->TICKET_MESSAGE_MAIL_NEW ? $conf->global->TICKET_MESSAGE_MAIL_NEW : $langs->transnoentities('TicketNewEmailBody')).'

'; $message .= $langs->transnoentities('TicketNewEmailBodyInfosTicket').'
'; - $url_public_ticket = ($conf->global->TICKET_URL_PUBLIC_INTERFACE ? $conf->global->TICKET_URL_PUBLIC_INTERFACE.'/view.php' : dol_buildpath('/public/ticket/view.php', 2)).'?track_id='.$object->track_id; + $url_public_ticket = getDolGlobalString('TICKET_URL_PUBLIC_INTERFACE', dol_buildpath('/public/ticket/', 2)).'?track_id='.$object->track_id; $infos_new_ticket = $langs->transnoentities('TicketNewEmailBodyInfosTrackId', ''.$object->track_id.'').'
'; $infos_new_ticket .= $langs->transnoentities('TicketNewEmailBodyInfosTrackUrl').'

'; diff --git a/htdocs/public/ticket/index.php b/htdocs/public/ticket/index.php index 70f0b027559..57addce8158 100644 --- a/htdocs/public/ticket/index.php +++ b/htdocs/public/ticket/index.php @@ -85,8 +85,10 @@ print '
'; print '

'.(getDolGlobalString("TICKET_PUBLIC_TEXT_HOME", ''.$langs->trans("TicketPublicDesc")).'

').'

'; print '
'; +$baseurl = getDolGlobalString('TICKET_URL_PUBLIC_INTERFACE', DOL_URL_ROOT.'/public/ticket/'); + print '
'; -print '

'.dol_escape_htmltag($langs->trans("CreateTicket")).'
'; +print '

'.dol_escape_htmltag($langs->trans("CreateTicket")).'
'; print '

'.dol_escape_htmltag($langs->trans("ViewMyTicketList")).'
'; print '
'.img_picto('', 'ticket', 'class="fa-15"').'
'.dol_escape_htmltag($langs->trans("ShowTicketWithTrackId")).'
'; print '
'; diff --git a/htdocs/public/ticket/list.php b/htdocs/public/ticket/list.php index 005c671fd43..9bd5c306a12 100644 --- a/htdocs/public/ticket/list.php +++ b/htdocs/public/ticket/list.php @@ -92,7 +92,7 @@ if (!isModEnabled('ticket')) { */ if ($cancel) { - $backtopage = DOL_URL_ROOT.'/public/ticket/index.php'; + $backtopage = getDolGlobalString('TICKET_URL_PUBLIC_INTERFACE', DOL_URL_ROOT.'/public/ticket/'); header("Location: ".$backtopage); exit; @@ -710,7 +710,9 @@ if ($action == "view_ticketlist") { print ''; - print '