Updates
This commit is contained in:
@@ -4,13 +4,12 @@ namespace App\Model\MailJob;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Condition extends Model
|
||||
{
|
||||
protected $table = 'conditions';
|
||||
class Condition extends Model {
|
||||
|
||||
protected $table = "conditions";
|
||||
protected $fillable = ['job', 'value'];
|
||||
|
||||
public function getConditionValue($job)
|
||||
{
|
||||
public function getConditionValue($job) {
|
||||
$value = ['condition' => '', 'at' => ''];
|
||||
$condition = $this->where('job', $job)->first();
|
||||
if ($condition) {
|
||||
@@ -20,55 +19,41 @@ class Condition extends Model
|
||||
$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)) {
|
||||
|
||||
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' => ''];
|
||||
public function checkActiveJob() {
|
||||
$result = ['fetching' => '', 'notification' => '', 'work' => '', 'message' => '', 'remind' => ''];
|
||||
$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) {
|
||||
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) {
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -4,8 +4,9 @@ namespace App\Model\MailJob;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class FaveoMail extends Model
|
||||
{
|
||||
protected $table = 'faveo_mails';
|
||||
protected $fillable = ['drive', 'key', 'value', 'email_id'];
|
||||
class FaveoMail extends Model {
|
||||
|
||||
protected $table = "faveo_mails";
|
||||
protected $fillable = ["drive", "key", "value","email_id"];
|
||||
|
||||
}
|
||||
|
@@ -4,8 +4,9 @@ namespace App\Model\MailJob;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class FaveoQueue extends Model
|
||||
{
|
||||
protected $table = 'faveo_queues';
|
||||
protected $fillable = ['key', 'value', 'service_id'];
|
||||
class FaveoQueue extends Model {
|
||||
|
||||
protected $table = "faveo_queues";
|
||||
protected $fillable = ["key", "value","service_id"];
|
||||
|
||||
}
|
||||
|
@@ -6,6 +6,6 @@ use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class MailService extends Model
|
||||
{
|
||||
protected $table = 'mail_services';
|
||||
protected $fillable = ['name', 'short_name'];
|
||||
protected $table = "mail_services";
|
||||
protected $fillable = ["name","short_name"];
|
||||
}
|
||||
|
@@ -7,67 +7,55 @@ use Lang;
|
||||
|
||||
class QueueService extends Model
|
||||
{
|
||||
protected $table = 'queue_services';
|
||||
protected $fillable = ['name', 'short_name', 'status'];
|
||||
|
||||
public function extraFieldRelation()
|
||||
{
|
||||
protected $table = "queue_services";
|
||||
protected $fillable = ["name","short_name","status"];
|
||||
|
||||
public function extraFieldRelation(){
|
||||
$related = "App\Model\MailJob\FaveoQueue";
|
||||
|
||||
return $this->hasMany($related, 'service_id');
|
||||
return $this->hasMany($related,'service_id');
|
||||
}
|
||||
|
||||
public function getExtraField($key)
|
||||
{
|
||||
$value = '';
|
||||
$setting = $this->extraFieldRelation()->where('key', $key)->first();
|
||||
if ($setting) {
|
||||
|
||||
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'];
|
||||
|
||||
public function getName(){
|
||||
$name = $this->attributes['name'];
|
||||
$id = $this->attributes['id'];
|
||||
$html = '<a href='.url('queue/'.$id).'>'.$name.'</a>';
|
||||
|
||||
$html = "<a href=".url('queue/'.$id).">".$name."</a>";
|
||||
return $html;
|
||||
}
|
||||
|
||||
public function getStatus()
|
||||
{
|
||||
|
||||
public function getStatus(){
|
||||
$status = $this->attributes['status'];
|
||||
$html = "<span style='color:red'>".Lang::get('lang.inactive').'</span>';
|
||||
if ($status == 1) {
|
||||
$html = "<span style='color:green'>".Lang::get('lang.active').'</span>';
|
||||
$html = "<span style='color:red'>".Lang::get('lang.inactive')."</span>";
|
||||
if($status==1){
|
||||
$html = "<span style='color:green'>".Lang::get('lang.active')."</span>";
|
||||
}
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
public function getAction()
|
||||
{
|
||||
|
||||
public function getAction(){
|
||||
$id = $this->attributes['id'];
|
||||
$status = $this->attributes['status'];
|
||||
$html = '<a href='.url('queue/'.$id.'/activate')." class='btn btn-primary'>".Lang::get('lang.activate').'</a>';
|
||||
if ($status == 1) {
|
||||
$html = "<a href='#' class='btn btn-primary' disabled>".Lang::get('lang.activate').'</a>';
|
||||
$html = "<a href=".url('queue/'.$id.'/activate')." class='btn btn-primary'>".Lang::get('lang.activate')."</a>";
|
||||
if($status==1){
|
||||
$html = "<a href='#' class='btn btn-primary' disabled>".Lang::get('lang.activate')."</a>";
|
||||
}
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
public function isActivate()
|
||||
{
|
||||
|
||||
public function isActivate(){
|
||||
$check = true;
|
||||
$settings = $this->extraFieldRelation()->get();
|
||||
if ($settings->count() == 0) {
|
||||
if($settings->count()==0){
|
||||
$check = false;
|
||||
}
|
||||
|
||||
return $check;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user