From 4be39392e7de2fff7f2a9dc46a7e1275ef1caf83 Mon Sep 17 00:00:00 2001 From: Manish Verma Date: Thu, 1 Dec 2016 12:53:58 +0530 Subject: [PATCH] bug fix patch # update dummy database # update update sql dump # added ticket link in ticekt assignent template --- DB/demodatabase.sql | 2 +- DB/dummy-data.sql | 2 +- DB/update from 1.0.7.8 to 1.0.7.9/Updatedatabase.sql | 5 +---- app/Http/Controllers/Agent/helpdesk/TicketController.php | 6 +++--- app/Http/Controllers/Auth/AuthController.php | 6 ------ app/Http/Controllers/Common/PhpMailController.php | 5 +++-- database/seeds/DatabaseSeeder.php | 2 +- .../views/themes/default1/agent/layout/agent.blade.php | 2 +- 8 files changed, 11 insertions(+), 19 deletions(-) diff --git a/DB/demodatabase.sql b/DB/demodatabase.sql index efa253848..2c0b011e0 100644 --- a/DB/demodatabase.sql +++ b/DB/demodatabase.sql @@ -1755,7 +1755,7 @@ CREATE TABLE IF NOT EXISTS `templates` ( -- INSERT INTO `templates` (`id`, `name`, `variable`, `type`, `subject`, `message`, `description`, `set_id`, `created_at`, `updated_at`) VALUES -(1, 'This template is for sending notice to agent when ticket is assigned to them', '0', 1, '', '
Hello {!!$ticket_agent_name!!},

Ticket No: {!!$ticket_number!!}
Has been assigned to you by {!!$ticket_assigner!!} 

Thank You
Kind Regards,
{!!$system_from!!}
', '', 1, '2016-11-29 23:28:44', '2016-11-29 23:28:44'), +(1, 'This template is for sending notice to agent when ticket is assigned to them', '0', 1, '', '
Hello {!!$ticket_agent_name!!},

Ticket No: {!!$ticket_number!!}
Has been assigned to you by {!!$ticket_assigner!!}
Please check and resppond on the ticket.
Link: {!!$ticket_link!!}

Thank You
Kind Regards,
{!!$system_from!!}
', '', 1, '2016-11-29 23:28:44', '2016-11-29 23:28:44'), (2, 'This template is for sending notice to client with ticket link to check ticket without logging in to system', '1', 2, 'Check your Ticket', '
Hello {!!$user!!},

Click the link below to view your requested ticket
{!!$ticket_link_with_number!!}

Kind Regards,
{!!$system_from!!}
', '', 1, '2016-11-29 23:28:44', '2016-11-29 23:28:44'), (3, 'This template is for sending notice to client when ticket status is changed to close', '0', 3, '', '
Hello,

This message is regarding your ticket ID {!!$ticket_number!!}. We are changing the status of this ticket to "Closed" as the issue appears to be resolved.

Thank you
Kind regards,
{!!$system_from!!}
', '', 1, '2016-11-29 23:28:44', '2016-11-29 23:28:44'), (4, 'This template is for sending notice to client on successful ticket creation', '0', 4, '', '
Hello {!!$user!!}

Thank you for contacting us. This is an automated response confirming the receipt of your ticket. Our team will get back to you as soon as possible. When replying, please make sure that the ticket ID is kept in the subject so that we can track your replies.

Ticket ID: {!!$ticket_number!!} 

{!!$department_sign!!}
You can check the status of or update this ticket online at: {!!$system_link!!}
', '', 1, '2016-11-29 23:28:44', '2016-11-29 23:28:44'), diff --git a/DB/dummy-data.sql b/DB/dummy-data.sql index efa253848..2c0b011e0 100644 --- a/DB/dummy-data.sql +++ b/DB/dummy-data.sql @@ -1755,7 +1755,7 @@ CREATE TABLE IF NOT EXISTS `templates` ( -- INSERT INTO `templates` (`id`, `name`, `variable`, `type`, `subject`, `message`, `description`, `set_id`, `created_at`, `updated_at`) VALUES -(1, 'This template is for sending notice to agent when ticket is assigned to them', '0', 1, '', '
Hello {!!$ticket_agent_name!!},

Ticket No: {!!$ticket_number!!}
Has been assigned to you by {!!$ticket_assigner!!} 

Thank You
Kind Regards,
{!!$system_from!!}
', '', 1, '2016-11-29 23:28:44', '2016-11-29 23:28:44'), +(1, 'This template is for sending notice to agent when ticket is assigned to them', '0', 1, '', '
Hello {!!$ticket_agent_name!!},

