From 3138da5f5b3a76e58cd1423841b71048b5a0c23b Mon Sep 17 00:00:00 2001 From: Sujit Prasad Date: Thu, 23 Jun 2016 17:43:18 +0530 Subject: [PATCH] update v1.0.7.7 --- app/Exceptions/Handler.php | 2 +- .../Client/helpdesk/UnAuthController.php | 38 +++++++++++++++++++ app/Http/routes.php | 2 +- 3 files changed, 40 insertions(+), 2 deletions(-) diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index 197d2b548..de501c26d 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -23,7 +23,7 @@ class Handler extends ExceptionHandler */ protected $dontReport = [ // 'Symfony\Component\HttpKernel\Exception\HttpException', -// 'Illuminate\Http\Exception\HttpResponseException', + Illuminate\Http\Exception\HttpResponseException::class, ValidationException::class, AuthorizationException::class, HttpResponseException ::class, diff --git a/app/Http/Controllers/Client/helpdesk/UnAuthController.php b/app/Http/Controllers/Client/helpdesk/UnAuthController.php index 4c7993422..52e37e4d9 100644 --- a/app/Http/Controllers/Client/helpdesk/UnAuthController.php +++ b/app/Http/Controllers/Client/helpdesk/UnAuthController.php @@ -278,4 +278,42 @@ class UnAuthController extends Controller return Lang::get('lang.your_ticket_has_been').' '.$ticket_status->state; } + + //Auto-close tickets + public function autoCloseTickets() + { + $workflow = \App\Model\helpdesk\Workflow\WorkflowClose::whereId(1)->first(); + + if ($workflow->condition == 1) { + $overdues = Tickets::where('status', '=', 1)->where('isanswered', '=', 1)->orderBy('id', 'DESC')->get(); + if (count($overdues) == 0) { + $tickets = null; + } else { + $i = 0; + foreach ($overdues as $overdue) { + // $sla_plan = Sla_plan::where('id', '=', $overdue->sla)->first(); + + $ovadate = $overdue->created_at; + $new_date = date_add($ovadate, date_interval_create_from_date_string($workflow->days.' days')).'

'; + if (date('Y-m-d H:i:s') > $new_date) { + $i++; + $overdue->status = 3; + $overdue->closed = 1; + $overdue->closed_at = date('Y-m-d H:i:s'); + $overdue->save(); +// if($workflow->send_email == 1) { +// $this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('0', $overdue->dept_id), $to = ['name' => $user_name, 'email' => $email], $message = ['subject' => $ticket_subject.'[#'.$ticket_number.']', 'scenario' => 'close-ticket'], $template_variables = ['ticket_number' => $ticket_number]); +// } + } + } + // dd(count($value)); +// if ($i > 0) { +// $tickets = new collection($value); +// } else { +// $tickets = null; +// } + } + } else { + } + } } diff --git a/app/Http/routes.php b/app/Http/routes.php index 6e76ba247..f35e5fca8 100644 --- a/app/Http/routes.php +++ b/app/Http/routes.php @@ -1006,7 +1006,7 @@ Route::group(['middleware' => ['web']], function () { */ Route::get('readmails', ['as' => 'readmails', 'uses' => 'Agent\helpdesk\MailController@readmails']); Route::get('notification', ['as' => 'notification', 'uses' => 'Agent\helpdesk\NotificationController@send_notification']); - Route::get('auto-close-tickets', ['as' => 'auto.close', 'uses' => 'Agent\helpdesk\TicketController@autoCloseTickets']); + Route::get('auto-close-tickets', ['as' => 'auto.close', 'uses' => 'Client\helpdesk\UnAuthController@autoCloseTickets']); /* |=============================================================