Skip to content

Commit 3f33835

Browse files
committed
Patch: Make embedded reply recipients include current owner_id
1 parent 78f387a commit 3f33835

4 files changed

Lines changed: 14 additions & 5 deletions

File tree

src/Controllers/TicketsController.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1214,12 +1214,13 @@ public function edit($id, $parameters = null)
12141214

12151215
// Default notification recipients
12161216
$all_c = clone $all_comments;
1217-
$a_reply = [(!is_null($ticket->owner) ? $ticket->owner->id : $ticket->user_id)];
1218-
$a_note = [];
1217+
$a_reply = $a_note = [];
1218+
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());
1222-
}elseif($comm->type == 'note'){
1222+
1223+
}elseif($comm->type == 'note'){
12231224
$a_note = array_merge($a_note, $comm->notifications->pluck('member_id')->toArray());
12241225
}
12251226
}

src/Views/tickets/createedit/form.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
<label for="owner_id" class="{{ $u->currentLevel()==1 ? 'col-lg-2' : 'col-lg-3' }} level_class col-form-label tooltip-info" data-level-1-class="col-lg-2" data-level-2-class="col-lg-3" title="{{ trans('panichd::lang.create-ticket-owner-help') }}"> *{{trans('panichd::lang.owner')}}{{trans('panichd::lang.colon')}} <span class="fa fa-question-circle" style="color: #bbb"></span></label>
4747

4848
<div class="{{ $u->currentLevel()==1 ? 'col-lg-10' : 'col-lg-9' }} level_class" data-level-1-class="col-lg-10" data-level-2-class="col-lg-9">
49-
<select name="owner_id" class="generate_default_select2 form-control" style="display: none; width: 100%">
49+
<select id="owner_id" name="owner_id" class="generate_default_select2 form-control" style="display: none; width: 100%">
5050
@foreach ($c_members as $owner)
5151
<option value="{{ $owner->id }}" {{ $owner->id == $a_current['owner_id'] ? 'selected="selected"' : '' }}>{{ $owner->name . ($owner->email == "" ? ' ' . trans('panichd::lang.ticket-owner-no-email') : ' - ' . $owner->email) }}
5252
@if ($setting->grab('departments_notices_feature'))

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
</select>
4444
<select class="form-control reply_recipients" name="comment_x_recipients[]" class="form-control" multiple="multiple" style="display: none; width: 100%" disabled="disabled">
4545
@foreach ($c_members->filter(function($q)use($u){ return $q->id != $u->id; }) as $member)
46-
<option value="{{ $member->id }}" {{ in_array($member->id, $a_notifications['reply']) ? 'selected="selected"' : '' }}>{{ $member->name . ($member->email == "" ? ' ' . trans('panichd::lang.ticket-owner-no-email') : ' - ' . $member->email) }}
46+
<option value="{{ $member->id }}">{{ $member->name . ($member->email == "" ? ' ' . trans('panichd::lang.ticket-owner-no-email') : ' - ' . $member->email) }}
4747
@if ($setting->grab('departments_notices_feature'))
4848
@if ($member->ticketit_department == '0')
4949
{{ ' - ' . trans('panichd::lang.create-ticket-notices') . ' ' . trans('panichd::lang.all-depts')}}

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
77
// Notification members
88
var a_notifications_note = [{{ implode(',', $a_notifications['note']) }}];
9+
var a_notifications_reply = [{{ implode(',', $a_notifications['reply']) }}];
910
1011
var _cloned = $('#comment_template').clone();
1112
var _num = $('#comments .comment_block').length + 1;
@@ -19,6 +20,13 @@
1920
});
2021
// Add current agent id
2122
_cloned.find('.note_recipients option[value=' + $('#agent_id').val() + ']').prop('selected', true);
23+
24+
$(a_notifications_reply).each(function(i,v){
25+
// Add other reply recipients
26+
_cloned.find('.reply_recipients option[value=' + v + ']').prop('selected', true);
27+
});
28+
// Add current owner
29+
_cloned.find('.reply_recipients option[value=' + $('#owner_id').val() + ']').prop('selected', true);
2230
2331
// Activate notification recipients selects
2432
_cloned.find('.note_recipients').prop('disabled', false).attr('name', 'comment_' + _num + '_recipients[]');

0 commit comments

Comments
 (0)