diff --git a/include/ajax.tasks.php b/include/ajax.tasks.php index 19016e20c7fbe3d7691f576a7af7ba3df7a00beb..b379382b1f363d78752519b11ff00062ae0e18c0 100644 --- a/include/ajax.tasks.php +++ b/include/ajax.tasks.php @@ -86,6 +86,8 @@ class TasksAjaxAPI extends AjaxController { if ($tid) $originalTask = Task::lookup($tid); + else + unset($_SESSION[':form-data']); $info=$errors=array(); if ($_POST) { @@ -116,9 +118,9 @@ class TasksAjaxAPI extends AjaxController { if (($task=Task::create($vars, $errors))) { if ($_SESSION[':form-data']['eid']) { //add internal note to original task: - $taskLink = sprintf('<a href="tasks.php?id=%d"><b>#%d</b></a>', + $taskLink = sprintf('<a href="tasks.php?id=%d"><b>#%s</b></a>', $task->getId(), - $task->getId()); + $task->getNumber()); $entryLink = sprintf('<a href="#entry-%d"><b>%d</b></a> (%s)', $_SESSION[':form-data']['eid'], @@ -143,8 +145,6 @@ class TasksAjaxAPI extends AjaxController { 'note' => __('This Task was created from Task ' . $taskLink)); $task->postNote($note, $errors, $thisstaff); - - unset($_SESSION[':form-data']); } Http::response(201, $task->getId()); diff --git a/include/ajax.tickets.php b/include/ajax.tickets.php index 0a7cf21bcbd1ea0bc01bec441bbcc385cbf62090..5c2584f7633ed5461ffbcb31a3d327a1de230771 100644 --- a/include/ajax.tickets.php +++ b/include/ajax.tickets.php @@ -1352,9 +1352,9 @@ function refer($tid, $target=null) { if ($_SESSION[':form-data']['eid']) { //add internal note to ticket: - $taskLink = sprintf('<a href="tasks.php?id=%d"><b>#%d</b></a>', + $taskLink = sprintf('<a href="tasks.php?id=%d"><b>#%s</b></a>', $task->getId(), - $task->getId()); + $task->getNumber()); $entryLink = sprintf('<a href="#entry-%d"><b>%d</b></a> (%s)', $_SESSION[':form-data']['eid'], @@ -1380,8 +1380,7 @@ function refer($tid, $target=null) { $task->postNote($note, $errors, $thisstaff); } - unset($_SESSION[':form-data']); - } + } Http::response(201, $task->getId()); } diff --git a/include/class.thread_actions.php b/include/class.thread_actions.php index 25b787d1190fa3edb29d8ecb959eeeb38c4228fe..5a84db9495cbe00f15b58826adbfa8f7f9cf2325 100644 --- a/include/class.thread_actions.php +++ b/include/class.thread_actions.php @@ -511,6 +511,9 @@ JS $vars = array( 'description' => Format::htmlchars($this->entry->getBody())); + if ($_SESSION[':form-data']) + unset($_SESSION[':form-data']); + $_SESSION[':form-data']['tid'] = $this->entry->getThread()->getObJectId(); $_SESSION[':form-data']['eid'] = $this->entry->getId(); $_SESSION[':form-data']['timestamp'] = $this->entry->getCreateDate(); diff --git a/include/class.ticket.php b/include/class.ticket.php index 3c2856d3baab56c8d883741592fc0d0fc487aa82..008a1b29833bef9dc30362770fb9a460cffb242d 100644 --- a/include/class.ticket.php +++ b/include/class.ticket.php @@ -3933,8 +3933,6 @@ implements RestrictedAccess, Threadable, Searchable { $oldTicket->logNote($ticketNote['title'], $ticketNote['body'], $thisstaff); elseif ($oldTask) $oldTask->postNote($taskNote, $errors, $thisstaff); - - unset($_SESSION[':form-data']); } // Configure service-level-agreement for this ticket diff --git a/include/i18n/en_US/templates/email/ticket.activity.notice.bcc.yaml b/include/i18n/en_US/templates/email/ticket.activity.notice.bcc.yaml new file mode 100644 index 0000000000000000000000000000000000000000..c6553869044b8901cedbfe939a38b02a212b217c --- /dev/null +++ b/include/i18n/en_US/templates/email/ticket.activity.notice.bcc.yaml @@ -0,0 +1,38 @@ +# +# Email template: ticket.activity.notice.bcc.yaml +# +# Notice sent to BCCd collaborators on ticket activity e.g reply or message +# +--- +notes: | + Notice sent to BCCd collaborators on ticket activity e.g reply or message. + +subject: | + Re: %{ticket.subject} [#%{ticket.number}] +body: | + <h3><strong>Dear %{recipient.name.first},</strong></h3> + <div> + <em>%{poster.name}</em> just logged a message to a ticket in which you participate. + </div> + <br> + %{message} + <br> + <br> + Ticket recipients can be seen below where the User is first and any other + names are ticket Collaborators. + <br> + <br> + Recipients: + <br> + %{ticket.recipients} + <br> + <br> + <hr> + <div style="color: rgb(127, 127, 127); font-size: small; text-align: center;"> + <em>You're getting this email because you have been BCC'd + on ticket <a href="%{recipient.ticket_link}" style="color: rgb(84, 141, 212);" + >#%{ticket.number}</a> This means that only agents can see your responses to + this ticket. To participate, simply reply to this email + or <a href="%{recipient.ticket_link}" style="color: rgb(84, 141, 212);" + >click here</a> for a complete archive of the ticket thread.</em> + </div> diff --git a/include/i18n/en_US/templates/email/ticket.notice.bcc.yaml b/include/i18n/en_US/templates/email/ticket.notice.bcc.yaml new file mode 100644 index 0000000000000000000000000000000000000000..b0b1799f6655f3f9e6823e8fafbbfdf82a9354ba --- /dev/null +++ b/include/i18n/en_US/templates/email/ticket.notice.bcc.yaml @@ -0,0 +1,52 @@ +# +# Email template: ticket.notice.bcc.yaml +# +# Sent to a BCC'd user when a staff member creates a ticket on another user's behalf. +# +--- +notes: | + Sent to a BCC'd user when a staff member creates a ticket on another user's behalf. + +subject: | + %{ticket.subject} [#%{ticket.number}] +body: | + <h3><strong>Dear %{recipient.name.first},</strong></h3> + Our customer care team has created a ticket, <a + href="%{recipient.ticket_link}">#%{ticket.number}</a> on behalf of %{ticket.name}, with + the following details and summary: + <br> + <br> + Topic: <strong>%{ticket.topic.name}</strong> + <br> + Subject: <strong>%{ticket.subject}</strong> + <br> + <br> + %{message} + <br> + <br> + You have been BCC'd on this ticket. This means that only agents can see your + responses to this ticket. + <br> + <br> + You can <a href="%{recipient.ticket_link}">view this + ticket's progress online</a>. + <br> + <br> + Ticket recipients can be seen below where the User is first and any other + names are ticket Collaborators. + <br> + <br> + Recipients: + <br> + %{ticket.recipients} + <br> + <br> + <div style="color: rgb(127, 127, 127);"> + Your %{company.name} Team,<br> + %{signature}</div> + <hr> + <div style="color: rgb(127, 127, 127); font-size: small; "><em>If you + wish to provide additional comments or information regarding the issue, + please reply to this email or <a href="%{recipient.ticket_link}"><span + style="color: rgb(84, 141, 212);" >login to your account</span></a> for + a complete archive of your support requests.</em></div> diff --git a/include/i18n/en_US/templates/email/ticket.reply.bcc.yaml b/include/i18n/en_US/templates/email/ticket.reply.bcc.yaml new file mode 100644 index 0000000000000000000000000000000000000000..4f18c78075f21551032416507bcd8ffbf42bc27e --- /dev/null +++ b/include/i18n/en_US/templates/email/ticket.reply.bcc.yaml @@ -0,0 +1,39 @@ +# +# Email template: ticket.reply.bcc.yaml +# +# Sent to BCC'd collaborators when a staff member makes a reply to a ticket. +# Replies are only generated by staff members. +# +--- +notes: | + Sent to BCC'd collaborators when a staff member makes a reply to their ticket. + Replies are only generated by staff members. + +subject: | + Re: %{ticket.subject} [#%{ticket.number}] +body: | + <h3><strong>Dear %{recipient.name.first},</strong></h3> + %{response} + <br> + <br> + Ticket recipients can be seen below where the User is first and any other + names are ticket Collaborators. + <br> + <br> + Recipients: + <br> + %{ticket.recipients} + <br> + <br> + <div style="color: rgb(127, 127, 127);"> + Your %{company.name} Team,<br> + %{signature} + </div> + <hr> + <div style="color: rgb(127, 127, 127); font-size: small; text-align: center;" + ><em>You are receiving this message because you have been BCC'd on a ticket. + This means that only agents can see your responses to this ticket. + To participate in this ticket, please reply to this email or + <a href="%{recipient.ticket_link}" style="color: rgb(84, 141, 212);" >login + to your account</a> for a complete archive of all your support requests + and responses.</em></div> diff --git a/include/staff/ticket-open.inc.php b/include/staff/ticket-open.inc.php index 17b9891b90dba383df6180102ac49e0da28b7778..923e19b41f195132edb739c15f841f6a13129727 100644 --- a/include/staff/ticket-open.inc.php +++ b/include/staff/ticket-open.inc.php @@ -6,6 +6,8 @@ if (!defined('OSTSCPINC') || !$thisstaff $info=array(); $info=Format::htmlchars(($errors && $_POST)?$_POST:$info); +if ($_SESSION[':form-data'] && !$_GET['tid']) + unset($_SESSION[':form-data']); // Use thread entry to seed the ticket if (!$user && $_GET['tid'] && ($entry = ThreadEntry::lookup($_GET['tid']))) { diff --git a/scp/js/thread.js b/scp/js/thread.js index bb67ca4ce868d7ea865c4aa5972f184836aa3c2c..69a1a96c04de2af66641f02adb298cbc426fd921 100644 --- a/scp/js/thread.js +++ b/scp/js/thread.js @@ -162,7 +162,7 @@ var thread = { // unless referring to thread entry on current page $('div.thread-body a', $container).each(function() { var str = this.toString(); - if (!str.includes('#entry-')) + if (str.indexOf('#entry-') == -1) $(this).attr('target', '_blank'); });