bug-fix-patch-7

# while changing owner of the ticket cheking if the owner already owns
the ticket or not
# fixed showing inactive agents problem in help topic edit and create
pages
This commit is contained in:
Manish Verma
2016-12-22 13:15:16 +05:30
parent df14836985
commit c47b5da890
12 changed files with 34 additions and 15 deletions

View File

@@ -85,7 +85,7 @@ class HelptopicController extends Controller
$departments = $department->get(); $departments = $department->get();
$topics = $topic->get(); $topics = $topic->get();
$forms = $form->get(); $forms = $form->get();
$agents = $agent->where('role', '=', 'agent')->get(); $agents = $agent->where('role', '!=', 'user')->where('active', '=', 1)->orderBy('first_name')->get();
$slas = $sla->get(); $slas = $sla->get();
$priority = Ticket_Priority::where('status', '=', 1)->get(); $priority = Ticket_Priority::where('status', '=', 1)->get();
@@ -143,7 +143,7 @@ class HelptopicController extends Controller
public function edit($id, Ticket_Priority $priority, Department $department, Help_topic $topic, Forms $form, Sla_plan $sla) public function edit($id, Ticket_Priority $priority, Department $department, Help_topic $topic, Forms $form, Sla_plan $sla)
{ {
try { try {
$agents = User::where('role', '=', 'agent')->get(); $agents = User::where('role', '!=', 'user')->where('active', '=', 1)->orderBy('first_name')->get();
$departments = $department->get(); $departments = $department->get();
$topics = $topic->whereId($id)->first(); $topics = $topic->whereId($id)->first();
$forms = $form->get(); $forms = $form->get();

View File

@@ -2218,6 +2218,9 @@ class TicketController extends Controller
if ($count === 1) { if ($count === 1) {
$user_id = $user->id; $user_id = $user->id;
$ticket = Tickets::where('id', '=', $id)->first(); $ticket = Tickets::where('id', '=', $id)->first();
if($user_id === $ticket->user_id) {
return 400;
}
$ticket_number = $ticket->ticket_number; $ticket_number = $ticket->ticket_number;
$ticket->user_id = $user_id; $ticket->user_id = $user_id;
$ticket->save(); $ticket->save();

View File

@@ -1155,5 +1155,7 @@ return [
'inactive-users' => 'Inactive users', 'inactive-users' => 'Inactive users',
'all-users' => 'All users', 'all-users' => 'All users',
'search' => 'Search...', 'search' => 'Search...',
//update 21-12-2016
'selected-user-is-already-the-owner' => 'Selected user is already the owner of this ticket.',
]; ];

View File

@@ -1118,7 +1118,7 @@ return [
'minutes' => ' minutes', 'minutes' => ' minutes',
'in_minutes' => 'In minutes', 'in_minutes' => 'In minutes',
'add_another_owner' => 'Add another owner', 'add_another_owner' => 'Add another owner',
'user-not-found' => 'User not found. Try again or add a new user.', 'user-not-found' => 'User not found or user is inactive. Try again or add a new user.',
'change-success' => 'Success! owner has been changed for this ticket.', 'change-success' => 'Success! owner has been changed for this ticket.',
'user-exists' => 'User already exists. Try search existing user.', 'user-exists' => 'User already exists. Try search existing user.',
'valid-email' => 'Enter a valid email address.', 'valid-email' => 'Enter a valid email address.',
@@ -1592,4 +1592,6 @@ return [
'inactive-users' => 'Inactive users', 'inactive-users' => 'Inactive users',
'all-users' => 'All users', 'all-users' => 'All users',
'search' => 'Search...', 'search' => 'Search...',
//update 21-12-2016
'selected-user-is-already-the-owner' => 'Selected user is already the owner of this ticket.',
]; ];

View File

@@ -1563,5 +1563,7 @@ return [
'inactive-users' => 'Inactive users', 'inactive-users' => 'Inactive users',
'all-users' => 'All users', 'all-users' => 'All users',
'search' => 'Search...', 'search' => 'Search...',
//update 21-12-2016
'selected-user-is-already-the-owner' => 'Selected user is already the owner of this ticket.',
]; ];

View File

@@ -1115,4 +1115,6 @@ return [
'inactive-users' => 'Inactive users', 'inactive-users' => 'Inactive users',
'all-users' => 'All users', 'all-users' => 'All users',
'search' => 'Search...', 'search' => 'Search...',
//update 21-12-2016
'selected-user-is-already-the-owner' => 'Selected user is already the owner of this ticket.',
]; ];

View File

@@ -1609,4 +1609,6 @@ return [
'inactive-users' => 'Inactive users', 'inactive-users' => 'Inactive users',
'all-users' => 'All users', 'all-users' => 'All users',
'search' => 'Search...', 'search' => 'Search...',
//update 21-12-2016
'selected-user-is-already-the-owner' => 'Selected user is already the owner of this ticket.',
]; ];

View File

@@ -1554,5 +1554,7 @@ return [
'inactive-users' => 'Inactive users', 'inactive-users' => 'Inactive users',
'all-users' => 'All users', 'all-users' => 'All users',
'search' => 'Search...', 'search' => 'Search...',
//update 21-12-2016
'selected-user-is-already-the-owner' => 'Selected user is already the owner of this ticket.',
]; ];

View File

@@ -1063,4 +1063,6 @@ return [
'inactive-users' => 'Inactive users', 'inactive-users' => 'Inactive users',
'all-users' => 'All users', 'all-users' => 'All users',
'search' => 'Search...', 'search' => 'Search...',
//update 21-12-2016
'selected-user-is-already-the-owner' => 'Selected user is already the owner of this ticket.',
]; ];

