diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index f4b7f1b2bfb..a133e3cc314 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -1317,7 +1317,7 @@ class ActionComm extends CommonObject dol_syslog(get_class()."::getActions", LOG_DEBUG); require_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php'; - $hookmanager = new HookManager($db); + $hookmanager = new HookManager($this->db); // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('agendadao')); diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index 0e5e6ff9e7c..214413b8f1b 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -1270,7 +1270,7 @@ class FormTicket // Define output language $outputlangs = $langs; $newlang = ''; - if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang)) { + if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang) && isset($this->param['langsmodels'])) { $newlang = $this->param['langsmodels']; } if (!empty($newlang)) { @@ -1281,7 +1281,7 @@ class FormTicket // Get message template for $this->param["models"] into c_email_templates $arraydefaultmessage = -1; - if ($this->param['models'] != 'none') { + if (isset($this->param['models']) && $this->param['models'] != 'none') { $model_id = 0; if (array_key_exists('models_id', $this->param)) { $model_id = (int) $this->param["models_id"]; @@ -1323,7 +1323,7 @@ class FormTicket // Define output language $outputlangs = $langs; $newlang = ''; - if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang)) { + if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang) && isset($this->param['langsmodels'])) { $newlang = $this->param['langsmodels']; } if (!empty($newlang)) { @@ -1380,7 +1380,12 @@ class FormTicket print ''; print ''; print ''; - print ''; + if (!empty($this->trackid)) { + print ''; + } else { + print ''; + $keytoavoidconflict = empty($this->track_id) ? '' : '-'.$this->track_id; // track_id instead of trackid + } foreach ($this->param as $key => $value) { print ''; } @@ -1392,7 +1397,7 @@ class FormTicket $arraydefaultmessage = $formmail->getEMailTemplate($this->db, $this->param["models"], $user, $outputlangs, $model_id); } - $result = $formmail->fetchAllEMailTemplate($this->param["models"], $user, $outputlangs); + $result = $formmail->fetchAllEMailTemplate(!empty($this->param["models"]) ? $this->param["models"] : "", $user, $outputlangs); if ($result < 0) { setEventMessages($this->error, $this->errors, 'errors'); } @@ -1404,7 +1409,7 @@ class FormTicket print ''; // External users can't send message email - if ($user->rights->ticket->write && !$user->socid) { + if ($user->hasRight("ticket", "write") && !$user->socid) { $ticketstat = new Ticket($this->db); $res = $ticketstat->fetch('', '', $this->track_id); @@ -1556,7 +1561,7 @@ class FormTicket // Deal with format differences between message and signature (text / HTML) if (dol_textishtml($defaultmessage) && !dol_textishtml($this->substit['__USER_SIGNATURE__'])) { $this->substit['__USER_SIGNATURE__'] = dol_nl2br($this->substit['__USER_SIGNATURE__']); - } elseif (!dol_textishtml($defaultmessage) && dol_textishtml($this->substit['__USER_SIGNATURE__'])) { + } elseif (!dol_textishtml($defaultmessage) && isset($this->substit['__USER_SIGNATURE__']) && dol_textishtml($this->substit['__USER_SIGNATURE__'])) { $defaultmessage = dol_nl2br($defaultmessage); } if (GETPOSTISSET("message") && !GETPOST('modelselected')) { @@ -1569,7 +1574,7 @@ class FormTicket } print ''; diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 3a6adeb6c20..6c195c16704 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -1666,7 +1666,7 @@ class Ticket extends CommonObject */ public function loadCacheMsgsTicket() { - if (is_array($this->cache_msgs_ticket) && count($this->cache_msgs_ticket)) { + if (!empty($this->cache_msgs_ticket) && is_array($this->cache_msgs_ticket) && count($this->cache_msgs_ticket)) { return 0; }
'; print $langs->trans("InitialMessage"); print ''; - if ($user->rights->ticket->manage) { + if ($user->hasRight("ticket", "manage")) { print ''.img_edit($langs->trans('Modify')).''; } print '