Ticket No: {!!$ticket_number!!}
Has been assigned to you by {!!$ticket_assigner!!}
Please check and resppond on the ticket.
Link: {!!$ticket_link!!}

Thank You
Kind Regards,
{!!$system_from!!}
', '', 1, '2016-11-29 23:28:44', '2016-11-29 23:28:44'), (2, 'This template is for sending notice to client with ticket link to check ticket without logging in to system', '1', 2, 'Check your Ticket', '
Hello {!!$user!!},

Click the link below to view your requested ticket
{!!$ticket_link_with_number!!}

Kind Regards,
{!!$system_from!!}
', '', 1, '2016-11-29 23:28:44', '2016-11-29 23:28:44'), (3, 'This template is for sending notice to client when ticket status is changed to close', '0', 3, '', '
Hello,

This message is regarding your ticket ID {!!$ticket_number!!}. We are changing the status of this ticket to "Closed" as the issue appears to be resolved.

Thank you
Kind regards,
{!!$system_from!!}
', '', 1, '2016-11-29 23:28:44', '2016-11-29 23:28:44'), (4, 'This template is for sending notice to client on successful ticket creation', '0', 4, '', '
Hello {!!$user!!}

Thank you for contacting us. This is an automated response confirming the receipt of your ticket. Our team will get back to you as soon as possible. When replying, please make sure that the ticket ID is kept in the subject so that we can track your replies.

Ticket ID: {!!$ticket_number!!} 

