update 1.0.8.0
Commits for version update
This commit is contained in:
74
app/Model/MailJob/Condition.php
Normal file
74
app/Model/MailJob/Condition.php
Normal file
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
|
||||
namespace App\Model\MailJob;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Condition extends Model
|
||||
{
|
||||
protected $table = 'conditions';
|
||||
protected $fillable = ['job', 'value'];
|
||||
|
||||
public function getConditionValue($job)
|
||||
{
|
||||
$value = ['condition' => '', 'at' => ''];
|
||||
$condition = $this->where('job', $job)->first();
|
||||
if ($condition) {
|
||||
$condition_value = explode(',', $condition->value);
|
||||
$value = ['condition' => $condition_value, 'at' => ''];
|
||||
if (is_array($condition_value)) {
|
||||
$value = ['condition' => $this->checkArray(0, $condition_value), 'at' => $this->checkArray(1, $condition_value)];
|
||||
}
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
public function checkArray($key, $array)
|
||||
{
|
||||
$value = '';
|
||||
if (is_array($array)) {
|
||||
if (array_key_exists($key, $array)) {
|
||||
$value = $array[$key];
|
||||
}
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
public function checkActiveJob()
|
||||
{
|
||||
$result = ['fetching' => '', 'notification' => '', 'work' => '', 'message' => ''];
|
||||
$emails = new \App\Model\helpdesk\Settings\Email();
|
||||
$email = $emails->find(1);
|
||||
if ($email) {
|
||||
if ($email->email_fetching == 1) {
|
||||
$result['fetching'] = true;
|
||||
}
|
||||
if ($email->notification_cron == 1) {
|
||||
$result['notification'] = true;
|
||||
}
|
||||
}
|
||||
$works = new \App\Model\helpdesk\Workflow\WorkflowClose();
|
||||
$work = $works->find(1);
|
||||
//dd($work);
|
||||
if ($work) {
|
||||
if ($work->condition == 1) {
|
||||
$result['work'] = true;
|
||||
}
|
||||
}
|
||||
if (\Schema::hasTable('sms_notify_setting')) {
|
||||
$message = new \App\Plugins\SMS\Model\SmsNotify();
|
||||
$message = $message->select('status')->where('name', '=', 'open_ticket_nofification')->first();
|
||||
if ($message) {
|
||||
if ($message->status) {
|
||||
$result['message'] = true;
|
||||
} else {
|
||||
$result['message'] = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
11
app/Model/MailJob/FaveoMail.php
Normal file
11
app/Model/MailJob/FaveoMail.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Model\MailJob;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class FaveoMail extends Model
|
||||
{
|
||||
protected $table = 'faveo_mails';
|
||||
protected $fillable = ['drive', 'key', 'value', 'email_id'];
|
||||
}
|
11
app/Model/MailJob/FaveoQueue.php
Normal file
11
app/Model/MailJob/FaveoQueue.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Model\MailJob;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class FaveoQueue extends Model
|
||||
{
|
||||
protected $table = 'faveo_queues';
|
||||
protected $fillable = ['key', 'value', 'service_id'];
|
||||
}
|
11
app/Model/MailJob/MailService.php
Normal file
11
app/Model/MailJob/MailService.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Model\MailJob;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class MailService extends Model
|
||||
{
|
||||
protected $table = 'mail_services';
|
||||
protected $fillable = ['name', 'short_name'];
|
||||
}
|
72
app/Model/MailJob/QueueService.php
Normal file
72
app/Model/MailJob/QueueService.php
Normal file
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
namespace App\Model\MailJob;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class QueueService extends Model
|
||||
{
|
||||
protected $table = 'queue_services';
|
||||
protected $fillable = ['name', 'short_name', 'status'];
|
||||
|
||||
public function extraFieldRelation()
|
||||
{
|
||||
$related = "App\Model\MailJob\FaveoQueue";
|
||||
|
||||
return $this->hasMany($related, 'service_id');
|
||||
}
|
||||
|
||||
public function getExtraField($key)
|
||||
{
|
||||
$value = '';
|
||||
$setting = $this->extraFieldRelation()->where('key', $key)->first();
|
||||
if ($setting) {
|
||||
$value = $setting->value;
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
$name = $this->attributes['name'];
|
||||
$id = $this->attributes['id'];
|
||||
$html = '<a href='.url('queue/'.$id).'>'.$name.'</a>';
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
public function getStatus()
|
||||
{
|
||||
$status = $this->attributes['status'];
|
||||
$html = "<span style='color:red'>Inactive</span>";
|
||||
if ($status == 1) {
|
||||
$html = "<span style='color:green'>Active</span>";
|
||||
}
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
public function getAction()
|
||||
{
|
||||
$id = $this->attributes['id'];
|
||||
$status = $this->attributes['status'];
|
||||
$html = '<a href='.url('queue/'.$id.'/activate')." class='btn btn-primary'>Activate</a>";
|
||||
if ($status == 1) {
|
||||
$html = "<a href='#' class='btn btn-primary' disabled>Activate</a>";
|
||||
}
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
public function isActivate()
|
||||
{
|
||||
$check = true;
|
||||
$settings = $this->extraFieldRelation()->get();
|
||||
if ($settings->count() == 0) {
|
||||
$check = false;
|
||||
}
|
||||
|
||||
return $check;
|
||||
}
|
||||
}
|
@@ -7,5 +7,5 @@ use App\BaseModel;
|
||||
class Assign_team_agent extends BaseModel
|
||||
{
|
||||
protected $table = 'team_assign_agent';
|
||||
protected $fillable = ['id', 'team_id', 'agent_id'];
|
||||
protected $fillable = ['id', 'team_id', 'agent_id', 'updated_at', 'created_at'];
|
||||
}
|
||||
|
@@ -12,4 +12,27 @@ class Organization extends BaseModel
|
||||
|
||||
/* Define the fillable fields */
|
||||
protected $fillable = ['id', 'name', 'phone', 'website', 'address', 'head', 'internal_notes'];
|
||||
|
||||
public function userRelation()
|
||||
{
|
||||
$related = "App\Model\helpdesk\Agent_panel\User_org";
|
||||
|
||||
return $this->hasMany($related, 'org_id');
|
||||
}
|
||||
|
||||
public function getUserIds()
|
||||
{
|
||||
$user_relations = $this->userRelation()->lists('user_id')->toArray();
|
||||
|
||||
return $user_relations;
|
||||
}
|
||||
|
||||
public function users()
|
||||
{
|
||||
$user = new \App\User();
|
||||
$user_ids = $this->getUserIds();
|
||||
$users = $user->whereIn('id', $user_ids);
|
||||
|
||||
return $users;
|
||||
}
|
||||
}
|
||||
|
@@ -12,4 +12,13 @@ class User_org extends BaseModel
|
||||
|
||||
/* define fillable fields */
|
||||
protected $fillable = ['id', 'org_id', 'user_id'];
|
||||
|
||||
public function setOrgIdAttribute($value)
|
||||
{
|
||||
if ($value == '') {
|
||||
$this->attributes['org_id'] = null;
|
||||
} else {
|
||||
$this->attributes['org_id'] = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -14,4 +14,62 @@ class Emails extends BaseModel
|
||||
'fetching_status', 'move_to_folder', 'delete_email', 'do_nothing',
|
||||
'sending_status', 'authentication', 'header_spoofing', 'imap_config',
|
||||
];
|
||||
|
||||
public function getCurrentDrive()
|
||||
{
|
||||
$drive = $this->attributes['sending_protocol'];
|
||||
$mailServices = new \App\Model\MailJob\MailService();
|
||||
$id = '';
|
||||
$mailService = $mailServices->where('short_name', $drive)->first();
|
||||
if ($mailService) {
|
||||
$id = $mailService->id;
|
||||
}
|
||||
|
||||
return $id;
|
||||
}
|
||||
|
||||
public function getExtraField($key)
|
||||
{
|
||||
$value = '';
|
||||
$id = $this->attributes['id'];
|
||||
$services = new \App\Model\MailJob\FaveoMail();
|
||||
$service = $services->where('email_id', $id)->where('key', $key)->first();
|
||||
if ($service) {
|
||||
$value = $service->value;
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
public function extraFieldRelation()
|
||||
{
|
||||
$related = "App\Model\MailJob\FaveoMail";
|
||||
|
||||
return $this->hasMany($related, 'email_id');
|
||||
}
|
||||
|
||||
public function deleteExtraFields()
|
||||
{
|
||||
$fields = $this->extraFieldRelation()->get();
|
||||
if ($fields->count() > 0) {
|
||||
foreach ($fields as $field) {
|
||||
$field->delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function getPasswordAttribute($value)
|
||||
{
|
||||
if ($value) {
|
||||
return \Crypt::decrypt($value);
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
public function delete()
|
||||
{
|
||||
$this->deleteExtraFields();
|
||||
parent::delete();
|
||||
}
|
||||
}
|
||||
|
@@ -7,5 +7,16 @@ use Illuminate\Database\Eloquent\Model;
|
||||
class FieldValue extends Model
|
||||
{
|
||||
protected $table = 'field_values';
|
||||
protected $fillable = ['field_id', 'parent_id', 'field_key', 'field_value'];
|
||||
protected $fillable = ['field_id', 'child_id', 'field_key', 'field_value'];
|
||||
|
||||
public function childId()
|
||||
{
|
||||
$childid = '';
|
||||
$child = $this->attributes['child_id'];
|
||||
if ($child) {
|
||||
$childid = $this->attributes['child_id'];
|
||||
}
|
||||
|
||||
return $childid;
|
||||
}
|
||||
}
|
||||
|
@@ -29,6 +29,39 @@ class Fields extends BaseModel
|
||||
return $value;
|
||||
}
|
||||
|
||||
public function valuesAsString()
|
||||
{
|
||||
$string = '';
|
||||
$values = $this->values()->lists('field_value')->toArray();
|
||||
if (count($values) > 0) {
|
||||
$string = implode(',', $values);
|
||||
}
|
||||
|
||||
return $string;
|
||||
}
|
||||
|
||||
public function requiredFieldForCheck()
|
||||
{
|
||||
$check = false;
|
||||
$required = $this->attributes['required'];
|
||||
if ($required === '1') {
|
||||
$check = true;
|
||||
}
|
||||
|
||||
return $check;
|
||||
}
|
||||
|
||||
public function nonRequiredFieldForCheck()
|
||||
{
|
||||
$check = false;
|
||||
$required = $this->attributes['required'];
|
||||
if ($required !== '1') {
|
||||
$check = true;
|
||||
}
|
||||
|
||||
return $check;
|
||||
}
|
||||
|
||||
public function deleteValues()
|
||||
{
|
||||
$values = $this->values()->get();
|
||||
@@ -41,6 +74,7 @@ class Fields extends BaseModel
|
||||
|
||||
public function delete()
|
||||
{
|
||||
$this->deleteValues();
|
||||
parent::delete();
|
||||
}
|
||||
}
|
||||
|
16
app/Model/helpdesk/Settings/Approval.php
Normal file
16
app/Model/helpdesk/Settings/Approval.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\Model\helpdesk\Settings;
|
||||
|
||||
use App\BaseModel;
|
||||
|
||||
class Approval extends BaseModel
|
||||
{
|
||||
/* Using Ticket table */
|
||||
|
||||
protected $table = 'approval';
|
||||
/* Set fillable fields in table */
|
||||
protected $fillable = [
|
||||
'id', 'name', 'status', 'created_at', 'updated_at',
|
||||
];
|
||||
}
|
@@ -8,6 +8,6 @@ class CommonSettings extends BaseModel
|
||||
{
|
||||
protected $table = 'common_settings';
|
||||
protected $fillable = [
|
||||
'optional', 'key', 'value', 'created_at', 'updated_at',
|
||||
'status', 'option_name', 'option_value', 'optional_field', 'created_at', 'updated_at',
|
||||
];
|
||||
}
|
||||
|
17
app/Model/helpdesk/Settings/Followup.php
Normal file
17
app/Model/helpdesk/Settings/Followup.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Model\helpdesk\Settings;
|
||||
|
||||
use App\BaseModel;
|
||||
|
||||
class Followup extends BaseModel
|
||||
{
|
||||
/* Using auto_response table */
|
||||
|
||||
protected $table = 'followup';
|
||||
/* Set fillable fields in table */
|
||||
protected $fillable = [
|
||||
|
||||
'id', 'name', 'status', 'condition', 'created_at', 'updated_at',
|
||||
];
|
||||
}
|
61
app/Model/helpdesk/Settings/SocialMedia.php
Normal file
61
app/Model/helpdesk/Settings/SocialMedia.php
Normal file
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
namespace App\Model\helpdesk\Settings;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class SocialMedia extends Model
|
||||
{
|
||||
protected $table = 'social_media';
|
||||
protected $fillable = [
|
||||
'provider',
|
||||
'key',
|
||||
'value',
|
||||
];
|
||||
|
||||
public function getvalueByKey($provider, $key = '', $login = true)
|
||||
{
|
||||
$social = '';
|
||||
if ($key == 'redirect' && $login == true) {
|
||||
$social = url('social/login/'.$provider);
|
||||
}
|
||||
if ($key !== '' && $key !== 'redirect') {
|
||||
$social = $this->where('provider', $provider)->where('key', $key)->first();
|
||||
} elseif ($key !== 'redirect') {
|
||||
$social = $this->where('provider', $provider)->lists('value', 'key')->toArray();
|
||||
}
|
||||
if (is_object($social)) {
|
||||
$social = $social->value;
|
||||
}
|
||||
|
||||
return $social;
|
||||
}
|
||||
|
||||
public function checkActive($provider)
|
||||
{
|
||||
$check = '';
|
||||
$social = $this->where('provider', $provider)->where('key', 'status')->first();
|
||||
if ($social) {
|
||||
$value = $social->value;
|
||||
if ($value === '1') {
|
||||
$check = true;
|
||||
}
|
||||
}
|
||||
|
||||
return $check;
|
||||
}
|
||||
|
||||
public function checkInactive($provider)
|
||||
{
|
||||
$check = '';
|
||||
$social = $this->where('provider', $provider)->where('key', 'status')->first();
|
||||
if ($social) {
|
||||
$value = $social->value;
|
||||
if ($value === '0') {
|
||||
$check = true;
|
||||
}
|
||||
}
|
||||
|
||||
return $check;
|
||||
}
|
||||
}
|
@@ -6,9 +6,10 @@ use App\BaseModel;
|
||||
|
||||
class Ticket_Priority extends BaseModel
|
||||
{
|
||||
protected $primaryKey = 'priority_id';
|
||||
public $timestamps = false;
|
||||
protected $table = 'ticket_priority';
|
||||
protected $fillable = [
|
||||
'priority_id', 'priority', 'priority_desc', 'priority_color', 'priority_urgency', 'ispublic',
|
||||
'priority_id', 'priority', 'status', 'user_priority_status', 'priority_desc', 'priority_color', 'priority_urgency', 'ispublic', 'created_at', 'updated_at',
|
||||
];
|
||||
}
|
||||
|
@@ -3,6 +3,7 @@
|
||||
namespace App\Model\helpdesk\Ticket;
|
||||
|
||||
//use App\BaseModel;
|
||||
use File;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Ticket_Thread extends Model
|
||||
@@ -27,8 +28,117 @@ class Ticket_Thread extends Model
|
||||
// $this->attributes['title'] = str_replace('"', "'", $value);
|
||||
// }
|
||||
|
||||
public function getTitleAttribute($value)
|
||||
{
|
||||
return str_replace('"', "'", $value);
|
||||
}
|
||||
public function getTitleAttribute($value)
|
||||
{
|
||||
return str_replace('"', "'", $value);
|
||||
}
|
||||
|
||||
public function thread($content)
|
||||
{
|
||||
// $porufi = $this->purify($content);
|
||||
// dd($content,$porufi);
|
||||
//return $content;
|
||||
return $this->purify($content);
|
||||
}
|
||||
|
||||
public function purifyOld($value)
|
||||
{
|
||||
require_once base_path('vendor'.DIRECTORY_SEPARATOR.'htmlpurifier'.DIRECTORY_SEPARATOR.'library'.DIRECTORY_SEPARATOR.'HTMLPurifier.auto.php');
|
||||
$path = base_path('vendor'.DIRECTORY_SEPARATOR.'htmlpurifier'.DIRECTORY_SEPARATOR.'library'.DIRECTORY_SEPARATOR.'HTMLPurifier'.DIRECTORY_SEPARATOR.'DefinitionCache'.DIRECTORY_SEPARATOR.'Serializer');
|
||||
if (!File::exists($path)) {
|
||||
File::makeDirectory($path, $mode = 0777, true, true);
|
||||
}
|
||||
$config = \HTMLPurifier_Config::createDefault();
|
||||
$config->set('HTML.Trusted', true);
|
||||
$config->set('Filter.YouTube', true);
|
||||
|
||||
$purifier = new \HTMLPurifier($config);
|
||||
if ($value != strip_tags($value)) {
|
||||
$value = $purifier->purify($value);
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
public function purify()
|
||||
{
|
||||
$value = $this->attributes['body'];
|
||||
$str = str_replace("'", '"', $value);
|
||||
$html = preg_replace('#<script(.*?)>(.*?)</script>#is', '', $str);
|
||||
$string = trim(preg_replace('/\s+/', ' ', $html));
|
||||
$content = $this->inlineAttachment($string);
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
public function setTitleAttribute($value)
|
||||
{
|
||||
if ($value == '') {
|
||||
$this->attributes['title'] = 'No available';
|
||||
} else {
|
||||
$this->attributes['title'] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
public function removeScript($html)
|
||||
{
|
||||
$doc = new \DOMDocument();
|
||||
|
||||
// load the HTML string we want to strip
|
||||
$doc->loadHTML($html);
|
||||
|
||||
// get all the script tags
|
||||
$script_tags = $doc->getElementsByTagName('script');
|
||||
|
||||
$length = $script_tags->length;
|
||||
|
||||
// for each tag, remove it from the DOM
|
||||
for ($i = 0; $i < $length; $i++) {
|
||||
$script_tags->item($i)->parentNode->removeChild($script_tags->item($i));
|
||||
}
|
||||
|
||||
// get the HTML string back
|
||||
$no_script_html_string = $doc->saveHTML();
|
||||
|
||||
return $no_script_html_string;
|
||||
}
|
||||
|
||||
public function firstContent()
|
||||
{
|
||||
$poster = $this->attributes['poster'];
|
||||
if ($poster == 'client') {
|
||||
return 'yes';
|
||||
}
|
||||
|
||||
return 'no';
|
||||
}
|
||||
|
||||
public function inlineAttachment($body)
|
||||
{
|
||||
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);
|
||||
}
|
||||
$body = str_replace($search, $replace, $body);
|
||||
}
|
||||
|
||||
return $body;
|
||||
}
|
||||
|
||||
public function getSubject()
|
||||
{
|
||||
$subject = $this->attributes['title'];
|
||||
$array = imap_mime_header_decode($subject);
|
||||
$title = '';
|
||||
if (is_array($array) && count($array) > 0) {
|
||||
foreach ($array as $text) {
|
||||
$title .= $text->text;
|
||||
}
|
||||
|
||||
return wordwrap($title, 70, "<br>\n");
|
||||
}
|
||||
|
||||
return wordwrap($subject, 70, "<br>\n");
|
||||
}
|
||||
}
|
||||
|
@@ -9,6 +9,6 @@ class Ticket_source extends BaseModel
|
||||
public $timestamps = false;
|
||||
protected $table = 'ticket_source';
|
||||
protected $fillable = [
|
||||
'name', 'value',
|
||||
'name', 'value', 'css_class',
|
||||
];
|
||||
}
|
||||
|
@@ -28,6 +28,34 @@ class Tickets extends BaseModel
|
||||
return $this->hasMany('App\Model\helpdesk\Ticket\Ticket_Form_Data', 'ticket_id');
|
||||
}
|
||||
|
||||
public function extraFields()
|
||||
{
|
||||
$id = $this->attributes['id'];
|
||||
$ticket_form_datas = \App\Model\helpdesk\Ticket\Ticket_Form_Data::where('ticket_id', '=', $id)->get();
|
||||
|
||||
return $ticket_form_datas;
|
||||
}
|
||||
|
||||
public function source()
|
||||
{
|
||||
$source_id = $this->attributes['source'];
|
||||
$sources = new Ticket_source();
|
||||
$source = $sources->find($source_id);
|
||||
|
||||
return $source;
|
||||
}
|
||||
|
||||
public function sourceCss()
|
||||
{
|
||||
$css = 'fa fa-comment';
|
||||
$source = $this->source();
|
||||
if ($source) {
|
||||
$css = $source->css_class;
|
||||
}
|
||||
|
||||
return $css;
|
||||
}
|
||||
|
||||
public function delete()
|
||||
{
|
||||
$this->thread()->delete();
|
||||
|
11
app/Model/helpdesk/Utility/Otp.php
Normal file
11
app/Model/helpdesk/Utility/Otp.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Model\helpdesk\Utility;
|
||||
|
||||
use App\BaseModel;
|
||||
|
||||
class Otp extends BaseModel
|
||||
{
|
||||
protected $table = 'user_verification';
|
||||
protected $fillable = ['id', 'user_id', 'otp', 'temp_mobile', 'updated_at', 'created_at'];
|
||||
}
|
Reference in New Issue
Block a user