Merge remote-tracking branch 'refs/remotes/origin/master' into arindam-bug-priority

This commit is contained in:
Manish Verma
2016-11-04 18:23:31 +05:30
parent e4b9755294
commit 775e0561d8
2541 changed files with 59048 additions and 90348 deletions

View File

@@ -89,7 +89,7 @@ class AgentController extends Controller
// list all the teams in a single variable
$teams = $team->lists('id', 'name')->toArray();
$location = GeoIP::getLocation();
$phonecode = $code->where('iso', '=', $location['isoCode'])->first();
$phonecode = $code->where('iso', '=', $location->iso_code)->first();
// returns to the page with all the variables and their datas
$send_otp = DB::table('common_settings')->select('status')->where('option_name', '=', 'send_otp')->first();
@@ -184,7 +184,7 @@ class AgentController extends Controller
{
try {
$location = GeoIP::getLocation();
$phonecode = $code->where('iso', '=', $location['isoCode'])->first();
$phonecode = $code->where('iso', '=', $location->iso_code)->first();
$user = $user->whereId($id)->first();
$team = $team->get();
$teams1 = $team->lists('name', 'id');

View File

@@ -252,12 +252,10 @@ class EmailsController extends Controller
$this->emailService($driver, $service_request);
$this->setMailConfig($driver, $username, $name, $password, $enc, $host, $port);
$controller = new \App\Http\Controllers\Common\PhpMailController();
$to = 'example@ladybirdweb.com';
$toname = 'test';
$subject = 'test';
$data = 'test';
//dd(\Config::get('mail'),\Config::get('services'));
$send = $controller->laravelMail($to, $toname, $subject, $data, [], []);
$send = $controller->laravelMail($username, $name, $subject, $data, [], []);
return $send;
}

View File

@@ -156,8 +156,8 @@ class PriorityController extends Controller
$tk_priority->ispublic = $request->ispublic;
$tk_priority->save();
if ($request->input('default_priority') == 'on') {
Ticket_Priority::where('is_default', '>', '0')
->update(['is_default' => '0']);
Ticket_Priority::where('is_default', '=', 1)
->update(['is_default' => 0]);
Ticket_Priority::where('priority_id', '=', $priority_id)
->update(['is_default' => 1]);
}

View File

@@ -172,7 +172,8 @@ class MailController extends Controller
}
$server->setFlag($cert);
$server->setAuthentication($username, $password);
$messages = $server->search('UNSEEN', 10);
$date = date('d M Y', strtotime('-1 days'));
$messages = $server->search("SINCE \"$date\" UNSEEN");
$this->message($messages, $email);
}
}
@@ -339,22 +340,19 @@ class MailController extends Controller
*/
public function get_data($id)
{
$attachments = \App\Model\helpdesk\Ticket\Ticket_attachments::where('id', '=', $id)->get();
foreach ($attachments as $attachment) {
header('Content-type: application/'.$attachment->type.'');
header('Content-Disposition: inline; filename='.$attachment->name.'');
header('Content-Transfer-Encoding: binary');
$headers = [
'Content-type: application/'.$attachment->type.'',
'Content-Disposition: inline; filename='.$attachment->name.'',
'Content-Transfer-Encoding: binary',
];
$file = $attachment->file;
echo $file;
// return response($file)
// ->header('Content-Type', $attachment->type)
// ->header('Content-Disposition', 'inline; filename='.$attachment->name.'')
// ->header('Content-Transfer-Encoding', 'binary');
$attachment = \App\Model\helpdesk\Ticket\Ticket_attachments::where('id', '=', $id)->first();
if (mime($attachment->type) == true) {
echo "<img src=data:$attachment->type;base64,".$attachment->file.'>';
} else {
$file = base64_decode($attachment->file);
return response($file)
->header('Cache-Control', 'no-cache private')
->header('Content-Description', 'File Transfer')
->header('Content-Type', $attachment->type)
->header('Content-length', strlen($file))
->header('Content-Disposition', 'attachment; filename='.$attachment->name)
->header('Content-Transfer-Encoding', 'binary');
}
}
}

View File

