Merge remote-tracking branch 'refs/remotes/origin/release-v1.9.2'

# Conflicts:
#	app/Console/Kernel.php
#	app/FaveoStorage/Controllers/SettingsController.php
#	app/Http/Controllers/Admin/helpdesk/TemplateController.php
This commit is contained in:
Manish Verma
2017-01-05 19:09:35 +05:30
59 changed files with 3240 additions and 1546 deletions

View File

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

View File

@@ -122,79 +122,84 @@ class LanguageController extends Controller
*/
public function postForm()
{
// getting all of the post data
$file = [
'File' => Input::file('File'),
'language-name' => Input::input('language-name'),
'iso-code' => Input::input('iso-code'),
];
try {
// getting all of the post data
$file = [
'File' => Input::file('File'),
'language-name' => Input::input('language-name'),
'iso-code' => Input::input('iso-code'),
];
// setting up rules
$rules = [
'File' => 'required|mimes:zip|max:30000',
'language-name' => 'required',
'iso-code' => 'required|max:2',
]; // and for max size
// doing the validation, passing post data, rules and the messages
$validator = Validator::make($file, $rules);
if ($validator->fails()) {
// setting up rules
$rules = [
'File' => 'required|mimes:zip|max:30000',
'language-name' => 'required',
'iso-code' => 'required|max:2',
]; // and for max size
// doing the validation, passing post data, rules and the messages
$validator = Validator::make($file, $rules);
if ($validator->fails()) {
// send back to the page with the input data and errors
return Redirect::back()->withInput()->withErrors($validator);
} else {
//Checking if package already exists or not in lang folder
$path = base_path('resources/lang');
if (in_array(strtolower(Input::get('iso-code')), scandir($path))) {
//sending back with error message
Session::flash('fails', Lang::get('lang.package_exist'));
Session::flash('link', 'change-language/'.strtolower(Input::get('iso-code')));
return Redirect::back()->withInput();
} elseif (!array_key_exists(strtolower(Input::get('iso-code')), Config::get('languages'))) {//Checking Valid ISO code form Languages.php
//sending back with error message
Session::flash('fails', Lang::get('lang.iso-code-error'));
return Redirect::back()->withInput();
// send back to the page with the input data and errors
return Redirect::back()->withInput()->withErrors($validator);
} else {
// checking file is valid.
if (Input::file('File')->isValid()) {
$name = Input::file('File')->getClientOriginalName(); //uploaded file's original name
$destinationPath = base_path('public/uploads/'); // defining uploading path
$extractpath = base_path('resources/lang').'/'.strtolower(Input::get('iso-code')); //defining extracting path
mkdir($extractpath); //creating directroy for extracting uploadd file
//mkdir($destinationPath);
Input::file('File')->move($destinationPath, $name); // uploading file to given path
\Zipper::make($destinationPath.'/'.$name)->extractTo($extractpath); //extracting file to give path
//check if Zip extract foldercontains any subfolder
$directories = File::directories($extractpath);
//$directories = glob($extractpath. '/*' , GLOB_ONLYDIR);
if (!empty($directories)) { //if extract folder contains subfolder
$success = File::deleteDirectory($extractpath); //remove extracted folder and it's subfolder from lang
//$success2 = File::delete($destinationPath.'/'.$name);
if ($success) {
//sending back with error message
Session::flash('fails', Lang::get('lang.zipp-error'));
Session::flash('link2', 'http://www.ladybirdweb.com/support/show/how-to-translate-faveo-into-multiple-languages');
//Checking if package already exists or not in lang folder
$path = base_path('resources/lang');
if (in_array(strtolower(Input::get('iso-code')), scandir($path))) {
return Redirect::back()->withInput();
//sending back with error message
Session::flash('fails', Lang::get('lang.package_exist'));
Session::flash('link', 'change-language/'.strtolower(Input::get('iso-code')));
return Redirect::back()->withInput();
} elseif (!array_key_exists(strtolower(Input::get('iso-code')), Config::get('languages'))) {//Checking Valid ISO code form Languages.php
//sending back with error message
Session::flash('fails', Lang::get('lang.iso-code-error'));
return Redirect::back()->withInput();
} else {
// checking file is valid.
if (Input::file('File')->isValid()) {
$name = Input::file('File')->getClientOriginalName(); //uploaded file's original name
$destinationPath = base_path('public/uploads/'); // defining uploading path
$extractpath = base_path('resources/lang').'/'.strtolower(Input::get('iso-code')); //defining extracting path
mkdir($extractpath); //creating directroy for extracting uploadd file
//mkdir($destinationPath);
Input::file('File')->move($destinationPath, $name); // uploading file to given path
\Zipper::make($destinationPath.'/'.$name)->extractTo($extractpath); //extracting file to give path
//check if Zip extract foldercontains any subfolder
$directories = File::directories($extractpath);
//$directories = glob($extractpath. '/*' , GLOB_ONLYDIR);
if (!empty($directories)) { //if extract folder contains subfolder
$success = File::deleteDirectory($extractpath); //remove extracted folder and it's subfolder from lang
//$success2 = File::delete($destinationPath.'/'.$name);
if ($success) {
//sending back with error message
Session::flash('fails', Lang::get('lang.zipp-error'));
Session::flash('link2', 'http://www.ladybirdweb.com/support/show/how-to-translate-faveo-into-multiple-languages');
return Redirect::back()->withInput();
}
} else {
// sending back with success message
Session::flash('success', Lang::get('lang.upload-success'));
Session::flash('link', 'change-language/'.strtolower(Input::get('iso-code')));
return Redirect::route('LanguageController');
}
} else {
// sending back with success message
Session::flash('success', Lang::get('lang.upload-success'));
Session::flash('link', 'change-language/'.strtolower(Input::get('iso-code')));
// sending back with error message.
Session::flash('fails', Lang::get('lang.file-error'));
return Redirect::route('LanguageController');
return Redirect::route('form');
}
} else {
// sending back with error message.
Session::flash('fails', Lang::get('lang.file-error'));
return Redirect::route('form');
}
}
} catch (\Exception $e) {
Session::flash('fails', $e->getMessage());
Redirect::back()->withInput();
}
}
@@ -205,7 +210,8 @@ class LanguageController extends Controller
*/
public function download()
{
$file_path = base_path('public/downloads/en.zip');
$path = 'downloads'.DIRECTORY_SEPARATOR.'en.zip';
$file_path = public_path($path);
return response()->download($file_path);
}

View File

@@ -68,7 +68,7 @@ class TeamController extends Controller
public function create(User $user)
{
try {
$user = $user->where('role', '<>', 'user')->where('active', '=', 1)->get();
$user = $user->where('role', '<>', 'user')->where('active', '=', 1)->orderBy('first_name')->get();
return view('themes.default1.admin.helpdesk.agent.teams.create', compact('user'));
} catch (Exception $e) {
@@ -86,15 +86,23 @@ class TeamController extends Controller
*/
public function store(Teams $team, TeamRequest $request)
{
if ($request->team_lead) {
$team_lead = $request->team_lead;
} else {
$team_lead = null;
}
$team->team_lead = $team_lead;
try {
/* Check whether function success or not */
$team->fill($request->except('team_lead'))->save();
$team_update = Teams::find($team->id);
if ($request->team_lead) {
$team_lead = $request->team_lead;
$team_update->update([
'team_lead' => $team_lead,
]);
Assign_team_agent::create([
'team_id' => $team_update->id,
'agent_id' => $team_lead,
]);
} else {
$team_lead = null;
}
/* redirect to Index page with Success Message */
return redirect('teams')->with('success', Lang::get('lang.teams_created_successfully'));
} catch (Exception $e) {
@@ -202,11 +210,16 @@ $users = DB::table('team_assign_agent')->select('team_assign_agent.id', 'team_as
public function edit($id, User $user, Assign_team_agent $assign_team_agent, Teams $team)
{
try {
$user = $user->where('role', '<>', 'user')->where('active', '=', 1)->get();
$a_id = [];
$teams = $team->whereId($id)->first();
$agent_team = $assign_team_agent->where('team_id', $id)->get();
$agent_id = $agent_team->lists('agent_id', 'agent_id');
foreach ($agent_id as $value) {
array_push($a_id, $value);
}
// dd($a_id);
$user = $user->whereIn('id', $a_id)->where('active', '=', 1)->orderBy('first_name')->get();
// dd($user);
return view('themes.default1.admin.helpdesk.agent.teams.edit', compact('agent_id', 'user', 'teams', 'allagents'));
} catch (Exception $e) {
return redirect()->back()->with('fails', $e->getMessage());