Skip to content

Commit 464b7dc

Browse files
committed
Patch: Make embedded note recipients include current agent_id
1 parent 142aa5b commit 464b7dc

3 files changed

Lines changed: 13 additions & 2 deletions

File tree

src/Controllers/TicketsController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1215,7 +1215,7 @@ public function edit($id, $parameters = null)
12151215
// Default notification recipients
12161216
$all_c = clone $all_comments;
12171217
$a_reply = [(!is_null($ticket->owner) ? $ticket->owner->id : $ticket->user_id)];
1218-
$a_note = [$ticket->agent->id];
1218+
$a_note = [];
12191219
foreach($all_c->get() as $comm){
12201220
if ($comm->type == 'reply'){
12211221
$a_reply = array_merge($a_reply, $comm->notifications->pluck('member_id')->toArray());

src/Views/tickets/partials/comments/embedded_form.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
<div class="col-lg-10">
3131
<select class="form-control note_recipients" name="comment_x_recipients[]" multiple="multiple" style="display: none; width: 100%" disabled="disabled">
3232
@foreach ($c_members->filter(function($q)use($u){ return $q->id != $u->id; }) as $member)
33-
<option value="{{ $member->id }}" {{ in_array($member->id, $a_notifications['note']) ? 'selected="selected"' : '' }}>{{ $member->name . ($member->email == "" ? ' ' . trans('panichd::lang.ticket-owner-no-email') : ' - ' . $member->email) }}
33+
<option value="{{ $member->id }}">{{ $member->name . ($member->email == "" ? ' ' . trans('panichd::lang.ticket-owner-no-email') : ' - ' . $member->email) }}
3434
@if ($setting->grab('departments_notices_feature'))
3535
@if ($member->ticketit_department == '0')
3636
{{ ' - ' . trans('panichd::lang.create-ticket-notices') . ' ' . trans('panichd::lang.all-depts')}}

src/Views/tickets/partials/comments/embedded_scripts.blade.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,23 @@
44
$('#add_comment').click(function(e){
55
e.preventDefault();
66
7+
// Notification members
8+
var a_notifications_note = [{{ implode(',', $a_notifications['note']) }}];
9+
710
var _cloned = $('#comment_template').clone();
811
var _num = $('#comments .comment_block').length + 1;
912
_cloned.prop('id', 'comment_' + _num);
1013
_cloned.find('.input_comment_num').val(_num);
1114
_cloned.find('.input_response_type').prop('disabled', false).attr('name', 'response_' + _num);
1215
@if($setting->grab('custom_recipients'))
16+
$(a_notifications_note).each(function(i,v){
17+
// Add other notes recipients
18+
_cloned.find('.note_recipients option[value=' + v + ']').prop('selected', true);
19+
});
20+
// Add current agent id
21+
_cloned.find('.note_recipients option[value=' + $('#agent_id').val() + ']').prop('selected', true);
22+
23+
// Activate notification recipients selects
1324
_cloned.find('.note_recipients').prop('disabled', false).attr('name', 'comment_' + _num + '_recipients[]');
1425
_cloned.find('.reply_recipients').attr('name', 'comment_' + _num + '_recipients[]');
1526
@endif

0 commit comments

Comments
 (0)