NEW adds a hook in the ticket email/message form generated by `FormTicket… (#37580)
* add hook * fix pre-commit --------- Co-authored-by: jpb <jean-pascal.boudet@atm-consulting>
This commit is contained in:
parent
129f6ee8b3
commit
7a4f28fc72
1 changed files with 44 additions and 38 deletions
|
|
@ -1706,54 +1706,60 @@ class FormTicket
|
|||
print '</span></td></tr>';
|
||||
|
||||
// Recipients / adressed-to
|
||||
print '<tr class="email_line"><td>'.$langs->trans('MailRecipients');
|
||||
print ' '.$form->textwithpicto('', $langs->trans("TicketMessageRecipientsHelp"), 1, 'help');
|
||||
print '</td><td>';
|
||||
if ($res) {
|
||||
// Retrieve email of all contacts (internal and external)
|
||||
$contacts = $ticketstat->getInfosTicketInternalContact(1);
|
||||
$contacts = array_merge($contacts, $ticketstat->getInfosTicketExternalContact(1));
|
||||
$parameters = array();
|
||||
$action = '';
|
||||
$reshook = $hookmanager->executeHooks('printFieldTicketEmailTo', $parameters, $this, $action);
|
||||
if (empty($reshook)) {
|
||||
print '<tr class="email_line"><td>'.$langs->trans('MailRecipients');
|
||||
print ' '.$form->textwithpicto('', $langs->trans("TicketMessageRecipientsHelp"), 1, 'help');
|
||||
print '</td><td>';
|
||||
if ($res) {
|
||||
// Retrieve email of all contacts (internal and external)
|
||||
$contacts = $ticketstat->getInfosTicketInternalContact(1);
|
||||
$contacts = array_merge($contacts, $ticketstat->getInfosTicketExternalContact(1));
|
||||
|
||||
$sendto = array();
|
||||
$sendto = array();
|
||||
|
||||
// Build array to display recipient list
|
||||
if (is_array($contacts) && count($contacts) > 0) {
|
||||
foreach ($contacts as $key => $info_sendto) {
|
||||
if ($info_sendto['email'] != '') {
|
||||
$sendto[] = dol_escape_htmltag(trim($info_sendto['firstname']." ".$info_sendto['lastname'])." <".$info_sendto['email'].">").' <small class="opacitymedium">('.dol_escape_htmltag($info_sendto['libelle']).")</small>";
|
||||
// Build array to display recipient list
|
||||
if (is_array($contacts) && count($contacts) > 0) {
|
||||
foreach ($contacts as $key => $info_sendto) {
|
||||
if ($info_sendto['email'] != '') {
|
||||
$sendto[] = dol_escape_htmltag(trim($info_sendto['firstname']." ".$info_sendto['lastname'])." <".$info_sendto['email'].">").' <small class="opacitymedium">('.dol_escape_htmltag($info_sendto['libelle']).")</small>";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($ticketstat->origin_replyto) && !in_array($ticketstat->origin_replyto, $sendto)) {
|
||||
$sendto[] = dol_escape_htmltag((string) $ticketstat->origin_replyto).' <small class="opacitymedium">('.$langs->trans("TicketEmailOriginIssuer").")</small>";
|
||||
} elseif ($ticketstat->origin_email && !in_array($ticketstat->origin_email, $sendto)) {
|
||||
$sendto[] = dol_escape_htmltag((string) $ticketstat->origin_email).' <small class="opacitymedium">('.$langs->trans("TicketEmailOriginIssuer").")</small>";
|
||||
}
|
||||
if (!empty($ticketstat->origin_replyto) && !in_array($ticketstat->origin_replyto, $sendto)) {
|
||||
$sendto[] = dol_escape_htmltag((string) $ticketstat->origin_replyto).' <small class="opacitymedium">('.$langs->trans("TicketEmailOriginIssuer").")</small>";
|
||||
} elseif ($ticketstat->origin_email && !in_array($ticketstat->origin_email, $sendto)) {
|
||||
$sendto[] = dol_escape_htmltag((string) $ticketstat->origin_email).' <small class="opacitymedium">('.$langs->trans("TicketEmailOriginIssuer").")</small>";
|
||||
}
|
||||
|
||||
if ($ticketstat->fk_soc > 0) {
|
||||
$ticketstat->socid = $ticketstat->fk_soc;
|
||||
$ticketstat->fetch_thirdparty();
|
||||
if ($ticketstat->fk_soc > 0) {
|
||||
$ticketstat->socid = $ticketstat->fk_soc;
|
||||
$ticketstat->fetch_thirdparty();
|
||||
|
||||
if (!empty($ticketstat->thirdparty->email) && !in_array($ticketstat->thirdparty->email, $sendto)) {
|
||||
$sendto[] = $ticketstat->thirdparty->email.' <small class="opacitymedium">('.$langs->trans('Customer').')</small>';
|
||||
if (!empty($ticketstat->thirdparty->email) && !in_array($ticketstat->thirdparty->email, $sendto)) {
|
||||
$sendto[] = $ticketstat->thirdparty->email.' <small class="opacitymedium">('.$langs->trans('Customer').')</small>';
|
||||
}
|
||||
}
|
||||
|
||||
if (getDolGlobalInt('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS')) {
|
||||
$sendto[] = getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO').' <small class="opacitymedium">(generic email)</small>';
|
||||
}
|
||||
|
||||
// Print recipient list
|
||||
if (is_array($sendto) && count($sendto) > 0) {
|
||||
print img_picto('', 'email', 'class="pictofixedwidth"');
|
||||
print implode(', ', $sendto);
|
||||
} else {
|
||||
print '<div class="warning">'.$langs->trans('WarningNoEMailsAdded').' '.$langs->trans('TicketGoIntoContactTab').'</div>';
|
||||
}
|
||||
}
|
||||
|
||||
if (getDolGlobalInt('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS')) {
|
||||
$sendto[] = getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO').' <small class="opacitymedium">(generic email)</small>';
|
||||
}
|
||||
|
||||
// Print recipient list
|
||||
if (is_array($sendto) && count($sendto) > 0) {
|
||||
print img_picto('', 'email', 'class="pictofixedwidth"');
|
||||
print implode(', ', $sendto);
|
||||
} else {
|
||||
print '<div class="warning">'.$langs->trans('WarningNoEMailsAdded').' '.$langs->trans('TicketGoIntoContactTab').'</div>';
|
||||
}
|
||||
print '</td></tr>';
|
||||
} else {
|
||||
print $hookmanager->resPrint;
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Send to CC
|
||||
$sendtocc = getDolGlobalString('TICKET_SEND_INTERNAL_CC');
|
||||
if ($sendtocc) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue