first commit

This commit is contained in:
Maximilien Rozniecki
2023-04-27 11:02:22 +02:00
parent 5b90302bf8
commit 40d476d2c9
4 changed files with 31 additions and 3 deletions

View File

@@ -1535,7 +1535,7 @@ class Contact extends CommonObject
$linkend = '</a>';
}
$result .= $linkstart;
$result .= (($option == 'nolink') ? '' : $linkstart);
if ($withpicto) {
if ($withpicto < 0) {
$result .= '<!-- picto photo user --><span class="nopadding userimg'.($morecss ? ' '.$morecss : '').'">'.Form::showphoto('contact', $this, 0, 0, 0, 'userphoto'.($withpicto == -3 ? 'small' : ''), 'mini', 0, 1).'</span>';
@@ -1546,7 +1546,7 @@ class Contact extends CommonObject
if ($withpicto != 2 && $withpicto != -2) {
$result .= '<span class="valigmiddle">'.($maxlen ? dol_trunc($this->getFullName($langs), $maxlen) : $this->getFullName($langs)).'</span>';
}
$result .= $linkend;
$result .= (($option == 'nolink') ? '' : $linkend);
global $action;
$hookmanager->initHooks(array('contactdao'));

View File

@@ -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 .= '<div class="filters-container" >';
$out .= '<form name="listactionsfilter" class="listactionsfilter" action="'.$_SERVER["PHP_SELF"].'" method="POST">';
@@ -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 .= '</div>';
// Title

View File

@@ -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');
}

View File

@@ -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;