';
+ print '
';
+
print load_fiche_titre($langs->trans('TicketAddMessage'), $morehtmlright, 'messages@ticket');
print '
';
@@ -1507,6 +1507,7 @@ if ($action == 'create' || $action == 'presend') {
$formticket->track_id = $object->track_id;
$formticket->ref = $object->ref;
$formticket->id = $object->id;
+ $formticket->trackid = 'tic'.$object->id;
$formticket->withfile = 2;
$formticket->withcancel = 1;
diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php
index 7242fdafa28..42ffa662246 100644
--- a/htdocs/ticket/class/ticket.class.php
+++ b/htdocs/ticket/class/ticket.class.php
@@ -2495,7 +2495,8 @@ class Ticket extends CommonObject
}
/**
- * Add new message on a ticket (private/public area). Can also send it be email if GETPOST('send_email', 'int') is set.
+ * Add new message on a ticket (private/public area).
+ * Can also send it be email if GETPOST('send_email', 'int') is set. For such email, header and footer is added.
*
* @param User $user User for action
* @param string $action Action string
@@ -2556,11 +2557,10 @@ class Ticket extends CommonObject
//var_dump($_SESSION);
//var_dump($listofpaths);exit;
- /*
- * Public area
- */
if (!empty($public_area)) {
/*
+ * Message created fromthe Public interface
+ *
* Send emails to assigned users (public area notification)
*/
if (!empty($conf->global->TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_ENABLED)) {
@@ -2629,9 +2629,8 @@ class Ticket extends CommonObject
}
} else {
/*
- * Private area
- */
- /*
+ * Send from Backoffice / Private area
+ *
* Send emails to internal users (linked contacts)
*/
if ($send_email > 0) {
@@ -2645,7 +2644,7 @@ class Ticket extends CommonObject
$subject = GETPOST('subject', 'alphanohtml') ? GETPOST('subject', 'alphanohtml') : '['.$label_title.'- ticket #'.$object->track_id.'] '.$langs->trans('TicketNewMessage');
$message_intro = $langs->trans('TicketNotificationEmailBody', "#".$object->id);
- $message_signature = GETPOST('mail_signature') ? GETPOST('mail_signature') : $conf->global->TICKET_MESSAGE_MAIL_SIGNATURE;
+ $message_signature = GETPOST('mail_signature') ? GETPOST('mail_signature') : getDolGlobalString('TICKET_MESSAGE_MAIL_SIGNATURE');
$message = $langs->trans('TicketMessageMailIntroText');
$message .= '
';
@@ -2683,7 +2682,7 @@ class Ticket extends CommonObject
// URL ticket
$url_internal_ticket = dol_buildpath('/ticket/card.php', 2).'?track_id='.$object->track_id;
- // altairis: make html link on url
+ // add html link on url
$message .= '
'.$langs->trans('TicketNotificationEmailBodyInfosTrackUrlinternal').' :
'.$object->track_id.'';
// Add global email address recipient
@@ -2693,7 +2692,7 @@ class Ticket extends CommonObject
}
}
- // altairis: dont try to send email if no recipient
+ // dont try to send email if no recipient
if (!empty($sendto)) {
$this->sendTicketMessageByEmail($subject, $message, '', $sendto, $listofpaths, $listofmimes, $listofnames);
}
@@ -2724,8 +2723,8 @@ class Ticket extends CommonObject
$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');
- $message_intro = GETPOST('mail_intro') ? GETPOST('mail_intro', 'restricthtml') : $conf->global->TICKET_MESSAGE_MAIL_INTRO;
- $message_signature = GETPOST('mail_signature') ? GETPOST('mail_signature', 'restricthtml') : $conf->global->TICKET_MESSAGE_MAIL_SIGNATURE;
+ $message_intro = GETPOST('mail_intro') ? GETPOST('mail_intro', 'restricthtml') : getDolGlobalString('TICKET_MESSAGE_MAIL_INTRO');
+ $message_signature = GETPOST('mail_signature') ? GETPOST('mail_signature', 'restricthtml') : getDolGlobalString('TICKET_MESSAGE_MAIL_SIGNATURE');
if (!dol_textishtml($message_intro)) {
$message_intro = dol_nl2br($message_intro);
}
diff --git a/htdocs/ticket/messaging.php b/htdocs/ticket/messaging.php
index 6c8438b5ac0..88ac4ef686c 100644
--- a/htdocs/ticket/messaging.php
+++ b/htdocs/ticket/messaging.php
@@ -244,10 +244,14 @@ if (!empty($object->id)) {
$messagingUrl = DOL_URL_ROOT.'/ticket/agenda.php?track_id='.$object->track_id;
$morehtmlright .= dolGetButtonTitle($langs->trans('MessageListViewType'), '', 'fa fa-bars imgforviewmode', $messagingUrl, '', 1);
-
- // Show link to add a message (if read and not closed)
+ // Show link to send an email (if read and not closed)
$btnstatus = $object->status < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage";
- $url = 'card.php?track_id='.$object->track_id.'&action=presend_addmessage&mode=init&backtopage='.urlencode($_SERVER["PHP_SELF"].'?track_id='.$object->track_id);
+ $url = 'card.php?track_id='.$object->track_id.'&action=presend_addmessage&mode=init&private_message=0&send_email=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?track_id='.$object->track_id).'#formmailbeforetitle';
+ $morehtmlright .= dolGetButtonTitle($langs->trans('SendMail'), '', 'fa fa-paper-plane', $url, 'email-title-button', $btnstatus);
+
+ // Show link to add a private message (if read and not closed)
+ $btnstatus = $object->status < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage";
+ $url = 'card.php?track_id='.$object->track_id.'&action=presend_addmessage&mode=init&backtopage='.urlencode($_SERVER["PHP_SELF"].'?track_id='.$object->track_id).'#formmailbeforetitle';
$morehtmlright .= dolGetButtonTitle($langs->trans('TicketAddMessage'), '', 'fa fa-comment-dots', $url, 'add-new-ticket-title-button', $btnstatus);
// Show link to add event (if read and not closed)
diff --git a/htdocs/user/card.php b/htdocs/user/card.php
index 9ba58cd069b..3c65d018e6b 100644
--- a/htdocs/user/card.php
+++ b/htdocs/user/card.php
@@ -1864,7 +1864,7 @@ if ($action == 'create' || $action == 'adduserldap') {
$langs->load("mails");
$params['attr']['title'] = $langs->trans('NoEMail');
}
- print dolGetButtonAction($langs->trans('SendMail'), '', 'default', $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=presend&mode=init#formmailbeforetitle', '', $canSendMail, $params);
+ print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=presend&mode=init#formmailbeforetitle', '', $canSendMail, $params);
}
if ($caneditfield && (!isModEnabled('multicompany') || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $object->entity == 1))) {
diff --git a/htdocs/webhook/target_card.php b/htdocs/webhook/target_card.php
index 83d0d4a1831..f7536cc15b0 100644
--- a/htdocs/webhook/target_card.php
+++ b/htdocs/webhook/target_card.php
@@ -460,20 +460,20 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
if (empty($reshook)) {
// Send
if (empty($user->socid)) {
- print dolGetButtonAction($langs->trans('SendMail'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&mode=init&token='.newToken().'#formmailbeforetitle');
+ print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&mode=init&token='.newToken().'#formmailbeforetitle');
}
// Back to draft
if ($object->status == $object::STATUS_VALIDATED) {
- print dolGetButtonAction($langs->trans('SetToDraft'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=confirm_setdraft&confirm=yes&token='.newToken(), '', $permissiontoadd);
+ print dolGetButtonAction('', $langs->trans('SetToDraft'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=confirm_setdraft&confirm=yes&token='.newToken(), '', $permissiontoadd);
}
- print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&token='.newToken(), '', $permissiontoadd);
+ print dolGetButtonAction('', $langs->trans('Modify'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&token='.newToken(), '', $permissiontoadd);
// Validate
if ($object->status == $object::STATUS_DRAFT) {
if (empty($object->table_element_line) || (is_array($object->lines) && count($object->lines) > 0)) {
- print dolGetButtonAction($langs->trans('Validate'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=confirm_validate&confirm=yes&token='.newToken(), '', $permissiontoadd);
+ print dolGetButtonAction('', $langs->trans('Validate'), 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=confirm_validate&confirm=yes&token='.newToken(), '', $permissiontoadd);
} else {
$langs->load("errors");
print dolGetButtonAction($langs->trans("ErrorAddAtLeastOneLineFirst"), $langs->trans("Validate"), 'default', '#', '', 0);