2006-04-14_snapshot

git-svn-id: svn://192.168.202.10@3 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2006-07-07 15:08:33 +00:00
parent de5419f81a
commit 78a38cbe58
18 changed files with 1259 additions and 299 deletions
+102 -12
View File
@@ -13,7 +13,7 @@
### - $pass
### optional variables:
### - $format - ('text','debug')
### - $ACTION - ('regCLOSER','manDiaLnextCALL','manDiaLskip','manDiaLonly','manDiaLlookCALL','manDiaLlogCALL','userLOGout','updateDISPO','VDADpause','VDADready','VDADcheckINCOMING','UpdatEFavoritEs')
### - $ACTION - ('regCLOSER','manDiaLnextCALL','manDiaLskip','manDiaLonly','manDiaLlookCALL','manDiaLlogCALL','userLOGout','updateDISPO','VDADpause','VDADready','VDADcheckINCOMING','UpdatEFavoritEs','CalLBacKLisT','CalLBacKCounT')
### - $stage - ('start','finish')
### - $closer_choice - ('CL_TESTCAMP_L CL_OUT123_L -')
### - $conf_exten - ('8600011',...)
@@ -92,10 +92,13 @@
# 60208-1617 Added dtmf buttons output per call
# 60213-1521 Added closer_campaigns update to vicidial_users
# 60215-1036 Added Callback date-time entry into vicidial_callbacks table
# 60413-1541 Added USERONLY Callback listings output - CalLBacKLisT
# Added USERONLY Callback count output - CalLBacKCounT
# 60414-1140 Added Callback lead lookup for manual dialing
#
$version = '0.0.26';
$build = '60215-1036';
$version = '0.0.28';
$build = '60414-1140';
require("dbconnect.php");
@@ -161,6 +164,7 @@ $agent_log=$_GET["agent_log"]; if (!$agent_log) {$agent_log=$_POST["agent_log"
$favorites_list=$_GET["favorites_list"]; if (!$favorites_list) {$favorites_list=$_POST["favorites_list"];}
$CallBackDatETimE=$_GET["CallBackDatETimE"]; if (!$CallBackDatETimE) {$CallBackDatETimE=$_POST["CallBackDatETimE"];}
$recipient=$_GET["recipient"]; if (!$recipient) {$recipient=$_POST["recipient"];}
$callback_id=$_GET["callback_id"]; if (!$callback_id) {$callback_id=$_POST["callback_id"];}
# default optional vars if not set
@@ -172,6 +176,7 @@ $StarTtime = date("U");
$NOW_DATE = date("Y-m-d");
$NOW_TIME = date("Y-m-d H:i:s");
$CIDdate = date("mdHis");
$ENTRYdate = date("YmdHis");
if (!$query_date) {$query_date = $NOW_DATE;}
$MT[0]='';
@@ -287,14 +292,42 @@ if ($ACTION == 'manDiaLnextCaLL')
}
else
{
### grab the next lead in the hopper for this campaign and reserve it for the user
$stmt = "UPDATE vicidial_hopper set status='QUEUE', user='$user' where campaign_id='$campaign' and status='READY' order by hopper_id LIMIT 1";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
$affected_rows = mysql_affected_rows($link);
### check if this is a callback, if it is, skip the grabbing of a new lead and mark the callback as INACTIVE
if ( (strlen($callback_id)>0) && (strlen($lead_id)>0) )
{
$affected_rows=1;
$CBleadIDset=1;
$stmt = "UPDATE vicidial_callbacks set status='INACTIVE' where callback_id='$callback_id';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
}
else
{
if (strlen($phone_number)>3)
{
### grab the next lead in the hopper for this campaign and reserve it for the user
$stmt = "INSERT INTO vicidial_list SET phone_code='$phone_code',phone_number='$phone_number',list_id='$list_id',status='QUEUE',user='$user',called_since_last_reset='Y',entry_date='$ENTRYdate';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
$affected_rows = mysql_affected_rows($link);
$lead_id = mysql_insert_id();
$CBleadIDset=1;
}
else
{
### grab the next lead in the hopper for this campaign and reserve it for the user
$stmt = "UPDATE vicidial_hopper set status='QUEUE', user='$user' where campaign_id='$campaign' and status='READY' order by hopper_id LIMIT 1";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
$affected_rows = mysql_affected_rows($link);
}
}
if ($affected_rows > 0)
{
if (!$CBleadIDset)
{
##### grab the lead_id of the reserved user in vicidial_hopper
$stmt="SELECT lead_id FROM vicidial_hopper where campaign_id='$campaign' and status='QUEUE' and user='$user' LIMIT 1;";
$rslt=mysql_query($stmt, $link);
@@ -305,6 +338,7 @@ if ($ACTION == 'manDiaLnextCaLL')
$row=mysql_fetch_row($rslt);
$lead_id =$row[0];
}
}
##### grab the data from vicidial_list for the lead_id
$stmt="SELECT * FROM vicidial_list where lead_id='$lead_id' LIMIT 1;";
@@ -350,10 +384,13 @@ if ($ACTION == 'manDiaLnextCaLL')
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
### delete the lead from the hopper
$stmt = "DELETE FROM vicidial_hopper where lead_id='$lead_id';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
if (!$CBleadIDset)
{
### delete the lead from the hopper
$stmt = "DELETE FROM vicidial_hopper where lead_id='$lead_id';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
}
$stmt="UPDATE vicidial_agent_log set lead_id='$lead_id' where agent_log_id='$agent_log_id';";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
@@ -1274,6 +1311,59 @@ if ($ACTION == 'UpdatEFavoritEs')
}
################################################################################
### CalLBacKLisT - List the USERONLY callbacks for an agent
################################################################################
if ($ACTION == 'CalLBacKLisT')
{
$stmt = "select callback_id,lead_id,campaign_id,status,entry_time,callback_time,comments from vicidial_callbacks where recipient='USERONLY' and user='$user' and status NOT IN('INACTIVE','DEAD') order by callback_time;";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
if ($rslt) {$callbacks_count = mysql_num_rows($rslt);}
echo "$callbacks_count\n";
$loop_count=0;
while ($callbacks_count>$loop_count)
{
$row=mysql_fetch_row($rslt);
$callback_id[$loop_count] = $row[0];
$lead_id[$loop_count] = $row[1];
$campaign_id[$loop_count] = $row[2];
$status[$loop_count] = $row[3];
$entry_time[$loop_count] = $row[4];
$callback_time[$loop_count] = $row[5];
$comments[$loop_count] = $row[6];
$loop_count++;
}
$loop_count=0;
while ($callbacks_count>$loop_count)
{
$stmt = "select first_name,last_name,phone_number from vicidial_list where lead_id='$lead_id[$loop_count]';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
echo "$row[0] ~$row[1] ~$row[2] ~$callback_id[$loop_count] ~$lead_id[$loop_count] ~$campaign_id[$loop_count] ~$status[$loop_count] ~$entry_time[$loop_count] ~$callback_time[$loop_count] ~$comments[$loop_count]\n";
$loop_count++;
}
}
################################################################################
### CalLBacKCounT - send the count of the USERONLY callbacks for an agent
################################################################################
if ($ACTION == 'CalLBacKCounT')
{
$stmt = "select count(*) from vicidial_callbacks where recipient='USERONLY' and user='$user' and status NOT IN('INACTIVE','DEAD');";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$cbcount=$row[0];
echo "$cbcount";
}
if ($format=='debug')