5088d28e by G Manojkumar

VRM new Application

0 parents
Showing 1000 changed files with 4964 additions and 0 deletions

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.

../custom/.env
\ No newline at end of file
* text=auto
*.css linguist-vendored
*.less linguist-vendored
#!/bin/bash
export PATH=$PATH:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
echo asterisk -rx "sip show channels";
The difference between this server and other servers is KPAMIListen.php Please make sure updating this file.
Version No. 1.14v
Changes: agent time report updated, commented if condition.
Date: 03/09/2018
Version No. 1.13v
Changes: hangup beep, footer.blade.php, dialer.js changed and hangup beep added to assets/sounds/
Date: 11/08/2018 Only on Mumbai servers
Version No. 1.12v
Changes: followup for new disposition, DialerController.php and dialer.js is changed.
Date: 11/08/2018
Version No. 1.11v
Changes: Master report download, Changes main.blade.php, Added two libraries lib, php, KHRMS.php, XLSX library.
Date: 08/08/2018
Version No. 1.10v
Changes: Username for inbounddrop and Userbusy for SIP/GATEWAY , Changes KPAMIListen.php
Date: 02/08/2018
Version No. 1.9v
Changes: Call log report supervisor, and Date range in call report.
Date: 30/07/2018
Version No. 1.8v
Changes: HDFC Mogo, Changes 1.extension.conf, 2.DialerController.php, 3.mogo tune in moh location.
Date 20/07/2018
Version No. 1.7V
Changes: Live report reload button issue, commented one line of code in Livereport.blade.php
Date: 19/07/2018
Versio No. 1.6V
Changes: call forward, KPAMIListen, .env and extension.conf file updated
Date: 14/07/2018
Version No. 1.5V
Changes: Birthday calls for progressive mode, DialerController.php is updated
Date: 13/07/2018
Version No. 1.4V
Changes: To Blank diallines, DailyLogout.php is updated.
Date: 6/07/2018
Version No. 1.3v
Changes: Bulkupload
Date: 5/07/2018
Version NO. 1.2v
Changes: To remove multiple circles in dialer, dialer.js is updated.
Date: 4/07/2018
Version No. 1.1v
Changes: To remove Inbound Portfolio issue, KPAMIListen updated.
Date: 18/06/2018
<?php namespace App\Console\Commands;
use Illuminate\Console\Command;
//use Mail;
use DB;
use Config;
use App\Models\User;
use App\Models\Accesslog;
use App\Models\CRMCall;
use Schema;
use PDO;
use App\Models\Notification;
use App\Jobs\KHRMSLib;
use Input;
use Illuminate\Database\Schema\Blueprint;
class bulkserverupload_data extends Command {
/**
* The console command name.
*
* @var string
*/
protected $signature = 'bulkserverupload_data';
/**
* The console command description.
*
* @var string
*/
protected $description = 'bulkserverupload_data';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
//echo "\n".date('Y-m-d')."\n";
echo "2";
echo "\n".date('Y-m-d H:i:s')."\n";
$server_ip=env('app_ip');
$central_ip=env('central_ip');
$wakka = new KHRMSLib();
$kformlib=new \App\Jobs\KFormLib($wakka->HRCoreVars["HRFiledsStr"]);
$kformlib->gthis=$wakka;
$themehome=$wakka->GetThemePath('/');
$updatetime=time();
$clientlst=$wakka->GetBBBUserData("clientslist");
$isadmin=$wakka->IsAdmin();
$username=$wakka->GetUserName();
$triggers=Input::get("triggers");
$tmpstr=explode(",",$kformlib->HRFiledsStr);
$success="";$message="";$successcnt=0;$duplicatecount=0;
$conn = array(
'driver' => 'mysql',
'host' => $central_ip,
'database' => env('DB_DATABASE', 'kstych_flexydial'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', 'yb9738z'),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'options' => array(
PDO::ATTR_TIMEOUT => 5,
),
);
Config::set("database.connections.conn", $conn);
DB::connection("conn")->getDatabaseName();
$serverclist=DB::connection("conn")->select(DB::raw("select location from server_details where server_ip='$server_ip'"));
$location=$serverclist[0]->location;
$excelarray = DB::connection("conn")->select(DB::raw("select * from bz_record_upload_uat_150918 where SERVER_IP='$server_ip'"));
$conn='';
$tcol=0;$fieldsarr=array();$extrahdrarr=array();
foreach($excelarray as $key => $array){
$excelarray[$key] = (array)$array;
}
$highestColumn = DB::connection("conn")->select(DB::raw("select count(*) as cnt from information_schema.columns where table_name='bz_record_upload_uat_150918'"));
$highestColumn = $highestColumn[0]->cnt;
$highestrow = count($excelarray);
$flag = 0;
$editflag=0;
for($i=0;$i<$highestrow;$i++)
{
if($excelarray[$i]["clientcode"]!="")
{
/*if($excelarray[$i]["id"]=="CREATE")
{
$excelarray[$i]["id"]=$wakka->Query("insert into","","records",array('created'=>date('Y-m-d H:i:s')));
}
else*/
$excelarray[$i]["clientcode"]=intval($excelarray[$i]["clientcode"]);
//$excelarray[$i]["client"]=$excelarray[$i]["rm_code"];
if($wakka->getCount("records","clientcode='".$excelarray[$i]["clientcode"]."'")==1)
{
//$empdata=$wakka->getPerson($excelarray[$i]["id"]);
$empdata=$wakka->getPersonServer($excelarray[$i]["clientcode"]);
$ppldata=$empdata["peopledata"];
$createdlog=$empdata['modifylog'];
$fdirty=$empdata['dirty'];
$createdlog[$updatetime]=$username."::";
$createdlog["updated"]=$updatetime;
$newdata=$ppldata;
foreach($excelarray[$i] as $key => $value)
{
if($value!="")
{
if("A".$ppldata[$key]!="A".$value)//forcing string comparrision //MAGIC
{
$value=str_replace("'"," ",$value);
if(strstr($createdlog[$updatetime],$key)==FALSE)$createdlog[$updatetime].="$key|".str_replace(array("|",",")," ",$ppldata[$key])."|".str_replace(array("|",",")," ",$value).",";
$fdirty[$key]=1;
$newdata[$key]=$value;
}
}
}
/*Start - Changes need to be done*/
if($excelarray[$i]["status"]==null)
{
$empdata['status'] = "rom";
}
if($excelarray[$i]["dialer_status"]==null)
{
$empdata['dialer_status'] = "rom";
}
if($excelarray[$i]["dialer_substatus"]==null)
{
$empdata['dialer_substatus'] = "rom";
}
/*End - Changes need to be done*/
$empdata["peopledata"]=$newdata;
$empdata['modifylog']=$createdlog;
$empdata['dirty']=$fdirty;
//$wakka->setPerson($excelarray[$i]["id"],$empdata);
$wakka->setPersonServer($excelarray[$i]["clientcode"],$empdata);
$excelarray[$i]['modified']=date('Y-m-d H:i:s');
$successArr[] = $excelarray[$i];
}
else
{
$excelarray[$i]["id"]=$wakka->Query("insert into","","records",array('created'=>date('Y-m-d H:i:s')));
$empdata=$wakka->getPerson($excelarray[$i]["id"]);
$ppldata=$empdata["peopledata"];
$createdlog=$empdata['modifylog'];
$fdirty=$empdata['dirty'];
$createdlog[$updatetime]=$username."::";
$createdlog["updated"]=$updatetime;
$newdata=$ppldata;
foreach($excelarray[$i] as $key => $value)
{
if($value!="")
{
if("A".$ppldata[$key]!="A".$value)//forcing string comparrision //MAGIC
{
$value=str_replace("'"," ",$value);
if(strstr($createdlog[$updatetime],$key)==FALSE)$createdlog[$updatetime].="$key|".str_replace(array("|",",")," ",$ppldata[$key])."|".str_replace(array("|",",")," ",$value).",";
$fdirty[$key]=1;
$newdata[$key]=$value;
}
}
}
$empdata["peopledata"]=$newdata;
$empdata['modifylog']=$createdlog;
$empdata['dirty']=$fdirty;
//$wakka->setPerson($excelarray[$i]["id"],$empdata);
$wakka->setPerson($excelarray[$i]["id"],$empdata);
$reason = "";
$reason .= "Record ID is not on local server,";
$excelarray[$i]['server_ip'] =$server_ip;
$excelarray[$i]['location'] =$location;
if($excelarray[$i]["clientcode"]!="")
$excelarray[$i]['cust_id'] =$excelarray[$i]["clientcode"];
$excelarray[$i]['record_id'] = $excelarray[$i]["id"];
$excelarray[$i]['Reason'] = $reason;
$failureArr[] = $excelarray[$i];
}
}
else
{
$reason = "";
if($excelarray[$i]["id"]=="")
$reason .= "Column ID is blank,";
$excelarray[$i]['server_ip'] =$server_ip;
$excelarray[$i]['location'] =$location;
if($excelarray[$i]["clientcode"]!="")
$excelarray[$i]['cust_id'] =$excelarray[$i]["clientcode"];
$excelarray[$i]['Reason'] = $reason;
$failureArr[] = $excelarray[$i];
}
}
/*if(!empty($successArr)){
foreach($successArr as $succes)
{
$setSuccess=array();
$setSuccess[] = "server_ip='$server_ip'";
$setSuccess[] = "location='$location'";
$setSuccess[] = "record_id='".$succes['id']."'";
$setSuccess[] = "cust_id='".$succes['clientcode']."'";
$setSuccess[] = "modified='".$succes['modified']."'";
$setSuccess = implode(",",$setSuccess);
DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_success set $setSuccess"));
}
}
if(!empty($failureArr)){
foreach($failureArr as $failur)
{
$setFailure=array();
$setFailure[] = "server_ip='$server_ip'";
$setFailure[] = "location='$location'";
$setFailure[] = "cust_id='".$failur['clientcode']."'";
$setFailure[] = "record_id='".$failur['record_id']."'";
$setFailure[] = "reason='".$failur['Reason']."'";
$setFailure = implode(",",$setFailure);
DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_failure set $setFailure"));
}
}*/
DB::connection("conn")->disconnect();
}
}
<?php namespace App\Console\Commands;
use Illuminate\Console\Command;
//use Mail;
use DB;
use Config;
use App\Models\User;
use App\Models\Accesslog;
use App\Models\CRMCall;
use Schema;
use PDO;
use App\Models\Notification;
use App\Jobs\KHRMSLib;
use Input;
use Illuminate\Database\Schema\Blueprint;
class bulkServerUpload extends Command {
/**
* The console command name.
*
* @var string
*/
protected $signature = 'bulkServerUpload';
/**
* The console command description.
*
* @var string
*/
protected $description = 'bulkServerUpload';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
//echo "\n".date('Y-m-d')."\n";
echo "2";
echo "\n".date('Y-m-d H:i:s')."\n";
$server_ip=env('app_ip');
$central_ip=env('central_ip');
$wakka = new KHRMSLib();
$kformlib=new \App\Jobs\KFormLib($wakka->HRCoreVars["HRFiledsStr"]);
$kformlib->gthis=$wakka;
$themehome=$wakka->GetThemePath('/');
$updatetime=time();
$clientlst=$wakka->GetBBBUserData("clientslist");
$isadmin=$wakka->IsAdmin();
$username=$wakka->GetUserName();
$triggers=Input::get("triggers");
$tmpstr=explode(",",$kformlib->HRFiledsStr);
$success="";$message="";$successcnt=0;$duplicatecount=0;
$conn = array(
'driver' => 'mysql',
'host' => $central_ip,
'database' => env('DB_DATABASE', 'kstych_flexydial'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', 'yb9738z'),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'options' => array(
PDO::ATTR_TIMEOUT => 5,
),
);
Config::set("database.connections.conn", $conn);
DB::connection("conn")->getDatabaseName();
$serverclist=DB::connection("conn")->select(DB::raw("select location from server_details where server_ip='$server_ip'"));
$location=$serverclist[0]->location;
$excelarray = DB::connection("conn")->select(DB::raw("select * from bz_record_upload_uat_09102018_1 where SERVER_IP='$server_ip'"));
$conn='';
$tcol=0;$fieldsarr=array();$extrahdrarr=array();
foreach($excelarray as $key => $array){
$excelarray[$key] = (array)$array;
}
$highestColumn = DB::connection("conn")->select(DB::raw("select count(*) as cnt from information_schema.columns where table_name='bz_record_upload_uat_09102018_1'"));
$highestColumn = $highestColumn[0]->cnt;
$highestrow = count($excelarray);
$flag = 0;
$editflag=0;
for($i=0;$i<$highestrow;$i++)
{
if($excelarray[$i]["clientcode"]!="")
{
/*if($excelarray[$i]["id"]=="CREATE")
{
$excelarray[$i]["id"]=$wakka->Query("insert into","","records",array('created'=>date('Y-m-d H:i:s')));
}
else*/
$excelarray[$i]["clientcode"]=intval($excelarray[$i]["clientcode"]);
//$excelarray[$i]["client"]=$excelarray[$i]["rm_code"];
if($wakka->getCount("records","clientcode='".$excelarray[$i]["clientcode"]."'")==1)
{
//$empdata=$wakka->getPerson($excelarray[$i]["id"]);
$empdata=$wakka->getPersonServer($excelarray[$i]["clientcode"]);
$excelarray[$i]["other_information"]='2018-10-09_1';
$ppldata=$empdata["peopledata"];
$createdlog=$empdata['modifylog'];
$fdirty=$empdata['dirty'];
$createdlog[$updatetime]=$username."::";
$createdlog["updated"]=$updatetime;
$newdata=$ppldata;
foreach($excelarray[$i] as $key => $value)
{
if($value!="")
{
if("A".$ppldata[$key]!="A".$value)//forcing string comparrision //MAGIC
{
$value=str_replace("'"," ",$value);
if(strstr($createdlog[$updatetime],$key)==FALSE)$createdlog[$updatetime].="$key|".str_replace(array("|",",")," ",$ppldata[$key])."|".str_replace(array("|",",")," ",$value).",";
$fdirty[$key]=1;
$newdata[$key]=$value;
}
}
}
/*Start - Changes need to be done*/
if($excelarray[$i]["status"]==null)
{
$empdata['status'] = "rom";
}
if($excelarray[$i]["dialer_status"]==null)
{
$empdata['dialer_status'] = "rom";
}
if($excelarray[$i]["dialer_substatus"]==null)
{
$empdata['dialer_substatus'] = "rom";
}
/*End - Changes need to be done*/
$empdata["peopledata"]=$newdata;
$empdata['modifylog']=$createdlog;
$empdata['dirty']=$fdirty;
//$wakka->setPerson($excelarray[$i]["id"],$empdata);
$wakka->setPersonServer($excelarray[$i]["clientcode"],$empdata);
$excelarray[$i]['modified']=date('Y-m-d H:i:s');
$successArr[] = $excelarray[$i];
}
else
{
$excelarray[$i]["id"]=$wakka->Query("insert into","","records",array('created'=>date('Y-m-d H:i:s')));
$empdata=$wakka->getPerson($excelarray[$i]["id"]);
$ppldata=$empdata["peopledata"];
$createdlog=$empdata['modifylog'];
$fdirty=$empdata['dirty'];
$createdlog[$updatetime]=$username."::";
$createdlog["updated"]=$updatetime;
$newdata=$ppldata;
foreach($excelarray[$i] as $key => $value)
{
if($value!="")
{
if("A".$ppldata[$key]!="A".$value)//forcing string comparrision //MAGIC
{
$value=str_replace("'"," ",$value);
if(strstr($createdlog[$updatetime],$key)==FALSE)$createdlog[$updatetime].="$key|".str_replace(array("|",",")," ",$ppldata[$key])."|".str_replace(array("|",",")," ",$value).",";
$fdirty[$key]=1;
$newdata[$key]=$value;
}
}
}
$empdata["peopledata"]=$newdata;
$empdata['modifylog']=$createdlog;
$empdata['dirty']=$fdirty;
//$wakka->setPerson($excelarray[$i]["id"],$empdata);
$wakka->setPerson($excelarray[$i]["id"],$empdata);
$reason = "";
$reason .= "Record ID is not on local server,";
$excelarray[$i]['server_ip'] =$server_ip;
$excelarray[$i]['location'] =$location;
if($excelarray[$i]["clientcode"]!="")
$excelarray[$i]['cust_id'] =$excelarray[$i]["clientcode"];
$excelarray[$i]['record_id'] = $excelarray[$i]["id"];
$excelarray[$i]['Reason'] = $reason;
$failureArr[] = $excelarray[$i];
}
}
else
{
$reason = "";
if($excelarray[$i]["id"]=="")
$reason .= "Column ID is blank,";
$excelarray[$i]['server_ip'] =$server_ip;
$excelarray[$i]['location'] =$location;
if($excelarray[$i]["clientcode"]!="")
$excelarray[$i]['cust_id'] =$excelarray[$i]["clientcode"];
$excelarray[$i]['Reason'] = $reason;
$failureArr[] = $excelarray[$i];
}
}
echo "\n"."Updated data partial upload end"."\n";
/*if(!empty($successArr)){
foreach($successArr as $succes)
{
$setSuccess=array();
$setSuccess[] = "server_ip='$server_ip'";
$setSuccess[] = "location='$location'";
$setSuccess[] = "record_id='".$succes['id']."'";
$setSuccess[] = "cust_id='".$succes['clientcode']."'";
$setSuccess[] = "modified='".$succes['modified']."'";
$setSuccess = implode(",",$setSuccess);
DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_09102018_1_success set $setSuccess"));
}
}
if(!empty($failureArr)){
foreach($failureArr as $failur)
{
$setFailure=array();
$setFailure[] = "server_ip='$server_ip'";
$setFailure[] = "location='$location'";
$setFailure[] = "cust_id='".$failur['clientcode']."'";
$setFailure[] = "record_id='".$failur['record_id']."'";
$setFailure[] = "reason='".$failur['Reason']."'";
$setFailure = implode(",",$setFailure);
DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_failure set $setFailure"));
}
}*/
DB::connection("conn")->disconnect();
}
}
<?php namespace App\Console\Commands;
use Illuminate\Console\Command;
//use Mail;
use DB;
use Config;
use App\Models\User;
use App\Models\Accesslog;
use App\Models\CRMCall;
use Schema;
use PDO;
use App\Models\Notification;
use App\Jobs\KHRMSLib;
use Input;
use App\Models\Sipid;
use App\Models\Kqueue;
use App\Models\Dialline;
use App\Models\Session;
use Illuminate\Database\Schema\Blueprint;
class BirthdayDate extends Command {
/**
* The console command name.
*
* @var string
*/
protected $signature = 'BirthdayDate';
/**
* The console command description.
*
* @var string
*/
protected $description = 'BirthdayDate';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
echo "\n".date('Y-m-d H:i:s')."\n";
$birthday="%".date('-m-d')."%";
$wakka = new KHRMSLib();
$dobarray=DB::select(DB::raw("select peopledata from records where `DOB` like '$birthday'"));
foreach($dobarray as $dobarr)
{
$dobarray = unserialize($dobarr->peopledata);
$dobarray['priority']='11';
$preppldata['peopledata'] = $dobarray;
$query=$wakka->setPerson($dobarray['id'],$preppldata);
}
}
}
<?php namespace App\Console\Commands;
use Illuminate\Console\Command;
//use Mail;
use DB;
use Config;
use App\Models\User;
use App\Models\Accesslog;
use App\Models\CRMCall;
use Schema;
use PDO;
use Illuminate\Database\Schema\Blueprint;
class Calllogupdate extends Command {
/**
* The console command name.
*
* @var string
*/
protected $signature = 'Calllogupdate';
/**
* The console command description.
*
* @var string
*/
protected $description = 'App Main Daily Task for CreportEight';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$nowts=time();
$date=date('F_Y');
echo "\n".date('Y-m-d H:i:s')."\n";
$logdate=strtotime('0 day');
$tcol=0;$fieldsarr=array();$extrahdrarr=array();
$central_ip=env('central_ip');
$server_ip=env('app_ip');
$calllog_report = "calllog_report_".$date;
$conn = array(
'driver' => 'mysql',
'host' => $central_ip,
'database' => env('DB_DATABASE', 'kstych_flexydial'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'options' => array(
PDO::ATTR_TIMEOUT => 5,
),
);
Config::set("database.connections.conn", $conn);
DB::connection("conn")->getDatabaseName();
$serverclist=DB::connection("conn")->select(DB::raw("select id from server_details where server_ip='$server_ip'"));
$server_id=$serverclist[0]->id;
if($server_id<10){
$server_id="0".$server_id;
}
$alistupdate=DB::select(DB::raw("SELECT * from crmcalls where call_flag='Z' and created_at <= '".date("Y-m-d H:i:s",$logdate-(05*60))."'"));
foreach ($alistupdate as $aline) {
$clientcode="";$currentstatus="";$legalstatus="";$record_id="";
if($aline->crm_id>0)
{
$user=DB::select(DB::raw("select id,clientcode,currentstatus,legalstatus from records where id='".$aline->crm_id."' limit 1;"));
if(isset($user[0]))
{
$record_id=$user[0]->id;
$clientcode=$user[0]->clientcode;
$currentstatus=$user[0]->currentstatus;
$legalstatus=$user[0]->legalstatus;
}
}
$tpostdata=json_decode($aline->data,true);
$fulldate=date("Y-m-d H:i:s",strtotime($aline->created_at)+330*60);
$talktime=$aline->talkSec+$aline->recstartSec+$aline->recendSec;
$length=round(($aline->waitSec+$aline->callSec+$talktime+$aline->dispoSec)/1000,2);
if(!isset($userarr[$aline->user_id])&&$aline->user_id>0)$userarr[$aline->user_id]=User::find($aline->user_id);
$dispname="";if(isset($userarr[$aline->user_id]))$dispname=$userarr[$aline->user_id]->dispname();
$username="";if(isset($userarr[$aline->user_id]))$username=$userarr[$aline->user_id]->username;
$globalid=$server_id.$record_id;
$server = $server_id;
$record_id = $record_id;
$crmcall_id = $aline->id;
$globalid = $globalid;
$created_at = $aline->created_at;
$start = $fulldate;
$length = $length;
$user = $username;
$name = $dispname;
$dispo = $aline->userstatus;
$subdispo = $aline->usersubstatus;
$callback = $aline->usercallback;
$number = $aline->number;
$clientcode = $clientcode;
$currentstatus = $currentstatus;
$legalstatus = $legalstatus;
$client = $aline->client;
$department = $aline->department;
$state = $aline->state;
$hsource = $aline->hsource;
$type = $aline->type;
$status = $aline->status;
$statuscode = $aline->statuscode;
$statusstr = $aline->substatus;
$dialline = $aline->dialline_id;
$did = $aline->did;
$waitsec = round($aline->waitSec/1000,2);
$callsec = round($aline->callSec/1000,2);
$talksec = round($talktime/1000,2);
$disposec = round($aline->dispoSec/1000,2);
$remarks = str_replace("'","",$aline->userremarks);
$userdata = $aline->userdata;
$attempt = $aline->attempt;
$priority = $aline->priority;
$question = $aline->question;
DB::connection("conn")->update(DB::raw("UPDATE $calllog_report set server='$server', record_id='$record_id', crmcall_id='$crmcall_id', globalid='$globalid', created_at='$created_at', start='$start', length='$length', user='$user', name='$name', dispo='$dispo', subdispo='$subdispo', callback='$callback', number='$number', clientcode='$clientcode', currentstatus='$currentstatus', legalstatus='$legalstatus', client='$client', department='$department', state='$state', hsource='$hsource', type='$type', status='$status', statuscode='$statuscode', statusstr='$statusstr', dialline='$dialline', did='$did', waitsec='$waitsec', callsec='$callsec', talksec='$talksec', disposec='$disposec', remarks='$remarks', userdata='$userdata', attempt='$attempt', priority='$priority', question='$question' where server= '$server_id' and crmcall_id= '$crmcall_id'"));
DB::update(DB::raw("UPDATE crmcalls set call_flag='C' where id=$crmcall_id"));
}
echo "\n".date('Y-m-d H:i:s')."\n";
DB::connection("conn")->disconnect();
}
}
<?php namespace App\Console\Commands;
use Illuminate\Console\Command;
//use Mail;
use DB;
use Config;
use App\Models\User;
use App\Models\Accesslog;
use App\Models\CRMCall;
use Schema;
use PDO;
use Illuminate\Database\Schema\Blueprint;
class CreportEight extends Command {
/**
* The console command name.
*
* @var string
*/
protected $signature = 'CreportEight';
/**
* The console command description.
*
* @var string
*/
protected $description = 'App Main Daily Task for CreportEight';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$nowts=time();
$date=date('F_Y');
echo "\n".date('Y-m-d H:i:s')."\n";
$logdate=strtotime('0 day');
$tcol=0;$fieldsarr=array();$extrahdrarr=array();
$central_ip=env('central_ip');
$server_ip=env('app_ip');
$calllog_report = "calllog_report_".$date;
$conn = array(
'driver' => 'mysql',
'host' => $central_ip,
'database' => env('DB_DATABASE', 'kstych_flexydial'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'options' => array(
PDO::ATTR_TIMEOUT => 5,
),
);
Config::set("database.connections.conn", $conn);
DB::connection("conn")->getDatabaseName();
$serverclist=DB::connection("conn")->select(DB::raw("select id from server_details where server_ip='$server_ip'"));
$server_id=$serverclist[0]->id;
if($server_id<10){
$server_id="0".$server_id;
}
$maxid=DB::connection("conn")->select(DB::raw("SELECT max(crmcall_id) as maxid from $calllog_report where server='$server_id'"));
$maxids=$maxid[0]->maxid;
//$alist=DB::select(DB::raw("SELECT * from crmcalls where id>'$maxids' and created_at<'".date("Y-m-d H:i:s",$logdate-(60*60))."'"));
$alist=DB::select(DB::raw("SELECT * from crmcalls where id>'$maxids'"));
$countnumber=count($alist);
$finalnumber=$countnumber/50;
$finalnumber=floor($finalnumber);
$datainser='';
$iii=1;
$kkk=1;
$shortinsert="";
$userarr=array();
foreach($alist as $aline)
{
$clientcode="";$currentstatus="";$legalstatus="";$record_id="";
if($aline->crm_id>0)
{
$user=DB::select(DB::raw("select id,clientcode,currentstatus,legalstatus from records where id='".$aline->crm_id."' limit 1;"));
if(isset($user[0]))
{
$record_id=$user[0]->id;
$clientcode=$user[0]->clientcode;
$currentstatus=$user[0]->currentstatus;
$legalstatus=$user[0]->legalstatus;
}
}
$tpostdata=json_decode($aline->data,true);
$fulldate=date("Y-m-d H:i:s",strtotime($aline->created_at)+330*60);
$talktime=$aline->talkSec+$aline->recstartSec+$aline->recendSec;
$length=round(($aline->waitSec+$aline->callSec+$talktime+$aline->dispoSec)/1000,2);
if(!isset($userarr[$aline->user_id])&&$aline->user_id>0)$userarr[$aline->user_id]=User::find($aline->user_id);
$dispname="";if(isset($userarr[$aline->user_id]))$dispname=$userarr[$aline->user_id]->dispname();
$username="";if(isset($userarr[$aline->user_id]))$username=$userarr[$aline->user_id]->username;
$globalid=$server_id.$record_id;
$server = $server_id;
$record_id = $record_id;
$crmcall_id = $aline->id;
$globalid = $globalid;
$created_at = $aline->created_at;
$start = $fulldate;
$length = $length;
$user = $username;
$name = $dispname;
$dispo = $aline->userstatus;
$subdispo = $aline->usersubstatus;
$callback = $aline->usercallback;
$number = $aline->number;
$clientcode = $clientcode;
$currentstatus = $currentstatus;
$legalstatus = $legalstatus;
$client = $aline->client;
$department = $aline->department;
$state = $aline->state;
$hsource = $aline->hsource;
$type = $aline->type;
$status = $aline->status;
$statuscode = $aline->statuscode;
$statusstr = $aline->substatus;
$dialline = $aline->dialline_id;
$did = $aline->did;
$waitsec = round($aline->waitSec/1000,2);
$callsec = round($aline->callSec/1000,2);
$talksec = round($talktime/1000,2);
$disposec = round($aline->dispoSec/1000,2);
$remarks = str_replace("'","",$aline->userremarks);
$userdata = $aline->userdata;
$attempt = $aline->attempt;
$priority = $aline->priority;
$question = $aline->question;
$shortinsert.="('$server', '$record_id', '$crmcall_id', '$globalid','$created_at', '$start', '$length', '$user', '$name', '$dispo', '$subdispo', '$callback', '$number', '$clientcode', '$currentstatus', '$legalstatus', '$client', '$department', '$state', '$hsource', '$type', '$status', '$statuscode', '$statusstr', '$dialline', '$did', '$waitsec', '$callsec', '$talksec', '$disposec', '$remarks', '$userdata', '$attempt', '$priority', '$question'),";
if($kkk<=$finalnumber){
if($iii%50==0){
$shortinsert=substr($shortinsert,0,-1);
DB::connection("conn")->insert(DB::raw("INSERT INTO $calllog_report (`server`, `record_id`, `crmcall_id`, `globalid`, `created_at`, `start`, `length`, `user`, `name`, `dispo`, `subdispo`, `callback`, `number`, `clientcode`, `currentstatus`, `legalstatus`, `client`, `department`, `state`, `hsource`, `type`, `status`, `statuscode`, `statusstr`, `dialline`, `did`, `waitsec`, `callsec`, `talksec`, `disposec`, `remarks`, `userdata`, `attempt`, `priority`, `question`) VALUES $shortinsert"));
$kkk++;
}
}else{
DB::connection("conn")->insert(DB::raw("INSERT INTO $calllog_report set server='$server', record_id='$record_id', crmcall_id='$crmcall_id', globalid='$globalid', created_at='$created_at', start='$start', length='$length', user='$user', name='$name', dispo='$dispo', subdispo='$subdispo', callback='$callback', number='$number', clientcode='$clientcode', currentstatus='$currentstatus', legalstatus='$legalstatus', client='$client', department='$department', state='$state', hsource='$hsource', type='$type', status='$status', statuscode='$statuscode', statusstr='$statusstr', dialline='$dialline', did='$did', waitsec='$waitsec', callsec='$callsec', talksec='$talksec', disposec='$disposec', remarks='$remarks', userdata='$userdata', attempt='$attempt', priority='$priority', question='$question'"));
}
if($iii%50==0){
$shortinsert="";
}
$iii++;
//$update=DB::connection("conn")->select(DB::raw("SELECT crmcall_id as updateid from $calllog_report where server='$server_id' and `state` IN ('DialBegin','DialEnd')"));
//echo $update;
DB::update(DB::raw("UPDATE crmcalls set call_flag='C' where id=$crmcall_id"));
}
echo "\n".date('Y-m-d H:i:s')."\n";
DB::connection("conn")->disconnect();
}
}
<?php namespace App\Console\Commands;
use Illuminate\Console\Command;
//use Mail;
use DB;
use Config;
use App\Models\User;
use App\Models\Accesslog;
use App\Models\CRMCall;
use Schema;
use PDO;
use Illuminate\Database\Schema\Blueprint;
class CreportNine extends Command {
/**
* The console command name.
*
* @var string
*/
protected $signature = 'CreportNine';
/**
* The console command description.
*
* @var string
*/
protected $description = 'App Main Daily Task for CreportNine';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$nowts=time();
$date=date('F_Y');
echo "\n".date('Y-m-d H:i:s')."\n";
$logdate=strtotime('0 day');
$tcol=0;$fieldsarr=array();$extrahdrarr=array();
$central_ip=env('central_ip');
$server_ip=env('app_ip');
$d='01';
$startdate=date('Y-m-')."$d";
$calllog_report = "calllog_report_".$date;
// $calllog_report = "calllog_report_February_2018";
$conn = array(
'driver' => 'mysql',
'host' => $central_ip,
'database' => env('DB_DATABASE', 'kstych_flexydial'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'options' => array(
PDO::ATTR_TIMEOUT => 5,
),
);
Config::set("database.connections.conn", $conn);
DB::connection("conn")->getDatabaseName();
$serverclist=DB::connection("conn")->select(DB::raw("select id from server_details where server_ip='$server_ip'"));
$server_id=$serverclist[0]->id;
if($server_id<10){
$server_id="0".$server_id;
}
$maxid=DB::connection("conn")->select(DB::raw("SELECT max(crmcall_id) as maxid from $calllog_report where server='$server_id'"));
$maxids=$maxid[0]->maxid;
//$alist=DB::select(DB::raw("SELECT * from crmcalls where id>'$maxids' and created_at<'".date("Y-m-d H:i:s",$logdate-(60*60))."'"));
$alist=DB::select(DB::raw("SELECT * from crmcalls where id>'$maxids'"));
//$alist=DB::select(DB::raw("SELECT * from crmcalls where id>'$maxids' and created_at<'".date("Y-m-d H:i:s",$logdate-(60*60))."'"));
$userarr=array();
foreach($alist as $aline)
{
$setstrarr=array();
$clientcode="";$currentstatus="";$legalstatus="";$record_id="";
if($aline->crm_id>0)
{
$user=DB::select(DB::raw("select id,clientcode,currentstatus,legalstatus from records where id='".$aline->crm_id."' limit 1;"));
if(isset($user[0]))
{
$record_id=$user[0]->id;
$clientcode=$user[0]->clientcode;
$currentstatus=$user[0]->currentstatus;
$legalstatus=$user[0]->legalstatus;
}
}
$tpostdata=json_decode($aline->data,true);
$fulldate=date("Y-m-d H:i:s",strtotime($aline->created_at)+330*60);
$talktime=$aline->talkSec+$aline->recstartSec+$aline->recendSec;
$length=round(($aline->waitSec+$aline->callSec+$talktime+$aline->dispoSec)/1000,2);
if(!isset($userarr[$aline->user_id])&&$aline->user_id>0)$userarr[$aline->user_id]=User::find($aline->user_id);
$dispname="";if(isset($userarr[$aline->user_id]))$dispname=$userarr[$aline->user_id]->dispname();
$username="";if(isset($userarr[$aline->user_id]))$username=$userarr[$aline->user_id]->username;
$globalid=$server_id.$record_id;
$setstrarr[]="server='$server_id'";
$setstrarr[]="record_id='$record_id'";
$setstrarr[]="crmcall_id='$aline->id'";
$setstrarr[]="globalid='$globalid'";
$setstrarr[]="created_at='$aline->created_at'";
$setstrarr[]="start='$fulldate'";
$setstrarr[]="length='$length'";
$setstrarr[]="user='$username'";
$setstrarr[]="name='$dispname'";
$setstrarr[]="dispo='$aline->userstatus'";
$setstrarr[]="subdispo='$aline->usersubstatus'";
$setstrarr[]="callback='$aline->usercallback'";
$setstrarr[]="number='$aline->number'";
$setstrarr[]="clientcode='$clientcode'";
$setstrarr[]="currentstatus='$currentstatus'";
$setstrarr[]="legalstatus='$legalstatus'";
$setstrarr[]="client='$aline->client'";
$setstrarr[]="department='$aline->department'";
$setstrarr[]="state='$aline->state'";
$setstrarr[]="hsource='$aline->hsource'";
$setstrarr[]="type='$aline->type'";
$setstrarr[]="status='$aline->status'";
$setstrarr[]="statuscode='$aline->statuscode'";
$setstrarr[]="statusstr='$aline->substatus'";
$setstrarr[]="dialline='$aline->dialline_id'";
$setstrarr[]="did='$aline->did'";
$setstrarr[]="waitsec='".round($aline->waitSec/1000,2)."'";
$setstrarr[]="callsec='".round($aline->callSec/1000,2)."'";
$setstrarr[]="talksec='".round($talktime/1000,2)."'";
$setstrarr[]="disposec='".round($aline->dispoSec/1000,2)."'";
$setstrarr[]="remarks='".str_replace("'","",$aline->userremarks)."'";
$setstrarr[]="userdata='$aline->userdata'";
$setstrarr[]="attempt='$aline->attempt'";
$setstrarr[]="priority='$aline->priority'";
$setstrarr[]="question='$aline->question'";
$setstr=implode(",",$setstrarr);
DB::connection("conn")->insert(DB::raw("insert into ".$calllog_report." set $setstr"));
}
DB::connection("conn")->disconnect();
}
}
<?php namespace App\Console\Commands;
use Illuminate\Console\Command;
//use Mail;
use DB;
use Config;
use App\Models\User;
use App\Models\Accesslog;
use App\Models\CRMCall;
use Schema;
use PDO;
use Illuminate\Database\Schema\Blueprint;
class CreportTen extends Command {
/**
* The console command name.
*
* @var string
*/
protected $signature = 'CreportTen';
/**
* The console command description.
*
* @var string
*/
protected $description = 'App Main Daily Task for CreportTen';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$nowts=time();
$date=date('F_Y');
echo "\n".date('Y-m-d H:i:s')."\n";
$logdate=strtotime('0 day');
$tcol=0;$fieldsarr=array();$extrahdrarr=array();
$central_ip=env('central_ip');
$server_ip=env('app_ip');
//$calllog_report = "calllog_report_".date("d_m_Y");
$calllog_report = "calllog_report_test";
$conn = array(
'driver' => 'mysql',
'host' => $central_ip,
'database' => env('DB_DATABASE', 'kstych_flexydial'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'options' => array(
PDO::ATTR_TIMEOUT => 5,
),
);
Config::set("database.connections.conn", $conn);
DB::connection("conn")->getDatabaseName();
$serverclist=DB::connection("conn")->select(DB::raw("select id from server_details where server_ip='$server_ip'"));
$server_id=$serverclist[0]->id;
if($server_id<10){
$server_id="0".$server_id;
}
$maxid=DB::connection("conn")->select(DB::raw("SELECT max(crmcall_id) as maxid from $calllog_report where server='$server_id'"));
$maxids=$maxid[0]->maxid;
echo "Maxid".$maxids;
//$alist=DB::select(DB::raw("SELECT * from crmcalls_archive where created_at>'2018-06-01' and created_at<'2018-07-01'"));
//$alist=DB::select(DB::raw("SELECT * from crmcalls where id>'$maxids' and created_at>'".date("Y-m-d")."' and created_at<'".date("Y-m-d H:i:s",$logdate-(60*60))."'"));
$alist=DB::select(DB::raw("SELECT * from crmcalls where id>'$maxids' and created_at<'".date("Y-m-d H:i:s",$logdate-(60*60))."'"));
$userarr=array();
foreach($alist as $aline)
{
$setstrarr=array();
$clientcode="";$currentstatus="";$legalstatus="";$record_id="";
if($aline->crm_id>0)
{
$user=DB::select(DB::raw("select id,clientcode,currentstatus,legalstatus from records where id='".$aline->crm_id."' limit 1;"));
if(isset($user[0]))
{
$record_id=$user[0]->id;
$clientcode=$user[0]->clientcode;
$currentstatus=$user[0]->currentstatus;
$legalstatus=$user[0]->legalstatus;
}
}
$tpostdata=json_decode($aline->data,true);
$fulldate=date("Y-m-d H:i:s",strtotime($aline->created_at)+330*60);
$talktime=$aline->talkSec+$aline->recstartSec+$aline->recendSec;
$length=round(($aline->waitSec+$aline->callSec+$talktime+$aline->dispoSec)/1000,2);
if(!isset($userarr[$aline->user_id])&&$aline->user_id>0)$userarr[$aline->user_id]=User::find($aline->user_id);
$dispname="";if(isset($userarr[$aline->user_id]))$dispname=$userarr[$aline->user_id]->dispname();
$username="";if(isset($userarr[$aline->user_id]))$username=$userarr[$aline->user_id]->username;
$globalid=$server_id.$record_id;
$setstrarr[]="server='$server_id'";
$setstrarr[]="record_id='$record_id'";
$setstrarr[]="crmcall_id='$aline->id'";
$setstrarr[]="globalid='$globalid'";
$setstrarr[]="created_at='$aline->created_at'";
$setstrarr[]="start='$fulldate'";
$setstrarr[]="length='$length'";
$setstrarr[]="user='$username'";
$setstrarr[]="name='$dispname'";
$setstrarr[]="dispo='$aline->userstatus'";
$setstrarr[]="subdispo='$aline->usersubstatus'";
$setstrarr[]="callback='$aline->usercallback'";
$setstrarr[]="number='$aline->number'";
$setstrarr[]="clientcode='$clientcode'";
$setstrarr[]="currentstatus='$currentstatus'";
$setstrarr[]="legalstatus='$legalstatus'";
$setstrarr[]="client='$aline->client'";
$setstrarr[]="department='$aline->department'";
$setstrarr[]="state='$aline->state'";
$setstrarr[]="hsource='$aline->hsource'";
$setstrarr[]="type='$aline->type'";
$setstrarr[]="status='$aline->status'";
$setstrarr[]="statuscode='$aline->statuscode'";
$setstrarr[]="statusstr='$aline->substatus'";
$setstrarr[]="dialline='$aline->dialline_id'";
$setstrarr[]="did='$aline->did'";
$setstrarr[]="waitsec='".round($aline->waitSec/1000,2)."'";
$setstrarr[]="callsec='".round($aline->callSec/1000,2)."'";
$setstrarr[]="talksec='".round($talktime/1000,2)."'";
$setstrarr[]="disposec='".round($aline->dispoSec/1000,2)."'";
$setstrarr[]="remarks='".str_replace("'","",$aline->userremarks)."'";
$setstrarr[]="userdata='$aline->userdata'";
$setstrarr[]="attempt='$aline->attempt'";
$setstrarr[]="priority='$aline->priority'";
$setstrarr[]="question='$aline->question'";
$setstr=implode(",",$setstrarr);
DB::connection("conn")->insert(DB::raw("insert into ".$calllog_report." set $setstr"));
//DB::connection("conn")->update(DB::raw("UPDATE ".$calllog_report." as ca INNER JOIN crmcalls as c on ca.crmcall_id = c.id set ca.state = c.state,ca.statuscode = c.statuscode,ca.status = c.status,ca.substatus = c.substatus,ca.callSec = c.callSec,ca.ts_Talk = c.ts_Talk,ca.ts_Recstart = c.ts_Recstart,ca.ts_Recend = c.ts_Recend,ca.ts_Dispo = c.ts_Dispo,ca.ts_Close = c.ts_Close,ca.dispoSec = c.dispoSec,ca.recstartSec=c.recstartSec,ca.data = c.data,ca.recsize = c.recsize,ca.userstatus = c.userstatus,ca.usersubstatus = c.usersubstatus,ca.usercallback = c.usercallback ,ca.userremarks = c.userremarks,ca.attempt = c.attempt,ca.priority = c.priority,ca.question = c.question"));
}
echo "AfterUploadingData=".date('Y-m-d H:i:s');
}
}
<?php namespace App\Console\Commands;
use Illuminate\Console\Command;
//use Mail;
use DB;
use Config;
use App\Models\User;
use App\Models\Accesslog;
use App\Models\CRMCall;
use Schema;
use PDO;
use App\Models\Notification;
use App\Jobs\KHRMSLib;
use Input;
use App\Models\Sipid;
use App\Models\Kqueue;
use App\Models\Dialline;
use App\Models\Session;
use Illuminate\Database\Schema\Blueprint;
class DailyLogout extends Command {
/**
* The console command name.
*
* @var string
*/
protected $signature = 'DailyLogout';
/**
* The console command description.
*
* @var string
*/
protected $description = 'DailyLogout';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
Dialline::where('status','!=','Free')->update(['status'=>'Free','conf'=>'','channel'=>'','updated_at'=>'0000-00-00 00:00:00']);
Sipid::where('status','!=','0')->update(['status'=>0,'user'=>0,'ready'=>0,'confup'=>0,'clients'=>'','updated_at'=>'0000-00-00 00:00:00']);
User::where('presence','>','0')->update(['presence'=>0]);
Session::truncate();
return "";
}
}
<?php namespace App\Console\Commands;
use Illuminate\Console\Command;
//use Mail;
use DB;
use Config;
use App\Models\User;
use App\Models\Accesslog;
use App\Models\CRMCall;
use Schema;
use PDO;
use App\Models\Notification;
use App\Jobs\KHRMSLib;
use Input;
use App\Models\Sipid;
use App\Models\Kqueue;
use App\Models\Dialline;
use App\Models\Session;
use Illuminate\Database\Schema\Blueprint;
class DeleteCrmcalls extends Command {
/**
* The console command name.
*
* @var string
*/
protected $signature = 'DeleteCrmcalls';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Delete data from CRMCalls before 7 days';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
echo "\n".date('Y-m-d H:i:s')."\n";
$logdate=strtotime('-7 day');
CRMCall::where('created_at','<',date("Y-m-d",$logdate))->delete();
}
}
<?php namespace App\Console\Commands;
use Illuminate\Console\Command;
//use Mail;
use DB;
use Config;
use App\Models\User;
use App\Models\Accesslog;
use App\Models\CRMCall;
use Schema;
use PDO;
use App\Models\Notification;
use App\Jobs\KHRMSLib;
use Input;
use App\Models\Sipid;
use App\Models\Kqueue;
use App\Models\Dialline;
use App\Models\Session;
use Illuminate\Database\Schema\Blueprint;
class InsertCrmArchive extends Command {
/**
* The console command name.
*
* @var string
*/
protected $signature = 'InsertCrmArchive';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Insert updated data into crmcalls_archive from crmcalls';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
echo "\n".date('Y-m-d H:i:s')."\n";
DB::insert(DB::raw("insert into crmcalls_archive select * from crmcalls where id>(select max(id) from crmcalls_archive)"));
DB::update(DB::raw("UPDATE crmcalls_archive as ca INNER JOIN crmcalls as c on ca.id = c.id set ca.state = c.state,ca.statuscode = c.statuscode,ca.status = c.status,ca.substatus = c.substatus,ca.callSec = c.callSec,ca.ts_Talk = c.ts_Talk,ca.ts_Recstart = c.ts_Recstart,ca.ts_Recend = c.ts_Recend,ca.ts_Dispo = c.ts_Dispo,ca.ts_Close = c.ts_Close,ca.dispoSec = c.dispoSec,ca.recstartSec=c.recstartSec,ca.data = c.data,ca.recsize = c.recsize,ca.userstatus = c.userstatus,ca.usersubstatus = c.usersubstatus,ca.usercallback = c.usercallback ,ca.userremarks = c.userremarks,ca.attempt = c.attempt,ca.priority = c.priority,ca.question = c.question"));
echo 'End';
}
}
<?php namespace App\Console\Commands;
use Illuminate\Console\Command;
use App\Jobs\KPAMIListen;
class KstychARP extends Command {
/**
* The console command name.
*
* @var string
*/
protected $signature = 'KstychARP';
/**
* The console command description.
*
* @var string
*/
protected $description = 'ARP Broadcast';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
}
}
<?php namespace App\Console\Commands;
use Illuminate\Console\Command;
use Mail;
use DB;
use Config;
use App\Models\User;
use App\Models\Accesslog;
use App\Models\CRMCall;
use Schema;
use PDO;
use Illuminate\Database\Schema\Blueprint;
class KstychDaily extends Command {
/**
* The console command name.
*
* @var string
*/
protected $signature = 'KstychDaily';
/**
* The console command description.
*
* @var string
*/
protected $description = 'App Main Daily Task';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$nowts=time();
Accesslog::where('endtime','<',date("Y-m-d H:i:s",$nowts-2*24*60*60))->update(array('postdata'=>'','queries'=>''));
Accesslog::where('endtime','<',date("Y-m-d H:i:s",$nowts-2*24*60*60))->delete();
if(env('app_ip')=="10.3.177.14")
{
if(!Schema::hasTable('calllog_report'))
{
Schema::create('calllog_report', function(Blueprint $table)
{
$table->string('server', 100);
$table->dateTime('start');
$table->integer('length');
$table->string('user',100);
$table->string('name',100);
$table->string('dispo', 200);
$table->string('subdispo', 200);
$table->dateTime('callback');
$table->string('number', 100);
$table->string('clientcode', 100);
$table->string('currentstatus', 100);
$table->string('legalstatus', 100);
$table->string('client', 200);
$table->string('department', 200);
$table->string('state', 50);
$table->string('hsource', 100);
$table->string('type', 50);
$table->string('statuscode', 20);
$table->string('status', 100);
$table->string('statusstr', 100);
$table->integer('dialline');
$table->string('did', 50);
$table->bigInteger('waitsec');
$table->bigInteger('callsec');
$table->bigInteger('talksec');
$table->bigInteger('disposec');
$table->string('remarks', 500);
$table->string('userdata',1000);
});
}
$offline=array();
$arr=Config::get("app.hdfcnodes");
$logdate=strtotime('-1 day');
$tcol=0;$fieldsarr=array();$extrahdrarr=array();
$ii=1;$ci=0;
foreach($arr as $server=>$serverline)
{
$ci++;
$conn = array(
'driver' => 'mysql',
'host' => $server,
'database' => env('DB_DATABASE', 'kstych_flexydial'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'options' => array(
PDO::ATTR_TIMEOUT => 5,
),
);
Config::set("database.connections.conn$ci", $conn);
try
{
DB::connection("conn$ci")->getDatabaseName();
$alist=CRMCall::on("conn$ci")->where('created_at','>=',date("Y-m-d H:i:s",$logdate))->where('created_at','<=',date("Y-m-d H:i:s",$logdate+24*60*60))->get();
$userarr=array();
foreach($alist as $aline)
{
$setstrarr=array();
$clientcode="";$currentstatus="";$legalstatus="";
if($aline->crm_id>0)
{
$user=DB::connection("conn$ci")->select(DB::raw("select id,clientcode,currentstatus,legalstatus from records where id='".$aline->crm_id."' limit 1;"));
if(isset($user[0]))
{
$clientcode=$user[0]->clientcode;
$currentstatus=$user[0]->currentstatus;
$legalstatus=$user[0]->legalstatus;
}
}
$tpostdata=json_decode($aline->data,true);
$fulldate=date("Y-m-d H:i:s",strtotime($aline->created_at)+330*60);
$talktime=$aline->talkSec+$aline->recstartSec+$aline->recendSec;
$length=round(($aline->waitSec+$aline->callSec+$talktime+$aline->dispoSec)/1000,2);
if(!isset($userarr[$aline->user_id])&&$aline->user_id>0)$userarr[$aline->user_id]=User::on("conn$ci")->find($aline->user_id);
$dispname="";if(isset($userarr[$aline->user_id]))$dispname=$userarr[$aline->user_id]->dispname();
$username="";if(isset($userarr[$aline->user_id]))$username=$userarr[$aline->user_id]->username;
$setstrarr[]="server='$server'";
$setstrarr[]="start='$fulldate'";
$setstrarr[]="length='$length'";
$setstrarr[]="user='$username'";
$setstrarr[]="name='$dispname'";
$setstrarr[]="dispo='$aline->userstatus'";
$setstrarr[]="subdispo='$aline->usersubstatus'";
$setstrarr[]="callback='$aline->usercallback'";
$setstrarr[]="number='$aline->number'";
$setstrarr[]="clientcode='$clientcode'";
$setstrarr[]="currentstatus='$currentstatus'";
$setstrarr[]="legalstatus='$legalstatus'";
$setstrarr[]="client='$aline->client'";
$setstrarr[]="department='$aline->department'";
$setstrarr[]="state='$aline->state'";
$setstrarr[]="hsource='$aline->hsource'";
$setstrarr[]="type='$aline->type'";
$setstrarr[]="status='$aline->status'";
$setstrarr[]="statuscode='$aline->statuscode'";
$setstrarr[]="statusstr='$aline->substatus'";
$setstrarr[]="dialline='$aline->dialline_id'";
$setstrarr[]="did='$aline->did'";
$setstrarr[]="waitsec='".round($aline->waitSec/1000,2)."'";
$setstrarr[]="callsec='".round($aline->callSec/1000,2)."'";
$setstrarr[]="talksec='".round($talktime/1000,2)."'";
$setstrarr[]="disposec='".round($aline->dispoSec/1000,2)."'";
$setstrarr[]="remarks='$aline->userremarks'";
$setstrarr[]="userdata='$aline->userdata'";
$setstr=implode(",",$setstrarr);
DB::insert(DB::raw("insert into calllog_report set $setstr"));
}
}
catch(Exception $e)
{
$offline[]=$server;
}
}
}
}
}
<?php namespace App\Console\Commands;
use Illuminate\Console\Command;
use App\Jobs\KPAGIListen;
class KstychPAGI extends Command {
/**
* The console command name.
*
* @var string
*/
protected $signature = 'KstychPAGI';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Daemon to Listen to Asterisk';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$agi = \PAGI\Client\Impl\ClientImpl::getInstance();
$kpagi = new KPAGIListen(array('pagiClient' => $agi));
$kpagi->init();
$kpagi->run();
}
}
<?php namespace App\Console\Commands;
use Illuminate\Console\Command;
use App\Jobs\KPAMIListen;
class KstychPAMI extends Command {
/**
* The console command name.
*
* @var string
*/
protected $signature = 'KstychPAMI {serverip=127.0.0.1}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Daemon to Listen to Asterisk';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$listener = new KPAMIListen($this->argument('serverip'));$listener->run();
}
}
<?php namespace App\Console\Commands;
use Illuminate\Console\Command;
use DB;
use Config;
use App\Models\User;
use App\Models\Accesslog;
use App\Models\CRMCall;
use Schema;
use PDO;
use Illuminate\Database\Schema\Blueprint;
class Userlog_datavalidation extends Command {
/**
* The console command name.
*
* @var string
*/
protected $signature = 'Userlog_datavalidation';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Userlog_datavalidation';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$nowts=time();
echo "\n".date('Y-m-d')."\n";
$logdate=strtotime('-1 day');
$tcol=0;$fieldsarr=array();$extrahdrarr=array();
$server_ip=env('app_ip');
$central_ip=env('central_ip');
$conn = array(
'driver' => 'mysql',
'host' => $central_ip,
'database' => env('DB_DATABASE', 'kstych_flexydial'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'options' => array(
PDO::ATTR_TIMEOUT => 5,
),
);
Config::set("database.connections.conn", $conn);
if(DB::connection("conn")->getDatabaseName())
{
$serverclist=DB::connection("conn")->select(DB::raw("select id from server_details where server_ip='$server_ip'"));
$server_id=$serverclist[0]->id;
if($server_id<10){
$server_id="0".$server_id;
}
$i=0;
$ulist=DB::select(DB::raw("select * from users WHERE 1"));
foreach($ulist as $uline) {
$users[$uline->id] = $uline->username;
}
if($alist=DB::select(DB::raw("select * from userlogs WHERE created_at>'".date("Y-m-d",$logdate)."' and created_at<'".date("Y-m-d",$logdate+24*60*60)."'"))){
foreach($alist as $aline) {
$i++;
$global_id = $server_id . $i;
if($aline->enddate=='0000-00-00'|| $aline->endtime=='00:00:00' || $aline->durationsec=='0')
{
$enddatetime=date("Y-m-d H:i:s",strtotime($aline->updated_at));
$enddate=explode(" ",$enddatetime)[0];
$endtime=explode(" ",$enddatetime)[1];
$durationsec=date("Y-m-d H:i:s",strtotime($endtime-$aline->starttime));
}
else
{
$enddate=$aline->enddate;
$endtime=$aline->endtime;
$durationsec=$aline->durationsec;
}
$rowdata = array('server'=>$server_id,'server_ip'=>$server_ip,'global_id'=>$global_id,'id'=>$aline->id,
'created_at'=>$aline->created_at,'updated_at'=>$aline->updated_at,'user_id'=>$aline->user_id,'user'=>$users[$aline->user_id],
'startdate'=>$aline->startdate,'starttime'=>$aline->starttime,'enddate'=>$enddate,'endtime'=>$endtime,
'durationsec'=>$durationsec,'data'=>$aline->data,'group'=>$aline->group,'login'=>'','dialnext'=>'','dialnext-agentbriefing'=>'','dialnext-downtime'=>'','dialnext-floorannouncements'=>'','dialnext-incoming'=>'','dialnext-lunchbreak'=>'','dialnext-manual'=>'','dialnext-notready'=>'','dialnext-qualityfeedback'=>'','dialnext-teabreak'=>'','dialnext-teammeeting'=>'','dialnext-utilitybreak'=>'','manual'=>'','manual-agentbriefing'=>'','manual-agentbriefing'=>'','manual-downtime'=>'','manual-floorannouncements'=>'','manual-incoming'=>'','manual-lunchbreak'=>'','manual-manual'=>'','manual-notready'=>'','manual-qualityfeedback'=>'','manual-teabreak'=>'','manual-teammeeting'=>'','manual-utilitybreak'=>'','paused'=>'','paused-agentbriefing'=>'','paused-downtime'=>'','paused-floorannouncements'=>'','paused-incoming'=>'','paused-lunchbreak'=>'','paused-manual'=>'','paused-notready'=>'','paused-qualityfeedback'=>'','paused-teabreak'=>'','paused-teammeeting'=>'','paused-utilitybreak'=>'','paused-autowrapup'=>'','paused-wrapup'=>'','progressive'=>'','progressive-agentbriefing'=>'','progressive-agentbriefing'=>'','progressive-downtime'=>'','progressive-floorannouncements'=>'','progressive-incoming'=>'','progressive-lunchbreak'=>'','progressive-manual'=>'','progressive-notready'=>'','progressive-qualityfeedback'=>'','progressive-teabreak'=>'','progressive-teammeeting'=>'','progressive-utilitybreak'=>'','ready-incoming'=>''
);
$data=json_decode($aline->data,true);
foreach($data as $sipid=>$sdata)
{
$prets= isset($sdata[1]) ? $sdata[1] : (strtotime($aline->startdate . " " . $aline->starttime)+19600)*1000;
if(isset($sdata['states']))
{
$previous="login";
foreach($sdata['states'] as $fts=>$states)
{
if($states[0] != 1)
{
$rowdata[$previous] +=round(($fts-$prets)/1000,2);
$previous = (trim($states[1]) != '') ? strtolower($states[0]."-".$states[1]) : strtolower($states[0]);
$prets=$fts;
}
}
$rowdata[$previous] += round(($sdata['ts']-$prets)/1000,2);
}
}
$rowdata["login"] = $aline->durationsec;
$rowdata['not-ready']=$rowdata['paused-agentbriefing']+$rowdata['paused-autowrapup']+$rowdata['paused-downtime']+$rowdata['paused-floorannouncements']+$rowdata['paused-lunchbreak']+$rowdata['paused-notready']+$rowdata['paused-qualityfeedback']+$rowdata['paused-teammeeting']+$rowdata['paused-teabreak']+$rowdata['paused-utilitybreak'];
$key_value = '';
$startTime=$aline->startdate." ".$aline->starttime;
$endTime=$aline->enddate." ".$aline->endtime;
$crmCalls=DB::select(DB::raw("select user_id,type,ts_Wait,ts_Call,ts_Talk,ts_Recstart,ts_Recend,ts_Dispo,ts_Close from crmcalls WHERE updated_at>='".$startTime."' and updated_at<'".$endTime."' and user_id='".$aline->user_id."'"));
$ts_Wait=0;$ts_Call=0;$ts_Talk=0;$ts_Dispo=0;
$progTs_Wait=0;$progTs_Call=0;$progTs_Talk=0;$progTs_Dispo=0;
$manTs_Wait=0;$manTs_Call=0;$manTs_Talk=0;$manTs_Dispo=0;
$inbTs_Wait=0;$inbTs_Call=0;$inbTs_Talk=0;$inbTs_Dispo=0;
$tt_prog=0;$tt_man=0;$tt_inb=0;
if($crmCalls!=null){
foreach($crmCalls as $crmCall){
$ts_Wait += round(($crmCall->ts_Call - $crmCall->ts_Wait)/1000,2);
$ts_Call += round(($crmCall->ts_Talk - $crmCall->ts_Call)/1000,2);
$ts_Talk += round(($crmCall->ts_Dispo - $crmCall->ts_Talk)/1000,2);
$ts_Dispo += round(($crmCall->ts_Close - $crmCall->ts_Dispo)/1000,2);
if($crmCall->type == 'Progressive')
{
$progTs_Wait += round(($crmCall->ts_Call - $crmCall->ts_Wait)/1000,2);
$progTs_Call += round(($crmCall->ts_Talk - $crmCall->ts_Call)/1000,2);
$progTs_Talk += round(($crmCall->ts_Dispo - $crmCall->ts_Talk)/1000,2);
$progTs_Dispo += round(($crmCall->ts_Close - $crmCall->ts_Dispo)/1000,2);
}
if($crmCall->type == 'Manual')
{
$manTs_Wait += round(($crmCall->ts_Call - $crmCall->ts_Wait)/1000,2);
$manTs_Call += round(($crmCall->ts_Talk - $crmCall->ts_Call)/1000,2);
$manTs_Talk += round(($crmCall->ts_Dispo - $crmCall->ts_Talk)/1000,2);
$manTs_Dispo += round(($crmCall->ts_Close - $crmCall->ts_Dispo)/1000,2);
}
if($crmCall->type == 'Inbound')
{
$inbTs_Wait += round(($crmCall->ts_Call - $crmCall->ts_Wait)/1000,2);
$inbTs_Call += round(($crmCall->ts_Talk - $crmCall->ts_Call)/1000,2);
$inbTs_Talk += round(($crmCall->ts_Dispo - $crmCall->ts_Talk)/1000,2);
$inbTs_Dispo += round(($crmCall->ts_Close - $crmCall->ts_Dispo)/1000,2);
}
}
}
$tt_prog = $progTs_Wait + $progTs_Call + $progTs_Talk + $progTs_Dispo;
$tt_man = $manTs_Wait + $manTs_Call + $manTs_Talk + $manTs_Dispo;
$tt_inb = $inbTs_Wait + $inbTs_Call + $inbTs_Talk + $inbTs_Dispo;
$total_idealtime=$rowdata["login"]-($rowdata['not-ready']+$tt_prog+$tt_man+$tt_inb);
echo "notready time-----idle----".$total_idealtime;
foreach($rowdata AS $key=>$value) {
if($key != 1)
$key_value .= "`$key` = '$value', ";
}
$prod_TOS = $ts_Wait + $ts_Call + $ts_Talk + $ts_Dispo;
$key_value .= "`tt_prog` = '$tt_prog', ";
$key_value .= "`tt_man` = '$tt_man', ";
$key_value .= "`tt_inb` = '$tt_inb', ";
$key_value .= "`ts_Wait` = '$ts_Wait', ";
$key_value .= "`ts_Call` = '$ts_Call', ";
$key_value .= "`ts_Talk` = '$ts_Talk', ";
$key_value .= "`ts_Dispo` = '$ts_Dispo', ";
$key_value .= "`progts_Wait` = '$progTs_Wait', ";
$key_value .= "`progts_Call` = '$progTs_Call', ";
$key_value .= "`progts_Talk` = '$progTs_Talk', ";
$key_value .= "`progts_Dispo` = '$progTs_Dispo', ";
$key_value .= "`mants_Wait` = '$manTs_Wait', ";
$key_value .= "`mants_Call` = '$manTs_Call', ";
$key_value .= "`mants_Talk` = '$manTs_Talk', ";
$key_value .= "`mants_Dispo` = '$manTs_Dispo', ";
$key_value .= "`incts_Wait` = '$inbTs_Wait', ";
$key_value .= "`incts_Call` = '$inbTs_Call', ";
$key_value .= "`incts_Talk` = '$inbTs_Talk', ";
$key_value .= "`incts_Dispo` = '$inbTs_Dispo', ";
$key_value .= "`prod_tos` = '$prod_TOS', ";
$key_value .= "`totalidealtime` = '$total_idealtime', ";
$key_value = substr($key_value, 0, -2);
//$userlogsTable = "userlogs_".date("d_m_Y",$logdate);
$userlogsTable = "userlogs_datavalid";
DB::connection("conn")->insert(DB::raw("INSERT INTO ".$userlogsTable." SET $key_value"));
}
}
}
}
}
<?php namespace App\Console\Commands;
use Illuminate\Console\Command;
use DB;
use Config;
use App\Models\User;
use App\Models\Accesslog;
use App\Models\CRMCall;
use Schema;
use PDO;
use Illuminate\Database\Schema\Blueprint;
class dailyupload_calllog extends Command {
/**
* The console command name.
*
* @var string
*/
protected $signature = 'dailyupload_calllog';
/**
* The console command description.
*
* @var string
*/
protected $description = 'dailyupload_calllog';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$nowts=time();
echo "\n".date('Y-m-d H:i:s')."\n";
$logdate=strtotime('0 day');
$tcol=0;$fieldsarr=array();$extrahdrarr=array();
$server_ip=env('app_ip');
$central_ip=env('central_ip');
$calllog_report = "calllog_report_".date("d_m_Y",$logdate);
$created_at=date("Y-m-d H:i:s");
$conn = array(
'driver' => 'mysql',
'host' => $central_ip,
'database' => env('DB_DATABASE', 'kstych_flexydial'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'options' => array(
PDO::ATTR_TIMEOUT => 5,
),
);
Config::set("database.connections.conn", $conn);
if(DB::connection("conn")->getDatabaseName())
{
$serverclist=DB::connection("conn")->select(DB::raw("select id from server_details where server_ip='$server_ip'"));
$server_id=$serverclist[0]->id;
if($server_id<10){
$server_id="0".$server_id;
}
$clist=DB::connection("conn")->select(DB::raw("select count(*) as cnt,server from $calllog_report group by server"));
$caar=[];
foreach($clist as $cline)
{
$caar[$cline->server]= $cline->cnt;
}
$mlist=DB::select(DB::raw("select count(*) as countrecord from crmcalls where created_at>'".date("Y-m-d",$logdate)."' and created_at<'".date("Y-m-d",$logdate+24*60*60)."'"));
$location_cont='0';
$central_cont='0';
$location_cont=$mlist[0]->countrecord;
if(array_key_exists($server_id,$caar)){
$central_cont=$caar[$server_id];
}else{
$central_cont=0;
}
$dif=($central_cont)-($mlist[0]->countrecord);
if($dif==0){
$result="Y";
DB::connection("conn")->insert(DB::raw("insert into dailyupload_calllog_records set created_at='$created_at',server_id='$server_id',server_ip='$server_ip',central_count='$central_cont',location_count='$location_cont',difference='$dif',result='$result'"));
}else{
$result="N";
DB::connection("conn")->insert(DB::raw("insert into dailyupload_calllog_records set created_at='$created_at',server_id='$server_id',server_ip='$server_ip',central_count='$central_cont',location_count='$location_cont',difference='$dif',result='$result'"));
}
DB::connection("conn")->disconnect();
}
}
}
<?php namespace App\Console\Commands;
use Illuminate\Console\Command;
use DB;
use Config;
use App\Models\User;
use App\Models\Accesslog;
use App\Models\CRMCall;
use Schema;
use PDO;
use Illuminate\Database\Schema\Blueprint;
class records_details extends Command {
/**
* The console command name.
*
* @var string
*/
protected $signature = 'records_details';
/**
* The console command description.
*
* @var string
*/
protected $description = 'records_details';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$nowts=time();
echo "\n".date('Y-m-d')."\n";
$server_ip=env('app_ip');
$central_ip=env('central_ip');
$conn='';
$tcol=0;$fieldsarr=array();$extrahdrarr=array();
$conn = array(
'driver' => 'mysql',
'host' => $central_ip,
'database' => env('DB_DATABASE', 'kstych_flexydial'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'options' => array(
PDO::ATTR_TIMEOUT => 5,
),
);
Config::set("database.connections.conn", $conn);
if(DB::connection("conn")->getDatabaseName())
{
$serverclist=DB::connection("conn")->select(DB::raw("select id,location from server_details where server_ip='$server_ip'"));
$server_id=$serverclist[0]->id;
if($server_id<10){
$server_id="0".$server_id;
}
$location=$serverclist[0]->location;
echo ",".$server_ip;
$qlist=DB::select(DB::raw("SELECT id,clientcode,client,status,clientinternalid,mobile,priority,modified,question,firstname FROM `records`"));
$datainser='';
foreach($qlist as $qline)
{
$record_id=$qline->id;
$clientcode=$qline->clientcode;
$client=$qline->client;
$status=$qline->status;
$clientinternalid=$qline->clientinternalid;
$mobile=$qline->mobile;
$priority=$qline->priority;
$modified=$qline->modified;
$question=$qline->question;
$firstname=$qline->firstname;
DB::connection("conn")->insert(DB::raw("insert into records_details set client='$client', server_ip='$server_ip', record_id='$record_id', cust_id='$clientcode', records_status='$status', group_id='$clientinternalid', location='$location',mobile='$mobile',question='$question',firstname='$firstname',priority='$priority',modified='$modified'"));
}
DB::connection("conn")->disconnect();
}
}
}
<?php namespace App\Console\Commands;
use Illuminate\Console\Command;
//use Mail;
use DB;
use Config;
use App\Models\User;
use App\Models\Accesslog;
use App\Models\CRMCall;
use Schema;
use PDO;
use App\Models\Notification;
use App\Jobs\KHRMSLib;
use Input;
use Illuminate\Database\Schema\Blueprint;
class bulkServerUpload extends Command {
/**
* The console command name.
*
* @var string
*/
protected $signature = 'bulkServerUpload';
/**
* The console command description.
*
* @var string
*/
protected $description = 'bulkServerUpload';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
//echo "\n".date('Y-m-d')."\n";
echo "4";
echo "\n".date('Y-m-d H:i:s')."\n";
$server_ip=env('app_ip');
$central_ip=env('central_ip');
$wakka = new KHRMSLib();
$kformlib=new \App\Jobs\KFormLib($wakka->HRCoreVars["HRFiledsStr"]);
$kformlib->gthis=$wakka;
$themehome=$wakka->GetThemePath('/');
$updatetime=time();
$clientlst=$wakka->GetBBBUserData("clientslist");
$isadmin=$wakka->IsAdmin();
$username=$wakka->GetUserName();
$triggers=Input::get("triggers");
$tmpstr=explode(",",$kformlib->HRFiledsStr);
$success="";$message="";$successcnt=0;$duplicatecount=0;
$conn = array(
'driver' => 'mysql',
'host' => $central_ip,
'database' => env('DB_DATABASE', 'kstych_flexydial'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', 'yb9738z'),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'options' => array(
PDO::ATTR_TIMEOUT => 5,
),
);
Config::set("database.connections.conn", $conn);
DB::connection("conn")->getDatabaseName();
$serverclist=DB::connection("conn")->select(DB::raw("select location from server_details where server_ip='$server_ip'"));
$location=$serverclist[0]->location;
$excelarray = DB::connection("conn")->select(DB::raw("select * from bz_record_upload_uat where SERVER_IP='$server_ip' order by auto_id asc limit 0,20000"));
$conn='';
$tcol=0;$fieldsarr=array();$extrahdrarr=array();
foreach($excelarray as $key => $array){
$excelarray[$key] = (array)$array;
}
$highestColumn = DB::connection("conn")->select(DB::raw("select count(*) as cnt from information_schema.columns where table_name='bz_record_upload_uat'"));
$highestColumn = $highestColumn[0]->cnt;
$highestrow = count($excelarray);
$flag = 0;
$editflag=0;
for($i=0;$i<$highestrow;$i++)
{
if($excelarray[$i]["id"]!="")
{
if($excelarray[$i]["id"]=="CREATE")
{
$excelarray[$i]["id"]=$wakka->Query("insert into","","records",array('created'=>date('Y-m-d H:i:s')));
}
else $excelarray[$i]["id"]=intval($excelarray[$i]["id"]);
if($wakka->getCount("records","id='".$excelarray[$i]["id"]."'")==1)
{
$empdata=$wakka->getPerson($excelarray[$i]["id"]);
$ppldata=$empdata["peopledata"];
$createdlog=$empdata['modifylog'];
$fdirty=$empdata['dirty'];
$createdlog[$updatetime]=$username."::";
$createdlog["updated"]=$updatetime;
$newdata=$ppldata;
foreach($excelarray[$i] as $key => $value)
{
if($value!="")
{
if("A".$ppldata[$key]!="A".$value)//forcing string comparrision //MAGIC
{
$value=str_replace("'"," ",$value);
if(strstr($createdlog[$updatetime],$key)==FALSE)$createdlog[$updatetime].="$key|".str_replace(array("|",",")," ",$ppldata[$key])."|".str_replace(array("|",",")," ",$value).",";
$fdirty[$key]=1;
$newdata[$key]=$value;
}
}
}
/*Start - Changes need to be done*/
if($excelarray[$i]["status"]==null)
{
$empdata['status'] = "rom";
}
if($excelarray[$i]["dialer_status"]==null)
{
$empdata['dialer_status'] = "rom";
}
if($excelarray[$i]["dialer_substatus"]==null)
{
$empdata['dialer_substatus'] = "rom";
}
/*End - Changes need to be done*/
$empdata["peopledata"]=$newdata;
$empdata['modifylog']=$createdlog;
$empdata['dirty']=$fdirty;
$wakka->setPerson($excelarray[$i]["id"],$empdata);
$excelarray[$i]['modified']=date('Y-m-d H:i:s');
$successArr[] = $excelarray[$i];
}
else
{
$reason = "";
$reason .= "Record ID is not on local server,";
$excelarray[$i]['server_ip'] =$server_ip;
$excelarray[$i]['location'] =$location;
if($excelarray[$i]["clientcode"]!="")
$excelarray[$i]['cust_id'] =$excelarray[$i]["clientcode"];
$excelarray[$i]['record_id'] = $excelarray[$i]["id"];
$excelarray[$i]['Reason'] = $reason;
$failureArr[] = $excelarray[$i];
}
}
else
{
$reason = "";
if($excelarray[$i]["id"]=="")
$reason .= "Column ID is blank,";
$excelarray[$i]['server_ip'] =$server_ip;
$excelarray[$i]['location'] =$location;
if($excelarray[$i]["clientcode"]!="")
$excelarray[$i]['cust_id'] =$excelarray[$i]["clientcode"];
$excelarray[$i]['Reason'] = $reason;
$failureArr[] = $excelarray[$i];
}
}
if(!empty($successArr)){
foreach($successArr as $succes)
{
$setSuccess=array();
$setSuccess[] = "server_ip='$server_ip'";
$setSuccess[] = "location='$location'";
$setSuccess[] = "record_id='".$succes['id']."'";
$setSuccess[] = "cust_id='".$succes['clientcode']."'";
$setSuccess[] = "modified='".$succes['modified']."'";
$setSuccess = implode(",",$setSuccess);
DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_success set $setSuccess"));
}
}
if(!empty($failureArr)){
foreach($failureArr as $failur)
{
$setFailure=array();
$setFailure[] = "server_ip='$server_ip'";
$setFailure[] = "location='$location'";
$setFailure[] = "cust_id='".$failur['clientcode']."'";
$setFailure[] = "record_id='".$failur['record_id']."'";
$setFailure[] = "reason='".$failur['Reason']."'";
$setFailure = implode(",",$setFailure);
DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_failure set $setFailure"));
}
}
DB::connection("conn")->disconnect();
}
}
<?php namespace App\Console\Commands;
use Illuminate\Console\Command;
//use Mail;
use DB;
use Config;
use App\Models\User;
use App\Models\Accesslog;
use App\Models\CRMCall;
use Schema;
use PDO;
use App\Models\Notification;
use App\Jobs\KHRMSLib;
use Input;
use Illuminate\Database\Schema\Blueprint;
class bulkServerUpload_1 extends Command {
/**
* The console command name.
*
* @var string
*/
protected $signature = 'bulkServerUpload_1';
/**
* The console command description.
*
* @var string
*/
protected $description = 'bulkServerUpload_1';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
//echo "\n".date('Y-m-d')."\n";
echo "2";
echo "\n".date('Y-m-d H:i:s')."\n";
$server_ip=env('app_ip');
$central_ip=env('central_ip');
$wakka = new KHRMSLib();
$kformlib=new \App\Jobs\KFormLib($wakka->HRCoreVars["HRFiledsStr"]);
$kformlib->gthis=$wakka;
$themehome=$wakka->GetThemePath('/');
$updatetime=time();
$clientlst=$wakka->GetBBBUserData("clientslist");
$isadmin=$wakka->IsAdmin();
$username=$wakka->GetUserName();
$triggers=Input::get("triggers");
$tmpstr=explode(",",$kformlib->HRFiledsStr);
$success="";$message="";$successcnt=0;$duplicatecount=0;
$conn = array(
'driver' => 'mysql',
'host' => $central_ip,
'database' => env('DB_DATABASE', 'kstych_flexydial'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', 'yb9738z'),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'options' => array(
PDO::ATTR_TIMEOUT => 5,
),
);
Config::set("database.connections.conn", $conn);
DB::connection("conn")->getDatabaseName();
$serverclist=DB::connection("conn")->select(DB::raw("select location from server_details where server_ip='$server_ip'"));
$location=$serverclist[0]->location;
$excelarray = DB::connection("conn")->select(DB::raw("select * from bz_record_upload_uat where SERVER_IP='$server_ip' order by auto_id asc limit 20001,40000"));
$conn='';
$tcol=0;$fieldsarr=array();$extrahdrarr=array();
foreach($excelarray as $key => $array){
$excelarray[$key] = (array)$array;
}
$highestColumn = DB::connection("conn")->select(DB::raw("select count(*) as cnt from information_schema.columns where table_name='bz_record_upload_uat'"));
$highestColumn = $highestColumn[0]->cnt;
$highestrow = count($excelarray);
$flag = 0;
$editflag=0;
for($i=0;$i<$highestrow;$i++)
{
if($excelarray[$i]["id"]!="")
{
if($excelarray[$i]["id"]=="CREATE")
{
$excelarray[$i]["id"]=$wakka->Query("insert into","","records",array('created'=>date('Y-m-d H:i:s')));
}
else $excelarray[$i]["id"]=intval($excelarray[$i]["id"]);
if($wakka->getCount("records","id='".$excelarray[$i]["id"]."'")==1)
{
$empdata=$wakka->getPerson($excelarray[$i]["id"]);
$ppldata=$empdata["peopledata"];
$createdlog=$empdata['modifylog'];
$fdirty=$empdata['dirty'];
$createdlog[$updatetime]=$username."::";
$createdlog["updated"]=$updatetime;
$newdata=$ppldata;
foreach($excelarray[$i] as $key => $value)
{
if($value!="")
{
if("A".$ppldata[$key]!="A".$value)//forcing string comparrision //MAGIC
{
$value=str_replace("'"," ",$value);
if(strstr($createdlog[$updatetime],$key)==FALSE)$createdlog[$updatetime].="$key|".str_replace(array("|",",")," ",$ppldata[$key])."|".str_replace(array("|",",")," ",$value).",";
$fdirty[$key]=1;
$newdata[$key]=$value;
}
}
}
/*Start - Changes need to be done*/
if($excelarray[$i]["status"]==null)
{
$empdata['status'] = "rom";
}
if($excelarray[$i]["dialer_status"]==null)
{
$empdata['dialer_status'] = "rom";
}
if($excelarray[$i]["dialer_substatus"]==null)
{
$empdata['dialer_substatus'] = "rom";
}
/*End - Changes need to be done*/
$empdata["peopledata"]=$newdata;
$empdata['modifylog']=$createdlog;
$empdata['dirty']=$fdirty;
$wakka->setPerson($excelarray[$i]["id"],$empdata);
$excelarray[$i]['modified']=date('Y-m-d H:i:s');
$successArr[] = $excelarray[$i];
}
else
{
$reason = "";
$reason .= "Record ID is not on local server,";
$excelarray[$i]['server_ip'] =$server_ip;
$excelarray[$i]['location'] =$location;
if($excelarray[$i]["clientcode"]!="")
$excelarray[$i]['cust_id'] =$excelarray[$i]["clientcode"];
$excelarray[$i]['record_id'] = $excelarray[$i]["id"];
$excelarray[$i]['Reason'] = $reason;
$failureArr[] = $excelarray[$i];
}
}
else
{
$reason = "";
if($excelarray[$i]["id"]=="")
$reason .= "Column ID is blank,";
$excelarray[$i]['server_ip'] =$server_ip;
$excelarray[$i]['location'] =$location;
if($excelarray[$i]["clientcode"]!="")
$excelarray[$i]['cust_id'] =$excelarray[$i]["clientcode"];
$excelarray[$i]['Reason'] = $reason;
$failureArr[] = $excelarray[$i];
}
}
if(!empty($successArr)){
foreach($successArr as $succes)
{
$setSuccess=array();
$setSuccess[] = "server_ip='$server_ip'";
$setSuccess[] = "location='$location'";
$setSuccess[] = "record_id='".$succes['id']."'";
$setSuccess[] = "cust_id='".$succes['clientcode']."'";
$setSuccess[] = "modified='".$succes['modified']."'";
$setSuccess = implode(",",$setSuccess);
DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_success set $setSuccess"));
}
}
if(!empty($failureArr)){
foreach($failureArr as $failur)
{
$setFailure=array();
$setFailure[] = "server_ip='$server_ip'";
$setFailure[] = "location='$location'";
$setFailure[] = "cust_id='".$failur['clientcode']."'";
$setFailure[] = "record_id='".$failur['record_id']."'";
$setFailure[] = "reason='".$failur['Reason']."'";
$setFailure = implode(",",$setFailure);
DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_failure set $setFailure"));
}
}
DB::connection("conn")->disconnect();
}
}
<?php namespace App\Console\Commands;
use Illuminate\Console\Command;
//use Mail;
use DB;
use Config;
use App\Models\User;
use App\Models\Accesslog;
use App\Models\CRMCall;
use Schema;
use PDO;
use App\Models\Notification;
use App\Jobs\KHRMSLib;
use Input;
use Illuminate\Database\Schema\Blueprint;
class bulkServerUpload_2 extends Command {
/**
* The console command name.
*
* @var string
*/
protected $signature = 'bulkServerUpload_2';
/**
* The console command description.
*
* @var string
*/
protected $description = 'bulkServerUpload_2';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
//echo "\n".date('Y-m-d')."\n";
echo "3";
echo "\n".date('Y-m-d H:i:s')."\n";
$server_ip=env('app_ip');
$central_ip=env('central_ip');
$wakka = new KHRMSLib();
$kformlib=new \App\Jobs\KFormLib($wakka->HRCoreVars["HRFiledsStr"]);
$kformlib->gthis=$wakka;
$themehome=$wakka->GetThemePath('/');
$updatetime=time();
$clientlst=$wakka->GetBBBUserData("clientslist");
$isadmin=$wakka->IsAdmin();
$username=$wakka->GetUserName();
$triggers=Input::get("triggers");
$tmpstr=explode(",",$kformlib->HRFiledsStr);
$success="";$message="";$successcnt=0;$duplicatecount=0;
$conn = array(
'driver' => 'mysql',
'host' => $central_ip,
'database' => env('DB_DATABASE', 'kstych_flexydial'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', 'yb9738z'),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'options' => array(
PDO::ATTR_TIMEOUT => 5,
),
);
Config::set("database.connections.conn", $conn);
DB::connection("conn")->getDatabaseName();
$serverclist=DB::connection("conn")->select(DB::raw("select location from server_details where server_ip='$server_ip'"));
$location=$serverclist[0]->location;
$excelarray = DB::connection("conn")->select(DB::raw("select * from bz_record_upload_uat where SERVER_IP='$server_ip' order by auto_id asc limit 40001,60000"));
$conn='';
$tcol=0;$fieldsarr=array();$extrahdrarr=array();
foreach($excelarray as $key => $array){
$excelarray[$key] = (array)$array;
}
$highestColumn = DB::connection("conn")->select(DB::raw("select count(*) as cnt from information_schema.columns where table_name='bz_record_upload_uat'"));
$highestColumn = $highestColumn[0]->cnt;
$highestrow = count($excelarray);
$flag = 0;
$editflag=0;
for($i=0;$i<$highestrow;$i++)
{
if($excelarray[$i]["id"]!="")
{
if($excelarray[$i]["id"]=="CREATE")
{
$excelarray[$i]["id"]=$wakka->Query("insert into","","records",array('created'=>date('Y-m-d H:i:s')));
}
else $excelarray[$i]["id"]=intval($excelarray[$i]["id"]);
if($wakka->getCount("records","id='".$excelarray[$i]["id"]."'")==1)
{
$empdata=$wakka->getPerson($excelarray[$i]["id"]);
$ppldata=$empdata["peopledata"];
$createdlog=$empdata['modifylog'];
$fdirty=$empdata['dirty'];
$createdlog[$updatetime]=$username."::";
$createdlog["updated"]=$updatetime;
$newdata=$ppldata;
foreach($excelarray[$i] as $key => $value)
{
if($value!="")
{
if("A".$ppldata[$key]!="A".$value)//forcing string comparrision //MAGIC
{
$value=str_replace("'"," ",$value);
if(strstr($createdlog[$updatetime],$key)==FALSE)$createdlog[$updatetime].="$key|".str_replace(array("|",",")," ",$ppldata[$key])."|".str_replace(array("|",",")," ",$value).",";
$fdirty[$key]=1;
$newdata[$key]=$value;
}
}
}
/*Start - Changes need to be done*/
if($excelarray[$i]["status"]==null)
{
$empdata['status'] = "rom";
}
if($excelarray[$i]["dialer_status"]==null)
{
$empdata['dialer_status'] = "rom";
}
if($excelarray[$i]["dialer_substatus"]==null)
{
$empdata['dialer_substatus'] = "rom";
}
/*End - Changes need to be done*/
$empdata["peopledata"]=$newdata;
$empdata['modifylog']=$createdlog;
$empdata['dirty']=$fdirty;
$wakka->setPerson($excelarray[$i]["id"],$empdata);
$excelarray[$i]['modified']=date('Y-m-d H:i:s');
$successArr[] = $excelarray[$i];
}
else
{
$reason = "";
$reason .= "Record ID is not on local server,";
$excelarray[$i]['server_ip'] =$server_ip;
$excelarray[$i]['location'] =$location;
if($excelarray[$i]["clientcode"]!="")
$excelarray[$i]['cust_id'] =$excelarray[$i]["clientcode"];
$excelarray[$i]['record_id'] = $excelarray[$i]["id"];
$excelarray[$i]['Reason'] = $reason;
$failureArr[] = $excelarray[$i];
}
}
else
{
$reason = "";
if($excelarray[$i]["id"]=="")
$reason .= "Column ID is blank,";
$excelarray[$i]['server_ip'] =$server_ip;
$excelarray[$i]['location'] =$location;
if($excelarray[$i]["clientcode"]!="")
$excelarray[$i]['cust_id'] =$excelarray[$i]["clientcode"];
$excelarray[$i]['Reason'] = $reason;
$failureArr[] = $excelarray[$i];
}
}
if(!empty($successArr)){
foreach($successArr as $succes)
{
$setSuccess=array();
$setSuccess[] = "server_ip='$server_ip'";
$setSuccess[] = "location='$location'";
$setSuccess[] = "record_id='".$succes['id']."'";
$setSuccess[] = "cust_id='".$succes['clientcode']."'";
$setSuccess[] = "modified='".$succes['modified']."'";
$setSuccess = implode(",",$setSuccess);
DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_success set $setSuccess"));
}
}
if(!empty($failureArr)){
foreach($failureArr as $failur)
{
$setFailure=array();
$setFailure[] = "server_ip='$server_ip'";
$setFailure[] = "location='$location'";
$setFailure[] = "cust_id='".$failur['clientcode']."'";
$setFailure[] = "record_id='".$failur['record_id']."'";
$setFailure[] = "reason='".$failur['Reason']."'";
$setFailure = implode(",",$setFailure);
DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_failure set $setFailure"));
}
}
DB::connection("conn")->disconnect();
}
}
<?php namespace App\Console\Commands;
use Illuminate\Console\Command;
//use Mail;
use DB;
use Config;
use App\Models\User;
use App\Models\Accesslog;
use App\Models\CRMCall;
use Schema;
use PDO;
use App\Models\Notification;
use App\Jobs\KHRMSLib;
use Input;
use Illuminate\Database\Schema\Blueprint;
class bulkServerUpload_3 extends Command {
/**
* The console command name.
*
* @var string
*/
protected $signature = 'bulkServerUpload_3';
/**
* The console command description.
*
* @var string
*/
protected $description = 'bulkServerUpload_3';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
//echo "\n".date('Y-m-d')."\n";
echo "4";
echo "\n".date('Y-m-d H:i:s')."\n";
$server_ip=env('app_ip');
$central_ip=env('central_ip');
$wakka = new KHRMSLib();
$kformlib=new \App\Jobs\KFormLib($wakka->HRCoreVars["HRFiledsStr"]);
$kformlib->gthis=$wakka;
$themehome=$wakka->GetThemePath('/');
$updatetime=time();
$clientlst=$wakka->GetBBBUserData("clientslist");
$isadmin=$wakka->IsAdmin();
$username=$wakka->GetUserName();
$triggers=Input::get("triggers");
$tmpstr=explode(",",$kformlib->HRFiledsStr);
$success="";$message="";$successcnt=0;$duplicatecount=0;
$conn = array(
'driver' => 'mysql',
'host' => $central_ip,
'database' => env('DB_DATABASE', 'kstych_flexydial'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', 'yb9738z'),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'options' => array(
PDO::ATTR_TIMEOUT => 5,
),
);
Config::set("database.connections.conn", $conn);
DB::connection("conn")->getDatabaseName();
$serverclist=DB::connection("conn")->select(DB::raw("select location from server_details where server_ip='$server_ip'"));
$location=$serverclist[0]->location;
$excelarray = DB::connection("conn")->select(DB::raw("select * from bz_record_upload_uat where SERVER_IP='$server_ip' order by auto_id asc limit 60001,80000"));
$conn='';
$tcol=0;$fieldsarr=array();$extrahdrarr=array();
foreach($excelarray as $key => $array){
$excelarray[$key] = (array)$array;
}
$highestColumn = DB::connection("conn")->select(DB::raw("select count(*) as cnt from information_schema.columns where table_name='bz_record_upload_uat'"));
$highestColumn = $highestColumn[0]->cnt;
$highestrow = count($excelarray);
$flag = 0;
$editflag=0;
for($i=0;$i<$highestrow;$i++)
{
if($excelarray[$i]["id"]!="")
{
if($excelarray[$i]["id"]=="CREATE")
{
$excelarray[$i]["id"]=$wakka->Query("insert into","","records",array('created'=>date('Y-m-d H:i:s')));
}
else $excelarray[$i]["id"]=intval($excelarray[$i]["id"]);
if($wakka->getCount("records","id='".$excelarray[$i]["id"]."'")==1)
{
$empdata=$wakka->getPerson($excelarray[$i]["id"]);
$ppldata=$empdata["peopledata"];
$createdlog=$empdata['modifylog'];
$fdirty=$empdata['dirty'];
$createdlog[$updatetime]=$username."::";
$createdlog["updated"]=$updatetime;
$newdata=$ppldata;
foreach($excelarray[$i] as $key => $value)
{
if($value!="")
{
if("A".$ppldata[$key]!="A".$value)//forcing string comparrision //MAGIC
{
$value=str_replace("'"," ",$value);
if(strstr($createdlog[$updatetime],$key)==FALSE)$createdlog[$updatetime].="$key|".str_replace(array("|",",")," ",$ppldata[$key])."|".str_replace(array("|",",")," ",$value).",";
$fdirty[$key]=1;
$newdata[$key]=$value;
}
}
}
/*Start - Changes need to be done*/
if($excelarray[$i]["status"]==null)
{
$empdata['status'] = "rom";
}
if($excelarray[$i]["dialer_status"]==null)
{
$empdata['dialer_status'] = "rom";
}
if($excelarray[$i]["dialer_substatus"]==null)
{
$empdata['dialer_substatus'] = "rom";
}
/*End - Changes need to be done*/
$empdata["peopledata"]=$newdata;
$empdata['modifylog']=$createdlog;
$empdata['dirty']=$fdirty;
$wakka->setPerson($excelarray[$i]["id"],$empdata);
$excelarray[$i]['modified']=date('Y-m-d H:i:s');
$successArr[] = $excelarray[$i];
}
else
{
$reason = "";
$reason .= "Record ID is not on local server,";
$excelarray[$i]['server_ip'] =$server_ip;
$excelarray[$i]['location'] =$location;
if($excelarray[$i]["clientcode"]!="")
$excelarray[$i]['cust_id'] =$excelarray[$i]["clientcode"];
$excelarray[$i]['record_id'] = $excelarray[$i]["id"];
$excelarray[$i]['Reason'] = $reason;
$failureArr[] = $excelarray[$i];
}
}
else
{
$reason = "";
if($excelarray[$i]["id"]=="")
$reason .= "Column ID is blank,";
$excelarray[$i]['server_ip'] =$server_ip;
$excelarray[$i]['location'] =$location;
if($excelarray[$i]["clientcode"]!="")
$excelarray[$i]['cust_id'] =$excelarray[$i]["clientcode"];
$excelarray[$i]['Reason'] = $reason;
$failureArr[] = $excelarray[$i];
}
}
if(!empty($successArr)){
foreach($successArr as $succes)
{
$setSuccess=array();
$setSuccess[] = "server_ip='$server_ip'";
$setSuccess[] = "location='$location'";
$setSuccess[] = "record_id='".$succes['id']."'";
$setSuccess[] = "cust_id='".$succes['clientcode']."'";
$setSuccess[] = "modified='".$succes['modified']."'";
$setSuccess = implode(",",$setSuccess);
DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_success set $setSuccess"));
}
}
if(!empty($failureArr)){
foreach($failureArr as $failur)
{
$setFailure=array();
$setFailure[] = "server_ip='$server_ip'";
$setFailure[] = "location='$location'";
$setFailure[] = "cust_id='".$failur['clientcode']."'";
$setFailure[] = "record_id='".$failur['record_id']."'";
$setFailure[] = "reason='".$failur['Reason']."'";
$setFailure = implode(",",$setFailure);
DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_failure set $setFailure"));
}
}
DB::connection("conn")->disconnect();
}
}
<?php namespace App\Console\Commands;
use Illuminate\Console\Command;
//use Mail;
use DB;
use Config;
use App\Models\User;
use App\Models\Accesslog;
use App\Models\CRMCall;
use Schema;
use PDO;
use App\Models\Notification;
use App\Jobs\KHRMSLib;
use Input;
use Illuminate\Database\Schema\Blueprint;
class bulkServerUpload_4 extends Command {
/**
* The console command name.
*
* @var string
*/
protected $signature = 'bulkServerUpload_4';
/**
* The console command description.
*
* @var string
*/
protected $description = 'bulkServerUpload_4';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
//echo "\n".date('Y-m-d')."\n";
echo "5";
echo "\n".date('Y-m-d H:i:s')."\n";
$server_ip=env('app_ip');
$central_ip=env('central_ip');
$wakka = new KHRMSLib();
$kformlib=new \App\Jobs\KFormLib($wakka->HRCoreVars["HRFiledsStr"]);
$kformlib->gthis=$wakka;
$themehome=$wakka->GetThemePath('/');
$updatetime=time();
$clientlst=$wakka->GetBBBUserData("clientslist");
$isadmin=$wakka->IsAdmin();
$username=$wakka->GetUserName();
$triggers=Input::get("triggers");
$tmpstr=explode(",",$kformlib->HRFiledsStr);
$success="";$message="";$successcnt=0;$duplicatecount=0;
$conn = array(
'driver' => 'mysql',
'host' => $central_ip,
'database' => env('DB_DATABASE', 'kstych_flexydial'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', 'yb9738z'),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'options' => array(
PDO::ATTR_TIMEOUT => 5,
),
);
Config::set("database.connections.conn", $conn);
DB::connection("conn")->getDatabaseName();
$serverclist=DB::connection("conn")->select(DB::raw("select location from server_details where server_ip='$server_ip'"));
$location=$serverclist[0]->location;
$excelarray = DB::connection("conn")->select(DB::raw("select * from bz_record_upload_uat where SERVER_IP='$server_ip' order by auto_id asc limit 80001,100000"));
$conn='';
$tcol=0;$fieldsarr=array();$extrahdrarr=array();
foreach($excelarray as $key => $array){
$excelarray[$key] = (array)$array;
}
$highestColumn = DB::connection("conn")->select(DB::raw("select count(*) as cnt from information_schema.columns where table_name='bz_record_upload_uat'"));
$highestColumn = $highestColumn[0]->cnt;
$highestrow = count($excelarray);
$flag = 0;
$editflag=0;
for($i=0;$i<$highestrow;$i++)
{
if($excelarray[$i]["id"]!="")
{
if($excelarray[$i]["id"]=="CREATE")
{
$excelarray[$i]["id"]=$wakka->Query("insert into","","records",array('created'=>date('Y-m-d H:i:s')));
}
else $excelarray[$i]["id"]=intval($excelarray[$i]["id"]);
if($wakka->getCount("records","id='".$excelarray[$i]["id"]."'")==1)
{
$empdata=$wakka->getPerson($excelarray[$i]["id"]);
$ppldata=$empdata["peopledata"];
$createdlog=$empdata['modifylog'];
$fdirty=$empdata['dirty'];
$createdlog[$updatetime]=$username."::";
$createdlog["updated"]=$updatetime;
$newdata=$ppldata;
foreach($excelarray[$i] as $key => $value)
{
if($value!="")
{
if("A".$ppldata[$key]!="A".$value)//forcing string comparrision //MAGIC
{
$value=str_replace("'"," ",$value);
if(strstr($createdlog[$updatetime],$key)==FALSE)$createdlog[$updatetime].="$key|".str_replace(array("|",",")," ",$ppldata[$key])."|".str_replace(array("|",",")," ",$value).",";
$fdirty[$key]=1;
$newdata[$key]=$value;
}
}
}
/*Start - Changes need to be done*/
if($excelarray[$i]["status"]==null)
{
$empdata['status'] = "rom";
}
if($excelarray[$i]["dialer_status"]==null)
{
$empdata['dialer_status'] = "rom";
}
if($excelarray[$i]["dialer_substatus"]==null)
{
$empdata['dialer_substatus'] = "rom";
}
/*End - Changes need to be done*/
$empdata["peopledata"]=$newdata;
$empdata['modifylog']=$createdlog;
$empdata['dirty']=$fdirty;
$wakka->setPerson($excelarray[$i]["id"],$empdata);
$excelarray[$i]['modified']=date('Y-m-d H:i:s');
$successArr[] = $excelarray[$i];
}
else
{
$reason = "";
$reason .= "Record ID is not on local server,";
$excelarray[$i]['server_ip'] =$server_ip;
$excelarray[$i]['location'] =$location;
if($excelarray[$i]["clientcode"]!="")
$excelarray[$i]['cust_id'] =$excelarray[$i]["clientcode"];
$excelarray[$i]['record_id'] = $excelarray[$i]["id"];
$excelarray[$i]['Reason'] = $reason;
$failureArr[] = $excelarray[$i];
}
}
else
{
$reason = "";
if($excelarray[$i]["id"]=="")
$reason .= "Column ID is blank,";
$excelarray[$i]['server_ip'] =$server_ip;
$excelarray[$i]['location'] =$location;
if($excelarray[$i]["clientcode"]!="")
$excelarray[$i]['cust_id'] =$excelarray[$i]["clientcode"];
$excelarray[$i]['Reason'] = $reason;
$failureArr[] = $excelarray[$i];
}
}
if(!empty($successArr)){
foreach($successArr as $succes)
{
$setSuccess=array();
$setSuccess[] = "server_ip='$server_ip'";
$setSuccess[] = "location='$location'";
$setSuccess[] = "record_id='".$succes['id']."'";
$setSuccess[] = "cust_id='".$succes['clientcode']."'";
$setSuccess[] = "modified='".$succes['modified']."'";
$setSuccess = implode(",",$setSuccess);
DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_success set $setSuccess"));
}
}
if(!empty($failureArr)){
foreach($failureArr as $failur)
{
$setFailure=array();
$setFailure[] = "server_ip='$server_ip'";
$setFailure[] = "location='$location'";
$setFailure[] = "cust_id='".$failur['clientcode']."'";
$setFailure[] = "record_id='".$failur['record_id']."'";
$setFailure[] = "reason='".$failur['Reason']."'";
$setFailure = implode(",",$setFailure);
DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_failure set $setFailure"));
}
}
DB::connection("conn")->disconnect();
}
}
<?php namespace App\Console\Commands;
use Illuminate\Console\Command;
//use Mail;
use DB;
use Config;
use App\Models\User;
use App\Models\Accesslog;
use App\Models\CRMCall;
use Schema;
use PDO;
use App\Models\Notification;
use App\Jobs\KHRMSLib;
use Input;
use Illuminate\Database\Schema\Blueprint;
class bulkServerUpload_5 extends Command {
/**
* The console command name.
*
* @var string
*/
protected $signature = 'bulkServerUpload_5';
/**
* The console command description.
*
* @var string
*/
protected $description = 'bulkServerUpload_5';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
//echo "\n".date('Y-m-d')."\n";
echo "6";
echo "\n".date('Y-m-d H:i:s')."\n";
$server_ip=env('app_ip');
$central_ip=env('central_ip');
$wakka = new KHRMSLib();
$kformlib=new \App\Jobs\KFormLib($wakka->HRCoreVars["HRFiledsStr"]);
$kformlib->gthis=$wakka;
$themehome=$wakka->GetThemePath('/');
$updatetime=time();
$clientlst=$wakka->GetBBBUserData("clientslist");
$isadmin=$wakka->IsAdmin();
$username=$wakka->GetUserName();
$triggers=Input::get("triggers");
$tmpstr=explode(",",$kformlib->HRFiledsStr);
$success="";$message="";$successcnt=0;$duplicatecount=0;
$conn = array(
'driver' => 'mysql',
'host' => $central_ip,
'database' => env('DB_DATABASE', 'kstych_flexydial'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', 'yb9738z'),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'options' => array(
PDO::ATTR_TIMEOUT => 5,
),
);
Config::set("database.connections.conn", $conn);
DB::connection("conn")->getDatabaseName();
$serverclist=DB::connection("conn")->select(DB::raw("select location from server_details where server_ip='$server_ip'"));
$location=$serverclist[0]->location;
$excelarray = DB::connection("conn")->select(DB::raw("select * from bz_record_upload_uat where SERVER_IP='$server_ip' order by auto_id asc limit 100001,120000"));
$conn='';
$tcol=0;$fieldsarr=array();$extrahdrarr=array();
foreach($excelarray as $key => $array){
$excelarray[$key] = (array)$array;
}
$highestColumn = DB::connection("conn")->select(DB::raw("select count(*) as cnt from information_schema.columns where table_name='bz_record_upload_uat'"));
$highestColumn = $highestColumn[0]->cnt;
$highestrow = count($excelarray);
$flag = 0;
$editflag=0;
for($i=0;$i<$highestrow;$i++)
{
if($excelarray[$i]["id"]!="")
{
if($excelarray[$i]["id"]=="CREATE")
{
$excelarray[$i]["id"]=$wakka->Query("insert into","","records",array('created'=>date('Y-m-d H:i:s')));
}
else $excelarray[$i]["id"]=intval($excelarray[$i]["id"]);
if($wakka->getCount("records","id='".$excelarray[$i]["id"]."'")==1)
{
$empdata=$wakka->getPerson($excelarray[$i]["id"]);
$ppldata=$empdata["peopledata"];
$createdlog=$empdata['modifylog'];
$fdirty=$empdata['dirty'];
$createdlog[$updatetime]=$username."::";
$createdlog["updated"]=$updatetime;
$newdata=$ppldata;
foreach($excelarray[$i] as $key => $value)
{
if($value!="")
{
if("A".$ppldata[$key]!="A".$value)//forcing string comparrision //MAGIC
{
$value=str_replace("'"," ",$value);
if(strstr($createdlog[$updatetime],$key)==FALSE)$createdlog[$updatetime].="$key|".str_replace(array("|",",")," ",$ppldata[$key])."|".str_replace(array("|",",")," ",$value).",";
$fdirty[$key]=1;
$newdata[$key]=$value;
}
}
}
/*Start - Changes need to be done*/
if($excelarray[$i]["status"]==null)
{
$empdata['status'] = "rom";
}
if($excelarray[$i]["dialer_status"]==null)
{
$empdata['dialer_status'] = "rom";
}
if($excelarray[$i]["dialer_substatus"]==null)
{
$empdata['dialer_substatus'] = "rom";
}
/*End - Changes need to be done*/
$empdata["peopledata"]=$newdata;
$empdata['modifylog']=$createdlog;
$empdata['dirty']=$fdirty;
$wakka->setPerson($excelarray[$i]["id"],$empdata);
$excelarray[$i]['modified']=date('Y-m-d H:i:s');
$successArr[] = $excelarray[$i];
}
else
{
$reason = "";
$reason .= "Record ID is not on local server,";
$excelarray[$i]['server_ip'] =$server_ip;
$excelarray[$i]['location'] =$location;
if($excelarray[$i]["clientcode"]!="")
$excelarray[$i]['cust_id'] =$excelarray[$i]["clientcode"];
$excelarray[$i]['record_id'] = $excelarray[$i]["id"];
$excelarray[$i]['Reason'] = $reason;
$failureArr[] = $excelarray[$i];
}
}
else
{
$reason = "";
if($excelarray[$i]["id"]=="")
$reason .= "Column ID is blank,";
$excelarray[$i]['server_ip'] =$server_ip;
$excelarray[$i]['location'] =$location;
if($excelarray[$i]["clientcode"]!="")
$excelarray[$i]['cust_id'] =$excelarray[$i]["clientcode"];
$excelarray[$i]['Reason'] = $reason;
$failureArr[] = $excelarray[$i];
}
}
if(!empty($successArr)){
foreach($successArr as $succes)
{
$setSuccess=array();
$setSuccess[] = "server_ip='$server_ip'";
$setSuccess[] = "location='$location'";
$setSuccess[] = "record_id='".$succes['id']."'";
$setSuccess[] = "cust_id='".$succes['clientcode']."'";
$setSuccess[] = "modified='".$succes['modified']."'";
$setSuccess = implode(",",$setSuccess);
DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_success set $setSuccess"));
}
}
if(!empty($failureArr)){
foreach($failureArr as $failur)
{
$setFailure=array();
$setFailure[] = "server_ip='$server_ip'";
$setFailure[] = "location='$location'";
$setFailure[] = "cust_id='".$failur['clientcode']."'";
$setFailure[] = "record_id='".$failur['record_id']."'";
$setFailure[] = "reason='".$failur['Reason']."'";
$setFailure = implode(",",$setFailure);
DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_failure set $setFailure"));
}
}
DB::connection("conn")->disconnect();
}
}
<?php namespace App\Console\Commands;
use Illuminate\Console\Command;
//use Mail;
use DB;
use Config;
use App\Models\User;
use App\Models\Accesslog;
use App\Models\CRMCall;
use Schema;
use PDO;
use App\Models\Notification;
use App\Jobs\KHRMSLib;
use Input;
use Illuminate\Database\Schema\Blueprint;
class bulkServerUpload_6 extends Command {
/**
* The console command name.
*
* @var string
*/
protected $signature = 'bulkServerUpload_6';
/**
* The console command description.
*
* @var string
*/
protected $description = 'bulkServerUpload_6';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
//echo "\n".date('Y-m-d')."\n";
echo "6";
echo "\n".date('Y-m-d H:i:s')."\n";
$server_ip=env('app_ip');
$central_ip=env('central_ip');
$wakka = new KHRMSLib();
$kformlib=new \App\Jobs\KFormLib($wakka->HRCoreVars["HRFiledsStr"]);
$kformlib->gthis=$wakka;
$themehome=$wakka->GetThemePath('/');
$updatetime=time();
$clientlst=$wakka->GetBBBUserData("clientslist");
$isadmin=$wakka->IsAdmin();
$username=$wakka->GetUserName();
$triggers=Input::get("triggers");
$tmpstr=explode(",",$kformlib->HRFiledsStr);
$success="";$message="";$successcnt=0;$duplicatecount=0;
$conn = array(
'driver' => 'mysql',
'host' => $central_ip,
'database' => env('DB_DATABASE', 'kstych_flexydial'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', 'yb9738z'),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'options' => array(
PDO::ATTR_TIMEOUT => 5,
),
);
Config::set("database.connections.conn", $conn);
DB::connection("conn")->getDatabaseName();
$serverclist=DB::connection("conn")->select(DB::raw("select location from server_details where server_ip='$server_ip'"));
$location=$serverclist[0]->location;
$excelarray = DB::connection("conn")->select(DB::raw("select * from bz_record_upload_uat where SERVER_IP='$server_ip' order by auto_id asc limit 120001,140000"));
$conn='';
$tcol=0;$fieldsarr=array();$extrahdrarr=array();
foreach($excelarray as $key => $array){
$excelarray[$key] = (array)$array;
}
$highestColumn = DB::connection("conn")->select(DB::raw("select count(*) as cnt from information_schema.columns where table_name='bz_record_upload_uat'"));
$highestColumn = $highestColumn[0]->cnt;
$highestrow = count($excelarray);
$flag = 0;
$editflag=0;
for($i=0;$i<$highestrow;$i++)
{
if($excelarray[$i]["id"]!="")
{
if($excelarray[$i]["id"]=="CREATE")
{
$excelarray[$i]["id"]=$wakka->Query("insert into","","records",array('created'=>date('Y-m-d H:i:s')));
}
else $excelarray[$i]["id"]=intval($excelarray[$i]["id"]);
if($wakka->getCount("records","id='".$excelarray[$i]["id"]."'")==1)
{
$empdata=$wakka->getPerson($excelarray[$i]["id"]);
$ppldata=$empdata["peopledata"];
$createdlog=$empdata['modifylog'];
$fdirty=$empdata['dirty'];
$createdlog[$updatetime]=$username."::";
$createdlog["updated"]=$updatetime;
$newdata=$ppldata;
foreach($excelarray[$i] as $key => $value)
{
if($value!="")
{
if("A".$ppldata[$key]!="A".$value)//forcing string comparrision //MAGIC
{
$value=str_replace("'"," ",$value);
if(strstr($createdlog[$updatetime],$key)==FALSE)$createdlog[$updatetime].="$key|".str_replace(array("|",",")," ",$ppldata[$key])."|".str_replace(array("|",",")," ",$value).",";
$fdirty[$key]=1;
$newdata[$key]=$value;
}
}
}
/*Start - Changes need to be done*/
if($excelarray[$i]["status"]==null)
{
$empdata['status'] = "rom";
}
if($excelarray[$i]["dialer_status"]==null)
{
$empdata['dialer_status'] = "rom";
}
if($excelarray[$i]["dialer_substatus"]==null)
{
$empdata['dialer_substatus'] = "rom";
}
/*End - Changes need to be done*/
$empdata["peopledata"]=$newdata;
$empdata['modifylog']=$createdlog;
$empdata['dirty']=$fdirty;
$wakka->setPerson($excelarray[$i]["id"],$empdata);
$excelarray[$i]['modified']=date('Y-m-d H:i:s');
$successArr[] = $excelarray[$i];
}
else
{
$reason = "";
$reason .= "Record ID is not on local server,";
$excelarray[$i]['server_ip'] =$server_ip;
$excelarray[$i]['location'] =$location;
if($excelarray[$i]["clientcode"]!="")
$excelarray[$i]['cust_id'] =$excelarray[$i]["clientcode"];
$excelarray[$i]['record_id'] = $excelarray[$i]["id"];
$excelarray[$i]['Reason'] = $reason;
$failureArr[] = $excelarray[$i];
}
}
else
{
$reason = "";
if($excelarray[$i]["id"]=="")
$reason .= "Column ID is blank,";
$excelarray[$i]['server_ip'] =$server_ip;
$excelarray[$i]['location'] =$location;
if($excelarray[$i]["clientcode"]!="")
$excelarray[$i]['cust_id'] =$excelarray[$i]["clientcode"];
$excelarray[$i]['Reason'] = $reason;
$failureArr[] = $excelarray[$i];
}
}
if(!empty($successArr)){
foreach($successArr as $succes)
{
$setSuccess=array();
$setSuccess[] = "server_ip='$server_ip'";
$setSuccess[] = "location='$location'";
$setSuccess[] = "record_id='".$succes['id']."'";
$setSuccess[] = "cust_id='".$succes['clientcode']."'";
$setSuccess[] = "modified='".$succes['modified']."'";
$setSuccess = implode(",",$setSuccess);
DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_success set $setSuccess"));
}
}
if(!empty($failureArr)){
foreach($failureArr as $failur)
{
$setFailure=array();
$setFailure[] = "server_ip='$server_ip'";
$setFailure[] = "location='$location'";
$setFailure[] = "cust_id='".$failur['clientcode']."'";
$setFailure[] = "record_id='".$failur['record_id']."'";
$setFailure[] = "reason='".$failur['Reason']."'";
$setFailure = implode(",",$setFailure);
DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_failure set $setFailure"));
}
}
DB::connection("conn")->disconnect();
}
}
<?php namespace App\Console\Commands;
use Illuminate\Console\Command;
//use Mail;
use DB;
use Config;
use App\Models\User;
use App\Models\Accesslog;
use App\Models\CRMCall;
use Schema;
use PDO;
use App\Models\Notification;
use App\Jobs\KHRMSLib;
use Input;
use Illuminate\Database\Schema\Blueprint;
class bulkServerUpload_daily extends Command {
/**
* The console command name.
*
* @var string
*/
protected $signature = 'bulkServerUpload_daily';
/**
* The console command description.
*
* @var string
*/
protected $description = 'bulkServerUpload_daily';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
//echo "\n".date('Y-m-d')."\n";
echo "1";
echo "\n".date('Y-m-d H:i:s')."\n";
$server_ip=env('app_ip');
$central_ip=env('central_ip');
$wakka = new KHRMSLib();
$kformlib=new \App\Jobs\KFormLib($wakka->HRCoreVars["HRFiledsStr"]);
$kformlib->gthis=$wakka;
$themehome=$wakka->GetThemePath('/');
$updatetime=time();
$clientlst=$wakka->GetBBBUserData("clientslist");
$isadmin=$wakka->IsAdmin();
$username=$wakka->GetUserName();
$triggers=Input::get("triggers");
$tmpstr=explode(",",$kformlib->HRFiledsStr);
$success="";$message="";$successcnt=0;$duplicatecount=0;
$conn = array(
'driver' => 'mysql',
'host' => $central_ip,
'database' => env('DB_DATABASE', 'kstych_flexydial'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', 'yb9738z'),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'options' => array(
PDO::ATTR_TIMEOUT => 5,
),
);
Config::set("database.connections.conn", $conn);
DB::connection("conn")->getDatabaseName();
$serverclist=DB::connection("conn")->select(DB::raw("select location from server_details where server_ip='$server_ip'"));
$location=$serverclist[0]->location;
echo $central_ip;
echo $location;
$excelarray = DB::connection("conn")->select(DB::raw("select * from bz_record_upload_uat_daily where SERVER_IP='$server_ip'"));
$conn='';
$tcol=0;$fieldsarr=array();$extrahdrarr=array();
foreach($excelarray as $key => $array){
$excelarray[$key] = (array)$array;
}
$highestColumn = DB::connection("conn")->select(DB::raw("select count(*) as cnt from information_schema.columns where table_name='bz_record_upload_uat'"));
$highestColumn = $highestColumn[0]->cnt;
$highestrow = count($excelarray);
$flag = 0;
$editflag=0;
for($i=0;$i<$highestrow;$i++)
{
if($excelarray[$i]["id"]!="")
{
if($excelarray[$i]["id"]=="CREATE")
{
$excelarray[$i]["id"]=$wakka->Query("insert into","","records",array('created'=>date('Y-m-d H:i:s')));
}
else $excelarray[$i]["id"]=intval($excelarray[$i]["id"]);
if($wakka->getCount("records","id='".$excelarray[$i]["id"]."'")==1)
{
$empdata=$wakka->getPerson($excelarray[$i]["id"]);
$ppldata=$empdata["peopledata"];
$createdlog=$empdata['modifylog'];
$fdirty=$empdata['dirty'];
$createdlog[$updatetime]=$username."::";
$createdlog["updated"]=$updatetime;
$newdata=$ppldata;
foreach($excelarray[$i] as $key => $value)
{
if($value!="")
{
if("A".$ppldata[$key]!="A".$value)//forcing string comparrision //MAGIC
{
$value=str_replace("'"," ",$value);
if(strstr($createdlog[$updatetime],$key)==FALSE)$createdlog[$updatetime].="$key|".str_replace(array("|",",")," ",$ppldata[$key])."|".str_replace(array("|",",")," ",$value).",";
$fdirty[$key]=1;
$newdata[$key]=$value;
}
}
}
/*Start - Changes need to be done*/
if($excelarray[$i]["status"]==null)
{
$empdata['status'] = "rom";
}
if($excelarray[$i]["dialer_status"]==null)
{
$empdata['dialer_status'] = "rom";
}
if($excelarray[$i]["dialer_substatus"]==null)
{
$empdata['dialer_substatus'] = "rom";
}
/*End - Changes need to be done*/
$empdata["peopledata"]=$newdata;
$empdata['modifylog']=$createdlog;
$empdata['dirty']=$fdirty;
$wakka->setPerson($excelarray[$i]["id"],$empdata);
$excelarray[$i]['modified']=date('Y-m-d H:i:s');
$successArr[] = $excelarray[$i];
}
else
{
$reason = "";
$reason .= "Record ID is not on local server,";
$excelarray[$i]['server_ip'] =$server_ip;
$excelarray[$i]['location'] =$location;
if($excelarray[$i]["clientcode"]!="")
$excelarray[$i]['cust_id'] =$excelarray[$i]["clientcode"];
$excelarray[$i]['record_id'] = $excelarray[$i]["id"];
$excelarray[$i]['Reason'] = $reason;
$failureArr[] = $excelarray[$i];
}
}
else
{
$reason = "";
if($excelarray[$i]["id"]=="")
$reason .= "Column ID is blank,";
$excelarray[$i]['server_ip'] =$server_ip;
$excelarray[$i]['location'] =$location;
if($excelarray[$i]["clientcode"]!="")
$excelarray[$i]['cust_id'] =$excelarray[$i]["clientcode"];
$excelarray[$i]['Reason'] = $reason;
$failureArr[] = $excelarray[$i];
}
}
if(!empty($successArr)){
foreach($successArr as $succes)
{
$setSuccess=array();
$setSuccess[] = "server_ip='$server_ip'";
$setSuccess[] = "location='$location'";
$setSuccess[] = "record_id='".$succes['id']."'";
$setSuccess[] = "cust_id='".$succes['clientcode']."'";
$setSuccess[] = "modified='".$succes['modified']."'";
$setSuccess = implode(",",$setSuccess);
DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_success_daily set $setSuccess"));
DB::connection("conn")->delete(DB::raw("DELETE FROM `bz_record_upload_uat_daily` where SERVER_IP='$server_ip' and id='".$succes['id']."'"));
}
}
if(!empty($failureArr)){
foreach($failureArr as $failur)
{
$setFailure=array();
$setFailure[] = "server_ip='$server_ip'";
$setFailure[] = "location='$location'";
$setFailure[] = "cust_id='".$failur['clientcode']."'";
$setFailure[] = "record_id='".$failur['record_id']."'";
$setFailure[] = "reason='".$failur['Reason']."'";
$setFailure = implode(",",$setFailure);
DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_failure_daily set $setFailure"));
}
}
//DB::connection("conn")->delete(DB::raw("DELETE FROM `bz_record_upload_uat_daily` where SERVER_IP='10.3.179.121'"));
DB::connection("conn")->disconnect();
}
}
<?php namespace App\Console\Commands;
use Illuminate\Console\Command;
//use Mail;
use DB;
use Config;
use App\Models\User;
use App\Models\Accesslog;
use App\Models\CRMCall;
use Schema;
use PDO;
use App\Models\Notification;
use App\Jobs\KHRMSLib;
use Input;
use Illuminate\Database\Schema\Blueprint;
class bulkServerUpload_data3 extends Command {
/**
* The console command name.
*
* @var string
*/
protected $signature = 'bulkServerUpload_data3';
/**
* The console command description.
*
* @var string
*/
protected $description = 'bulkServerUpload_data3';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
//echo "\n".date('Y-m-d')."\n";
echo "3";
echo "\n".date('Y-m-d H:i:s')."\n";
$server_ip=env('app_ip');
$central_ip=env('central_ip');
$wakka = new KHRMSLib();
$kformlib=new \App\Jobs\KFormLib($wakka->HRCoreVars["HRFiledsStr"]);
$kformlib->gthis=$wakka;
$themehome=$wakka->GetThemePath('/');
$updatetime=time();
$clientlst=$wakka->GetBBBUserData("clientslist");
$isadmin=$wakka->IsAdmin();
$username=$wakka->GetUserName();
$triggers=Input::get("triggers");
$tmpstr=explode(",",$kformlib->HRFiledsStr);
$success="";$message="";$successcnt=0;$duplicatecount=0;
$conn = array(
'driver' => 'mysql',
'host' => $central_ip,
'database' => env('DB_DATABASE', 'kstych_flexydial'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', 'yb9738z'),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'options' => array(
PDO::ATTR_TIMEOUT => 5,
),
);
Config::set("database.connections.conn", $conn);
DB::connection("conn")->getDatabaseName();
$serverclist=DB::connection("conn")->select(DB::raw("select location from server_details where server_ip='$server_ip'"));
$location=$serverclist[0]->location;
$excelarray = DB::connection("conn")->select(DB::raw("select * from bz_record_upload_uat_09102018_3 where SERVER_IP='$server_ip'"));
$conn='';
$tcol=0;$fieldsarr=array();$extrahdrarr=array();
foreach($excelarray as $key => $array){
$excelarray[$key] = (array)$array;
}
$highestColumn = DB::connection("conn")->select(DB::raw("select count(*) as cnt from information_schema.columns where table_name='bz_record_upload_uat_09102018_3'"));
$highestColumn = $highestColumn[0]->cnt;
$highestrow = count($excelarray);
$flag = 0;
$editflag=0;
for($i=0;$i<$highestrow;$i++)
{
if($excelarray[$i]["id"]!="")
{
if($excelarray[$i]["id"]=="CREATE")
{
$excelarray[$i]["id"]=$wakka->Query("insert into","","records",array('created'=>date('Y-m-d H:i:s')));
}
else $excelarray[$i]["id"]=intval($excelarray[$i]["id"]);
if($wakka->getCount("records","id='".$excelarray[$i]["id"]."'")==1)
{
$empdata=$wakka->getPerson($excelarray[$i]["id"]);
$excelarray[$i]["other_information"]='2018-10-09_3';
$ppldata=$empdata["peopledata"];
$createdlog=$empdata['modifylog'];
$fdirty=$empdata['dirty'];
$createdlog[$updatetime]=$username."::";
$createdlog["updated"]=$updatetime;
$newdata=$ppldata;
foreach($excelarray[$i] as $key => $value)
{
if($value!="")
{
if("A".$ppldata[$key]!="A".$value)//forcing string comparrision //MAGIC
{
$value=str_replace("'"," ",$value);
if(strstr($createdlog[$updatetime],$key)==FALSE)$createdlog[$updatetime].="$key|".str_replace(array("|",",")," ",$ppldata[$key])."|".str_replace(array("|",",")," ",$value).",";
$fdirty[$key]=1;
$newdata[$key]=$value;
}
}
}
/*Start - Changes need to be done*/
if($excelarray[$i]["status"]==null)
{
$empdata['status'] = "rom";
}
if($excelarray[$i]["dialer_status"]==null)
{
$empdata['dialer_status'] = "rom";
}
if($excelarray[$i]["dialer_substatus"]==null)
{
$empdata['dialer_substatus'] = "rom";
}
/*End - Changes need to be done*/
$empdata["peopledata"]=$newdata;
$empdata['modifylog']=$createdlog;
$empdata['dirty']=$fdirty;
$wakka->setPerson($excelarray[$i]["id"],$empdata);
$excelarray[$i]['modified']=date('Y-m-d H:i:s');
$successArr[] = $excelarray[$i];
}
else
{
$reason = "";
$reason .= "Record ID is not on local server,";
$excelarray[$i]['server_ip'] =$server_ip;
$excelarray[$i]['location'] =$location;
if($excelarray[$i]["clientcode"]!="")
$excelarray[$i]['cust_id'] =$excelarray[$i]["clientcode"];
$excelarray[$i]['record_id'] = $excelarray[$i]["id"];
$excelarray[$i]['Reason'] = $reason;
$failureArr[] = $excelarray[$i];
}
}
else
{
$reason = "";
if($excelarray[$i]["id"]=="")
$reason .= "Column ID is blank,";
$excelarray[$i]['server_ip'] =$server_ip;
$excelarray[$i]['location'] =$location;
if($excelarray[$i]["clientcode"]!="")
$excelarray[$i]['cust_id'] =$excelarray[$i]["clientcode"];
$excelarray[$i]['Reason'] = $reason;
$failureArr[] = $excelarray[$i];
}
}
echo "\n"."Updated data partial upload end"."\n";
/*if(!empty($successArr)){
foreach($successArr as $succes)
{
$setSuccess=array();
$setSuccess[] = "server_ip='$server_ip'";
$setSuccess[] = "location='$location'";
$setSuccess[] = "record_id='".$succes['id']."'";
$setSuccess[] = "cust_id='".$succes['clientcode']."'";
$setSuccess[] = "modified='".$succes['modified']."'";
$setSuccess = implode(",",$setSuccess);
DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_success set $setSuccess"));
}
}
if(!empty($failureArr)){
foreach($failureArr as $failur)
{
$setFailure=array();
$setFailure[] = "server_ip='$server_ip'";
$setFailure[] = "location='$location'";
$setFailure[] = "cust_id='".$failur['clientcode']."'";
$setFailure[] = "record_id='".$failur['record_id']."'";
$setFailure[] = "reason='".$failur['Reason']."'";
$setFailure = implode(",",$setFailure);
DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_failure set $setFailure"));
}
}*/
DB::connection("conn")->disconnect();
}
}
<?php namespace App\Console\Commands;
use Illuminate\Console\Command;
//use Mail;
use DB;
use Config;
use App\Models\User;
use App\Models\Accesslog;
use App\Models\CRMCall;
use Schema;
use PDO;
use App\Models\Notification;
use App\Jobs\KHRMSLib;
use Input;
use Illuminate\Database\Schema\Blueprint;
class bulkserverupload_data extends Command {
/**
* The console command name.
*
* @var string
*/
protected $signature = 'bulkserverupload_data';
/**
* The console command description.
*
* @var string
*/
protected $description = 'bulkserverupload_data';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
//echo "\n".date('Y-m-d')."\n";
echo "2";
echo "\n".date('Y-m-d H:i:s')."\n";
$server_ip=env('app_ip');
$central_ip=env('central_ip');
$wakka = new KHRMSLib();
$kformlib=new \App\Jobs\KFormLib($wakka->HRCoreVars["HRFiledsStr"]);
$kformlib->gthis=$wakka;
$themehome=$wakka->GetThemePath('/');
$updatetime=time();
$clientlst=$wakka->GetBBBUserData("clientslist");
$isadmin=$wakka->IsAdmin();
$username=$wakka->GetUserName();
$triggers=Input::get("triggers");
$tmpstr=explode(",",$kformlib->HRFiledsStr);
$success="";$message="";$successcnt=0;$duplicatecount=0;
$conn = array(
'driver' => 'mysql',
'host' => $central_ip,
'database' => env('DB_DATABASE', 'kstych_flexydial'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', 'yb9738z'),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'options' => array(
PDO::ATTR_TIMEOUT => 5,
),
);
Config::set("database.connections.conn", $conn);
DB::connection("conn")->getDatabaseName();
$serverclist=DB::connection("conn")->select(DB::raw("select location from server_details where server_ip='$server_ip'"));
$location=$serverclist[0]->location;
$excelarray = DB::connection("conn")->select(DB::raw("select * from bz_record_upload_uat_09102018_2 where SERVER_IP='$server_ip'"));
$conn='';
$tcol=0;$fieldsarr=array();$extrahdrarr=array();
foreach($excelarray as $key => $array){
$excelarray[$key] = (array)$array;
}
$highestColumn = DB::connection("conn")->select(DB::raw("select count(*) as cnt from information_schema.columns where table_name='bz_record_upload_uat_09102018_2'"));
$highestColumn = $highestColumn[0]->cnt;
$highestrow = count($excelarray);
$flag = 0;
$editflag=0;
for($i=0;$i<$highestrow;$i++)
{
if($excelarray[$i]["clientcode"]!="")
{
/*if($excelarray[$i]["id"]=="CREATE")
{
$excelarray[$i]["id"]=$wakka->Query("insert into","","records",array('created'=>date('Y-m-d H:i:s')));
}
else*/
$excelarray[$i]["clientcode"]=intval($excelarray[$i]["clientcode"]);
//$excelarray[$i]["client"]=$excelarray[$i]["rm_code"];
if($wakka->getCount("records","clientcode='".$excelarray[$i]["clientcode"]."'")==1)
{
//$empdata=$wakka->getPerson($excelarray[$i]["id"]);
$empdata=$wakka->getPersonServer($excelarray[$i]["clientcode"]);
$excelarray[$i]["other_information"]='2018-10-09';
$ppldata=$empdata["peopledata"];
$createdlog=$empdata['modifylog'];
$fdirty=$empdata['dirty'];
$createdlog[$updatetime]=$username."::";
$createdlog["updated"]=$updatetime;
$newdata=$ppldata;
foreach($excelarray[$i] as $key => $value)
{
if($value!="")
{
if("A".$ppldata[$key]!="A".$value)//forcing string comparrision //MAGIC
{
$value=str_replace("'"," ",$value);
if(strstr($createdlog[$updatetime],$key)==FALSE)$createdlog[$updatetime].="$key|".str_replace(array("|",",")," ",$ppldata[$key])."|".str_replace(array("|",",")," ",$value).",";
$fdirty[$key]=1;
$newdata[$key]=$value;
}
}
}
/*Start - Changes need to be done*/
if($excelarray[$i]["status"]==null)
{
$empdata['status'] = "rom";
}
if($excelarray[$i]["dialer_status"]==null)
{
$empdata['dialer_status'] = "rom";
}
if($excelarray[$i]["dialer_substatus"]==null)
{
$empdata['dialer_substatus'] = "rom";
}
/*End - Changes need to be done*/
$empdata["peopledata"]=$newdata;
$empdata['modifylog']=$createdlog;
$empdata['dirty']=$fdirty;
//$wakka->setPerson($excelarray[$i]["id"],$empdata);
$wakka->setPersonServer($excelarray[$i]["clientcode"],$empdata);
$excelarray[$i]['modified']=date('Y-m-d H:i:s');
$successArr[] = $excelarray[$i];
}
else
{
$excelarray[$i]["id"]=$wakka->Query("insert into","","records",array('created'=>date('Y-m-d H:i:s')));
$empdata=$wakka->getPerson($excelarray[$i]["id"]);
$ppldata=$empdata["peopledata"];
$createdlog=$empdata['modifylog'];
$fdirty=$empdata['dirty'];
$createdlog[$updatetime]=$username."::";
$createdlog["updated"]=$updatetime;
$newdata=$ppldata;
foreach($excelarray[$i] as $key => $value)
{
if($value!="")
{
if("A".$ppldata[$key]!="A".$value)//forcing string comparrision //MAGIC
{
$value=str_replace("'"," ",$value);
if(strstr($createdlog[$updatetime],$key)==FALSE)$createdlog[$updatetime].="$key|".str_replace(array("|",",")," ",$ppldata[$key])."|".str_replace(array("|",",")," ",$value).",";
$fdirty[$key]=1;
$newdata[$key]=$value;
}
}
}
$empdata["peopledata"]=$newdata;
$empdata['modifylog']=$createdlog;
$empdata['dirty']=$fdirty;
//$wakka->setPerson($excelarray[$i]["id"],$empdata);
$wakka->setPerson($excelarray[$i]["id"],$empdata);
$reason = "";
$reason .= "Record ID is not on local server,";
$excelarray[$i]['server_ip'] =$server_ip;
$excelarray[$i]['location'] =$location;
if($excelarray[$i]["clientcode"]!="")
$excelarray[$i]['cust_id'] =$excelarray[$i]["clientcode"];
$excelarray[$i]['record_id'] = $excelarray[$i]["id"];
$excelarray[$i]['Reason'] = $reason;
$failureArr[] = $excelarray[$i];
}
}
else
{
$reason = "";
if($excelarray[$i]["id"]=="")
$reason .= "Column ID is blank,";
$excelarray[$i]['server_ip'] =$server_ip;
$excelarray[$i]['location'] =$location;
if($excelarray[$i]["clientcode"]!="")
$excelarray[$i]['cust_id'] =$excelarray[$i]["clientcode"];
$excelarray[$i]['Reason'] = $reason;
$failureArr[] = $excelarray[$i];
}
}
echo "\n"."Updated data partial upload end"."\n";
/*if(!empty($successArr)){
foreach($successArr as $succes)
{
$setSuccess=array();
$setSuccess[] = "server_ip='$server_ip'";
$setSuccess[] = "location='$location'";
$setSuccess[] = "record_id='".$succes['id']."'";
$setSuccess[] = "cust_id='".$succes['clientcode']."'";
$setSuccess[] = "modified='".$succes['modified']."'";
$setSuccess = implode(",",$setSuccess);
DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_success set $setSuccess"));
}
}
if(!empty($failureArr)){
foreach($failureArr as $failur)
{
$setFailure=array();
$setFailure[] = "server_ip='$server_ip'";
$setFailure[] = "location='$location'";
$setFailure[] = "cust_id='".$failur['clientcode']."'";
$setFailure[] = "record_id='".$failur['record_id']."'";
$setFailure[] = "reason='".$failur['Reason']."'";
$setFailure = implode(",",$setFailure);
DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_failure set $setFailure"));
}
}*/
DB::connection("conn")->disconnect();
}
}
<?php namespace App\Console\Commands;
use Illuminate\Console\Command;
//use Mail;
use DB;
use Config;
use App\Models\User;
use App\Models\Accesslog;
use App\Models\CRMCall;
use Schema;
use PDO;
use Illuminate\Database\Schema\Blueprint;
class calllog extends Command {
/**
* The console command name.
*
* @var string
*/
protected $signature = 'calllog';
/**
* The console command description.
*
* @var string
*/
protected $description = 'App Main Daily Task for calllog';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$nowts=time();
$date=date('F_Y');
echo "\n".date('Y-m-d H:i:s')."\n";
$logdate=strtotime('0 day');
$tcol=0;$fieldsarr=array();$extrahdrarr=array();
$central_ip=env('central_ip');
$server_ip=env('app_ip');
$calllog_report = "calllog_report_".$date;
$conn = array(
'driver' => 'mysql',
'host' => $central_ip,
'database' => env('DB_DATABASE', 'kstych_flexydial'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'options' => array(
PDO::ATTR_TIMEOUT => 5,
),
);
Config::set("database.connections.conn", $conn);
DB::connection("conn")->getDatabaseName();
$serverclist=DB::connection("conn")->select(DB::raw("select id from server_details where server_ip='$server_ip'"));
$server_id=$serverclist[0]->id;
if($server_id<10){
$server_id="0".$server_id;
}
$maxid=DB::connection("conn")->select(DB::raw("SELECT max(crmcall_id) as maxid from $calllog_report where server='$server_id'"));
$maxids=$maxid[0]->maxid;
$alist=DB::select(DB::raw("SELECT * from crmcalls where id>'$maxids' and created_at<'".date("Y-m-d H:i:s",$logdate-(60*60))."'"));
//$alist=DB::select(DB::raw("SELECT * from crmcalls where id>'$maxids' and created_at>'".date("Y-m-d")."' and created_at<'".date("Y-m-d H:i:s",$logdate-(60*60))."'"));
//$alist=DB::select(DB::raw("SELECT * from crmcalls where id>'$maxids' and created_at<'".date("Y-m-d H:i:s",$logdate-(60*60))."'"));
$userarr=array();
foreach($alist as $aline)
{
$setstrarr=array();
$clientcode="";$currentstatus="";$legalstatus="";$record_id="";
if($aline->crm_id>0)
{
$user=DB::select(DB::raw("select id,clientcode,currentstatus,legalstatus from records where id='".$aline->crm_id."' limit 1;"));
if(isset($user[0]))
{
$record_id=$user[0]->id;
$clientcode=$user[0]->clientcode;
$currentstatus=$user[0]->currentstatus;
$legalstatus=$user[0]->legalstatus;
}
}
$tpostdata=json_decode($aline->data,true);
$fulldate=date("Y-m-d H:i:s",strtotime($aline->created_at)+330*60);
$talktime=$aline->talkSec+$aline->recstartSec+$aline->recendSec;
$length=round(($aline->waitSec+$aline->callSec+$talktime+$aline->dispoSec)/1000,2);
if(!isset($userarr[$aline->user_id])&&$aline->user_id>0)$userarr[$aline->user_id]=User::find($aline->user_id);
$dispname="";if(isset($userarr[$aline->user_id]))$dispname=$userarr[$aline->user_id]->dispname();
$username="";if(isset($userarr[$aline->user_id]))$username=$userarr[$aline->user_id]->username;
$globalid=$server_id.$record_id;
$setstrarr[]="server='$server_id'";
$setstrarr[]="record_id='$record_id'";
$setstrarr[]="crmcall_id='$aline->id'";
$countid=DB::connection("conn")->select(DB::raw("SELECT count(crmcall_id) as countid from $calllog_report where server='$server_id' and crmcall_id='$aline->id'"));
$countids=$countid[0]->countid;
if($countids>0){continue;}
$setstrarr[]="globalid='$globalid'";
$setstrarr[]="start='$fulldate'";
$setstrarr[]="length='$length'";
$setstrarr[]="user='$username'";
$setstrarr[]="name='$dispname'";
$setstrarr[]="dispo='$aline->userstatus'";
$setstrarr[]="subdispo='$aline->usersubstatus'";
$setstrarr[]="callback='$aline->usercallback'";
$setstrarr[]="number='$aline->number'";
$setstrarr[]="clientcode='$clientcode'";
$setstrarr[]="currentstatus='$currentstatus'";
$setstrarr[]="legalstatus='$legalstatus'";
$setstrarr[]="client='$aline->client'";
$setstrarr[]="department='$aline->department'";
$setstrarr[]="state='$aline->state'";
$setstrarr[]="hsource='$aline->hsource'";
$setstrarr[]="type='$aline->type'";
$setstrarr[]="status='$aline->status'";
$setstrarr[]="statuscode='$aline->statuscode'";
$setstrarr[]="statusstr='$aline->substatus'";
$setstrarr[]="dialline='$aline->dialline_id'";
$setstrarr[]="did='$aline->did'";
$setstrarr[]="waitsec='".round($aline->waitSec/1000,2)."'";
$setstrarr[]="callsec='".round($aline->callSec/1000,2)."'";
$setstrarr[]="talksec='".round($talktime/1000,2)."'";
$setstrarr[]="disposec='".round($aline->dispoSec/1000,2)."'";
$setstrarr[]="remarks='".str_replace("'","",$aline->userremarks)."'";
$setstrarr[]="userdata='$aline->userdata'";
$setstrarr[]="attempt='$aline->attempt'";
$setstr=implode(",",$setstrarr);
DB::connection("conn")->insert(DB::raw("insert into ".$calllog_report." set $setstr"));
}
}
}
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!