diff --git a/.gitignore b/.gitignore
index c9d24e72e..75847b355 100644
--- a/.gitignore
+++ b/.gitignore
@@ -11,3 +11,5 @@ Homestead.json
/public/uploads
/public/photos/
/app/FaveoJob
+
+.env
diff --git a/.travis.yml b/.travis.yml
index 99c90bc91..077ea260c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -19,7 +19,7 @@ script: phpunit
# fast_finish: If your build fails do not continue trying to build, just stop.
matrix:
allow_failures:
- - php: 5.6
+ - php: 5.5
- php: hhvm
fast_finish: true
diff --git a/DB/demodatabase.sql b/DB/demodatabase.sql
index 68284ba4d..2aef04abd 100644
--- a/DB/demodatabase.sql
+++ b/DB/demodatabase.sql
@@ -2036,10 +2036,10 @@ CREATE TABLE IF NOT EXISTS `ticket_priority` (
--
INSERT INTO `ticket_priority` (`priority_id`, `priority`, `priority_desc`, `priority_color`, `priority_urgency`, `ispublic`, `status`, `is_default`) VALUES
-(1, 'Low', 'Low', '#00a65a', 4, 1, 0, NULL),
-(2, 'Normal', 'Normal', '#00bfef', 3, 1, 1, NULL),
-(3, 'High', 'High', '#f39c11', 2, 1, 0, NULL),
-(4, 'Emergency', 'Emergency', '#dd4b38', 1, 1, 0, NULL);
+(1, 'Low', 'Low', '#00a65a', 4, 1, 0, 0),
+(2, 'Normal', 'Normal', '#00bfef', 3, 1, 1, 1),
+(3, 'High', 'High', '#f39c11', 2, 1, 0, 0),
+(4, 'Emergency', 'Emergency', '#dd4b38', 1, 1, 0, 0);
-- --------------------------------------------------------
diff --git a/DB/dummy-data.sql b/DB/dummy-data.sql
index 68284ba4d..2aef04abd 100644
--- a/DB/dummy-data.sql
+++ b/DB/dummy-data.sql
@@ -2036,10 +2036,10 @@ CREATE TABLE IF NOT EXISTS `ticket_priority` (
--
INSERT INTO `ticket_priority` (`priority_id`, `priority`, `priority_desc`, `priority_color`, `priority_urgency`, `ispublic`, `status`, `is_default`) VALUES
-(1, 'Low', 'Low', '#00a65a', 4, 1, 0, NULL),
-(2, 'Normal', 'Normal', '#00bfef', 3, 1, 1, NULL),
-(3, 'High', 'High', '#f39c11', 2, 1, 0, NULL),
-(4, 'Emergency', 'Emergency', '#dd4b38', 1, 1, 0, NULL);
+(1, 'Low', 'Low', '#00a65a', 4, 1, 0, 0),
+(2, 'Normal', 'Normal', '#00bfef', 3, 1, 1, 1),
+(3, 'High', 'High', '#f39c11', 2, 1, 0, 0),
+(4, 'Emergency', 'Emergency', '#dd4b38', 1, 1, 0, 0);
-- --------------------------------------------------------
diff --git a/README.md b/README.md
index e606c703d..ccce45507 100644
--- a/README.md
+++ b/README.md
@@ -29,7 +29,7 @@ Faveo is designed & developed by 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 "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');
}
}
}
diff --git a/app/Http/Controllers/Agent/helpdesk/TicketController.php b/app/Http/Controllers/Agent/helpdesk/TicketController.php
index b8a52c02c..35aad3df7 100644
--- a/app/Http/Controllers/Agent/helpdesk/TicketController.php
+++ b/app/Http/Controllers/Agent/helpdesk/TicketController.php
@@ -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 "";
})
->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 {
diff --git a/app/Http/Controllers/Agent/helpdesk/UserController.php b/app/Http/Controllers/Agent/helpdesk/UserController.php
index 97c2b9205..c1c9b2f0e 100644
--- a/app/Http/Controllers/Agent/helpdesk/UserController.php
+++ b/app/Http/Controllers/Agent/helpdesk/UserController.php
@@ -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 {
diff --git a/app/Http/Controllers/Client/helpdesk/FormController.php b/app/Http/Controllers/Client/helpdesk/FormController.php
index 7c4534b78..3bbfa019e 100644
--- a/app/Http/Controllers/Client/helpdesk/FormController.php
+++ b/app/Http/Controllers/Client/helpdesk/FormController.php
@@ -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'),
diff --git a/app/Http/Controllers/Client/helpdesk/GuestController.php b/app/Http/Controllers/Client/helpdesk/GuestController.php
index 5be2e258c..0b1281d8d 100644
--- a/app/Http/Controllers/Client/helpdesk/GuestController.php
+++ b/app/Http/Controllers/Client/helpdesk/GuestController.php
@@ -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;
diff --git a/app/Http/Requests/helpdesk/ProfileRequest.php b/app/Http/Requests/helpdesk/ProfileRequest.php
index 11b4da3d4..3b995c906 100644
--- a/app/Http/Requests/helpdesk/ProfileRequest.php
+++ b/app/Http/Requests/helpdesk/ProfileRequest.php
@@ -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';
+ }
+ }
}
diff --git a/app/Model/helpdesk/Ticket/Ticket_Thread.php b/app/Model/helpdesk/Ticket/Ticket_Thread.php
index e822dc3df..54f4c219e 100644
--- a/app/Model/helpdesk/Ticket/Ticket_Thread.php
+++ b/app/Model/helpdesk/Ticket/Ticket_Thread.php
@@ -118,7 +118,7 @@ class Ticket_Thread extends Model
if ($this->attach()->where('poster', 'INLINE')->get()->count() > 0) {
$search = $this->attach()->where('poster', 'INLINE')->lists('name')->toArray();
foreach ($this->attach()->where('poster', 'INLINE')->get() as $key => $attach) {
- $replace[$key] = "data:$attach->type;base64,".base64_encode($attach->file);
+ $replace[$key] = "data:$attach->type;base64,".$attach->file;
}
$body = str_replace($search, $replace, $body);
}
diff --git a/app/Model/helpdesk/Ticket/Ticket_attachments.php b/app/Model/helpdesk/Ticket/Ticket_attachments.php
index 33de6ad66..da680a731 100644
--- a/app/Model/helpdesk/Ticket/Ticket_attachments.php
+++ b/app/Model/helpdesk/Ticket/Ticket_attachments.php
@@ -10,4 +10,29 @@ class Ticket_attachments extends Model
protected $fillable = [
'id', 'thread_id', 'name', 'size', 'type', 'file', 'data', 'poster', 'updated_at', 'created_at',
];
+
+ public function setFileAttribute($value)
+ {
+ $this->attributes['file'] = base64_encode($value);
+ }
+
+ public function getFile()
+ {
+ $size = $this->size;
+ $units = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
+ $power = $size > 0 ? floor(log($size, 1024)) : 0;
+ $value = number_format($size / pow(1024, $power), 2, '.', ',').' '.$units[$power];
+ if ($this->poster == 'ATTACHMENT') {
+ if (mime($this->type) == true) {
+ $var = '
';
+
+ return '