diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 23fcf2d8c0a..5b76d43ab1d 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -1535,7 +1535,7 @@ class Contact extends CommonObject $linkend = ''; } - $result .= $linkstart; + $result .= (($option == 'nolink') ? '' : $linkstart); if ($withpicto) { if ($withpicto < 0) { $result .= ''.Form::showphoto('contact', $this, 0, 0, 0, 'userphoto'.($withpicto == -3 ? 'small' : ''), 'mini', 0, 1).''; @@ -1546,7 +1546,7 @@ class Contact extends CommonObject if ($withpicto != 2 && $withpicto != -2) { $result .= ''.($maxlen ? dol_trunc($this->getFullName($langs), $maxlen) : $this->getFullName($langs)).''; } - $result .= $linkend; + $result .= (($option == 'nolink') ? '' : $linkend); global $action; $hookmanager->initHooks(array('contactdao')); diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index bedb62c1162..62f552b7b80 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -12077,6 +12077,7 @@ function show_actions_messaging($conf, $langs, $db, $filterobj, $objcon = '', $n $sql .= " a.percent as percent, 'action' as type,"; $sql .= " a.fk_element, a.elementtype,"; $sql .= " a.fk_contact,"; + $sql .= " a.email_from as msg_from,"; $sql .= " c.code as acode, c.libelle as alabel, c.picto as apicto,"; $sql .= " u.rowid as user_id, u.login as user_login, u.photo as user_photo, u.firstname as user_firstname, u.lastname as user_lastname"; if (is_object($filterobj) && get_class($filterobj) == 'Societe') { @@ -12276,6 +12277,7 @@ function show_actions_messaging($conf, $langs, $db, $filterobj, $objcon = '', $n 'userfirstname'=>$obj->user_firstname, 'userlastname'=>$obj->user_lastname, 'userphoto'=>$obj->user_photo, + 'msg_from'=>$obj->msg_from, 'contact_id'=>$obj->fk_contact, 'socpeopleassigned' => $contactaction->socpeopleassigned, @@ -12339,6 +12341,7 @@ function show_actions_messaging($conf, $langs, $db, $filterobj, $objcon = '', $n $userstatic = new User($db); $contactstatic = new Contact($db); $userGetNomUrlCache = array(); + $contactGetNomUrlCache = array(); $out .= '
'; $out .= '
'; @@ -12501,6 +12504,17 @@ function show_actions_messaging($conf, $langs, $db, $filterobj, $objcon = '', $n } $out .= $userGetNomUrlCache[$histo[$key]['userid']]; } + else if (!empty($histo[$key]['msg_from']) && $actionstatic->code == 'TICKET_MSG') { + if (!isset($contactGetNomUrlCache[$histo[$key]['msg_from']])) { + if ($contactstatic->fetch(0,null,'',$histo[$key]['msg_from']) > 0) { + $contactGetNomUrlCache[$histo[$key]['msg_from']] = $contactstatic->getNomUrl(-1, '', 16); + } + else { + $contactGetNomUrlCache[$histo[$key]['msg_from']] = $histo[$key]['msg_from']; + } + } + $out .= $contactGetNomUrlCache[$histo[$key]['msg_from']]; + } $out .= '
'; // Title diff --git a/htdocs/ticket/class/actions_ticket.class.php b/htdocs/ticket/class/actions_ticket.class.php index 29a013f1eb9..fb426d74e09 100644 --- a/htdocs/ticket/class/actions_ticket.class.php +++ b/htdocs/ticket/class/actions_ticket.class.php @@ -306,6 +306,14 @@ class ActionsTicket if ($res) { print $userstat->getNomUrl(0); } + } else if (isset($arraymsgs['fk_contact_author'])) { + $contactstat = new Contact($this->db); + $res = $contactstat->fetch(0, null, '', $arraymsgs['fk_contact_author']); + if ($res) { + print $contactstat->getNomUrl(0, 'nolink'); + } else { + print $arraymsgs['fk_contact_author']; + } } else { print $langs->trans('Customer'); } diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 92baa55ea89..9ca4e3a3309 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -1700,6 +1700,9 @@ class Ticket extends CommonObject if ($send_email) { $actioncomm->code .= '_SENTBYMAIL'; } + if ((empty($user->id) || $user->id == 0) && isset($_SESSION['email_customer'])) { + $actioncomm->email_from = $_SESSION['email_customer']; + } $actioncomm->socid = $this->socid; $actioncomm->label = $this->subject; $actioncomm->note_private = $this->message; @@ -1753,7 +1756,7 @@ class Ticket extends CommonObject // Cache already loaded - $sql = "SELECT id as rowid, fk_user_author, datec, label, note as message, code"; + $sql = "SELECT id as rowid, fk_user_author, email_from, datec, label, note as message, code"; $sql .= " FROM ".MAIN_DB_PREFIX."actioncomm"; $sql .= " WHERE fk_element = ".(int) $this->id; $sql .= " AND elementtype = 'ticket'"; @@ -1768,6 +1771,9 @@ class Ticket extends CommonObject $obj = $this->db->fetch_object($resql); $this->cache_msgs_ticket[$i]['id'] = $obj->rowid; $this->cache_msgs_ticket[$i]['fk_user_author'] = $obj->fk_user_author; + if ($obj->code == 'TICKET_MSG' && empty($obj->fk_user_author)) { + $this->cache_msgs_ticket[$i]['fk_contact_author'] = $obj->email_from; + } $this->cache_msgs_ticket[$i]['datec'] = $this->db->jdate($obj->datec); $this->cache_msgs_ticket[$i]['subject'] = $obj->label; $this->cache_msgs_ticket[$i]['message'] = $obj->message;