Apply fixes from StyleCI
This commit is contained in:

committed by
StyleCI Bot

parent
857d3004eb
commit
88f3df2180
@@ -7,10 +7,11 @@ use App\Http\Controllers\Controller;
|
||||
// requests
|
||||
use App\Http\Requests\helpdesk\CompanyRequest;
|
||||
use App\Http\Requests\helpdesk\EmailRequest;
|
||||
use App\Http\Requests\helpdesk\Job\TaskRequest;
|
||||
use App\Http\Requests\helpdesk\RatingUpdateRequest;
|
||||
use App\Http\Requests\helpdesk\StatusRequest;
|
||||
use App\Http\Requests\helpdesk\SystemRequest;
|
||||
// models
|
||||
use App\Http\Requests\helpdesk\SystemRequest;
|
||||
use App\Model\helpdesk\Agent\Department;
|
||||
use App\Model\helpdesk\Email\Emails;
|
||||
use App\Model\helpdesk\Email\Template;
|
||||
@@ -19,9 +20,10 @@ use App\Model\helpdesk\Manage\Sla_plan;
|
||||
use App\Model\helpdesk\Notification\UserNotification;
|
||||
use App\Model\helpdesk\Ratings\Rating;
|
||||
use App\Model\helpdesk\Settings\Alert;
|
||||
use App\Model\helpdesk\Settings\CommonSettings;
|
||||
use App\Model\helpdesk\Settings\Company;
|
||||
use App\Model\helpdesk\Settings\Followup;
|
||||
use App\Model\helpdesk\Settings\Email;
|
||||
use App\Model\helpdesk\Settings\Followup;
|
||||
use App\Model\helpdesk\Settings\Responder;
|
||||
use App\Model\helpdesk\Settings\System;
|
||||
use App\Model\helpdesk\Settings\Ticket;
|
||||
@@ -31,30 +33,29 @@ use App\Model\helpdesk\Utility\Date_time_format;
|
||||
use App\Model\helpdesk\Utility\Time_format;
|
||||
use App\Model\helpdesk\Utility\Timezones;
|
||||
use App\Model\helpdesk\Workflow\WorkflowClose;
|
||||
use App\Model\helpdesk\Settings\CommonSettings;
|
||||
use DateTime;
|
||||
// classes
|
||||
use DateTime;
|
||||
use DB;
|
||||
use Exception;
|
||||
use File;
|
||||
use Illuminate\Http\Request;
|
||||
use Input;
|
||||
use Lang;
|
||||
use App\Http\Requests\helpdesk\Job\TaskRequest;
|
||||
|
||||
/**
|
||||
* SettingsController.
|
||||
*
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class SettingsController extends Controller {
|
||||
|
||||
class SettingsController extends Controller
|
||||
{
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct() {
|
||||
public function __construct()
|
||||
{
|
||||
// $this->smtp();
|
||||
$this->middleware('auth');
|
||||
$this->middleware('roles');
|
||||
@@ -68,7 +69,8 @@ class SettingsController extends Controller {
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function getcompany(Company $company) {
|
||||
public function getcompany(Company $company)
|
||||
{
|
||||
try {
|
||||
/* fetch the values of company from company table */
|
||||
$companys = $company->whereId('1')->first();
|
||||
@@ -88,13 +90,14 @@ class SettingsController extends Controller {
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function postcompany($id, Company $company, CompanyRequest $request) {
|
||||
public function postcompany($id, Company $company, CompanyRequest $request)
|
||||
{
|
||||
/* fetch the values of company request */
|
||||
$companys = $company->whereId('1')->first();
|
||||
if (Input::file('logo')) {
|
||||
$name = Input::file('logo')->getClientOriginalName();
|
||||
$destinationPath = 'uploads/company/';
|
||||
$fileName = rand(0000, 9999) . '.' . $name;
|
||||
$fileName = rand(0000, 9999).'.'.$name;
|
||||
Input::file('logo')->move($destinationPath, $fileName);
|
||||
$companys->logo = $fileName;
|
||||
}
|
||||
@@ -108,7 +111,7 @@ class SettingsController extends Controller {
|
||||
return redirect('getcompany')->with('success', Lang::get('lang.company_updated_successfully'));
|
||||
} catch (Exception $e) {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('getcompany')->with('fails', Lang::get('lang.company_can_not_updated') . '<li>' . $e->getMessage() . '</li>');
|
||||
return redirect('getcompany')->with('fails', Lang::get('lang.company_can_not_updated').'<li>'.$e->getMessage().'</li>');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,7 +120,8 @@ class SettingsController extends Controller {
|
||||
*
|
||||
* @return type string
|
||||
*/
|
||||
public function deleteLogo() {
|
||||
public function deleteLogo()
|
||||
{
|
||||
$path = $_GET['data1']; //get file path of logo image
|
||||
if (!unlink($path)) {
|
||||
return 'false';
|
||||
@@ -144,7 +148,8 @@ class SettingsController extends Controller {
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function getsystem(System $system, Department $department, Timezones $timezone, Date_format $date, Date_time_format $date_time, Time_format $time, CommonSettings $common_settings) {
|
||||
public function getsystem(System $system, Department $department, Timezones $timezone, Date_format $date, Date_time_format $date_time, Time_format $time, CommonSettings $common_settings)
|
||||
{
|
||||
try {
|
||||
/* fetch the values of system from system table */
|
||||
$systems = $system->whereId('1')->first();
|
||||
@@ -178,7 +183,8 @@ class SettingsController extends Controller {
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function postsystem($id, System $system, SystemRequest $request) {
|
||||
public function postsystem($id, System $system, SystemRequest $request)
|
||||
{
|
||||
try {
|
||||
/* fetch the values of system request */
|
||||
$systems = $system->whereId('1')->first();
|
||||
@@ -202,8 +208,8 @@ class SettingsController extends Controller {
|
||||
->update(['status' => $request->send_otp]);
|
||||
$email_mandatory = CommonSettings::where('option_name', '=', 'email_mandatory')
|
||||
->update(['status' => $request->email_mandatory]);
|
||||
|
||||
if($request->has('itil')){
|
||||
|
||||
if ($request->has('itil')) {
|
||||
$itil = $request->input('itil');
|
||||
$sett = CommonSettings::firstOrCreate(['option_name'=>'itil']);
|
||||
$sett->status = $itil;
|
||||
@@ -213,7 +219,7 @@ class SettingsController extends Controller {
|
||||
return redirect('getsystem')->with('success', Lang::get('lang.system_updated_successfully'));
|
||||
} catch (Exception $e) {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('getsystem')->with('fails', Lang::get('lang.system_can_not_updated') . '<br>' . $e->getMessage());
|
||||
return redirect('getsystem')->with('fails', Lang::get('lang.system_can_not_updated').'<br>'.$e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -227,7 +233,8 @@ class SettingsController extends Controller {
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function getticket(Ticket $ticket, Sla_plan $sla, Help_topic $topic, Ticket_Priority $priority) {
|
||||
public function getticket(Ticket $ticket, Sla_plan $sla, Help_topic $topic, Ticket_Priority $priority)
|
||||
{
|
||||
try {
|
||||
/* fetch the values of ticket from ticket table */
|
||||
$tickets = $ticket->whereId('1')->first();
|
||||
@@ -251,7 +258,8 @@ class SettingsController extends Controller {
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function postticket($id, Ticket $ticket, Request $request) {
|
||||
public function postticket($id, Ticket $ticket, Request $request)
|
||||
{
|
||||
try {
|
||||
/* fetch the values of ticket request */
|
||||
$tickets = $ticket->whereId('1')->first();
|
||||
@@ -272,7 +280,7 @@ class SettingsController extends Controller {
|
||||
return redirect('getticket')->with('success', Lang::get('lang.ticket_updated_successfully'));
|
||||
} catch (Exception $e) {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('getticket')->with('fails', Lang::get('lang.ticket_can_not_updated') . '<li>' . $e->getMessage() . '</li>');
|
||||
return redirect('getticket')->with('fails', Lang::get('lang.ticket_can_not_updated').'<li>'.$e->getMessage().'</li>');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -285,7 +293,8 @@ class SettingsController extends Controller {
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function getemail(Email $email, Template $template, Emails $email1) {
|
||||
public function getemail(Email $email, Template $template, Emails $email1)
|
||||
{
|
||||
try {
|
||||
/* fetch the values of email from Email table */
|
||||
$emails = $email->whereId('1')->first();
|
||||
@@ -309,7 +318,8 @@ class SettingsController extends Controller {
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function postemail($id, Email $email, EmailRequest $request) {
|
||||
public function postemail($id, Email $email, EmailRequest $request)
|
||||
{
|
||||
try {
|
||||
/* fetch the values of email request */
|
||||
$emails = $email->whereId('1')->first();
|
||||
@@ -328,7 +338,7 @@ class SettingsController extends Controller {
|
||||
return redirect('getemail')->with('success', Lang::get('lang.email_updated_successfully'));
|
||||
} catch (Exception $e) {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('getemail')->with('fails', Lang::get('lang.email_can_not_updated') . '<li>' . $e->getMessage() . '</li>');
|
||||
return redirect('getemail')->with('fails', Lang::get('lang.email_can_not_updated').'<li>'.$e->getMessage().'</li>');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -341,7 +351,8 @@ class SettingsController extends Controller {
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function getSchedular(Email $email, Template $template, Emails $email1, WorkflowClose $workflow) {
|
||||
public function getSchedular(Email $email, Template $template, Emails $email1, WorkflowClose $workflow)
|
||||
{
|
||||
// try {
|
||||
/* fetch the values of email from Email table */
|
||||
$emails = $email->whereId('1')->first();
|
||||
@@ -354,41 +365,43 @@ class SettingsController extends Controller {
|
||||
$cron_path = base_path('artisan');
|
||||
$command = ":- <pre>***** php $cron_path schedule:run >> /dev/null 2>&1</pre>";
|
||||
$shared = ":- <pre>/usr/bin/php-cli -q $cron_path schedule:run >> /dev/null 2>&1</pre>";
|
||||
$warn = "";
|
||||
$warn = '';
|
||||
$condition = new \App\Model\MailJob\Condition();
|
||||
$job = $condition->checkActiveJob();
|
||||
$commands = [
|
||||
'' => 'Select',
|
||||
'everyMinute' => 'Every Minute',
|
||||
'everyFiveMinutes' => 'Every Five Minute',
|
||||
'everyTenMinutes' => 'Every Ten Minute',
|
||||
'' => 'Select',
|
||||
'everyMinute' => 'Every Minute',
|
||||
'everyFiveMinutes' => 'Every Five Minute',
|
||||
'everyTenMinutes' => 'Every Ten Minute',
|
||||
'everyThirtyMinutes' => 'Every Thirty Minute',
|
||||
'hourly' => 'Every Hour',
|
||||
'daily' => 'Every Day',
|
||||
'dailyAt' => 'Daily at',
|
||||
'weekly' => 'Every Week',
|
||||
'monthly' => 'Monthly',
|
||||
'yearly' => 'Yearly',
|
||||
'hourly' => 'Every Hour',
|
||||
'daily' => 'Every Day',
|
||||
'dailyAt' => 'Daily at',
|
||||
'weekly' => 'Every Week',
|
||||
'monthly' => 'Monthly',
|
||||
'yearly' => 'Yearly',
|
||||
];
|
||||
$followupcommands = [
|
||||
'' => 'Select',
|
||||
'everyMinute' => 'Every Minute',
|
||||
'everyFiveMinutes' => 'Every Five Minute',
|
||||
'everyTenMinutes' => 'Every Ten Minute',
|
||||
'' => 'Select',
|
||||
'everyMinute' => 'Every Minute',
|
||||
'everyFiveMinutes' => 'Every Five Minute',
|
||||
'everyTenMinutes' => 'Every Ten Minute',
|
||||
'everyThirtyMinutes' => 'Every Thirty Minute',
|
||||
'hourly' => 'Every Hour',
|
||||
'daily' => 'Every Day',
|
||||
'weekly' => 'Every Week',
|
||||
'monthly' => 'Monthly',
|
||||
'yearly' => 'Yearly',
|
||||
'hourly' => 'Every Hour',
|
||||
'daily' => 'Every Day',
|
||||
'weekly' => 'Every Week',
|
||||
'monthly' => 'Monthly',
|
||||
'yearly' => 'Yearly',
|
||||
];
|
||||
if (ini_get('register_argc_argv') == "") {
|
||||
if (ini_get('register_argc_argv') == '') {
|
||||
//$warn = "Please make 'register_argc_argv' flag as on. Or you can set all your job url in cron";
|
||||
}
|
||||
return view('themes.default1.admin.helpdesk.settings.cron.cron', compact('emails', 'templates', 'emails1', 'workflow', 'warn', 'command', 'commands','followupcommands','condition','shared'));
|
||||
|
||||
return view('themes.default1.admin.helpdesk.settings.cron.cron', compact('emails', 'templates', 'emails1', 'workflow', 'warn', 'command', 'commands', 'followupcommands', 'condition', 'shared'));
|
||||
// } catch {
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified schedular in storage for cron job.
|
||||
*
|
||||
@@ -397,18 +410,16 @@ class SettingsController extends Controller {
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function postSchedular(Email $email, Template $template, Followup $followup, Emails $email1, TaskRequest $request, WorkflowClose $workflow) {
|
||||
public function postSchedular(Email $email, Template $template, Followup $followup, Emails $email1, TaskRequest $request, WorkflowClose $workflow)
|
||||
{
|
||||
try {
|
||||
$followup = $followup->whereId('1')->first();
|
||||
$status = $request->followup_notification_cron;
|
||||
|
||||
$followup=$followup->whereId('1')->first();
|
||||
$status=$request->followup_notification_cron;
|
||||
|
||||
if ($status='null') {
|
||||
|
||||
if ($status = 'null') {
|
||||
$followup->status = $request->followup_notification_cron;
|
||||
|
||||
}
|
||||
if($status= 1) {
|
||||
if ($status = 1) {
|
||||
$followup->status = $request->followup_notification_cron;
|
||||
$followup->condition = $request->followup_notification_commands;
|
||||
$followup->save();
|
||||
@@ -444,7 +455,7 @@ class SettingsController extends Controller {
|
||||
return redirect('job-scheduler')->with('success', Lang::get('lang.job-scheduler-success'));
|
||||
} catch (Exception $e) {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('job-scheduler')->with('fails', Lang::get('lang.job-scheduler-error') . '<li>' . $e->getMessage() . '</li>');
|
||||
return redirect('job-scheduler')->with('fails', Lang::get('lang.job-scheduler-error').'<li>'.$e->getMessage().'</li>');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -455,7 +466,8 @@ class SettingsController extends Controller {
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function getresponder(Responder $responder) {
|
||||
public function getresponder(Responder $responder)
|
||||
{
|
||||
try {
|
||||
/* fetch the values of responder from responder table */
|
||||
$responders = $responder->whereId('1')->first();
|
||||
@@ -474,7 +486,8 @@ class SettingsController extends Controller {
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public function postresponder(Responder $responder, Request $request) {
|
||||
public function postresponder(Responder $responder, Request $request)
|
||||
{
|
||||
try {
|
||||
/* fetch the values of responder request */
|
||||
$responders = $responder->whereId('1')->first();
|
||||
@@ -491,7 +504,7 @@ class SettingsController extends Controller {
|
||||
return redirect('getresponder')->with('success', Lang::get('lang.auto_response_updated_successfully'));
|
||||
} catch (Exception $e) {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('getresponder')->with('fails', Lang::get('lang.auto_response_can_not_updated') . '<li>' . $e->getMessage() . '</li>');
|
||||
return redirect('getresponder')->with('fails', Lang::get('lang.auto_response_can_not_updated').'<li>'.$e->getMessage().'</li>');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -502,7 +515,8 @@ class SettingsController extends Controller {
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function getalert(Alert $alert) {
|
||||
public function getalert(Alert $alert)
|
||||
{
|
||||
try {
|
||||
/* fetch the values of alert from alert table */
|
||||
$alerts = $alert->whereId('1')->first();
|
||||
@@ -522,7 +536,8 @@ class SettingsController extends Controller {
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function postalert($id, Alert $alert, Request $request) {
|
||||
public function postalert($id, Alert $alert, Request $request)
|
||||
{
|
||||
try {
|
||||
/* fetch the values of alert request */
|
||||
$alerts = $alert->whereId('1')->first();
|
||||
@@ -577,7 +592,7 @@ class SettingsController extends Controller {
|
||||
return redirect('getalert')->with('success', Lang::get('lang.alert_&_notices_updated_successfully'));
|
||||
} catch (Exception $e) {
|
||||
/* redirect to Index page with Fails Message */
|
||||
return redirect('getalert')->with('fails', Lang::get('lang.alert_&_notices_can_not_updated') . '<li>' . $e->getMessage() . '</li>');
|
||||
return redirect('getalert')->with('fails', Lang::get('lang.alert_&_notices_can_not_updated').'<li>'.$e->getMessage().'</li>');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -586,7 +601,8 @@ class SettingsController extends Controller {
|
||||
*
|
||||
* @return type json
|
||||
*/
|
||||
public function generateApiKey() {
|
||||
public function generateApiKey()
|
||||
{
|
||||
$key = str_random(32);
|
||||
|
||||
return $key;
|
||||
@@ -597,7 +613,8 @@ class SettingsController extends Controller {
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function settings() {
|
||||
public function settings()
|
||||
{
|
||||
return view('themes.default1.admin.helpdesk.setting');
|
||||
}
|
||||
|
||||
@@ -609,7 +626,8 @@ class SettingsController extends Controller {
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function getStatuses() {
|
||||
public function getStatuses()
|
||||
{
|
||||
try {
|
||||
/* fetch the values of company from company table */
|
||||
$statuss = \DB::table('ticket_status')->get();
|
||||
@@ -628,7 +646,8 @@ class SettingsController extends Controller {
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function getEditStatuses($id) {
|
||||
public function getEditStatuses($id)
|
||||
{
|
||||
try {
|
||||
/* fetch the values of company from company table */
|
||||
$status = \DB::table('ticket_status')->where('id', '=', $id)->first();
|
||||
@@ -647,7 +666,8 @@ class SettingsController extends Controller {
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function editStatuses($id, StatusRequest $request) {
|
||||
public function editStatuses($id, StatusRequest $request)
|
||||
{
|
||||
try {
|
||||
/* fetch the values of company from company table */
|
||||
$statuss = \App\Model\helpdesk\Ticket\Ticket_Status::whereId($id)->first();
|
||||
@@ -678,7 +698,8 @@ class SettingsController extends Controller {
|
||||
*
|
||||
* @return type redirect
|
||||
*/
|
||||
public function createStatuses(\App\Model\helpdesk\Ticket\Ticket_Status $statuss, StatusRequest $request) {
|
||||
public function createStatuses(\App\Model\helpdesk\Ticket\Ticket_Status $statuss, StatusRequest $request)
|
||||
{
|
||||
try {
|
||||
/* fetch the values of company from company table */
|
||||
$statuss->name = $request->input('name');
|
||||
@@ -707,7 +728,8 @@ class SettingsController extends Controller {
|
||||
*
|
||||
* @return type redirect
|
||||
*/
|
||||
public function deleteStatuses($id) {
|
||||
public function deleteStatuses($id)
|
||||
{
|
||||
try {
|
||||
if ($id > 5) {
|
||||
/* fetch the values of company from company table */
|
||||
@@ -727,7 +749,8 @@ class SettingsController extends Controller {
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function notificationSettings() {
|
||||
public function notificationSettings()
|
||||
{
|
||||
return view('themes.default1.admin.helpdesk.settings.notification');
|
||||
}
|
||||
|
||||
@@ -736,7 +759,8 @@ class SettingsController extends Controller {
|
||||
*
|
||||
* @return type redirect
|
||||
*/
|
||||
public function deleteReadNoti() {
|
||||
public function deleteReadNoti()
|
||||
{
|
||||
$markasread = UserNotification::where('is_read', '=', 1)->get();
|
||||
foreach ($markasread as $mark) {
|
||||
$mark->delete();
|
||||
@@ -751,13 +775,14 @@ class SettingsController extends Controller {
|
||||
*
|
||||
* @return type redirect
|
||||
*/
|
||||
public function deleteNotificationLog() {
|
||||
public function deleteNotificationLog()
|
||||
{
|
||||
$days = Input::get('no_of_days');
|
||||
if ($days == null) {
|
||||
return redirect()->back()->with('fails', 'Please enter valid no of days');
|
||||
}
|
||||
$date = new DateTime();
|
||||
$date->modify($days . ' day');
|
||||
$date->modify($days.' day');
|
||||
$formatted_date = $date->format('Y-m-d H:i:s');
|
||||
$markasread = UserNotification::where('created_at', '<=', $formatted_date)->get();
|
||||
foreach ($markasread as $mark) {
|
||||
@@ -765,7 +790,7 @@ class SettingsController extends Controller {
|
||||
\App\Model\helpdesk\Notification\Notification::whereId($mark->notification_id)->delete();
|
||||
}
|
||||
|
||||
return redirect()->back()->with('success', Lang::get('lang.you_have_deleted_all_the_notification_records_since') . $days . ' days.');
|
||||
return redirect()->back()->with('success', Lang::get('lang.you_have_deleted_all_the_notification_records_since').$days.' days.');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -773,7 +798,8 @@ class SettingsController extends Controller {
|
||||
*
|
||||
* @return type View
|
||||
*/
|
||||
public function RatingSettings() {
|
||||
public function RatingSettings()
|
||||
{
|
||||
try {
|
||||
$ratings = Rating::orderBy('display_order', 'asc')->get();
|
||||
|
||||
@@ -790,7 +816,8 @@ class SettingsController extends Controller {
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function editRatingSettings($id) {
|
||||
public function editRatingSettings($id)
|
||||
{
|
||||
try {
|
||||
$rating = Rating::whereId($id)->first();
|
||||
|
||||
@@ -805,7 +832,8 @@ class SettingsController extends Controller {
|
||||
*
|
||||
* @return type Redirect
|
||||
*/
|
||||
public function PostRatingSettings($id, Rating $ratings, RatingUpdateRequest $request) {
|
||||
public function PostRatingSettings($id, Rating $ratings, RatingUpdateRequest $request)
|
||||
{
|
||||
try {
|
||||
$rating = $ratings->whereId($id)->first();
|
||||
$rating->name = $request->input('name');
|
||||
@@ -827,11 +855,12 @@ class SettingsController extends Controller {
|
||||
*
|
||||
* @return type redirect
|
||||
*/
|
||||
public function createRating() {
|
||||
public function createRating()
|
||||
{
|
||||
try {
|
||||
return view('themes.default1.admin.helpdesk.settings.create-ratings');
|
||||
} catch (Exception $ex) {
|
||||
return redirect('getratings')->with('fails', Lang::get('lang.ratings_can_not_be_created') . '<li>' . $ex->getMessage() . '</li>');
|
||||
return redirect('getratings')->with('fails', Lang::get('lang.ratings_can_not_be_created').'<li>'.$ex->getMessage().'</li>');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -844,7 +873,8 @@ class SettingsController extends Controller {
|
||||
*
|
||||
* @return type redirect
|
||||
*/
|
||||
public function storeRating(Rating $rating, \App\Model\helpdesk\Ratings\RatingRef $ratingrefs, \App\Http\Requests\helpdesk\RatingRequest $request) {
|
||||
public function storeRating(Rating $rating, \App\Model\helpdesk\Ratings\RatingRef $ratingrefs, \App\Http\Requests\helpdesk\RatingRequest $request)
|
||||
{
|
||||
$rating->name = $request->input('name');
|
||||
$rating->display_order = $request->input('display_order');
|
||||
$rating->allow_modification = $request->input('allow_modification');
|
||||
@@ -863,13 +893,16 @@ class SettingsController extends Controller {
|
||||
*
|
||||
* @return type Redirect
|
||||
*/
|
||||
public function RatingDelete($slug, \App\Model\helpdesk\Ratings\RatingRef $ratingrefs) {
|
||||
public function RatingDelete($slug, \App\Model\helpdesk\Ratings\RatingRef $ratingrefs)
|
||||
{
|
||||
$ratingrefs->where('rating_id', '=', $slug)->delete();
|
||||
Rating::whereId($slug)->delete();
|
||||
|
||||
return redirect()->back()->with('success', Lang::get('lang.rating_deleted_successfully'));
|
||||
}
|
||||
public function saveConditions() {
|
||||
|
||||
public function saveConditions()
|
||||
{
|
||||
if (\Input::get('fetching-commands') && \Input::get('notification-commands')) {
|
||||
$fetching_commands = \Input::get('fetching-commands');
|
||||
$fetching_dailyAt = \Input::get('fetching-dailyAt');
|
||||
@@ -880,62 +913,66 @@ class SettingsController extends Controller {
|
||||
$fetching_command = $this->getCommand($fetching_commands, $fetching_dailyAt);
|
||||
$notification_command = $this->getCommand($notification_commands, $notification_dailyAt);
|
||||
$work_command = $this->getCommand($work_commands, $workflow_dailyAt);
|
||||
$jobs = ['fetching'=>$fetching_command,'notification'=>$notification_command,'work'=>$work_command];
|
||||
$jobs = ['fetching'=>$fetching_command, 'notification'=>$notification_command, 'work'=>$work_command];
|
||||
$this->storeCommand($jobs);
|
||||
}
|
||||
}
|
||||
|
||||
public function getCommand($command, $daily_at) {
|
||||
|
||||
|
||||
public function getCommand($command, $daily_at)
|
||||
{
|
||||
if ($command == 'dailyAt') {
|
||||
$command = "dailyAt,$daily_at";
|
||||
}
|
||||
|
||||
return $command;
|
||||
}
|
||||
|
||||
public function storeCommand($array=[]){
|
||||
|
||||
public function storeCommand($array = [])
|
||||
{
|
||||
$command = new \App\Model\MailJob\Condition();
|
||||
$commands = $command->get();
|
||||
if($commands->count()>0){
|
||||
foreach($commands as $condition){
|
||||
if ($commands->count() > 0) {
|
||||
foreach ($commands as $condition) {
|
||||
$condition->delete();
|
||||
}
|
||||
}
|
||||
if(count($array)>0){
|
||||
foreach($array as $key=>$save){
|
||||
if (count($array) > 0) {
|
||||
foreach ($array as $key=>$save) {
|
||||
$command->create([
|
||||
'job'=>$key,
|
||||
'value'=>$save,
|
||||
'job' => $key,
|
||||
'value'=> $save,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function getTicketNumber(Request $request) {
|
||||
public function getTicketNumber(Request $request)
|
||||
{
|
||||
$this->validate($request, [
|
||||
'format' => ['required', 'regex:/^(?=.*[$|-|#]).+$/'],
|
||||
'type' => 'required',
|
||||
'type' => 'required',
|
||||
]);
|
||||
|
||||
$format = $request->input('format');
|
||||
$type = $request->input('type');
|
||||
$number = $this->switchNumber($format, $type);
|
||||
|
||||
return $number;
|
||||
}
|
||||
|
||||
public function switchNumber($format, $type) {
|
||||
public function switchNumber($format, $type)
|
||||
{
|
||||
switch ($type) {
|
||||
case "random":
|
||||
case 'random':
|
||||
return $this->createRandomNumber($format);
|
||||
case "sequence":
|
||||
case 'sequence':
|
||||
return $this->createSequencialNumber($format);
|
||||
}
|
||||
}
|
||||
|
||||
public function createRandomNumber($format) {
|
||||
$number = "";
|
||||
public function createRandomNumber($format)
|
||||
{
|
||||
$number = '';
|
||||
$array = str_split($format);
|
||||
for ($i = 0; $i < count($array); $i++) {
|
||||
if ($array[$i] === '$') {
|
||||
@@ -948,11 +985,13 @@ class SettingsController extends Controller {
|
||||
$number .= $array[$i];
|
||||
}
|
||||
}
|
||||
|
||||
return $number;
|
||||
}
|
||||
|
||||
public function createSequencialNumber($format) {
|
||||
$number = "";
|
||||
public function createSequencialNumber($format)
|
||||
{
|
||||
$number = '';
|
||||
$array_format = str_split($format);
|
||||
$count = count($array_format);
|
||||
for ($i = 0; $i < $count; $i++) {
|
||||
@@ -965,16 +1004,17 @@ class SettingsController extends Controller {
|
||||
$number .= '0';
|
||||
}
|
||||
|
||||
|
||||
if ($array_format[$i] !== '$' && $array_format[$i] !== '#') {
|
||||
$number .= $array_format[$i];
|
||||
}
|
||||
}
|
||||
|
||||
return $number;
|
||||
//return $this->nthTicketNumber($number);
|
||||
}
|
||||
|
||||
public function checkCurrentFormat($current, $format) {
|
||||
public function checkCurrentFormat($current, $format)
|
||||
{
|
||||
$check = true;
|
||||
$array_current = str_split($current);
|
||||
$array_format = str_split($format);
|
||||
@@ -988,11 +1028,12 @@ class SettingsController extends Controller {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return $check;
|
||||
}
|
||||
|
||||
public function nthTicketNumber($current, $type, $format, $force = false) {
|
||||
|
||||
public function nthTicketNumber($current, $type, $format, $force = false)
|
||||
{
|
||||
$check = $this->checkCurrentFormat($current, $format);
|
||||
if ($check === false && $force === false) {
|
||||
$current = $this->createSequencialNumber($format);
|
||||
@@ -1012,16 +1053,17 @@ class SettingsController extends Controller {
|
||||
if ($type === 'random') {
|
||||
$number = $this->createRandomNumber($format);
|
||||
}
|
||||
|
||||
|
||||
return $number;
|
||||
}
|
||||
|
||||
public function getRandomAlphebet() {
|
||||
$alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||
public function getRandomAlphebet()
|
||||
{
|
||||
$alpha = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||
$shuffled = str_shuffle($alpha);
|
||||
$shuffled_array = str_split($shuffled);
|
||||
$char = $shuffled_array[0];
|
||||
|
||||
return $char;
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user