Fixed email transfers bugs, modified transfer-conf panel for same
Added option to allow --ALL-- as a campaign value in lead report export git-svn-id: svn://192.168.202.10@2998 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
# default path to astguiclient configuration file:
|
||||
$PATHconf = '/etc/astguiclient.conf';
|
||||
|
||||
# Copyright (C) 2012 Joe Johnson, Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
# Copyright (C) 2018 Joe Johnson, Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# VD_email_inbound.pl
|
||||
# This script is responsible for assigning transferred and new emails to
|
||||
@@ -23,6 +23,7 @@ $PATHconf = '/etc/astguiclient.conf';
|
||||
#
|
||||
# changes:
|
||||
# 121214-2303 - First Build
|
||||
# 180610-1812 - Added code to not allow XFER emails to go to user who transferred
|
||||
#
|
||||
|
||||
if ($ARGV[0]=~/--help/)
|
||||
@@ -185,7 +186,7 @@ for ($i=0; $i<=1000000; $i++)
|
||||
|
||||
$email_ct=0;
|
||||
## CHECK IF THERE ARE ANY TRANSFERS TO ASSIGN
|
||||
$xfer_stmt="select email_row_id, vicidial_xfer_log.lead_id, vicidial_xfer_log.campaign_id, vicidial_inbound_groups.next_agent_call from vicidial_email_list, vicidial_inbound_groups, vicidial_xfer_log where vicidial_inbound_groups.group_handling='EMAIL' and vicidial_inbound_groups.active='Y' and vicidial_inbound_groups.group_id=vicidial_xfer_log.campaign_id and vicidial_xfer_log.closer='EMAIL_XFER' and vicidial_xfer_log.lead_id=vicidial_email_list.lead_id and vicidial_xfer_log.xfercallid=vicidial_email_list.xfercallid order by queue_priority desc, email_date asc";
|
||||
$xfer_stmt="select email_row_id, vicidial_xfer_log.lead_id, vicidial_xfer_log.campaign_id, vicidial_inbound_groups.next_agent_call, vicidial_xfer_log.user from vicidial_email_list, vicidial_inbound_groups, vicidial_xfer_log where vicidial_inbound_groups.group_handling='EMAIL' and vicidial_inbound_groups.active='Y' and vicidial_inbound_groups.group_id=vicidial_xfer_log.campaign_id and vicidial_xfer_log.closer='EMAIL_XFER' and vicidial_xfer_log.lead_id=vicidial_email_list.lead_id and vicidial_xfer_log.xfercallid=vicidial_email_list.xfercallid order by queue_priority desc, email_date asc";
|
||||
if ($ARGV[0]=~/debug/i) {print $xfer_stmt."\n";}
|
||||
$xfer_rslt=$dbhB->prepare($xfer_stmt);
|
||||
$xfer_rslt->execute or die "executing: $xfer_stmt ", $dbhB->errstr;
|
||||
@@ -198,6 +199,7 @@ for ($i=0; $i<=1000000; $i++)
|
||||
$row_id_ary[$email_ct]=$xfer_row[0];
|
||||
$lead_id_ary[$email_ct]=$xfer_row[1];
|
||||
$group_id_ary[$email_ct]=$xfer_row[2];
|
||||
$user_id_ary[$email_ct]=$xfer_row[3];
|
||||
$email_type_ary[$email_ct]="XFER";
|
||||
|
||||
$email_ct++;
|
||||
@@ -206,7 +208,7 @@ for ($i=0; $i<=1000000; $i++)
|
||||
$xfer_rslt->finish();
|
||||
|
||||
## CHECK IF THERE ARE ANY REGULAR EMAILS TO ASSIGN
|
||||
$inb_stmt="select email_row_id, lead_id, vicidial_email_list.group_id, vicidial_inbound_groups.next_agent_call from vicidial_email_list, vicidial_inbound_groups where group_handling='EMAIL' and active='Y' and vicidial_inbound_groups.group_id=vicidial_email_list.group_id and vicidial_email_list.status='NEW' order by queue_priority desc, email_date asc";
|
||||
$inb_stmt="select email_row_id, lead_id, vicidial_email_list.group_id, vicidial_inbound_groups.next_agent_call, vicidial_email_list.user from vicidial_email_list, vicidial_inbound_groups where group_handling='EMAIL' and active='Y' and vicidial_inbound_groups.group_id=vicidial_email_list.group_id and vicidial_email_list.status='NEW' order by queue_priority desc, email_date asc";
|
||||
if ($ARGV[0]=~/debug/i) {print $inb_stmt."\n";}
|
||||
$inb_rslt=$dbhB->prepare($inb_stmt);
|
||||
$inb_rslt->execute or die "executing: $inb_stmt ", $dbhB->errstr;
|
||||
@@ -218,6 +220,7 @@ for ($i=0; $i<=1000000; $i++)
|
||||
$row_id_ary[$email_ct]=$inb_row[0];
|
||||
$lead_id_ary[$email_ct]=$inb_row[1];
|
||||
$group_id_ary[$email_ct]=$inb_row[2];
|
||||
$user_id_ary[$email_ct]=$xfer_row[3];
|
||||
$email_type_ary[$email_ct]="INCOMING";
|
||||
|
||||
$email_ct++;
|
||||
@@ -242,6 +245,7 @@ sub AssignAgents()
|
||||
$lead_id=$lead_id_ary[$q];
|
||||
$email_type=$email_type_ary[$q];
|
||||
$group_id=$group_id_ary[$q];
|
||||
$user_id=$user_id_ary[$q];
|
||||
|
||||
$ADUfindSQL='';
|
||||
$user='';
|
||||
@@ -273,20 +277,6 @@ sub AssignAgents()
|
||||
$sthArows=$sthA->rows;
|
||||
if ($ARGV[0]=~/debug/i) {print $stmtA."\n";}
|
||||
|
||||
# if ($CAMP_callorder =~ /grade/)
|
||||
# {
|
||||
# $stmtA = "SELECT vicidial_live_agents.user,vicidial_live_inbound_agents.group_grade,vicidial_live_agents.campaign_grade from vicidial_live_agents, vicidial_live_inbound_agents WHERE vicidial_live_agents.user=vicidial_live_inbound_agents.user and status IN('CLOSER','READY') and lead_id<1 $ADUfindSQL and vicidial_live_inbound_agents.group_id='$group_id' and last_update_time > '$BDtsSQLdate' and vicidial_live_agents.user NOT IN($ring_no_answer_agents$vlia_users) and ring_callerid='' $qp_groupWAIT_camp_SQL limit 1000;";
|
||||
# $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
# $sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
# $sthArows=$sthA->rows;
|
||||
# }
|
||||
# else
|
||||
# {
|
||||
# $stmtA = "SELECT vicidial_live_agents.conf_exten,vicidial_live_agents.user,vicidial_live_agents.extension,vicidial_live_agents.server_ip,vicidial_live_inbound_agents.group_weight,ra_user,vicidial_live_agents.campaign_id,on_hook_agent,on_hook_ring_time,vicidial_live_inbound_agents.group_grade,vicidial_live_agents.campaign_grade from vicidial_live_agents, vicidial_live_inbound_agents WHERE vicidial_live_agents.user=vicidial_live_inbound_agents.user and status IN('CLOSER','READY') and lead_id<1 $ADUfindSQL and vicidial_live_inbound_agents.group_id='$group_id' and last_update_time > '$BDtsSQLdate' and vicidial_live_agents.user NOT IN($ring_no_answer_agents$vlia_users) and ring_callerid='' $qp_groupWAIT_camp_SQL $agent_call_order limit 1;";
|
||||
# $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
# $sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
# $sthArows=$sthA->rows;
|
||||
# }
|
||||
|
||||
if ($sthArows>0)
|
||||
{
|
||||
@@ -299,16 +289,30 @@ sub AssignAgents()
|
||||
|
||||
if ($user ne "")
|
||||
{
|
||||
$upd_stmt="update vicidial_email_list set status='QUEUE', user='$user' where email_row_id='$email_row_id'";
|
||||
# If XFER, cannot go to person who transferred
|
||||
if ($email_type eq "XFER")
|
||||
{
|
||||
$user_clause=" and user!='$user'";
|
||||
}
|
||||
else
|
||||
{
|
||||
$user_clause="";
|
||||
}
|
||||
|
||||
$upd_stmt="update vicidial_email_list set status='QUEUE', user='$user' where email_row_id='$email_row_id' $user_clause";
|
||||
$upd_rslt=$dbhB->prepare($upd_stmt);
|
||||
$upd_rslt->execute or die "executing: $upd_stmt ", $dbhB->errstr;
|
||||
$upd_rslt->finish();
|
||||
if ($ARGV[0]=~/debug/i) {print $upd_stmt."\n";}
|
||||
$upd_stmt="update vicidial_live_agents set status='MQUEUE' where user='$user'";
|
||||
$upd_rslt=$dbhA->prepare($upd_stmt);
|
||||
$upd_rslt->execute or die "executing: $upd_stmt ", $dbhB->errstr;
|
||||
|
||||
if ($upd_rslt->rows>0)
|
||||
{
|
||||
$upd_rslt->finish();
|
||||
$upd_stmt="update vicidial_live_agents set status='MQUEUE' where user='$user'";
|
||||
$upd_rslt=$dbhA->prepare($upd_stmt);
|
||||
$upd_rslt->execute or die "executing: $upd_stmt ", $dbhB->errstr;
|
||||
if ($ARGV[0]=~/debug/i) {print $upd_stmt."\n";}
|
||||
}
|
||||
$upd_rslt->finish();
|
||||
if ($ARGV[0]=~/debug/i) {print $upd_stmt."\n";}
|
||||
}
|
||||
|
||||
$stmtA = "UNLOCK TABLES;";
|
||||
@@ -337,16 +341,30 @@ sub AssignAgents()
|
||||
|
||||
if ($user ne "")
|
||||
{
|
||||
$upd_stmt="update vicidial_email_list set status='QUEUE', user='$user' where email_row_id='$email_row_id'";
|
||||
# If XFER, cannot go to person who transferred
|
||||
if ($email_type eq "XFER")
|
||||
{
|
||||
$user_clause=" and user!='$user'";
|
||||
}
|
||||
else
|
||||
{
|
||||
$user_clause="";
|
||||
}
|
||||
|
||||
$upd_stmt="update vicidial_email_list set status='QUEUE', user='$user' where email_row_id='$email_row_id' $user_clause";
|
||||
$upd_rslt=$dbhB->prepare($upd_stmt);
|
||||
$upd_rslt->execute or die "executing: $upd_stmt ", $dbhB->errstr;
|
||||
$upd_rslt->finish();
|
||||
if ($ARGV[0]=~/debug/i) {print $upd_stmt."\n";}
|
||||
$upd_stmt="update vicidial_live_agents set status='MQUEUE' where user='$user'";
|
||||
$upd_rslt=$dbhA->prepare($upd_stmt);
|
||||
$upd_rslt->execute or die "executing: $upd_stmt ", $dbhB->errstr;
|
||||
|
||||
if ($upd_rslt->rows>0)
|
||||
{
|
||||
$upd_rslt->finish();
|
||||
$upd_stmt="update vicidial_live_agents set status='MQUEUE' where user='$user'";
|
||||
$upd_rslt=$dbhA->prepare($upd_stmt);
|
||||
$upd_rslt->execute or die "executing: $upd_stmt ", $dbhB->errstr;
|
||||
if ($ARGV[0]=~/debug/i) {print $upd_stmt."\n";}
|
||||
}
|
||||
$upd_rslt->finish();
|
||||
if ($ARGV[0]=~/debug/i) {print $upd_stmt."\n";}
|
||||
}
|
||||
|
||||
$stmtA = "UNLOCK TABLES;";
|
||||
|
||||
@@ -79,6 +79,7 @@
|
||||
# 170526-2228 - Added additional variable filtering
|
||||
# 170709-1017 - Added xfer dead call checking process
|
||||
# 170817-0739 - Small change to xfer dead call checking process
|
||||
# 180602-0149 - Changed SQL query for email queue count for accuracy
|
||||
#
|
||||
|
||||
$version = '2.14-54';
|
||||
@@ -440,7 +441,8 @@ if ($ACTION == 'refresh')
|
||||
}
|
||||
else
|
||||
{
|
||||
$email_stmt="select count(*) from vicidial_email_list, vicidial_xfer_log where vicidial_email_list.status='QUEUE' and vicidial_email_list.user='$user' and vicidial_xfer_log.xfercallid=vicidial_email_list.xfercallid and direction='INBOUND' and vicidial_xfer_log.campaign_id in ('$AccampSQL') and closer='EMAIL_XFER'";
|
||||
# $email_stmt="select count(*) from vicidial_email_list, vicidial_xfer_log where vicidial_email_list.status='QUEUE' and vicidial_email_list.user='$user' and vicidial_xfer_log.xfercallid=vicidial_email_list.xfercallid and direction='INBOUND' and vicidial_xfer_log.campaign_id in ('$AccampSQL') and closer='EMAIL_XFER'";
|
||||
$email_stmt="select count(*) from vicidial_email_list, vicidial_xfer_log where vicidial_email_list.user!='$user' and vicidial_xfer_log.xfercallid=vicidial_email_list.xfercallid and direction='INBOUND' and vicidial_xfer_log.campaign_id in ('$AccampSQL') and closer='EMAIL_XFER'";
|
||||
$email_rslt=mysql_to_mysqli($email_stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$email_stmt,'03042',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$email_row=mysqli_fetch_row($email_rslt);
|
||||
|
||||
@@ -596,6 +596,7 @@
|
||||
# 180506-2222 - Added SWITCH custom field type
|
||||
# 180512-2226 - Added support for users-max_hopper_calls feature
|
||||
# 180522-1921 - Added Routing Initiated Recording ability for manual dial calls
|
||||
# 180606-0024 - Fixed email transfers bugs, modified transfer-conf panel for same
|
||||
#
|
||||
|
||||
$version = '2.14-566c';
|
||||
@@ -11245,6 +11246,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection)
|
||||
AutoDialWaiting = 0;
|
||||
UpdatESettingSChecK = 1;
|
||||
|
||||
|
||||
var VDIC_data_VDAC=check_VDIC_array[1].split("|");
|
||||
VDIC_web_form_address = VICIDiaL_web_form_address;
|
||||
VDIC_web_form_address_two = VICIDiaL_web_form_address_two;
|
||||
@@ -11368,6 +11370,8 @@ function set_length(SLnumber,SLlength_goal,SLdirection)
|
||||
document.vicidial_form.SecondS.value = 0;
|
||||
document.getElementById("SecondSDISP").innerHTML = '0';
|
||||
|
||||
lastcustchannel = VDIC_data_VDAC[6];
|
||||
|
||||
if (uniqueid_status_display=='ENABLED')
|
||||
{custom_call_id = " Call ID " + VDIC_data_VDAC[1];}
|
||||
if (uniqueid_status_display=='ENABLED_PREFIX')
|
||||
@@ -11660,6 +11664,17 @@ function set_length(SLnumber,SLlength_goal,SLdirection)
|
||||
|
||||
document.getElementById("HangupControl").innerHTML = "<a href=\"#\" onclick=\"dialedcall_send_hangup('','','','','YES');\"><img src=\"./images/<?php echo _QXZ("vdc_LB_hangupcustomer.gif"); ?>\" border=\"0\" alt=\"Hangup Customer\" /></a>";
|
||||
|
||||
// JOEJ - 053018 - PATCH
|
||||
if (lastcustchannel=="EMAIL")
|
||||
{
|
||||
document.getElementById("XferControl").innerHTML = "<a href=\"#\" onclick=\"ShoWTransferMain('ON','','YES');\"><img src=\"./images/<?php echo _QXZ("vdc_LB_transferconf.gif"); ?>\" border=\"0\" alt=\"Transfer - Conference\" /></a>";
|
||||
document.getElementById("DialBlindTransfer").innerHTML = "<a href=\"#\" onclick=\"mainxfer_send_redirect('XfeRBLIND','" + lastcustchannel + "','" + lastcustserverip + "','','','','YES');return false;\"><img src=\"./images/<?php echo _QXZ("vdc_XB_blindtransfer.gif"); ?>\" border=\"0\" alt=\"Dial Blind Transfer\" style=\"vertical-align:middle\" /></a>";
|
||||
|
||||
document.getElementById("HangupBothLines").innerHTML ="<img src=\"./images/<?php echo _QXZ("vdc_XB_hangupbothlines_OFF.gif"); ?>\" border=\"0\" alt=\"Hangup Both Lines\" style=\"vertical-align:middle\" />";
|
||||
// document.getElementById("Leave3WayCall").innerHTML ="<img src=\"./images/<?php echo _QXZ("vdc_XB_leave3waycall_OFF.gif"); ?>\" border=\"0\" alt=\"LEAVE 3-WAY CALL\" />";
|
||||
document.getElementById("DialWithCustomer").innerHTML ="<img src=\"./images/<?php echo _QXZ("vdc_XB_dialwithcustomer_OFF.gif") ?>\" border=\"0\" alt=\"Dial With Customer\" style=\"vertical-align:middle\" /></a>";
|
||||
document.getElementById("ParkCustomerDial").innerHTML ="<img src=\"./images/<?php echo _QXZ("vdc_XB_parkcustomerdial_OFF.gif") ?>\" border=\"0\" alt=\"Park Customer Dial\" style=\"vertical-align:middle\" /></a>";
|
||||
}
|
||||
/*
|
||||
document.getElementById("ParkControl").innerHTML ="<a href=\"#\" onclick=\"mainxfer_send_redirect('ParK','" + lastcustchannel + "','" + lastcustserverip + "','','','','YES');return false;\"><img src=\"./images/<?php echo _QXZ("vdc_LB_parkcall.gif"); ?>\" border=\"0\" alt=\"Park Call\" /></a>";
|
||||
if ( (ivr_park_call=='ENABLED') || (ivr_park_call=='ENABLED_PARK_ONLY') )
|
||||
@@ -11671,7 +11686,6 @@ function set_length(SLnumber,SLlength_goal,SLdirection)
|
||||
|
||||
document.getElementById("LocalCloser").innerHTML = "<a href=\"#\" onclick=\"mainxfer_send_redirect('XfeRLOCAL','" + lastcustchannel + "','" + lastcustserverip + "','','','','YES');return false;\"><img src=\"./images/<?php echo _QXZ("vdc_XB_localcloser.gif"); ?>\" border=\"0\" alt=\"LOCAL CLOSER\" style=\"vertical-align:middle\" /></a>";
|
||||
|
||||
document.getElementById("DialBlindTransfer").innerHTML = "<a href=\"#\" onclick=\"mainxfer_send_redirect('XfeRBLIND','" + lastcustchannel + "','" + lastcustserverip + "','','','','YES');return false;\"><img src=\"./images/<?php echo _QXZ("vdc_XB_blindtransfer.gif"); ?>\" border=\"0\" alt=\"Dial Blind Transfer\" style=\"vertical-align:middle\" /></a>";
|
||||
|
||||
document.getElementById("DialBlindVMail").innerHTML = "<a href=\"#\" onclick=\"mainxfer_send_redirect('XfeRVMAIL','" + lastcustchannel + "','" + lastcustserverip + "','','','','YES');return false;\"><img src=\"./images/<?php echo _QXZ("vdc_XB_ammessage.gif"); ?>\" border=\"0\" alt=\"Blind Transfer VMail Message\" style=\"vertical-align:middle\" /></a>";
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
# 170615-2245 - Refined DID filtering to calculate call length w/internal transfers
|
||||
# 180109-2005 - Added vendor lead code filtering option
|
||||
# 180422-0923 - Fix for missing header row in translated language, issue #1090
|
||||
# 180610-1634 - Added option to allow --ALL-- as a campaign value
|
||||
#
|
||||
|
||||
$startMS = microtime();
|
||||
@@ -407,6 +408,11 @@ if ($run_export > 0)
|
||||
$campaign_SQL = "campaign_id IN('')";
|
||||
$RUNcampaign=0;
|
||||
}
|
||||
else if ( preg_match('/\-\-ALL\-\-/',$campaign_string) )
|
||||
{
|
||||
$campaign_SQL = "";
|
||||
$RUNcampaign=$campaign_ct;
|
||||
}
|
||||
else
|
||||
{
|
||||
$campaign_SQL = preg_replace('/,$/i', '',$campaign_SQL);
|
||||
@@ -542,7 +548,7 @@ if ($run_export > 0)
|
||||
if ($DB > 0)
|
||||
{
|
||||
echo "<BR>\n";
|
||||
echo "$campaign_ct|$campaign_string|$campaign_SQL\n";
|
||||
echo "***$campaign_ct|$campaign_string|$campaign_SQL\n";
|
||||
echo "<BR>\n";
|
||||
echo "$group_ct|$group_string|$group_SQL\n";
|
||||
echo "<BR>\n";
|
||||
@@ -565,7 +571,7 @@ if ($run_export > 0)
|
||||
{
|
||||
$stmt = "SELECT vl.call_date,vl.phone_number,vi.status,vl.user,vu.full_name,vl.campaign_id,vi.vendor_lead_code,vi.source_id,vi.list_id,vi.gmt_offset_now,vi.phone_code,vi.phone_number,vi.title,vi.first_name,vi.middle_initial,vi.last_name,vi.address1,vi.address2,vi.address3,vi.city,vi.state,vi.province,vi.postal_code,vi.country_code,vi.gender,vi.date_of_birth,vi.alt_phone,vi.email,vi.security_phrase,vi.comments,vl.length_in_sec,vl.user_group,vl.alt_dial,vi.rank,vi.owner,vi.lead_id,vl.uniqueid,vi.entry_list_id,UNIX_TIMESTAMP(vl.call_date)$export_fields_SQL from vicidial_users vu,".$vicidial_log_table." vl,".$vicidial_list_table." vi where ".$date_field." >= '$query_date 00:00:00' and ".$date_field." <= '$end_date 23:59:59' and vu.user=vl.user and vi.lead_id=vl.lead_id $list_SQL $campaign_SQL $user_group_SQL $status_SQL $vlc_SQL order by ".$date_field." desc limit 500000;";
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
if ($DB) {echo "****$stmt****\n";}
|
||||
$outbound_to_print = mysqli_num_rows($rslt);
|
||||
if ( ($outbound_to_print < 1) and ($RUNgroup < 1) )
|
||||
{
|
||||
@@ -1203,6 +1209,9 @@ else
|
||||
$LISTcampaigns[$i]='---NONE---';
|
||||
$i++;
|
||||
$campaigns_to_print++;
|
||||
$LISTcampaigns[$i]='---ALL---';
|
||||
$i++;
|
||||
$campaigns_to_print++;
|
||||
while ($i < $campaigns_to_print)
|
||||
{
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
|
||||
Reference in New Issue
Block a user