Fixed small hopper bugs

git-svn-id: svn://192.168.202.10@1220 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2009-09-08 01:47:41 +00:00
parent c4a62821b9
commit 0211ef7f6d
5 changed files with 32 additions and 20 deletions
@@ -1258,7 +1258,7 @@ foreach(@campaign_id)
{
if ($DB) {print " looking for RECYCLE leads, maximum of $hopper_level[$i]\n";}
$stmtA = "SELECT lead_id,list_id,gmt_offset_now,phone_number,state,status,modify_date,user FROM vicidial_list where $recycle_SQL[$i] and list_id IN($camp_lists[$i]) and lead_id NOT IN($lead_id_lists) and ($all_gmtSQL[$i]) $lead_filter_sql[$i] limit $hopper_level[$i];";
$stmtA = "SELECT lead_id,list_id,gmt_offset_now,phone_number,state,status,modify_date,user FROM vicidial_list where $recycle_SQL[$i] and list_id IN($camp_lists[$i]) and lead_id NOT IN($lead_id_lists) and ($all_gmtSQL[$i]) $lead_filter_sql[$i] $order_stmt limit $hopper_level[$i];";
if ($DBX) {print " |$stmtA|\n";}
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
@@ -1306,7 +1306,7 @@ foreach(@campaign_id)
{
if ($DB) {print " looking for RECYCLE leads, maximum of $hopper_level[$i]\n";}
$stmtA = "SELECT lead_id,list_id,gmt_offset_now,phone_number,state,status FROM vicidial_list where $recycle_SQL[$i] and list_id IN($camp_lists[$i]) and lead_id NOT IN($lead_id_lists) and ($all_gmtSQL[$i]) $lead_filter_sql[$i] limit $hopper_level[$i];";
$stmtA = "SELECT lead_id,list_id,gmt_offset_now,phone_number,state,status FROM vicidial_list where $recycle_SQL[$i] and list_id IN($camp_lists[$i]) and lead_id NOT IN($lead_id_lists) and ($all_gmtSQL[$i]) $lead_filter_sql[$i] $order_stmt limit $hopper_level[$i];";
if ($DBX) {print " |$stmtA|\n";}
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
+1 -1
View File
@@ -16,7 +16,7 @@ Current integration features:
There has been a basic vtiger integration option available in VICIDIAL since the 1.X release versions through the vtiger_search.php web script(when used as a web form in the campaign) that will search through the leads for the dialed phone number in vicidial.php and if it is not in the vtiger system as a lead then it will be put in as a new lead.
More in-depth integration with Vtiger is a bit complicated due to the fact that it has 312 database tables(and you though VICIDIAL had a lot with about 70). Attempts at using the built-in 5.0.4 API structure were unsuccessful because of inaccurate documentation and the inability to use the modules easily outside of the vtiger directory tree without major reworking of the vtiger code, so we decided to have VICIDIAL work directly with the database instead. Unfortunately, working only with the database doesn't get you the whole way with Vtiger. For user synchronization you need to make sure that the patch(Vtiger504_vicidial.patch) is applied to Vtiger(see instructions below). This patch is used to create blank user profile files so Vtiger will load properly with synchronized users from VICIDIAL. Vtiger doesn't check to see if these user profile files exist before trying to use them, so one thing this patch does is check if the files exist for each user, and if they do not, it will create them with a simple placeholder. Another purpose of this patch is to allow for click-to-dial phone numbers in Vtiger, so that the numbers will be dialed as manual dial calls in a VICIDIAL agent screen. For this to work you must have applied the patch, you need to have user 1000 set up in VICIDIAL with a password of 1234 and Agent API set to '1', and the agent needs to be logged into vicidial.php(there is also a VICIDIAL Campaign Detail option to automatically login to Vtiger when an agent logs into vicidial.php) then when the agent clicks on any phone number with a "VCcall:" lable bext to it, a call will be placed in their vicidial.php agent screen and the Vtiger window will be closed so that they can open it up again with the vicidial.php WEB FORM button in VICIDIAL.
More in-depth integration with Vtiger is a bit complicated due to the fact that it has 312 database tables(and you though VICIDIAL had a lot with about 70). Attempts at using the built-in 5.0.4 API structure were unsuccessful because of inaccurate documentation and the inability to use the modules easily outside of the vtiger directory tree without major reworking of the vtiger code, so we decided to have VICIDIAL work directly with the database instead. Unfortunately, working only with the database doesn't get you the whole way with Vtiger. For user synchronization you need to make sure that the patch(Vtiger504_vicidial.patch) is applied to Vtiger(see instructions below). This patch is used to create blank user profile files so Vtiger will load properly with synchronized users from VICIDIAL. Vtiger doesn't check to see if these user profile files exist before trying to use them, so one thing this patch does is check if the files exist for each user, and if they do not, it will create them with a simple placeholder. Another purpose of this patch is to allow for click-to-dial phone numbers in Vtiger, so that the numbers will be dialed as manual dial calls in a VICIDIAL agent screen. For this to work you must have applied the patch, you need to have user 1000 set up in VICIDIAL with a password of 1234 and Agent API set to '1', and the agent needs to be logged into vicidial.php(there is also a VICIDIAL Campaign Detail option to automatically login to Vtiger when an agent logs into vicidial.php) then when the agent clicks on any phone number with a "VCcall:" lable next to it, a call will be placed in their vicidial.php agent screen and the Vtiger window will be closed so that they can open it up again with the vicidial.php WEB FORM button in VICIDIAL.
as of 2008-12-31, several user synchronization features have been added to allow for the creation of vtiger users from the vicidial_users user database. The vtiger_search.php script has also been updated to work with the current vtiger release 5.0.4. To enable the Vtiger integration features you will need to go to the Admin -> System Settings section of the admin.php Administration web page to set Vtiger Integration to enabled and configure the connection details for the Vtiger database.
+3 -3
View File
@@ -58,6 +58,7 @@
# 90723-0842 - Added no hopper dial option to clear hopper leads
# 90809-0347 - Quick fix for null list_id loading when no active campaign lists
# 90904-1612 - Added timezone ordering
# 90907-2132 - Fixed order issues
#
# constants
@@ -1360,7 +1361,7 @@ foreach(@campaign_id)
if ($lead_order[$i] =~ /^UP OWNER/) {$order_stmt = 'order by owner desc, lead_id asc';}
if ($lead_order[$i] =~ /^DOWN OWNER/) {$order_stmt = 'order by owner, lead_id asc';}
if ($lead_order[$i] =~ /^UP TIMEZONE/) {$order_stmt = 'order by gmt_offset_now desc, lead_id asc';}
if ($lead_order[$i] =~ /^DOWN TIMEZONE/) {$order_stmt = 'order gmt_offset_now, lead_id asc';}
if ($lead_order[$i] =~ /^DOWN TIMEZONE/) {$order_stmt = 'order by gmt_offset_now, lead_id asc';}
if ($lead_order[$i] =~ / 2nd NEW$/) {$NEW_count = 2;}
if ($lead_order[$i] =~ / 3rd NEW$/) {$NEW_count = 3;}
if ($lead_order[$i] =~ / 4th NEW$/) {$NEW_count = 4;}
@@ -1381,7 +1382,7 @@ foreach(@campaign_id)
{
if ($DB) {print " looking for RECYCLE leads, maximum of $hopper_level[$i]\n";}
$stmtA = "SELECT lead_id,list_id,gmt_offset_now,phone_number,state,status,modify_date,user FROM vicidial_list where $recycle_SQL[$i] and list_id IN($camp_lists[$i]) and lead_id NOT IN($lead_id_lists) and ($all_gmtSQL[$i]) $lead_filter_sql[$i] $DLTsql[$i] limit $hopper_level[$i];";
$stmtA = "SELECT lead_id,list_id,gmt_offset_now,phone_number,state,status,modify_date,user FROM vicidial_list where $recycle_SQL[$i] and list_id IN($camp_lists[$i]) and lead_id NOT IN($lead_id_lists) and ($all_gmtSQL[$i]) $lead_filter_sql[$i] $DLTsql[$i] $order_stmt limit $hopper_level[$i];";
if ($DBX) {print " |$stmtA|\n";}
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
@@ -1425,7 +1426,6 @@ foreach(@campaign_id)
{
$NEW_level = int($hopper_level[$i] / $NEW_count);
$OTHER_level = ($hopper_level[$i] - $NEW_level);
# $order_stmt = 'order by called_count, lead_id asc';
if ($DB) {print " looking for $NEW_level NEW leads mixed in with $OTHER_level other leads\n";}
$stmtA = "SELECT lead_id,list_id,gmt_offset_now,phone_number,state,status,modify_date,user FROM vicidial_list where called_since_last_reset='N' and status IN('NEW') and list_id IN($camp_lists[$i]) and lead_id NOT IN($lead_id_lists) and ($all_gmtSQL[$i]) $lead_filter_sql[$i] $DLTsql[$i] $order_stmt limit $NEW_level;";
@@ -344,6 +344,12 @@ foreach(@FILES)
#if ($DB)
while (<infile>)
{
$lead_id = '';
$vendor_lead_code = '';
$old_status = '';
$phone_number = '';
$old_list_id = '';
$Uaffected_rows = 0;
@m=@MT;
# print "$a| $number\n";
$number = $_;
@@ -395,11 +401,6 @@ foreach(@FILES)
if ($DBX) {print "$a|$vendor_lead_code|$lead_id|$status|$add_to_dnc\n";}
$lead_id = '';
$vendor_lead_code = '';
$old_status = '';
$phone_number = '';
$old_list_id = '';
$lead_found=0;
$stmtA = "SELECT lead_id,vendor_lead_code,status,phone_number,list_id from vicidial_list where $lookupSQL;";
@@ -408,6 +409,14 @@ foreach(@FILES)
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
$h=0;
if ($sthArows > 0)
{
$lead_id = '';
$vendor_lead_code = '';
$old_status = '';
$phone_number = '';
$old_list_id = '';
}
while ($sthArows > $h)
{
@aryA = $sthA->fetchrow_array;
@@ -415,20 +424,23 @@ foreach(@FILES)
$lead_id .= "$aryA[0],";
$vendor_lead_code .= "$aryA[1],";
$old_status .= "$aryA[2],";
$phone_number = "$aryA[3],";
$old_list_id = "$aryA[4],";
$phone_number .= "$aryA[3],";
$old_list_id .= "$aryA[4],";
$lead_found++;
$h++;
}
$sthA->finish();
chop($lead_idSQL);
chop($lead_id);
chop($vendor_lead_code);
chop($old_status);
chop($phone_number);
chop($old_list_id);
if ($sthArows > 0)
{
chop($lead_idSQL);
chop($lead_id);
chop($vendor_lead_code);
chop($old_status);
chop($phone_number);
chop($old_list_id);
}
if ($lead_found > 0)
{
@@ -463,7 +475,7 @@ foreach(@FILES)
# index (event_date)
# );
$stmtZ = "INSERT INTO vicidial_list_update_log SET event_date='$SQL_date',lead_id='$lead_id',vendor_id='$vendor_lead_code',phone_number='$phone_number',status='$status',old_status='$old_status',filename='$FILEname',result='$result',result_rows='$Uaffected_rows',list_id='$list_id';";
$stmtZ = "INSERT INTO vicidial_list_update_log SET event_date='$SQL_date',lead_id='$lead_id',vendor_id='$vendor_lead_code',phone_number='$phone_number',status='$status',old_status='$old_status',filename='$FILEname',result='$result',result_rows='$Uaffected_rows',list_id='$old_list_id';";
if (!$T) {$affected_rows = $dbhA->do($stmtZ); } # or die "Couldn't execute query: |$stmtZ|\n";
# $alt_phone_id = $dbhA->{'mysql_insertid'};
if($DB){print STDERR "\n|$affected_rows|$stmtZ|\n";}