{!!$department_sign!!}
You can check the status of or update this ticket online at: {!!$system_link!!}
', '', 1, '2016-11-29 23:28:44', '2016-11-29 23:28:44'), diff --git a/DB/update from 1.0.7.8 to 1.0.7.9/Updatedatabase.sql b/DB/update from 1.0.7.8 to 1.0.7.9/Updatedatabase.sql index 4b64bf6d2..ad331ff4b 100644 --- a/DB/update from 1.0.7.8 to 1.0.7.9/Updatedatabase.sql +++ b/DB/update from 1.0.7.8 to 1.0.7.9/Updatedatabase.sql @@ -4,10 +4,7 @@ -- Alter Table structure for table `common_settings` -- INSERT INTO `common_settings` (`id`, `option_name`, `option_value`, `status`, `optional_field`, `created_at`, `updated_at`) -VALUES (2, 'enable_rtl', '', '', '', '2016-06-14 09:07:17', '2016-06-14 09:07:17'), - (3, 'user_set_ticket_status', '',1,'','2016-06-14 09:07:17','2016-06-14 09:07:17'), - (4, 'send_otp', '',0,'','2016-06-14 09:07:17','2016-06-14 09:07:17'), - (5, 'email_mandatory', '',1,'','2016-06-14 09:07:17','2016-06-14 09:07:17'); +VALUES (5, 'email_mandatory', '',1,'','2016-06-14 09:07:17','2016-06-14 09:07:17'); -- INSERT INTO `ticket_status` (`id`, `name`, `state`, `mode`, `message`, `flags`, `sort`, `email_user`, `icon_class`, `properties`, `created_at`, `updated_at`) -- VALUES (6, 'Unverified', 'unverified', 3, 'User account verification required.', 0, 6, 0, '', 'Ticket will be open after user verifies his/her account.', '2016-06-14 09:07:04', '2016-06-14 09:07:04'); diff --git a/app/Http/Controllers/Agent/helpdesk/TicketController.php b/app/Http/Controllers/Agent/helpdesk/TicketController.php index 650734344..c3b976954 100644 --- a/app/Http/Controllers/Agent/helpdesk/TicketController.php +++ b/app/Http/Controllers/Agent/helpdesk/TicketController.php @@ -85,7 +85,7 @@ class TicketController extends Controller $tickets = Tickets::whereIn('status', [1, 7])->get(); } else { $dept = DB::table('department')->where('id', '=', Auth::user()->primary_dpt)->first(); - $tickets = Tickets::whereIn('status', [1, 7])->where('dept_id', '=', $dept->id)->get(); + $tickets = Tickets::whereIn('status', [1, 7])->where('dept_id', '=', $dept->id)->orWhere('assigned_to', '=', Auth::user()->id)->get(); } return $this->getTable($tickets); @@ -1508,10 +1508,10 @@ class TicketController extends Controller $agent = $user_detail->first_name; $agent_email = $user_detail->email; - + $ticket_link = route('ticket.thread', $id); $master = Auth::user()->first_name.' '.Auth::user()->last_name; try { - $this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('0', $ticket->dept_id), $to = ['name' => $agent, 'email' => $agent_email], $message = ['subject' => $ticket_subject.'[#'.$ticket_number.']', 'scenario' => 'assign-ticket'], $template_variables = ['ticket_agent_name' => $agent, 'ticket_number' => $ticket_number, 'ticket_assigner' => $master]); + $this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('0', $ticket->dept_id), $to = ['name' => $agent, 'email' => $agent_email], $message = ['subject' => $ticket_subject.'[#'.$ticket_number.']', 'scenario' => 'assign-ticket'], $template_variables = ['ticket_agent_name' => $agent, 'ticket_number' => $ticket_number, 'ticket_assigner' => $master, 'ticket_link' => $ticket_link]); } catch (\Exception $e) { return 0; } diff --git a/app/Http/Controllers/Auth/AuthController.php b/app/Http/Controllers/Auth/AuthController.php index 54d316f9e..0c0175d14 100644 --- a/app/Http/Controllers/Auth/AuthController.php +++ b/app/Http/Controllers/Auth/AuthController.php @@ -185,11 +185,6 @@ class AuthController extends Controller // Event for login \Event::fire(new \App\Events\LoginEvent($request)); $var = $this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => $name, 'email' => $request->input('email')], $message = ['subject' => null, 'scenario' => 'registration'], $template_variables = ['user' => $name, 'email_address' => $request->input('email'), 'password_reset_link' => url('account/activate/'.$code)]); - if ($var == null) { - $message12 = Lang::get('lang.failed_to_send_email_contact_administrator'); - - return redirect('home')->with('fails', $message12); - } else { if ($settings->status == 1 || $settings->status == '1') { if (count($sms) > 0) { if ($sms->status == 1 || $sms->status == '1') { @@ -203,7 +198,6 @@ class AuthController extends Controller } else { $message12 = Lang::get('lang.activate_your_account_click_on_Link_that_send_to_your_mail'); } - } return redirect('home')->with('success', $message12); } diff --git a/app/Http/Controllers/Common/PhpMailController.php b/app/Http/Controllers/Common/PhpMailController.php index faee32ff1..a95078f4d 100644 --- a/app/Http/Controllers/Common/PhpMailController.php +++ b/app/Http/Controllers/Common/PhpMailController.php @@ -110,6 +110,7 @@ class PhpMailController extends Controller if ($system_link === '') { $system_link = \Config::get('app.url'); } + $ticket_link = $this->checkElement('ticket_link', $template_variables); $system_error = $this->checkElement('system_error', $template_variables); $agent_sign = $this->checkElement('agent_sign', $template_variables); $department_sign = $this->checkElement('department_sign', $template_variables); @@ -147,9 +148,9 @@ class PhpMailController extends Controller } - $variables = ['{!!$user!!}', '{!!$agent!!}', '{!!$ticket_number!!}', '{!!$content!!}', '{!!$from!!}', '{!!$ticket_agent_name!!}', '{!!$ticket_client_name!!}', '{!!$ticket_client_email!!}', '{!!$ticket_body!!}', '{!!$ticket_assigner!!}', '{!!$ticket_link_with_number!!}', '{!!$system_error!!}', '{!!$agent_sign!!}', '{!!$department_sign!!}', '{!!$password_reset_link!!}', '{!!$email_address!!}', '{!!$user_password!!}', '{!!$system_from!!}', '{!!$system_link!!}']; + $variables = ['{!!$user!!}', '{!!$agent!!}', '{!!$ticket_number!!}', '{!!$content!!}', '{!!$from!!}', '{!!$ticket_agent_name!!}', '{!!$ticket_client_name!!}', '{!!$ticket_client_email!!}', '{!!$ticket_body!!}', '{!!$ticket_assigner!!}', '{!!$ticket_link_with_number!!}', '{!!$system_error!!}', '{!!$agent_sign!!}', '{!!$department_sign!!}', '{!!$password_reset_link!!}', '{!!$email_address!!}', '{!!$user_password!!}', '{!!$system_from!!}', '{!!$system_link!!}', '{!!$ticket_link!!}']; - $data = [$user, $agent, $ticket_number, $content, $from, $ticket_agent_name, $ticket_client_name, $ticket_client_email, $ticket_body, $ticket_assigner, $ticket_link_with_number, $system_error, $agent_sign, $department_sign, $password_reset_link, $email_address, $user_password, $system_from, $system_link]; + $data = [$user, $agent, $ticket_number, $content, $from, $ticket_agent_name, $ticket_client_name, $ticket_client_email, $ticket_body, $ticket_assigner, $ticket_link_with_number, $system_error, $agent_sign, $department_sign, $password_reset_link, $email_address, $user_password, $system_from, $system_link, $ticket_link]; foreach ($variables as $key => $variable) { $messagebody = str_replace($variables[$key], $data[$key], $contents); diff --git a/database/seeds/DatabaseSeeder.php b/database/seeds/DatabaseSeeder.php index 00f12934c..4ce3010ad 100644 --- a/database/seeds/DatabaseSeeder.php +++ b/database/seeds/DatabaseSeeder.php @@ -2007,7 +2007,7 @@ class DatabaseSeeder extends Seeder TemplateType::create(['id' => '13', 'name' => 'reset_new_password']); - Template::create(['id' => '1', 'variable' => '0', 'name' => 'This template is for sending notice to agent when ticket is assigned to them', 'type' => '1', 'message' => '
Hello {!!$ticket_agent_name!!},

Ticket No: {!!$ticket_number!!}
Has been assigned to you by {!!$ticket_assigner!!} 

Thank You
Kind Regards,
{!!$system_from!!}
', 'set_id' => '1']); + Template::create(['id' => '1', 'variable' => '0', 'name' => 'This template is for sending notice to agent when ticket is assigned to them', 'type' => '1', 'message' => '
Hello {!!$ticket_agent_name!!},

Ticket No: {!!$ticket_number!!}
Has been assigned to you by {!!$ticket_assigner!!}
Please check and resppond on the ticket.
Link: {!!$ticket_link!!}

Thank You
Kind Regards,
{!!$system_from!!}
', 'set_id' => '1']); Template::create(['id' => '2', 'variable' => '1', 'name' => 'This template is for sending notice to client with ticket link to check ticket without logging in to system', 'type' => '2', 'subject' => 'Check your Ticket', 'message' => '
Hello {!!$user!!},

Click the link below to view your requested ticket
{!!$ticket_link_with_number!!}

Kind Regards,
{!!$system_from!!}
', 'set_id' => '1']); Template::create(['id' => '3', 'variable' => '0', 'name' => 'This template is for sending notice to client when ticket status is changed to close', 'type' => '3', 'message' => '
Hello,

This message is regarding your ticket ID {!!$ticket_number!!}. We are changing the status of this ticket to "Closed" as the issue appears to be resolved.

Thank you
Kind regards,
{!!$system_from!!}
', 'set_id' => '1']); Template::create(['id' => '4', 'variable' => '0', 'name' => 'This template is for sending notice to client on successful ticket creation', 'type' => '4', 'message' => '
Hello {!!$user!!}

Thank you for contacting us. This is an automated response confirming the receipt of your ticket. Our team will get back to you as soon as possible. When replying, please make sure that the ticket ID is kept in the subject so that we can track your replies.

Ticket ID: {!!$ticket_number!!} 

{!!$department_sign!!}
You can check the status of or update this ticket online at: {!!$system_link!!}
', 'set_id' => '1']); diff --git a/resources/views/themes/default1/agent/layout/agent.blade.php b/resources/views/themes/default1/agent/layout/agent.blade.php index 0db04432d..66b78f5cb 100644 --- a/resources/views/themes/default1/agent/layout/agent.blade.php +++ b/resources/views/themes/default1/agent/layout/agent.blade.php @@ -266,7 +266,7 @@ //$inbox = App\Model\helpdesk\Ticket\Tickets::where('dept_id','',Auth::user()->primary_dpt)->get(); $myticket = App\Model\helpdesk\Ticket\Tickets::where('assigned_to', Auth::user()->id)->where('status', '1')->get(); $unassigned = App\Model\helpdesk\Ticket\Tickets::where('assigned_to', '=', null)->where('status', '=', '1')->where('dept_id', '=', Auth::user()->primary_dpt)->get(); - $tickets = App\Model\helpdesk\Ticket\Tickets::whereIn('status', array(1, 7))->where('dept_id', '=', Auth::user()->primary_dpt)->get(); + $tickets = App\Model\helpdesk\Ticket\Tickets::whereIn('status', array(1, 7))->where('dept_id', '=', Auth::user()->primary_dpt)->orWhere('assigned_to', '=', Auth::user()->id)->get(); $closingapproval = App\Model\helpdesk\Ticket\Tickets::where('status', '7')->get();