diff --git a/.env b/.env index 18df0e44d..1034f2d82 100644 --- a/.env +++ b/.env @@ -1,17 +1,17 @@ APP_ENV=local APP_DEBUG=false APP_KEY=SomeRandomString +DB_TYPE=mysql DB_HOST=localhost -DB_DATABASE=faveo-dev -DB_USERNAME=ladybird -DB_PASSWORD=ladybird -CACHE_DRIVER=file -SESSION_DRIVER=file -QUEUE_DRIVER=sync +DB_PORT= +DB_DATABASE=faveo +DB_USERNAME=root +DB_PASSWORD= MAIL_DRIVER=smtp MAIL_HOST=mailtrap.io MAIL_PORT=2525 MAIL_USERNAME=null MAIL_PASSWORD=null -DB_TYPE=mysql -DB_PORT= +CACHE_DRIVER=file +SESSION_DRIVER=file +QUEUE_DRIVER=sync diff --git a/README.md b/README.md index dc8679368..346be4803 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ -
Headquartered in Bangalore, Faveo HELPDESK provides Businesses with an automated Helpdesk system to manage customer support.
The word Faveo comes from Latin which means to be favourable. Which truly highlights vision and the scope as well as the functionality of the product that Faveo is. It is specifically designed to cater the needs of startups and SME’s empowering them with state of art, ticket based support system. In today’s competitive startup scenario customer retention is one of the major challenges. Handling client query diligently is all the difference between retaining or losing a long lasting relationship. The company is driven with passion of providing tools for managing consumer queries for strategic insights and helping companies take those decisive decisions.
-To date, Faveo has been integrated with 3 platforms and every month there is 1 to 2 update releases with new features & platform integration.
+To date, Faveo has been integrated with 6 platforms and every month there is 1 to 2 update releases with new features & platform integration.
Faveo can also be customised according to requirement and we do undertake such request.
diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php
index 28076e9e6..b538b2a8f 100644
--- a/app/Exceptions/Handler.php
+++ b/app/Exceptions/Handler.php
@@ -54,29 +54,30 @@ class Handler extends ExceptionHandler
*/
public function render($request, Exception $e)
{
- if ($e instanceof \Tymon\JWTAuth\Exceptions\TokenExpiredException) {
- return response()->json(['message' => $e->getMessage(), 'code' => $e->getStatusCode()]);
- } elseif ($e instanceof \Tymon\JWTAuth\Exceptions\TokenInvalidException) {
- return response()->json(['message' => $e->getMessage(), 'code' => $e->getStatusCode()]);
- }
- // This is to check if the debug is true or false
- if (config('app.debug') == false) {
- // checking if the error is actually an error page or if its an system error page
- if ($this->isHttpException($e) && $e->getStatusCode() == 404) {
- return response()->view('errors.404', []);
- } else {
- // checking if the application is installed
- if (\Config::get('database.install') == 1) {
- // checking if the error log send to Ladybirdweb is enabled or not
- if (\Config::get('app.ErrorLog') == '%1%') {
- //$this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => 'faveo logger', 'email' => 'faveoerrorlogger@gmail.com'], $message = ['subject' => 'Faveo downloaded from github has occured error', 'scenario' => 'error-report'], $template_variables = ['e' => $e]);
- }
- }
-
- return response()->view('errors.500', []);
- }
- }
- // returns non oops error message
+// $phpmail = new PhpMailController;
+// if ($e instanceof \Tymon\JWTAuth\Exceptions\TokenExpiredException) {
+// return response()->json(['message' => $e->getMessage(), 'code' => $e->getStatusCode()]);
+// } elseif ($e instanceof \Tymon\JWTAuth\Exceptions\TokenInvalidException) {
+// return response()->json(['message' => $e->getMessage(), 'code' => $e->getStatusCode()]);
+// }
+// // This is to check if the debug is true or false
+// if (config('app.debug') == false) {
+// // checking if the error is actually an error page or if its an system error page
+// if ($this->isHttpException($e) && $e->getStatusCode() == 404) {
+// return response()->view('errors.404', []);
+// } else {
+// // checking if the application is installed
+// if (\Config::get('database.install') == 1) {
+// // checking if the error log send to Ladybirdweb is enabled or not
+// if (\Config::get('app.ErrorLog') == '1') {
+// $this->phpmail->sendmail($from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => 'faveo logger', 'email' => 'faveoerrorlogger@gmail.com'], $message = ['subject' => 'Faveo downloaded from github has occured error', 'scenario' => 'error-report'], $template_variables = ['e' => $e]);
+// }
+// }
+//
+// return response()->view('errors.500', []);
+// }
+// }
+// // returns non oops error message
return parent::render($request, $e);
// checking if the error is related to http error i.e. page not found
if ($this->isHttpException($e)) {
diff --git a/app/Http/Controllers/Admin/helpdesk/AgentController.php b/app/Http/Controllers/Admin/helpdesk/AgentController.php
index b8ca005af..eb16521bf 100644
--- a/app/Http/Controllers/Admin/helpdesk/AgentController.php
+++ b/app/Http/Controllers/Admin/helpdesk/AgentController.php
@@ -4,7 +4,6 @@ namespace App\Http\Controllers\Admin\helpdesk;
// controller
use App\Http\Controllers\Common\PhpMailController;
-use App\Http\Controllers\Common\SettingsController;
use App\Http\Controllers\Controller;
// request
use App\Http\Requests\helpdesk\AgentRequest;
@@ -14,20 +13,16 @@ use App\Model\helpdesk\Agent\Assign_team_agent;
use App\Model\helpdesk\Agent\Department;
use App\Model\helpdesk\Agent\Groups;
use App\Model\helpdesk\Agent\Teams;
-use App\Model\helpdesk\Email\Emails;
-use App\Model\helpdesk\Settings\Company;
-use App\Model\helpdesk\Settings\Email;
use App\Model\helpdesk\Utility\Timezones;
use App\User;
// classes
use DB;
use Exception;
use Hash;
-use Mail;
/**
* AgentController
- * This controller is used to CRUD category.
+ * This controller is used to CRUD Agents.
*
* @author Ladybird
', $body);
- // var_dump($body);
- }
- $date = $mail->date;
- $datetime = $overview[0]->date;
- $date_time = explode(' ', $datetime);
- $date = $date_time[1].'-'.$date_time[2].'-'.$date_time[3].' '.$date_time[4];
- $date = date('Y-m-d H:i:s', strtotime($date));
- // dd($date);
-
- if (isset($mail->subject)) {
- $subject = $mail->subject;
+ if ($e_mail->fetching_encryption) {
+ $fetching_encryption = '/'.$e_mail->fetching_encryption;
} else {
- $subject = 'No Subject';
+ $fetching_encryption = '';
}
+ $protocol = $fetching_protocol.$fetching_encryption;
+ }
+ $imap_config = '{'.$host.':'.$port.$protocol.'}INBOX';
+ $password = Crypt::decrypt($e_mail->password);
+ $mailbox = new ImapMailbox($imap_config, $e_mail->email_address, $password, __DIR__);
+ $mails = [];
+ $mailsIds = $mailbox->searchMailBox('SINCE '.date('d-M-Y', strtotime('-1 day')));
+ if (!$mailsIds) {
+ die('Mailbox is empty');
+ }
+ foreach ($mailsIds as $mailId) {
+ $overview = $mailbox->get_overview($mailId);
+ $var = $overview[0]->seen ? 'read' : 'unread';
+ if ($var == 'unread') {
+ $mail = $mailbox->getMail($mailId);
+ if ($settings_email->first()->email_collaborator == 1) {
+ $collaborator = $mail->cc;
+ } else {
+ $collaborator = null;
+ }
+ $body = $mail->textHtml;
+ if ($body == null) {
+ $body = $mailbox->backup_getmail($mailId);
+ $body = str_replace('\r\n', '
', $body);
+ }
+ $date = $mail->date;
+ $datetime = $overview[0]->date;
+ $date_time = explode(' ', $datetime);
+ $date = $date_time[1].'-'.$date_time[2].'-'.$date_time[3].' '.$date_time[4];
+ $date = date('Y-m-d H:i:s', strtotime($date));
+ if (isset($mail->subject)) {
+ $subject = $mail->subject;
+ } else {
+ $subject = 'No Subject';
+ }
+ $fromname = $mail->fromName;
+ $fromaddress = $mail->fromAddress;
+ $ticket_source = Ticket_source::where('name', '=', 'email')->first();
+ $source = $ticket_source->id;
+ $phone = '';
- // dd($subject);
- $fromname = $mail->fromName;
- $fromaddress = $mail->fromAddress;
- $ticket_source = Ticket_source::where('name', '=', 'email')->first();
- $source = $ticket_source->id;
- $phone = '';
+ $assign = $get_helptopic->auto_assign;
+ $form_data = null;
+ $result = $this->TicketController->create_user($fromaddress, $fromname, $subject, $body, $phone, $helptopic, $sla, $priority, $source, $collaborator, $dept, $assign, $form_data);
+// dd($result);
+ if ($result[1] == true) {
+ $ticket_table = Tickets::where('ticket_number', '=', $result[0])->first();
+ $thread_id = Ticket_Thread::where('ticket_id', '=', $ticket_table->id)->max('id');
+// $thread_id = Ticket_Thread::whereRaw('id = (select max(`id`) from ticket_thread)')->first();
+ $thread_id = $thread_id;
- $assign = $get_helptopic->auto_assign;
- $form_data = null;
- $result = $this->TicketController->create_user($fromaddress, $fromname, $subject, $body, $phone, $helptopic, $sla, $priority, $source, $collaborator, $dept, $assign, $form_data);
- // dd($result);
- if ($result[1] == true) {
- $ticket_table = Tickets::where('ticket_number', '=', $result[0])->first();
- $thread_id = Ticket_Thread::where('ticket_id', '=', $ticket_table->id)->max('id');
- // $thread_id = Ticket_Thread::whereRaw('id = (select max(`id`) from ticket_thread)')->first();
- $thread_id = $thread_id;
+ foreach ($mail->getAttachments() as $attachment) {
+ $support = 'support';
+// echo $_SERVER['DOCUMENT_ROOT'];
+ $dir_img_paths = __DIR__;
+ $dir_img_path = explode('/code', $dir_img_paths);
+// dd($attachment->filePath);
+ $filepath = explode('../../../../../public', $attachment->filePath);
+// var_dump($attachment->filePath);
+// dd($filepath);
+// $path = $dir_img_path[0]."/code/public/".$filepath[1];
+ $path = public_path().$filepath[1];
+// dd($path);
+ $filesize = filesize($path);
+ $file_data = file_get_contents($path);
+ $ext = pathinfo($attachment->filePath, PATHINFO_EXTENSION);
+ $imageid = $attachment->id;
+ $string = str_replace('-', '', $attachment->name);
+ $filename = explode('src', $attachment->filePath);
+ $filename = str_replace('\\', '', $filename);
+ $body = str_replace('cid:'.$imageid, $filepath[1], $body);
+ $pos = strpos($body, $filepath[1]);
- foreach ($mail->getAttachments() as $attachment) {
- $support = 'support';
- // echo $_SERVER['DOCUMENT_ROOT'];
- $dir_img_paths = __DIR__;
- $dir_img_path = explode('/code', $dir_img_paths);
- // dd($attachment->filePath);
- $filepath = explode('../../../../../public', $attachment->filePath);
- // var_dump($attachment->filePath);
- // dd($filepath);
- // $path = $dir_img_path[0]."/code/public/".$filepath[1];
- $path = public_path().$filepath[1];
- // dd($path);
- $filesize = filesize($path);
- $file_data = file_get_contents($path);
- $ext = pathinfo($attachment->filePath, PATHINFO_EXTENSION);
- $imageid = $attachment->id;
- $string = str_replace('-', '', $attachment->name);
- $filename = explode('src', $attachment->filePath);
- $filename = str_replace('\\', '', $filename);
- $body = str_replace('cid:'.$imageid, $filepath[1], $body);
- $pos = strpos($body, $filepath[1]);
-
- if ($pos == false) {
- if ($settings_email->first()->attachment == 1) {
+ if ($pos == false) {
+ if ($settings_email->first()->attachment == 1) {
+ $upload = new Ticket_attachments();
+ $upload->file = $file_data;
+ $upload->thread_id = $thread_id;
+ $upload->name = $filepath[1];
+ $upload->type = $ext;
+ $upload->size = $filesize;
+ $upload->poster = 'ATTACHMENT';
+ $upload->save();
+ }
+ } else {
$upload = new Ticket_attachments();
$upload->file = $file_data;
$upload->thread_id = $thread_id;
$upload->name = $filepath[1];
$upload->type = $ext;
$upload->size = $filesize;
- $upload->poster = 'ATTACHMENT';
+ $upload->poster = 'INLINE';
$upload->save();
}
- } else {
- $upload = new Ticket_attachments();
- $upload->file = $file_data;
- $upload->thread_id = $thread_id;
- $upload->name = $filepath[1];
- $upload->type = $ext;
- $upload->size = $filesize;
- $upload->poster = 'INLINE';
- $upload->save();
+ unlink($path);
}
- unlink($path);
+ $body = Encoding::fixUTF8($body);
+ $thread = Ticket_Thread::where('id', '=', $thread_id)->first();
+ $thread->body = $this->separate_reply($body);
+ $thread->save();
}
- $body = Encoding::fixUTF8($body);
- $thread = Ticket_Thread::where('id', '=', $thread_id)->first();
- $thread->body = $this->separate_reply($body);
- $thread->save();
}
}
}
diff --git a/app/Http/Controllers/Agent/helpdesk/TicketController.php b/app/Http/Controllers/Agent/helpdesk/TicketController.php
index 52eaa34ea..1a576464c 100644
--- a/app/Http/Controllers/Agent/helpdesk/TicketController.php
+++ b/app/Http/Controllers/Agent/helpdesk/TicketController.php
@@ -81,7 +81,7 @@ class TicketController extends Controller
return \Datatable::collection(new Collection($tickets))
->addColumn('id', function ($ticket) {
- return "";
+ return "";
})
->addColumn('subject', function ($ticket) {
$subject = DB::table('ticket_thread')->select('title')->where('ticket_id', '=', $ticket->id)->first();
@@ -102,11 +102,10 @@ class TicketController extends Controller
} else {
$collabString = null;
}
- // dd($ticket->id);
+
$threads = Ticket_Thread::where('ticket_id', '=', $ticket->id)->first(); //
$count = Ticket_Thread::where('ticket_id', '=', $ticket->id)->count(); //Ticket_Thread::where('ticket_id', '=', $ticket->id)->get();
- // $count = count($threads);
- // dd($threads);
+
$attachment = Ticket_attachments::where('thread_id', '=', $threads->id)->get();
$attachCount = count($attachment);
if ($attachCount > 0) {
@@ -114,7 +113,6 @@ class TicketController extends Controller
} else {
$attachString = '';
}
- //return $threads->id;
return "id])."' title='".$subject->title."'>".$string." (".$count.")".$collabString.$attachString;
})
@@ -125,7 +123,6 @@ class TicketController extends Controller
$priority = DB::table('ticket_priority')->select('priority_desc', 'priority_color')->where('priority_id', '=', $ticket->priority_id)->first();
return ''.$priority->priority_desc.'';
- //return "loda";
})
->addColumn('from', function ($ticket) {
$from = DB::table('users')->select('user_name')->where('id', '=', $ticket->user_id)->first();
@@ -182,20 +179,15 @@ class TicketController extends Controller
public function get_open()
{
if (Auth::user()->role == 'admin') {
- // $tickets = Tickets::where('status','=',1)->get();;
-
- $tickets = Tickets::where('status', '=', 1)->where('isanswered', '=', 0)->where('assigned_to', '=', 0)->get();
+ $tickets = Tickets::where('status', '=', 1)->where('isanswered', '=', 0)->get();
} else {
- // $dept = DB::table('department')->where('name','=',Auth::user()->primary_dpt)->first();
- // $tickets = Tickets::where('status',1)->where('dept_id', '=', $dept->id)->get();
-
$dept = Department::where('id', '=', Auth::user()->primary_dpt)->first();
- $tickets = Tickets::where('status', '=', 1)->where('isanswered', '=', 0)->where('assigned_to', '=', 0)->where('dept_id', '=', $dept->id)->get();
+ $tickets = Tickets::where('status', '=', 1)->where('isanswered', '=', 0)->where('dept_id', '=', $dept->id)->get();
}
return \Datatable::collection(new Collection($tickets))
->addColumn('id', function ($ticket) {
- return "";
+ return "";
})
->addColumn('subject', function ($ticket) {
$subject = DB::table('ticket_thread')->select('title')->where('ticket_id', '=', $ticket->id)->first();
@@ -225,7 +217,6 @@ class TicketController extends Controller
} else {
$attachString = '';
}
- //return $threads->id;
return "id])."' title='".$subject->title."'>".$string." (".$count.")".$collabString.$attachString;
})
@@ -236,7 +227,6 @@ class TicketController extends Controller
$priority = DB::table('ticket_priority')->select('priority_desc', 'priority_color')->where('priority_id', '=', $ticket->priority_id)->first();
return ''.$priority->priority_desc.'';
- //return "loda";
})
->addColumn('from', function ($ticket) {
$from = DB::table('users')->select('user_name')->where('id', '=', $ticket->user_id)->first();
@@ -244,7 +234,7 @@ class TicketController extends Controller
return "".$from->user_name.'';
})
->addColumn('Last Replier', function ($ticket) {
- $TicketData = Ticket_Thread::where('ticket_id', '=', $ticket->id)->max('id');
+ $TicketData = Ticket_Thread::where('ticket_id', '=', $ticket->id)->where('is_internal', '=', 0)->max('id');
$TicketDatarow = Ticket_Thread::where('id', '=', $TicketData)->first();
$LastResponse = User::where('id', '=', $TicketDatarow->user_id)->first();
if ($LastResponse->role == 'user') {
@@ -273,7 +263,6 @@ class TicketController extends Controller
$TicketData = Ticket_Thread::where('ticket_id', '=', $ticket->id)->max('id');
$TicketDatarow = Ticket_Thread::select('updated_at')->where('id', '=', $TicketData)->first();
- // return date('d F Y, H:i:s', strtotime($TicketDatarow->updated_at));
return UTC::usertimezone($TicketDatarow->updated_at);
})
->searchColumns('subject', 'from', 'assigned_to', 'ticket_number', 'priority')
@@ -294,20 +283,15 @@ class TicketController extends Controller
public function get_answered()
{
if (Auth::user()->role == 'admin') {
- // $tickets = Tickets::where('status', '=', 1)->where('assigned_to', '=', Auth::user()->id)->get();
-
$tickets = Tickets::where('status', '=', 1)->where('isanswered', '=', 1)->get();
} else {
- // $dept = Department::where('name','=',Auth::user()->primary_dpt)->first();
- // $tickets = Tickets::where('status', '=', 1)->where('assigned_to', '=', Auth::user()->id)->get();
-
$dept = Department::where('id', '=', Auth::user()->primary_dpt)->first();
$tickets = Tickets::where('status', '=', 1)->where('isanswered', '=', 1)->where('dept_id', '=', $dept->id)->get();
}
return \Datatable::collection(new Collection($tickets))
->addColumn('id', function ($ticket) {
- return "";
+ return "";
})
->addColumn('subject', function ($ticket) {
$subject = DB::table('ticket_thread')->select('title')->where('ticket_id', '=', $ticket->id)->first();
@@ -337,7 +321,6 @@ class TicketController extends Controller
} else {
$attachString = '';
}
- //return $threads->id;
return "id])."' title='".$subject->title."'>".$string." (".$count.")".$collabString.$attachString;
})
@@ -348,7 +331,6 @@ class TicketController extends Controller
$priority = DB::table('ticket_priority')->select('priority_desc', 'priority_color')->where('priority_id', '=', $ticket->priority_id)->first();
return ''.$priority->priority_desc.'';
- //return "loda";
})
->addColumn('from', function ($ticket) {
$from = DB::table('users')->select('user_name')->where('id', '=', $ticket->user_id)->first();
@@ -385,7 +367,6 @@ class TicketController extends Controller
$TicketData = Ticket_Thread::where('ticket_id', '=', $ticket->id)->max('id');
$TicketDatarow = Ticket_Thread::select('updated_at')->where('id', '=', $TicketData)->first();
- // return date('d F Y, H:i:s', strtotime($TicketDatarow->updated_at));
return UTC::usertimezone($TicketDatarow->updated_at);
})
->searchColumns('subject', 'from', 'assigned_to', 'ticket_number', 'priority')
@@ -414,7 +395,7 @@ class TicketController extends Controller
return \Datatable::collection(new Collection($tickets))
->addColumn('id', function ($ticket) {
- return "";
+ return "";
})
->addColumn('subject', function ($ticket) {
$subject = DB::table('ticket_thread')->select('title')->where('ticket_id', '=', $ticket->id)->first();
@@ -444,7 +425,6 @@ class TicketController extends Controller
} else {
$attachString = '';
}
- //return $threads->id;
return "id])."' title='".$subject->title."'>".$string." (".$count.")".$collabString.$attachString;
})
@@ -455,7 +435,6 @@ class TicketController extends Controller
$priority = DB::table('ticket_priority')->select('priority_desc', 'priority_color')->where('priority_id', '=', $ticket->priority_id)->first();
return ''.$priority->priority_desc.'';
- //return "loda";
})
->addColumn('from', function ($ticket) {
$from = DB::table('users')->select('user_name')->where('id', '=', $ticket->user_id)->first();
@@ -492,7 +471,6 @@ class TicketController extends Controller
$TicketData = Ticket_Thread::where('ticket_id', '=', $ticket->id)->max('id');
$TicketDatarow = Ticket_Thread::select('updated_at')->where('id', '=', $TicketData)->first();
- // return date('d F Y, H:i:s', strtotime($TicketDatarow->updated_at));
return UTC::usertimezone($TicketDatarow->updated_at);
})
->searchColumns('subject', 'from', 'assigned_to', 'ticket_number', 'priority')
@@ -531,7 +509,7 @@ class TicketController extends Controller
return \Datatable::collection(new Collection($tickets))
->addColumn('id', function ($ticket) {
- return "";
+ return "";
})
->addColumn('subject', function ($ticket) {
$subject = DB::table('ticket_thread')->select('title')->where('ticket_id', '=', $ticket->id)->first();
@@ -561,7 +539,7 @@ class TicketController extends Controller
} else {
$attachString = '';
}
- //return $threads->id;
+
return "id])."' title='".$subject->title."'>".$string." (".$count.")".$collabString.$attachString;
})
->addColumn('ticket_number', function ($ticket) {
@@ -571,7 +549,6 @@ class TicketController extends Controller
$priority = DB::table('ticket_priority')->select('priority_desc', 'priority_color')->where('priority_id', '=', $ticket->priority_id)->first();
return ''.$priority->priority_desc.'';
- //return "loda";
})
->addColumn('from', function ($ticket) {
$from = DB::table('users')->select('user_name')->where('id', '=', $ticket->user_id)->first();
@@ -608,7 +585,6 @@ class TicketController extends Controller
$TicketData = Ticket_Thread::where('ticket_id', '=', $ticket->id)->max('id');
$TicketDatarow = Ticket_Thread::select('updated_at')->where('id', '=', $TicketData)->first();
- // return date('d F Y, H:i:s', strtotime($TicketDatarow->updated_at));
return UTC::usertimezone($TicketDatarow->updated_at);
})
->searchColumns('subject', 'from', 'assigned_to', 'ticket_number', 'priority')
@@ -637,7 +613,7 @@ class TicketController extends Controller
return \Datatable::collection(new Collection($tickets))
->addColumn('id', function ($ticket) {
- return "";
+ return "";
})
->addColumn('subject', function ($ticket) {
$subject = DB::table('ticket_thread')->select('title')->where('ticket_id', '=', $ticket->id)->first();
@@ -667,7 +643,6 @@ class TicketController extends Controller
} else {
$attachString = '';
}
- //return $threads->id;
return "id])."' title='".$subject->title."'>".$string." (".$count.")".$collabString.$attachString;
})
@@ -678,7 +653,6 @@ class TicketController extends Controller
$priority = DB::table('ticket_priority')->select('priority_desc', 'priority_color')->where('priority_id', '=', $ticket->priority_id)->first();
return ''.$priority->priority_desc.'';
- //return "loda";
})
->addColumn('from', function ($ticket) {
$from = DB::table('users')->select('user_name')->where('id', '=', $ticket->user_id)->first();
@@ -715,7 +689,6 @@ class TicketController extends Controller
$TicketData = Ticket_Thread::where('ticket_id', '=', $ticket->id)->max('id');
$TicketDatarow = Ticket_Thread::select('updated_at')->where('id', '=', $TicketData)->first();
- // return date('d F Y, H:i:s', strtotime($TicketDatarow->updated_at));
return UTC::usertimezone($TicketDatarow->updated_at);
})
->searchColumns('subject', 'from', 'assigned_to', 'ticket_number', 'priority')
@@ -768,8 +741,6 @@ class TicketController extends Controller
return Redirect('newticket')->with('fails', 'fails');
}
} catch (Exception $e) {
- // dd($e);
-
return Redirect()->back()->with('fails', ''.$user->user_name.'
'.$data->user_name.'
Alert!
Alert!
Alert!
Alert!
'.$user->user_name.'
'.$data->user_name.'
'.$reason;
$new_thread->format = $thread->format;
$new_thread->ip_address = $thread->ip_address;
- //$new_thread->save();
$new_parent_thread = new Ticket_thread();
$new_parent_thread->ticket_id = $p_id;
@@ -2705,7 +2506,6 @@ class TicketController extends Controller
$new_parent_thread->body = Lang::get('lang.ticket')." #".$ticket->ticket_number.' '.Lang::get('lang.ticket_merged').'
'.$reason;
$new_parent_thread->format = $parent_thread->format;
$new_parent_thread->ip_address = $parent_thread->ip_address;
- //$new_parent_thread->save();
if ($new_thread->save() && $new_parent_thread->save()) {
$success = 1;
} else {
diff --git a/app/Http/Controllers/Agent/helpdesk/UserController.php b/app/Http/Controllers/Agent/helpdesk/UserController.php
index b8376c49e..7ede3d829 100644
--- a/app/Http/Controllers/Agent/helpdesk/UserController.php
+++ b/app/Http/Controllers/Agent/helpdesk/UserController.php
@@ -38,7 +38,6 @@ class UserController extends Controller
* 1. authentication
* 2. user roles
* 3. roles must be agent.
- *
* @return void
*/
public function __construct()
@@ -51,9 +50,7 @@ class UserController extends Controller
/**
* Display all list of the users.
- *
* @param type User $user
- *
* @return type view
*/
public function index()
@@ -68,15 +65,14 @@ class UserController extends Controller
/**
* This function is used to display the list of users using chumper datatables.
- *
* @return datatable
*/
public function user_list()
{
// displaying list of users with chumper datatables
return \Datatable::collection(User::where('role', '!=', 'admin')->where('role', '!=', 'agent')->get())
- /* searchable column username */
- ->searchColumns('user_name')
+ /* searchable column username and email*/
+ ->searchColumns('user_name', 'email', 'phone')
/* order column username and email */
->orderColumns('user_name', 'email')
/* column username */
@@ -85,14 +81,14 @@ class UserController extends Controller
$username = substr($model->user_name, 0, 30);
$username = substr($username, 0, strrpos($username, ' ')).' ...';
} else {
- $username = $model->user_name;
+ $username = "id)."'>".$model->user_name."";
}
return $username;
})
/* column email */
->addColumn('email', function ($model) {
- $email = $model->email;
+ $email = "id)."'>".$model->email."";
return $email;
})
@@ -147,7 +143,6 @@ class UserController extends Controller
/**
* Show the form for creating a new users.
- *
* @return type view
*/
public function create()
@@ -161,10 +156,8 @@ class UserController extends Controller
/**
* Store a newly created users in storage.
- *
* @param type User $user
* @param type Sys_userRequest $request
- *
* @return type redirect
*/
public function store(User $user, Sys_userRequest $request)
@@ -191,10 +184,8 @@ class UserController extends Controller
/**
* Display the specified users.
- *
* @param type int $id
* @param type User $user
- *
* @return type view
*/
public function show($id, User $user)
@@ -211,10 +202,8 @@ class UserController extends Controller
/**
* Show the form for editing the specified resource.
- *
* @param type int $id
* @param type User $user
- *
* @return type Response
*/
public function edit($id, User $user)
@@ -231,16 +220,13 @@ class UserController extends Controller
/**
* Update the specified user in storage.
- *
* @param type int $id
* @param type User $user
* @param type Sys_userUpdate $request
- *
* @return type Response
*/
public function update($id, User $user, Sys_userUpdate $request)
{
-
/* select the field where id = $id(request Id) */
$users = $user->whereId($id)->first();
/* Update the value by selected field */
@@ -257,7 +243,6 @@ class UserController extends Controller
/**
* get agent profile page.
- *
* @return type view
*/
public function getProfile()
@@ -272,7 +257,6 @@ class UserController extends Controller
/**
* get profile edit page.
- *
* @return type view
*/
public function getProfileedit()
@@ -287,10 +271,8 @@ class UserController extends Controller
/**
* post profile edit.
- *
* @param type int $id
* @param type ProfileRequest $request
- *
* @return type Redirect
*/
public function postProfileedit(ProfileRequest $request)
@@ -339,10 +321,8 @@ class UserController extends Controller
/**
* Post profile password.
- *
* @param type int $id
* @param type ProfilePassword $request
- *
* @return type Redirect
*/
public function postProfilePassword($id, ProfilePassword $request)
@@ -354,7 +334,6 @@ class UserController extends Controller
$user->password = Hash::make($request->input('new_password'));
try {
$user->save();
-
return redirect('profile-edit')->with('success1', 'Password Updated sucessfully');
} catch (Exception $e) {
return redirect('profile-edit')->with('fails', $e->errorInfo[2]);
@@ -366,9 +345,7 @@ class UserController extends Controller
/**
* Assigning an user to an organization.
- *
* @param type $id
- *
* @return type boolean
*/
public function UserAssignOrg($id)
@@ -378,15 +355,12 @@ class UserController extends Controller
$user_org->org_id = $org;
$user_org->user_id = $id;
$user_org->save();
-
return 1;
}
/**
* creating an organization in user profile page via modal popup.
- *
* @param type $id
- *
* @return type
*/
public function User_Create_Org($id)
diff --git a/app/Http/Controllers/Api/v1/ApiController.php b/app/Http/Controllers/Api/v1/ApiController.php
index c7aa3a5aa..91dab4449 100644
--- a/app/Http/Controllers/Api/v1/ApiController.php
+++ b/app/Http/Controllers/Api/v1/ApiController.php
@@ -555,9 +555,10 @@ class ApiController extends Controller
$result[$key]['picture'] = $path;
}
$result = $this->createPagination($result, 10);
+ //dd($result);
//$result->toJson();
return $result->toJson();
- } catch (Exception $e) {
+ } catch (\Exception $e) {
$error = $e->getMessage();
$line = $e->getLine();
$file = $e->getFile();
diff --git a/app/Http/Controllers/Api/v1/ApiExceptAuthController.php b/app/Http/Controllers/Api/v1/ApiExceptAuthController.php
new file mode 100644
index 000000000..7480f60d6
--- /dev/null
+++ b/app/Http/Controllers/Api/v1/ApiExceptAuthController.php
@@ -0,0 +1,114 @@
+request = $request;
+ $this->middleware('api');
+ }
+
+ /**
+ * Check the url is valid or not.
+ *
+ * @return json
+ */
+ public function checkUrl()
+ {
+ //dd($this->request);
+ try {
+ $v = \Validator::make($this->request->all(), [
+ 'url' => 'required|url',
+ ]);
+ if ($v->fails()) {
+ $error = $v->errors();
+
+ return response()->json(compact('error'));
+ }
+
+ $url = $this->request->input('url');
+ $url = $url.'/api/v1/helpdesk/check-url';
+ $result = $this->CallGetApi($url);
+// dd($result);
+ return response()->json(compact('result'));
+ } catch (\Exception $ex) {
+ $error = $ex->getMessage();
+
+ return $error;
+ } catch (\Symfony\Component\HttpKernel\Exception\HttpException $ex) {
+ return ['status' => 'fails', 'code' => $ex->getStatusCode()];
+ }
+ }
+
+ /**
+ * Success for currect url.
+ *
+ * @return string
+ */
+ public function urlResult()
+ {
+ try {
+ $result = ['status' => 'success'];
+
+ return $result;
+ } catch (\Symfony\Component\HttpKernel\Exception\HttpException $ex) {
+ return ['status' => 'fails', 'code' => $ex->getStatusCode()];
+ }
+ }
+
+ /**
+ * Call curl function for Get Method.
+ *
+ * @param type $url
+ *
+ * @return type int|string|json
+ */
+ public function callGetApi($url)
+ {
+ $curl = curl_init($url);
+ curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
+ curl_setopt($curl, CURLOPT_URL, $url);
+ curl_setopt($curl, CURLOPT_HEADER, 0);
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
+ $response = curl_exec($curl);
+
+ if (curl_errno($curl)) {
+ //echo 'error:' . curl_error($curl);
+ }
+
+ return $response;
+ curl_close($curl);
+ }
+
+ /**
+ * Call curl function for POST Method.
+ *
+ * @param type $url
+ * @param type $data
+ *
+ * @return type int|string|json
+ */
+ public function callPostApi($url, $data)
+ {
+ $curl = curl_init($url);
+ curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
+ curl_setopt($curl, CURLOPT_URL, $url);
+ curl_setopt($curl, CURLOPT_HEADER, 0);
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
+ curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
+ $response = curl_exec($curl);
+
+ if (curl_errno($curl)) {
+ echo 'error:'.curl_error($curl);
+ }
+
+ return $response;
+ curl_close($curl);
+ }
+}
diff --git a/app/Http/Controllers/Api/v1/TestController.php b/app/Http/Controllers/Api/v1/TestController.php
index d4631539a..ab961cad1 100644
--- a/app/Http/Controllers/Api/v1/TestController.php
+++ b/app/Http/Controllers/Api/v1/TestController.php
@@ -473,6 +473,13 @@ class TestController extends Controller
public function getCustomersWith()
{
try {
+ //dd($this->server);
+ $url = $this->server.'helpdesk/customers-custom?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token='.\Config::get('app.token');
+ $_this = new self();
+ $respose = $_this->callGetApi($url);
+ dd($respose);
+
+ return $respose;
} catch (\Exception $e) {
$error = $e->getMessage();
$line = $e->getLine();
diff --git a/app/Http/Controllers/Client/helpdesk/ClientTicketController.php b/app/Http/Controllers/Client/helpdesk/ClientTicketController.php
index e92d9ac6d..66eb363c3 100644
--- a/app/Http/Controllers/Client/helpdesk/ClientTicketController.php
+++ b/app/Http/Controllers/Client/helpdesk/ClientTicketController.php
@@ -64,6 +64,7 @@ class ClientTicketController extends Controller
$tickets->closed = 0;
$tickets->reopened_at = date('Y-m-d H:i:s');
$tickets->reopened = 1;
+ $tickets->isanswered = 0;
$threads = new Ticket_Thread();
$threads->user_id = Auth::user()->id;
$threads->ticket_id = $tickets->id;
diff --git a/app/Http/Controllers/Common/PhpMailController.php b/app/Http/Controllers/Common/PhpMailController.php
index 24b766079..283bc710a 100644
--- a/app/Http/Controllers/Common/PhpMailController.php
+++ b/app/Http/Controllers/Common/PhpMailController.php
@@ -10,13 +10,16 @@ use App\Model\helpdesk\Settings\Email;
use App\User;
use Auth;
-class PhpMailController extends Controller
-{
- public function fetch_smtp_details($id)
- {
- $emails = Emails::where('id', '=', $id)->first();
+class PhpMailController extends Controller {
- return $emails;
+ public function fetch_smtp_details($id) {
+ $emails = Emails::where('id', '=', $id)->first();
+ if ($emails->sending_status == 1) {
+ return $emails;
+ } else {
+ $emails = null;
+ return $emails;
+ }
}
/**
@@ -24,231 +27,235 @@ class PhpMailController extends Controller
*
* @return Mail
*/
- public function sendmail($from, $to, $message, $template_variables)
- {
+ public function sendmail($from, $to, $message, $template_variables) {
// dd($from);
$from_address = $this->fetch_smtp_details($from);
+ if ($from_address == null) {
+ return $from_address;
+ } else {
+ // dd($from_address);
+ $username = $from_address->email_address;
+ $fromname = $from_address->email_name;
+ $password = \Crypt::decrypt($from_address->password);
+ $smtpsecure = $from_address->sending_encryption;
+ $host = $from_address->sending_host;
+ $port = $from_address->sending_port;
- // dd($from_address);
- $username = $from_address->email_address;
- $fromname = $from_address->email_name;
- $password = \Crypt::decrypt($from_address->password);
- $smtpsecure = $from_address->sending_encryption;
- $host = $from_address->sending_host;
- $port = $from_address->sending_port;
+ if (isset($to['email'])) {
+ $recipants = $to['email'];
+ } else {
+ $recipants = null;
+ }
+ if (isset($to['name'])) {
+ $recipantname = $to['name'];
+ } else {
+ $recipantname = null;
+ }
+ if (isset($to['cc'])) {
+ $cc = $to['cc'];
+ } else {
+ $cc = null;
+ }
+ if (isset($to['bc'])) {
+ $bc = $to['bc'];
+ } else {
+ $bc = null;
+ }
+ if (isset($message['subject'])) {
+ $subject = $message['subject'];
+ } else {
+ $subject = null;
+ }
+ if (isset($message['body'])) {
+ $content = $message['body'];
+ } else {
+ $content = null;
+ }
+ if (isset($message['scenario'])) {
+ $template = $message['scenario'];
+ } else {
+ $template = null;
+ }
+ if (isset($message['attachments'])) {
+ $attachment = $message['attachments'];
+ } else {
+ $attachment = null;
+ }
- if (isset($to['email'])) {
- $recipants = $to['email'];
- } else {
- $recipants = null;
- }
- if (isset($to['name'])) {
- $recipantname = $to['name'];
- } else {
- $recipantname = null;
- }
- if (isset($to['cc'])) {
- $cc = $to['cc'];
- } else {
- $cc = null;
- }
- if (isset($to['bc'])) {
- $bc = $to['bc'];
- } else {
- $bc = null;
- }
- if (isset($message['subject'])) {
- $subject = $message['subject'];
- } else {
- $subject = null;
- }
- if (isset($message['body'])) {
- $content = $message['body'];
- } else {
- $content = null;
- }
- if (isset($message['scenario'])) {
- $template = $message['scenario'];
- } else {
- $template = null;
- }
- if (isset($message['attachments'])) {
- $attachment = $message['attachments'];
- } else {
- $attachment = null;
- }
+ // template variables
+ if (Auth::user()) {
+ $agent = Auth::user()->user_name;
+ } else {
+ $agent = null;
+ }
+ if (isset($template_variables['ticket_agent_name'])) {
+ $ticket_agent_name = $template_variables['ticket_agent_name'];
+ } else {
+ $ticket_agent_name = null;
+ }
+ if (isset($template_variables['ticket_number'])) {
+ $ticket_number = $template_variables['ticket_number'];
+ } else {
+ $ticket_number = null;
+ }
+ if (isset($template_variables['ticket_client_name'])) {
+ $ticket_client_name = $template_variables['ticket_client_name'];
+ } else {
+ $ticket_client_name = null;
+ }
+ if (isset($template_variables['ticket_client_email'])) {
+ $ticket_client_email = $template_variables['ticket_client_email'];
+ } else {
+ $ticket_client_email = null;
+ }
+ if (isset($template_variables['ticket_body'])) {
+ $ticket_body = $template_variables['ticket_body'];
+ } else {
+ $ticket_body = null;
+ }
+ if (isset($template_variables['ticket_assigner'])) {
+ $ticket_assigner = $template_variables['ticket_assigner'];
+ } else {
+ $ticket_assigner = null;
+ }
+ if (isset($template_variables['ticket_link_with_number'])) {
+ $ticket_link_with_number = $template_variables['ticket_link_with_number'];
+ } else {
+ $ticket_link_with_number = null;
+ }
+ // if (isset($template_variables['system_from'])) {
+ // $system_from = $template_variables['system_from'];
+ // } else {
+ // $system_from = null;
+ // }
+ if (isset($template_variables['system_link'])) {
+ $system_link = $template_variables['system_link'];
+ } else {
+ $system_link = null;
+ }
+ if (isset($template_variables['system_error'])) {
+ $system_error = $template_variables['system_error'];
+ } else {
+ $system_error = null;
+ }
+ if (isset($template_variables['agent_sign'])) {
+ $agent_sign = $template_variables['agent_sign'];
+ } else {
+ $agent_sign = null;
+ }
+ if (isset($template_variables['department_sign'])) {
+ $department_sign = $template_variables['department_sign'];
+ } else {
+ $department_sign = null;
+ }
+ if (isset($template_variables['password_reset_link'])) {
+ $password_reset_link = $template_variables['password_reset_link'];
+ } else {
+ $password_reset_link = null;
+ }
+ if (isset($template_variables['user_password'])) {
+ $user_password = $template_variables['user_password'];
+ } else {
+ $user_password = null;
+ }
+ if (isset($template_variables['email_address'])) {
+ $email_address = $template_variables['email_address'];
+ } else {
+ $email_address = null;
+ }
+ if (isset($template_variables['user'])) {
+ $user = $template_variables['user'];
+ } else {
+ $user = null;
+ }
- // template variables
- if (Auth::user()) {
- $agent = Auth::user()->user_name;
- } else {
- $agent = null;
- }
- if (isset($template_variables['ticket_agent_name'])) {
- $ticket_agent_name = $template_variables['ticket_agent_name'];
- } else {
- $ticket_agent_name = null;
- }
- if (isset($template_variables['ticket_number'])) {
- $ticket_number = $template_variables['ticket_number'];
- } else {
- $ticket_number = null;
- }
- if (isset($template_variables['ticket_client_name'])) {
- $ticket_client_name = $template_variables['ticket_client_name'];
- } else {
- $ticket_client_name = null;
- }
- if (isset($template_variables['ticket_client_email'])) {
- $ticket_client_email = $template_variables['ticket_client_email'];
- } else {
- $ticket_client_email = null;
- }
- if (isset($template_variables['ticket_body'])) {
- $ticket_body = $template_variables['ticket_body'];
- } else {
- $ticket_body = null;
- }
- if (isset($template_variables['ticket_assigner'])) {
- $ticket_assigner = $template_variables['ticket_assigner'];
- } else {
- $ticket_assigner = null;
- }
- if (isset($template_variables['ticket_link_with_number'])) {
- $ticket_link_with_number = $template_variables['ticket_link_with_number'];
- } else {
- $ticket_link_with_number = null;
- }
- // if (isset($template_variables['system_from'])) {
- // $system_from = $template_variables['system_from'];
- // } else {
- // $system_from = null;
- // }
- if (isset($template_variables['system_link'])) {
- $system_link = $template_variables['system_link'];
- } else {
- $system_link = null;
- }
- if (isset($template_variables['system_error'])) {
- $system_error = $template_variables['system_error'];
- } else {
- $system_error = null;
- }
- if (isset($template_variables['agent_sign'])) {
- $agent_sign = $template_variables['agent_sign'];
- } else {
- $agent_sign = null;
- }
- if (isset($template_variables['department_sign'])) {
- $department_sign = $template_variables['department_sign'];
- } else {
- $department_sign = null;
- }
- if (isset($template_variables['password_reset_link'])) {
- $password_reset_link = $template_variables['password_reset_link'];
- } else {
- $password_reset_link = null;
- }
- if (isset($template_variables['user_password'])) {
- $user_password = $template_variables['user_password'];
- } else {
- $user_password = null;
- }
- if (isset($template_variables['email_address'])) {
- $email_address = $template_variables['email_address'];
- } else {
- $email_address = null;
- }
- if (isset($template_variables['user'])) {
- $user = $template_variables['user'];
- } else {
- $user = null;
- }
+ $system_link = url('/');
- $system_link = url('/');
+ $system_from = $this->company();
- $system_from = $this->company();
+ $mail = new \PHPMailer();
- $mail = new \PHPMailer();
+ $status = \DB::table('settings_email')->first();
- $status = \DB::table('settings_email')->first();
+ $path2 = \Config::get('view.paths');
- $path2 = \Config::get('view.paths');
+ $directory = $path2[0] . '\emails' . DIRECTORY_SEPARATOR . $status->template . DIRECTORY_SEPARATOR;
- $directory = $path2[0].'\emails'.DIRECTORY_SEPARATOR.$status->template.DIRECTORY_SEPARATOR;
+ $handle = fopen($directory . $template . '.blade.php', 'r');
+ $contents = fread($handle, filesize($directory . $template . '.blade.php'));
+ fclose($handle);
- $handle = fopen($directory.$template.'.blade.php', 'r');
- $contents = fread($handle, filesize($directory.$template.'.blade.php'));
- fclose($handle);
+ $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!!}'];
+ $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];
+ // dd($variables,$data,$contents);
+ // $messagebody = str_replace($variables, $data, $contents);
- // dd($variables,$data,$contents);
- // $messagebody = str_replace($variables, $data, $contents);
+ foreach ($variables as $key => $variable) {
+ $messagebody = str_replace($variables[$key], $data[$key], $contents);
+ // dd($messagebody);
+
+ $contents = $messagebody;
+ }
- foreach ($variables as $key => $variable) {
- $messagebody = str_replace($variables[$key], $data[$key], $contents);
// dd($messagebody);
+ //$mail->SMTPDebug = 3; // Enable verbose debug output
- $contents = $messagebody;
- }
+ $mail->isSMTP(); // Set mailer to use SMTP
+ $mail->Host = $host; // Specify main and backup SMTP servers
+ $mail->SMTPAuth = true; // Enable SMTP authentication
+ $mail->Username = $username; // SMTP username
+ $mail->Password = $password; // SMTP password
+ $mail->SMTPSecure = $smtpsecure; // Enable TLS encryption, `ssl` also accepted
+ $mail->Port = $port; // TCP port to connect to
- // dd($messagebody);
- //$mail->SMTPDebug = 3; // Enable verbose debug output
-
- $mail->isSMTP(); // Set mailer to use SMTP
- $mail->Host = $host; // Specify main and backup SMTP servers
- $mail->SMTPAuth = true; // Enable SMTP authentication
- $mail->Username = $username; // SMTP username
- $mail->Password = $password; // SMTP password
- $mail->SMTPSecure = $smtpsecure; // Enable TLS encryption, `ssl` also accepted
- $mail->Port = $port; // TCP port to connect to
-
- $mail->setFrom($username, $fromname);
- $mail->addAddress($recipants); // Add a recipient
- // Name is optional
- // $mail->addReplyTo('sada059@gmail.com', 'Information');
- // Optional name
- $mail->isHTML(true); // Set email format to HTML
- if ($cc != null) {
- foreach ($cc as $collaborator) {
- //mail to collaborators
- $collab_user_id = $collaborator->user_id;
- $user_id_collab = User::where('id', '=', $collab_user_id)->first();
- $collab_email = $user_id_collab->email;
- $mail->addCC($collab_email);
+ $mail->setFrom($username, $fromname);
+ $mail->addAddress($recipants); // Add a recipient
+ // Name is optional
+ // $mail->addReplyTo('sada059@gmail.com', 'Information');
+ // Optional name
+ $mail->isHTML(true); // Set email format to HTML
+ if ($cc != null) {
+ foreach ($cc as $collaborator) {
+ //mail to collaborators
+ $collab_user_id = $collaborator->user_id;
+ $user_id_collab = User::where('id', '=', $collab_user_id)->first();
+ $collab_email = $user_id_collab->email;
+ $mail->addCC($collab_email);
+ }
}
- }
- $mail->addBCC($bc);
+ $mail->addBCC($bc);
- if ($attachment != null) {
- $size = count($message['attachments']);
- $attach = $message['attachments'];
- for ($i = 0; $i < $size; $i++) {
- $file_path = $attach[$i]->getRealPath();
- $file_name = $attach[$i]->getClientOriginalName();
- $mail->addAttachment($file_path, $file_name);
+ if ($attachment != null) {
+ $size = count($message['attachments']);
+ $attach = $message['attachments'];
+ for ($i = 0; $i < $size; $i++) {
+ $file_path = $attach[$i]->getRealPath();
+ $file_name = $attach[$i]->getClientOriginalName();
+ $mail->addAttachment($file_path, $file_name);
+ }
}
- }
- $mail->Subject = $subject;
- if ($template == 'ticket-reply-agent') {
- $line = '---Reply above this line---
';
- $mail->Body = $line.$messagebody;
- } else {
- $mail->Body = $messagebody;
- }
+ $mail->Subject = $subject;
+ if ($template == 'ticket-reply-agent') {
+ $line = '---Reply above this line---
';
+ $mail->Body = $line . $messagebody;
+ } else {
+ $mail->Body = $messagebody;
+ }
- // $mail->AltBody = $altbody;
+ // $mail->AltBody = $altbody;
- if (!$mail->send()) {
- // echo 'Message could not be sent.';
- // echo 'Mailer Error: '.$mail->ErrorInfo;
- } else {
- // echo 'Message has been sent';
+ if (!$mail->send()) {
+ return null;
+ // echo 'Message could not be sent.';
+ // echo 'Mailer Error: '.$mail->ErrorInfo;
+ } else {
+ return 1;
+ // echo 'Message has been sent';
+ }
}
}
@@ -257,8 +264,7 @@ class PhpMailController extends Controller
*
* @return type
*/
- public function company()
- {
+ public function company() {
$company = Company::Where('id', '=', '1')->first();
if ($company->company_name == null) {
$company = 'Support Center';
@@ -320,8 +326,7 @@ class PhpMailController extends Controller
*
* @return type integer
*/
- public function mailfrom($reg, $dept_id)
- {
+ public function mailfrom($reg, $dept_id) {
$email = Email::where('id', '=', '1')->first();
if ($reg == 1) {
return $email->sys_email;
@@ -334,4 +339,5 @@ class PhpMailController extends Controller
}
}
}
+
}
diff --git a/app/Http/Controllers/Installer/helpdesk/InstallController.php b/app/Http/Controllers/Installer/helpdesk/InstallController.php
index db3681dbc..a35ca72ff 100644
--- a/app/Http/Controllers/Installer/helpdesk/InstallController.php
+++ b/app/Http/Controllers/Installer/helpdesk/InstallController.php
@@ -203,23 +203,30 @@ class InstallController extends Controller
$port = Input::get('port');
// Setting environment values
- $ENV['APP_ENV'] = 'local';
- $ENV['APP_DEBUG'] = 'false';
- $ENV['APP_KEY'] = 'SomeRandomString';
- $ENV['DB_TYPE'] = $default;
- $ENV['DB_HOST'] = $host;
- $ENV['DB_PORT'] = $port;
- $ENV['DB_DATABASE'] = $database;
- $ENV['DB_USERNAME'] = $dbusername;
- $ENV['DB_PASSWORD'] = $dbpassword;
- $ENV['MAIL_DRIVER'] = 'smtp';
- $ENV['MAIL_HOST'] = 'mailtrap.io';
- $ENV['MAIL_PORT'] = '2525';
- $ENV['MAIL_USERNAME'] = 'null';
- $ENV['MAIL_PASSWORD'] = 'null';
- $ENV['CACHE_DRIVER'] = 'file';
- $ENV['SESSION_DRIVER'] = 'file';
- $ENV['QUEUE_DRIVER'] = 'sync';
+ // $_ENV['DB_TYPE'] = $default;
+ // $_ENV['DB_HOST'] = $host;
+ // $_ENV['DB_PORT'] = $port;
+ // $_ENV['DB_DATABASE'] = $database;
+ // $_ENV['DB_USERNAME'] = $dbusername;
+ // $_ENV['DB_PASSWORD'] = $dbpassword;
+
+ $ENV['APP_ENV'] = 'local';
+ $ENV['APP_DEBUG'] = 'false';
+ $ENV['APP_KEY'] = 'SomeRandomString';
+ $ENV['DB_TYPE'] = $default;
+ $ENV['DB_HOST'] = $host;
+ $ENV['DB_PORT'] = $port;
+ $ENV['DB_DATABASE'] = $database;
+ $ENV['DB_USERNAME'] = $dbusername;
+ $ENV['DB_PASSWORD'] = $dbpassword;
+ $ENV['MAIL_DRIVER'] = 'smtp';
+ $ENV['MAIL_HOST'] = 'mailtrap.io';
+ $ENV['MAIL_PORT'] = '2525';
+ $ENV['MAIL_USERNAME'] = 'null';
+ $ENV['MAIL_PASSWORD'] = 'null';
+ $ENV['CACHE_DRIVER'] = 'file';
+ $ENV['SESSION_DRIVER'] = 'file';
+ $ENV['QUEUE_DRIVER'] = 'sync';
$config = '';
foreach ($ENV as $key => $val) {
diff --git a/app/Http/Middleware/ApiKey.php b/app/Http/Middleware/ApiKey.php
index 67d689888..7ad0170c0 100644
--- a/app/Http/Middleware/ApiKey.php
+++ b/app/Http/Middleware/ApiKey.php
@@ -26,19 +26,34 @@ class ApiKey
public function handle($request, Closure $next)
{
$set = $this->setting->where('id', '1')->first();
- if ($set->api_enable == 1) {
- $key = $set->api_key;
- if ($key == $request->input('api_key')) {
- return $next($request);
+ if ($set->api_key_mandatory == 1) {
+ if ($set->api_enable == 1) {
+ $key = $set->api_key;
+ $check = $this->test($key, $request->input('api_key'));
+ if ($check == '1') {
+ return $next($request);
+ }
+ if ($check == '0') {
+ $result = 'wrong api key';
+
+ return response()->json(compact('result'));
+ }
} else {
- $result = 'wrong api key';
+ $result = 'please enable api';
return response()->json(compact('result'));
}
} else {
- $result = 'please enable api';
+ return $next($request);
+ }
+ }
- return response()->json(compact('result'));
+ public function test($v1, $v2)
+ {
+ if ($v1 == $v2) {
+ return '1';
+ } else {
+ return '0';
}
}
}
diff --git a/app/Http/Requests/helpdesk/AgentRequest.php b/app/Http/Requests/helpdesk/AgentRequest.php
index 13b8e7288..44cf0b1f4 100644
--- a/app/Http/Requests/helpdesk/AgentRequest.php
+++ b/app/Http/Requests/helpdesk/AgentRequest.php
@@ -32,7 +32,7 @@ class AgentRequest extends Request
'user_name' => 'required|unique:users',
'first_name' => 'required',
'last_name' => 'required',
- 'email' => 'required',
+ 'email' => 'required|unique:users',
'active' => 'required',
// 'account_status' => 'required',
'assign_group' => 'required',
diff --git a/app/Http/Requests/helpdesk/EmailsEditRequest.php b/app/Http/Requests/helpdesk/EmailsEditRequest.php
index 498ec4c87..5f6e9ef3a 100644
--- a/app/Http/Requests/helpdesk/EmailsEditRequest.php
+++ b/app/Http/Requests/helpdesk/EmailsEditRequest.php
@@ -40,9 +40,9 @@ class EmailsEditRequest extends Request
// 'sending_host' => 'required',
// 'sending_port' => 'required',
//'mailbox_protocol' => 'required'
- 'fetching_host' => 'required',
- 'fetching_port' => 'required',
- 'mailbox_protocol' => 'required',
+// 'fetching_host' => 'required',
+// 'fetching_port' => 'required',
+// 'mailbox_protocol' => 'required',
];
}
}
diff --git a/app/Http/Requests/helpdesk/EmailsRequest.php b/app/Http/Requests/helpdesk/EmailsRequest.php
index fd290d58e..2502cb8d0 100644
--- a/app/Http/Requests/helpdesk/EmailsRequest.php
+++ b/app/Http/Requests/helpdesk/EmailsRequest.php
@@ -39,9 +39,9 @@ class EmailsRequest extends Request
// 'user_name' => 'required',
// 'sending_host' => 'required',
// 'sending_port' => 'required',
- 'fetching_host' => 'required',
- 'fetching_port' => 'required',
- 'mailbox_protocol' => 'required',
+// 'fetching_host' => 'required',
+// 'fetching_port' => 'required',
+// 'mailbox_protocol' => 'required',
];
}
}
diff --git a/app/Http/routes.php b/app/Http/routes.php
index 7a9a56a73..dcac4fd08 100644
--- a/app/Http/routes.php
+++ b/app/Http/routes.php
@@ -180,6 +180,9 @@ Route::group(['middleware' => 'roles', 'middleware' => 'auth'], function () {
Route::get('delete-language/{lang}', ['as' => 'lang.delete', 'uses' => 'Admin\helpdesk\LanguageController@deleteLanguage']);
Route::get('generate-api-key', 'Admin\helpdesk\SettingsController@GenerateApiKey'); // route to generate api key
+
+ Route::post('validating-email-settings', ['as' => 'validating.email.settings', 'uses' => 'Admin\helpdesk\EmailsController@validatingEmailSettings']); // route to check email input validation
+ Route::post('validating-email-settings-on-update/{id}', ['as' => 'validating.email.settings.update', 'uses' => 'Admin\helpdesk\EmailsController@validatingEmailSettingsUpdate']); // route to check email input validation
});
/*
@@ -354,7 +357,7 @@ Route::group(['middleware' => 'role.agent', 'middleware' => 'auth'], function ()
Route::get('/get-parent-tickets/{id}', ['as' => 'get.parent.ticket', 'uses' => 'Agent\helpdesk\TicketController@getParentTickets']);
- Route::patch('/merge-tickets/{id}', 'Agent\helpdesk\TicketController@mergeTickets');
+ Route::patch('/merge-tickets/{id}', ['as' => 'merge.tickets', 'uses' => 'Agent\helpdesk\TicketController@mergeTickets']);
});
@@ -633,8 +636,8 @@ Route::group(['prefix' => 'api/v1'], function () {
Route::get('customer', 'Api\v1\ApiController@getCustomer');
Route::get('ticket-search', 'Api\v1\ApiController@searchTicket');
Route::get('ticket-thread', 'Api\v1\ApiController@ticketThreads');
- Route::get('url', 'Api\v1\ApiController@checkUrl');
- Route::get('check-url', 'Api\v1\ApiController@urlResult');
+ Route::get('url', 'Api\v1\ApiExceptAuthController@checkUrl');
+ Route::get('check-url', 'Api\v1\ApiExceptAuthController@urlResult');
Route::get('api_key', 'Api\v1\ApiController@generateApiKey');
Route::get('help-topic', 'Api\v1\ApiController@getHelpTopic');
Route::get('sla-plan', 'Api\v1\ApiController@getSlaPlan');
@@ -688,7 +691,7 @@ Route::group(['prefix' => 'api/v1'], function () {
/*
* Newly added
*/
- Route::get('customers-custom', 'Api\v1\TestController@getCustomersWith');
+ Route::get('ticket/customers-custom', 'Api\v1\TestController@getCustomersWith');
Route::get('generate/token', 'Api\v1\TestController@generateToken');
Route::get('get/user', 'Api\v1\TestController@getAuthUser');
diff --git a/app/Model/helpdesk/Email/Emails.php b/app/Model/helpdesk/Email/Emails.php
index d98ccaf34..2d4bc6ea5 100644
--- a/app/Model/helpdesk/Email/Emails.php
+++ b/app/Model/helpdesk/Email/Emails.php
@@ -9,8 +9,8 @@ class Emails extends Model
protected $table = 'emails';
protected $fillable = [
'email_address', 'email_name', 'department', 'priority', 'help_topic',
- 'user_name', 'password', 'fetching_host', 'fetching_port', 'mailbox_protocol',
- 'folder', 'sending_host', 'sending_port', 'sending_encryption', 'internal_notes', 'auto_response',
+ 'user_name', 'password', 'fetching_host', 'fetching_port', 'fetching_protocol', 'fetching_encryption', 'mailbox_protocol',
+ 'folder', 'sending_host', 'sending_port', 'sending_protocol', 'sending_encryption', 'internal_notes', 'auto_response',
'fetching_status', 'move_to_folder', 'delete_email', 'do_nothing',
'sending_status', 'authentication', 'header_spoofing', 'imap_config',
];
diff --git a/app/Model/helpdesk/Settings/System.php b/app/Model/helpdesk/Settings/System.php
index 1244b0d09..43aaed68f 100644
--- a/app/Model/helpdesk/Settings/System.php
+++ b/app/Model/helpdesk/Settings/System.php
@@ -12,6 +12,6 @@ class System extends Model
protected $fillable = [
'id', 'status', 'url', 'name', 'department', 'page_size', 'log_level', 'purge_log', 'name_format',
- 'time_farmat', 'date_format', 'date_time_format', 'day_date_time', 'time_zone', 'content', 'api_key', 'api_enable',
+ 'time_farmat', 'date_format', 'date_time_format', 'day_date_time', 'time_zone', 'content', 'api_key', 'api_enable', 'api_key_mandatory',
];
}
diff --git a/config/app.php b/config/app.php
index 0800b8f82..8f8e40cc2 100644
--- a/config/app.php
+++ b/config/app.php
@@ -38,7 +38,7 @@ return [
|
*/
- 'version' => 'Community 1.0.6.5',
+ 'version' => 'Community 1.0.6.6',
/*
|--------------------------------------------------------------------------
diff --git a/database/migrations/2016_02_16_140450_create_emails_table.php b/database/migrations/2016_02_16_140450_create_emails_table.php
index dd9f372be..0aa0b3c7a 100644
--- a/database/migrations/2016_02_16_140450_create_emails_table.php
+++ b/database/migrations/2016_02_16_140450_create_emails_table.php
@@ -23,11 +23,14 @@ class CreateEmailsTable extends Migration
$table->string('password');
$table->string('fetching_host');
$table->string('fetching_port');
+ $table->string('fetching_protocol');
+ $table->string('fetching_encryption');
$table->string('mailbox_protocol');
$table->string('imap_config');
$table->string('folder');
$table->string('sending_host');
$table->string('sending_port');
+ $table->string('sending_protocol');
$table->string('sending_encryption');
$table->string('internal_notes');
$table->boolean('auto_response');
diff --git a/database/migrations/2016_02_16_140450_create_settings_system_table.php b/database/migrations/2016_02_16_140450_create_settings_system_table.php
index 85d33128b..59b140c4c 100644
--- a/database/migrations/2016_02_16_140450_create_settings_system_table.php
+++ b/database/migrations/2016_02_16_140450_create_settings_system_table.php
@@ -22,6 +22,7 @@ class CreateSettingsSystemTable extends Migration
$table->string('log_level');
$table->string('purge_log');
$table->integer('api_enable');
+ $table->integer('api_key_mandatory');
$table->string('api_key');
$table->string('name_format');
$table->integer('time_farmat')->unsigned()->nullable()->index('time_farmat');
diff --git a/nbproject/project.properties b/nbproject/project.properties
new file mode 100644
index 000000000..e69de29bb
diff --git a/nbproject/project.xml b/nbproject/project.xml
new file mode 100644
index 000000000..067bd4be4
--- /dev/null
+++ b/nbproject/project.xml
@@ -0,0 +1,12 @@
+
+{{Lang::get('lang.add_an_email')}}
@stop
@section('breadcrumbs')
@stop
@section('content')
-
-
- {!!Form::open(['action'=>'Admin\helpdesk\EmailsController@store','method'=>'POST'])!!}
- {{Lang::get('lang.create')}}
{!! Form::submit(Lang::get('lang.save'),['class'=>'form-group btn btn-primary pull-right'])!!}
-
-
-
- {!! Lang::get('lang.reuired_authentication') !!}
-
-
-
- {!! Lang::get('lang.fetching_email_via_imap') !!}
-
-
-
- Sending Email via SMTP
-
- {{Lang::get('lang.edit_an_email')}}
@stop
@@ -31,226 +31,406 @@ class="active"
@section('content')
-
- {!!Form::model($emails,['url'=>'emails/'.$emails->id,'method'=>'PATCH'])!!}
- {{Lang::get('lang.create')}}
{!! Form::submit(Lang::get('lang.save'),['class'=>'form-group btn btn-primary pull-right'])!!}
-
-
-
- {!! Lang::get('lang.reuired_authentication') !!}
-
-
-
- {!! Lang::get('lang.fetching_email_via_imap') !!}
-
-
-
- Sending Email via SMTP
-
- {!! Lang::get('lang.email_information_and_settings') !!}
+ {!! Lang::get('lang.new_ticket_settings') !!}
+ {!! Lang::get('lang.incoming_email_information') !!}
+ {!! Lang::get('lang.outgoing_email_information') !!}
+ {!! Lang::get('lang.admin_panel') !!}
- {!! Lang::get('lang.admin_panel') !!}
@stop
@@ -16,7 +14,6 @@
@section('content')
-
{!! Lang::get('lang.staffs') !!}
diff --git a/resources/views/themes/default1/admin/helpdesk/settings/email.blade.php b/resources/views/themes/default1/admin/helpdesk/settings/email.blade.php
index 75f7ee851..cd9b6cf86 100644
--- a/resources/views/themes/default1/admin/helpdesk/settings/email.blade.php
+++ b/resources/views/themes/default1/admin/helpdesk/settings/email.blade.php
@@ -29,164 +29,89 @@ class="active"
@section('content')
-
- {!! Form::model($emails,['url' => 'postemail/'.$emails->id, 'method' => 'PATCH']) !!}
-
- {{Lang::get('lang.email')}}
+ {!! Form::checkbox('email_fetching',1,true) !!} {{Lang::get('lang.fetch_auto-corn')}}
+ {{Lang::get('lang.system')}}
{!! Form::submit('Save',['onclick'=>'sendForm()','class'=>'btn btn-primary pull-right'])!!}
-
+ {{Lang::get('lang.system')}}
{!! Form::submit('Save',['onclick'=>'sendForm()','class'=>'btn btn-primary pull-right'])!!}
+
-{!! Lang::get('lang.api_configurations') !!}
+ {!! Form::label('department',Lang::get('lang.default_department')) !!}
+ {!! $errors->first('department', '
+ {!! Lang::get('lang.api_configurations') !!}
+
+
+
- @else
- KNOWLEDGE BASE
- @endif
-
-
-