NEW remove new lines in mail on add ticket message
This commit is contained in:
parent
30838f01d4
commit
c3b095c820
@ -903,7 +903,7 @@ class FormTicket
|
|||||||
print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
|
print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
|
||||||
}
|
}
|
||||||
print ' ';
|
print ' ';
|
||||||
print '<input class="button" type="submit" value="'.$langs->trans('Use').'" name="modelselected" id="modelselected">';
|
print '<input class="button" type="submit" value="'.$langs->trans('Apply').'" name="modelselected" id="modelselected">';
|
||||||
print '</div></td>';
|
print '</div></td>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2535,28 +2535,28 @@ class Ticket extends CommonObject
|
|||||||
|
|
||||||
// Message send
|
// Message send
|
||||||
$message = $langs->trans('TicketMessageMailIntroText');
|
$message = $langs->trans('TicketMessageMailIntroText');
|
||||||
$message .= "\n\n";
|
$message .= '<br><br>';
|
||||||
$message .= GETPOST('message', 'restricthtml');
|
$message .= GETPOST('message', 'none');
|
||||||
|
|
||||||
// Customer company infos
|
// Customer company infos
|
||||||
$message .= "\n\n";
|
$message .= '<br><br>';
|
||||||
$message .= "==============================================";
|
$message .= "==============================================";
|
||||||
$message .= !empty($object->thirdparty->name) ? "\n" . $langs->trans('Thirdparty') . " : " . $object->thirdparty->name : '';
|
$message .= !empty($object->thirdparty->name) ? '<br>' . $langs->trans('Thirdparty') . " : " . $object->thirdparty->name : '';
|
||||||
$message .= !empty($object->thirdparty->town) ? "\n" . $langs->trans('Town') . " : " . $object->thirdparty->town : '';
|
$message .= !empty($object->thirdparty->town) ? '<br>' . $langs->trans('Town') . " : " . $object->thirdparty->town : '';
|
||||||
$message .= !empty($object->thirdparty->phone) ? "\n" . $langs->trans('Phone') . " : " . $object->thirdparty->phone : '';
|
$message .= !empty($object->thirdparty->phone) ? '<br>' . $langs->trans('Phone') . " : " . $object->thirdparty->phone : '';
|
||||||
|
|
||||||
// Email send to
|
// Email send to
|
||||||
$message .= "\n\n";
|
$message .= '<br><br>';
|
||||||
if (!empty($assigned_user_dont_have_email)) {
|
if (!empty($assigned_user_dont_have_email)) {
|
||||||
$message .= "\n" . $langs->trans('NoEMail') . ' : ' . $assigned_user_dont_have_email;
|
$message .= '<br>' . $langs->trans('NoEMail') . ' : ' . $assigned_user_dont_have_email;
|
||||||
}
|
}
|
||||||
foreach ($sendto as $val) {
|
foreach ($sendto as $val) {
|
||||||
$message .= "\n" . $langs->trans('TicketNotificationRecipient') . ' : ' . $val;
|
$message .= '<br>' . $langs->trans('TicketNotificationRecipient') . ' : ' . $val;
|
||||||
}
|
}
|
||||||
|
|
||||||
// URL ticket
|
// URL ticket
|
||||||
$url_internal_ticket = dol_buildpath('/ticket/card.php', 2) . '?track_id=' . $object->track_id;
|
$url_internal_ticket = dol_buildpath('/ticket/card.php', 2) . '?track_id=' . $object->track_id;
|
||||||
$message .= "\n\n";
|
$message .= '<br><br>';
|
||||||
$message .= $langs->trans('TicketNotificationEmailBodyInfosTrackUrlinternal') . ' : <a href="' . $url_internal_ticket . '">' . $object->track_id . '</a>';
|
$message .= $langs->trans('TicketNotificationEmailBodyInfosTrackUrlinternal') . ' : <a href="' . $url_internal_ticket . '">' . $object->track_id . '</a>';
|
||||||
|
|
||||||
$this->sendTicketMessageByEmail($subject, $message, '', $sendto, $listofpaths, $listofmimes, $listofnames);
|
$this->sendTicketMessageByEmail($subject, $message, '', $sendto, $listofpaths, $listofmimes, $listofnames);
|
||||||
@ -2584,15 +2584,15 @@ class Ticket extends CommonObject
|
|||||||
$message_signature = GETPOST('mail_signature') ? GETPOST('mail_signature') : $conf->global->TICKET_MESSAGE_MAIL_SIGNATURE;
|
$message_signature = GETPOST('mail_signature') ? GETPOST('mail_signature') : $conf->global->TICKET_MESSAGE_MAIL_SIGNATURE;
|
||||||
|
|
||||||
$message = $langs->trans('TicketMessageMailIntroText');
|
$message = $langs->trans('TicketMessageMailIntroText');
|
||||||
$message .= "\n\n";
|
$message .= '<br><br>';
|
||||||
$message .= GETPOST('message', 'restricthtml');
|
$message .= GETPOST('message', 'restricthtml');
|
||||||
|
|
||||||
// Coordonnées client
|
// Coordonnées client
|
||||||
$message .= "\n\n";
|
$message .= '<br><br>';
|
||||||
$message .= "==============================================\n";
|
$message .= "==============================================<br>";
|
||||||
$message .= !empty($object->thirdparty->name) ? $langs->trans('Thirdparty') . " : " . $object->thirdparty->name : '';
|
$message .= !empty($object->thirdparty->name) ? $langs->trans('Thirdparty') . " : " . $object->thirdparty->name : '';
|
||||||
$message .= !empty($object->thirdparty->town) ? "\n" . $langs->trans('Town') . " : " . $object->thirdparty->town : '';
|
$message .= !empty($object->thirdparty->town) ? '<br>' . $langs->trans('Town') . " : " . $object->thirdparty->town : '';
|
||||||
$message .= !empty($object->thirdparty->phone) ? "\n" . $langs->trans('Phone') . " : " . $object->thirdparty->phone : '';
|
$message .= !empty($object->thirdparty->phone) ? '<br>' . $langs->trans('Phone') . " : " . $object->thirdparty->phone : '';
|
||||||
|
|
||||||
// Build array to display recipient list
|
// Build array to display recipient list
|
||||||
foreach ($internal_contacts as $key => $info_sendto) {
|
foreach ($internal_contacts as $key => $info_sendto) {
|
||||||
@ -2606,15 +2606,15 @@ class Ticket extends CommonObject
|
|||||||
|
|
||||||
//Contact type
|
//Contact type
|
||||||
$recipient = dolGetFirstLastname($info_sendto['firstname'], $info_sendto['lastname'], '-1') . ' (' . strtolower($info_sendto['libelle']) . ')';
|
$recipient = dolGetFirstLastname($info_sendto['firstname'], $info_sendto['lastname'], '-1') . ' (' . strtolower($info_sendto['libelle']) . ')';
|
||||||
$message .= (!empty($recipient) ? $langs->trans('TicketNotificationRecipient') . ' : ' . $recipient . "\n" : '');
|
$message .= (!empty($recipient) ? $langs->trans('TicketNotificationRecipient') . ' : ' . $recipient . '<br>' : '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$message .= "\n";
|
$message .= '<br>';
|
||||||
// URL ticket
|
// URL ticket
|
||||||
$url_internal_ticket = dol_buildpath('/ticket/card.php', 2) . '?track_id=' . $object->track_id;
|
$url_internal_ticket = dol_buildpath('/ticket/card.php', 2) . '?track_id=' . $object->track_id;
|
||||||
|
|
||||||
// altairis: make html link on url
|
// altairis: make html link on url
|
||||||
$message .= "\n" . $langs->trans('TicketNotificationEmailBodyInfosTrackUrlinternal') . ' : <a href="' . $url_internal_ticket . '">' . $object->track_id . '</a>' . "\n";
|
$message .= '<br>' . $langs->trans('TicketNotificationEmailBodyInfosTrackUrlinternal') . ' : <a href="' . $url_internal_ticket . '">' . $object->track_id . '</a><br>';
|
||||||
|
|
||||||
// Add global email address recipient
|
// Add global email address recipient
|
||||||
if ($conf->global->TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS && !in_array($conf->global->TICKET_NOTIFICATION_EMAIL_TO, $sendto)) {
|
if ($conf->global->TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS && !in_array($conf->global->TICKET_NOTIFICATION_EMAIL_TO, $sendto)) {
|
||||||
@ -2652,12 +2652,12 @@ class Ticket extends CommonObject
|
|||||||
$label_title = empty($conf->global->MAIN_APPLICATION_TITLE) ? $mysoc->name : $conf->global->MAIN_APPLICATION_TITLE;
|
$label_title = empty($conf->global->MAIN_APPLICATION_TITLE) ? $mysoc->name : $conf->global->MAIN_APPLICATION_TITLE;
|
||||||
$subject = GETPOST('subject') ? GETPOST('subject') : '[' . $label_title . '- ticket #' . $object->track_id . '] ' . $langs->trans('TicketNewMessage');
|
$subject = GETPOST('subject') ? GETPOST('subject') : '[' . $label_title . '- ticket #' . $object->track_id . '] ' . $langs->trans('TicketNewMessage');
|
||||||
|
|
||||||
$message_intro = GETPOST('mail_intro') ? GETPOST('mail_intro') : $conf->global->TICKET_MESSAGE_MAIL_INTRO;
|
$message_intro = GETPOST('mail_intro') ? GETPOST('mail_intro', 'restricthtml') : $conf->global->TICKET_MESSAGE_MAIL_INTRO;
|
||||||
$message_signature = GETPOST('mail_signature') ? GETPOST('mail_signature') : $conf->global->TICKET_MESSAGE_MAIL_SIGNATURE;
|
$message_signature = GETPOST('mail_signature') ? GETPOST('mail_signature', 'restricthtml') : $conf->global->TICKET_MESSAGE_MAIL_SIGNATURE;
|
||||||
|
|
||||||
// We put intro after
|
// We put intro after
|
||||||
$message = GETPOST('message');
|
$message = GETPOST('message', 'restricthtml');
|
||||||
$message .= "\n\n";
|
$message .= '<br><br>';
|
||||||
|
|
||||||
foreach ($external_contacts as $key => $info_sendto) {
|
foreach ($external_contacts as $key => $info_sendto) {
|
||||||
// altairis: avoid duplicate emails to external contacts
|
// altairis: avoid duplicate emails to external contacts
|
||||||
@ -2669,17 +2669,17 @@ class Ticket extends CommonObject
|
|||||||
if (!empty($info_sendto['email'])) $sendto[] = trim($info_sendto['firstname'] . " " . $info_sendto['lastname']) . " <" . $info_sendto['email'] . ">";
|
if (!empty($info_sendto['email'])) $sendto[] = trim($info_sendto['firstname'] . " " . $info_sendto['lastname']) . " <" . $info_sendto['email'] . ">";
|
||||||
|
|
||||||
$recipient = dolGetFirstLastname($info_sendto['firstname'], $info_sendto['lastname'], '-1') . ' (' . strtolower($info_sendto['libelle']) . ')';
|
$recipient = dolGetFirstLastname($info_sendto['firstname'], $info_sendto['lastname'], '-1') . ' (' . strtolower($info_sendto['libelle']) . ')';
|
||||||
$message .= (!empty($recipient) ? $langs->trans('TicketNotificationRecipient') . ' : ' . $recipient . "\n" : '');
|
$message .= (!empty($recipient) ? $langs->trans('TicketNotificationRecipient') . ' : ' . $recipient . '<br>' : '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If public interface is not enable, use link to internal page into mail
|
// If public interface is not enable, use link to internal page into mail
|
||||||
$url_public_ticket = (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE) ?
|
$url_public_ticket = (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE) ?
|
||||||
(!empty($conf->global->TICKET_URL_PUBLIC_INTERFACE) ? $conf->global->TICKET_URL_PUBLIC_INTERFACE . '/view.php' : dol_buildpath('/public/ticket/view.php', 2)) : dol_buildpath('/ticket/card.php', 2)) . '?track_id=' . $object->track_id;
|
(!empty($conf->global->TICKET_URL_PUBLIC_INTERFACE) ? $conf->global->TICKET_URL_PUBLIC_INTERFACE . '/view.php' : dol_buildpath('/public/ticket/view.php', 2)) : dol_buildpath('/ticket/card.php', 2)) . '?track_id=' . $object->track_id;
|
||||||
$message .= "\n" . $langs->trans('TicketNewEmailBodyInfosTrackUrlCustomer') . ' : <a href="' . $url_public_ticket . '">' . $object->track_id . '</a>' . "\n";
|
$message .= '<br>' . $langs->trans('TicketNewEmailBodyInfosTrackUrlCustomer') . ' : <a href="' . $url_public_ticket . '">' . $object->track_id . '</a><br>';
|
||||||
|
|
||||||
// Build final message
|
// Build final message
|
||||||
$message = $message_intro . $message;
|
$message = $message_intro . '<br><br>' . $message;
|
||||||
|
|
||||||
// Add signature
|
// Add signature
|
||||||
$message .= '<br>' . $message_signature;
|
$message .= '<br>' . $message_signature;
|
||||||
@ -2771,8 +2771,6 @@ class Ticket extends CommonObject
|
|||||||
$filename = $mimefilename_list;
|
$filename = $mimefilename_list;
|
||||||
$mimetype = $mimetype_list;
|
$mimetype = $mimetype_list;
|
||||||
|
|
||||||
$message_to_send = dol_nl2br($message);
|
|
||||||
|
|
||||||
// Envoi du mail
|
// Envoi du mail
|
||||||
if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) {
|
if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) {
|
||||||
$old_MAIN_MAIL_AUTOCOPY_TO = $conf->global->MAIN_MAIL_AUTOCOPY_TO;
|
$old_MAIN_MAIL_AUTOCOPY_TO = $conf->global->MAIN_MAIL_AUTOCOPY_TO;
|
||||||
@ -2780,7 +2778,7 @@ class Ticket extends CommonObject
|
|||||||
}
|
}
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
|
||||||
$trackid = "tic".$this->id;
|
$trackid = "tic".$this->id;
|
||||||
$mailfile = new CMailFile($subject, $receiver, $from, $message_to_send, $filepath, $mimetype, $filename, $sendtocc, '', $deliveryreceipt, -1, '', '', $trackid);
|
$mailfile = new CMailFile($subject, $receiver, $from, $message, $filepath, $mimetype, $filename, $sendtocc, '', $deliveryreceipt, -1, '', '', $trackid);
|
||||||
if ($mailfile->error) {
|
if ($mailfile->error) {
|
||||||
setEventMessages($mailfile->error, null, 'errors');
|
setEventMessages($mailfile->error, null, 'errors');
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user