Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion htdocs/ticket/class/ticket.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -2935,7 +2935,29 @@ public function newMessage($user, &$action, $private = 1, $public_area = 0)

$subject = GETPOST('subject') ? GETPOST('subject') : '['.$appli.' - '.$langs->trans("Ticket").' #'.$object->track_id.'] '.$langs->trans('TicketNewMessage');
/**SPECIFIQUE ATM **/
$message_intro = $this->applyMailSubstitutions(GETPOST('mail_intro') ? GETPOST('mail_intro', 'restricthtml') : getDolGlobalString('TICKET_MESSAGE_MAIL_INTRO'), $langs, $object);
$cliatm_intro = getDolGlobalString('CLIATM_TICKET_MAIL_INTRO');
if ($cliatm_intro) {
// Check if at least one SUPPORTCLI contact has an active portal account
$sqlPortal = 'SELECT COUNT(u.rowid) as nb';
$sqlPortal .= ' FROM '.$this->db->prefix().'element_contact ec';
$sqlPortal .= ' INNER JOIN '.$this->db->prefix().'c_type_contact tc ON tc.rowid = ec.fk_c_type_contact AND tc.element = \'ticket\' AND tc.source = \'external\' AND tc.code = \'SUPPORTCLI\'';
$sqlPortal .= ' INNER JOIN '.$this->db->prefix().'user u ON u.fk_socpeople = ec.fk_socpeople AND u.statut = 1 AND u.fk_soc > 0 AND u.entity IN ('.getEntity('user').')';
$sqlPortal .= ' WHERE ec.element_id = '.(int) $object->id;
$resPortal = $this->db->query($sqlPortal);
$hasPortalContact = false;
if ($resPortal) {
$objPortal = $this->db->fetch_object($resPortal);
$hasPortalContact = ($objPortal && $objPortal->nb > 0);
$this->db->free($resPortal);
}
if (!$hasPortalContact) {
$message_intro = $this->applyMailSubstitutions($cliatm_intro, $langs, $object);
} else {
$message_intro = $this->applyMailSubstitutions(GETPOST('mail_intro') ? GETPOST('mail_intro', 'restricthtml') : getDolGlobalString('TICKET_MESSAGE_MAIL_INTRO'), $langs, $object);
}
} else {
$message_intro = $this->applyMailSubstitutions(GETPOST('mail_intro') ? GETPOST('mail_intro', 'restricthtml') : getDolGlobalString('TICKET_MESSAGE_MAIL_INTRO'), $langs, $object);
}
$message_signature = $this->applyMailSubstitutions(GETPOST('mail_signature') ? GETPOST('mail_signature', 'restricthtml') : getDolGlobalString('TICKET_MESSAGE_MAIL_SIGNATURE'), $langs, $object);
/**SPECIFIQUE ATM **/
if (!dol_textishtml($message_intro)) {
Expand Down
Loading