View File

@@ -137,7 +137,7 @@ class="active"
<div class="col-md-4"> <div class="col-md-4">
<div class="form-group {{ $errors->has('auto_assign') ? 'has-error' : '' }}"> <div class="form-group {{ $errors->has('auto_assign') ? 'has-error' : '' }}">
{!! Form::label('auto_assign',Lang::get('lang.auto_assign')) !!} {!! Form::label('auto_assign',Lang::get('lang.auto_assign')) !!}
{!!Form::select('auto_assign', [''=>Lang::get('lang.select_an_agent'),Lang::get('lang.agents')=>$agents->lists('first_name','id')->toArray()],null,['class' => 'form-control']) !!} {!!Form::select('auto_assign', [''=>Lang::get('lang.select_an_agent'),Lang::get('lang.agents')=>$agents->lists('full_name','id')->toArray()],null,['class' => 'form-control']) !!}
</div> </div>
</div> </div>
</div> </div>

View File

@@ -135,7 +135,7 @@ class="active"
<div class="col-md-4"> <div class="col-md-4">
<div class="form-group {{ $errors->has('auto_assign') ? 'has-error' : '' }}"> <div class="form-group {{ $errors->has('auto_assign') ? 'has-error' : '' }}">
{!! Form::label('auto_assign',Lang::get('lang.auto_assign')) !!} {!! Form::label('auto_assign',Lang::get('lang.auto_assign')) !!}
{!!Form::select('auto_assign', [''=>Lang::get('lang.select_an_agent'),Lang::get('lang.agents')=>$agents->lists('first_name','id')->toArray()],null,['class' => 'form-control']) !!} {!!Form::select('auto_assign', [''=>Lang::get('lang.select_an_agent'),Lang::get('lang.agents')=>$agents->lists('full_name','id')->toArray()],null,['class' => 'form-control']) !!}
</div> </div>
</div> </div>
</div> </div>

View File

@@ -948,7 +948,7 @@ alert(h+20);
<div class="tab-pane active" id="ahah1"> <div class="tab-pane active" id="ahah1">
<div id="change_alert" class="alert alert-danger alert-dismissable" style="display:none;"> <div id="change_alert" class="alert alert-danger alert-dismissable" style="display:none;">
<button id="change_dismiss" type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button> <button id="change_dismiss" type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<h4><i class="icon fa fa-check"></i>Alert!</h4> <h4><i class="icon fa fa-exclamation-circle"></i>Alert!</h4>
<div id="message-success42"></div> <div id="message-success42"></div>
</div> </div>
<div class="modal-body"> <div class="modal-body">
@@ -1645,15 +1645,17 @@ alert(h+20);
$("#change_loader").show(); $("#change_loader").show();
}, },
success: function(response) { success: function(response) {
if (response != 1) if (response != 1) {
{ // $("#assign_body").show();
// $("#assign_body").show(); var message = "{{Lang::get('lang.user-not-found')}}";
var message = "{{Lang::get('lang.user-not-found')}}"; if (response == 400) {
$('#change_alert').show(); message = "{{Lang::get('lang.selected-user-is-already-the-owner')}}";
$('#message-success42').html(message); }
setInterval(function(){$("#change_alert").hide(); }, 5000); $('#change_alert').show();
$("#change_body").show(); $('#message-success42').html(message);
$("#change_loader").hide(); setInterval(function(){$("#change_alert").hide(); }, 5000);
$("#change_body").show();
$("#change_loader").hide();
} else { } else {
$("#change_body").show(); $("#change_body").show();
$("#change_loader").hide(); $("#change_loader").hide();