@@ -281,7 +281,7 @@ class TicketController extends Controller
public function newticket(CountryCode $code)
{
$location = GeoIP::getLocation();
$phonecode = $code->where('iso', '=', $location['isoCode'])->first();
$phonecode = $code->where('iso', '=', $location->iso_code)->first();
$settings = CommonSettings::select('status')->where('option_name', '=', 'send_otp')->first();
$email_mandatory = CommonSettings::select('status')->where('option_name', '=', 'email_mandatory')->first();
@@ -330,7 +330,7 @@ class TicketController extends Controller
$status = 1;
if ($phone != null || $mobile_number != null) {
$location = GeoIP::getLocation();
$geoipcode = $code->where('iso', '=', $location['isoCode'])->first();
$geoipcode = $code->where('iso', '=', $location->iso_code)->first();
if ($phonecode == null) {
$data = [
'fails' => Lang::get('lang.country-code-required-error'),
@@ -383,7 +383,7 @@ class TicketController extends Controller
return Redirect('newticket')->with('fails', Lang::get('lang.failed-to-create-user-tcket-as-mobile-has-been-taken'))->withInput($request->except('password'));
}
} catch (Exception $e) {
dd($e);
// dd($e);
if ($api != false) {
return $e->getMessage();
}
@@ -566,7 +566,7 @@ class TicketController extends Controller
$attachment_files = null;
}
$thread = Ticket_Thread::where('ticket_id', '=', $ticket_id)->first();
$thread = Ticket_Thread::where('ticket_id', '=', $ticket_id)->orderBy('id')->first();
$ticket_subject = $thread->title;
$user_id = $tickets->user_id;
$user = User::where('id', '=', $user_id)->first();
@@ -960,7 +960,7 @@ class TicketController extends Controller
try {
$this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('0', $ticketdata->dept_id), $to = ['user' => $email_data['to_user'], 'email' => $email_data['to_email']], $message = ['subject' => $updated_subject, 'body' => $body, 'scenario' => $mail], $template_variables = ['ticket_agent_name' => $email_data['to_user_name'], 'ticket_client_name' => $username, 'ticket_client_email' => $emailadd, 'user' => $email_data['to_user_name'], 'ticket_number' => $ticket_number2, 'email_address' => $emailadd, 'name' => $ticket_creator]);
} catch (\Exception $e) {
dd($e);
// dd($e);
}
}
$data = [
@@ -2477,7 +2477,7 @@ class TicketController extends Controller
return "<input type='checkbox' name='select_all[]' id='".$ticket->id."' onclick='someFunction(this.id)' class='selectval icheckbox_flat-blue' value='".$ticket->id."'></input>";
})
->addColumn('subject', function ($ticket) {
$subject = Ticket_Thread::where('ticket_id', '=', $ticket->id)->first();
$subject = Ticket_Thread::where('ticket_id', '=', $ticket->id)->orderBy('id')->first();
if (isset($subject->title)) {
$string = str_limit($subject->getSubject(), 20);
} else {

View File

@@ -188,7 +188,7 @@ class UserController extends Controller
$settings = CommonSettings::select('status')->where('option_name', '=', 'send_otp')->first();
$email_mandatory = CommonSettings::select('status')->where('option_name', '=', 'email_mandatory')->first();
$location = GeoIP::getLocation();
$phonecode = $code->where('iso', '=', $location['isoCode'])->first();
$phonecode = $code->where('iso', '=', $location->iso_code)->first();
$org = Organization::lists('name', 'id')->toArray();
return view('themes.default1.agent.helpdesk.user.create', compact('org', 'settings', 'email_mandatory'))->with('phonecode', $phonecode->phonecode);
@@ -575,7 +575,7 @@ class UserController extends Controller
/* select the field where id = $id(request Id) */
$users = $user->whereId($id)->first();
$location = GeoIP::getLocation();
$phonecode = $code->where('iso', '=', $location['isoCode'])->first();
$phonecode = $code->where('iso', '=', $location->iso_code)->first();
$org = Organization::lists('name', 'id')->toArray();
return view('themes.default1.agent.helpdesk.user.edit', compact('users', 'org', '$settings', '$email_mandatory'))->with('phonecode', $phonecode->phonecode);
@@ -651,7 +651,7 @@ class UserController extends Controller
{
$user = Auth::user();
$location = GeoIP::getLocation();
$phonecode = $code->where('iso', '=', $location['isoCode'])->first();
$phonecode = $code->where('iso', '=', $location->iso_code)->first();
$settings = CommonSettings::select('status')->where('option_name', '=', 'send_otp')->first();
$status = $settings->status;
try {

View File

@@ -68,7 +68,7 @@ class FormController extends Controller
return redirect('auth/login')->with(['login_require' => 'Please login to your account for submitting a ticket', 'referer' => 'form']);
}
$location = GeoIP::getLocation();
$phonecode = $code->where('iso', '=', $location['isoCode'])->first();
$phonecode = $code->where('iso', '=', $location->iso_code)->first();
if (System::first()->status == 1) {
$topics = $topic->get();
$codes = $code->get();
@@ -199,7 +199,7 @@ class FormController extends Controller
$team_assign = null;
if ($phone != null || $mobile_number != null) {
$location = GeoIP::getLocation();
$geoipcode = $code->where('iso', '=', $location['isoCode'])->first();
$geoipcode = $code->where('iso', '=', $location->iso_code)->first();
if ($phonecode == null) {
$data = [
'fails' => Lang::get('lang.country-code-required-error'),

View File

@@ -61,7 +61,7 @@ class GuestController extends Controller
{
$user = Auth::user();
$location = GeoIP::getLocation();
$phonecode = $code->where('iso', '=', $location['isoCode'])->first();
$phonecode = $code->where('iso', '=', $location->iso_code)->first();
$settings = CommonSettings::select('status')->where('option_name', '=', 'send_otp')->first();
$status = $settings->status;

View File

@@ -31,7 +31,21 @@ class ProfileRequest extends Request
return [
'first_name' => 'required',
'profile_pic' => 'mimes:png,jpeg',
// 'mobile' => 'unique:users,mobile',
'mobile' => $this->checkMobile(),
];
}
/**
*Check the mobile number is unique or not.
*
*@return string
*/
public function checkMobile()
{
if (\Auth::user()->mobile === Request::get('mobile')) {
return '';
} else {
return 'unique:users';
}
}
}