diff --git a/htdocs/ticket/agenda.php b/htdocs/ticket/agenda.php
index e0d06759d77..fd82269a08f 100644
--- a/htdocs/ticket/agenda.php
+++ b/htdocs/ticket/agenda.php
@@ -81,14 +81,14 @@ if (!$action) {
// Security check
$id = GETPOST("id", 'int');
if ($user->socid > 0) $socid = $user->socid;
-$result = restrictedArea($user, 'ticket', $id, '');
+$result = restrictedArea($user, 'ticket', $object->id, '');
// restrict access for externals users
if ($user->socid > 0 && ($object->fk_soc != $user->socid)) {
accessforbidden();
}
// or for unauthorized internals users
-if (!$user->socid && ($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY && $object->fk_user_assign != $user->id) && !$user->rights->ticket->manage) {
+if (!$user->socid && (!empty($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY) && $object->fk_user_assign != $user->id) && !$user->rights->ticket->manage) {
accessforbidden();
}
@@ -144,7 +144,7 @@ if ($socid > 0) {
print dol_get_fiche_end();
}
-if (!$user->socid && $conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY) {
+if (!$user->socid && !empty($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY)) {
$object->next_prev_filter = "te.fk_user_assign = '".$user->id."'";
} elseif ($user->socid > 0) {
$object->next_prev_filter = "te.fk_soc = '".$user->socid."'";
@@ -162,11 +162,15 @@ if ($object->fk_user_create > 0) {
$langs->load("users");
$fuser = new User($db);
$fuser->fetch($object->fk_user_create);
- $morehtmlref .= $fuser->getNomUrl(0);
-}
-if (!empty($object->origin_email)) {
+ $morehtmlref .= $fuser->getNomUrl(-1);
+} elseif (!empty($object->email_msgid)) {
$morehtmlref .= '
'.$langs->trans("CreatedBy").' : ';
- $morehtmlref .= $object->origin_email.' ('.$langs->trans("TicketEmailOriginIssuer").')';
+ $morehtmlref .= img_picto('', 'email', 'class="paddingrightonly"');
+ $morehtmlref .= dol_escape_htmltag($object->origin_email).' ('.$form->textwithpicto($langs->trans("CreatedByEmailCollector"), $langs->trans("EmailMsgID").': '.$object->email_msgid).')';
+} elseif (!empty($object->origin_email)) {
+ $morehtmlref .= '
'.$langs->trans("CreatedBy").' : ';
+ $morehtmlref .= img_picto('', 'email', 'class="paddingrightonly"');
+ $morehtmlref .= dol_escape_htmltag($object->origin_email).' ('.$langs->trans("CreatedByPublicPortal").')';
}
// Thirdparty
diff --git a/htdocs/ticket/messaging.php b/htdocs/ticket/messaging.php
index 0abbf568c26..91904a97dab 100644
--- a/htdocs/ticket/messaging.php
+++ b/htdocs/ticket/messaging.php
@@ -50,7 +50,7 @@ if (!$sortfield) {
$sortfield = "a.datep,a.id";
}
if (!$sortorder) {
- $sortorder = "desc";
+ $sortorder = "DESC";
}
$offset = $limit * $page;
$pageprev = $page - 1;