diff --git a/bin/AST_VDhopper.pl b/bin/AST_VDhopper.pl index 903bd1eb..897e64ed 100644 --- a/bin/AST_VDhopper.pl +++ b/bin/AST_VDhopper.pl @@ -52,6 +52,7 @@ # 80909-1901 - Added support for campaign-specific DNC lists # 90430-0117 - Added last call time and random sorting options # 90430-1022 - Changed this script to allow for List Mix ability +# 90601-2111 - Added allow_inactive_list_leads to allow for inactive lists while in List Mix mode # # constants @@ -120,6 +121,7 @@ $VDL_one = "$Vyear-$Vmon-$Vmday $Vhour:$Vmin:$Vsec"; if (length($ARGV[0])>1) { $i=0; + $allow_inactive_list_leads=0; while ($#ARGV >= $i) { $args = "$args $ARGV[$i]"; @@ -128,7 +130,16 @@ if (length($ARGV[0])>1) if ($args =~ /--help/i) { - print "allowed run time options(must stay in this order):\n [--debug] = debug\n [--debugX] = super debug\n [--dbgmt] = show GMT offset of records as they are inserted into hopper\n [--dbdetail] = additional level of logging the leads that are inserted into the hopper\n [-t] = test\n [--level=XXX] = force a hopper_level of XXX\n [--campaign=XXX] = run for campaign XXX only\n\n"; + print "allowed run time options(must stay in this order):\n"; + print " [--debug] = debug\n"; + print " [--debugX] = super debug\n"; + print " [--dbgmt] = show GMT offset of records as they are inserted into hopper\n"; + print " [--dbdetail] = additional level of logging the leads that are inserted into the hopper\n"; + print " [--allow-inactive-list-leads] = do not delete inactive list leads\n"; + print " [-t] = test\n"; + print " [--level=XXX] = force a hopper_level of XXX\n"; + print " [--campaign=XXX] = run for campaign XXX only\n"; + print "\n"; exit; } else @@ -170,6 +181,11 @@ if (length($ARGV[0])>1) if ($args =~ /--dbdetail/i) { $DB_detail=1; +# print "\n-----DEBUG DETAIL -----\n\n"; + } + if ($args =~ /--allow-inactive-list-leads/i) + { + $allow_inactive_list_leads=1; # print "\n-----DEBUG DETAIL -----\n\n"; } if ($args =~ /-t/i) @@ -304,11 +320,14 @@ if ($DB) {print "Inactive Lists: $inactive_lists_count\n";} if ($inactive_lists_count > 0) { chop($inactive_lists); - $stmtA = "DELETE from $vicidial_hopper where list_id IN($inactive_lists);"; - $affected_rows = $dbhA->do($stmtA); - if ($DB) {print "Inactive List Leads Deleted: $affected_rows |$stmtA|\n";} - $event_string = "|INACTIVE LIST DEL|$affected_rows|"; - &event_logger; + if ($allow_inactive_list_leads < 1) + { + $stmtA = "DELETE from $vicidial_hopper where list_id IN($inactive_lists);"; + $affected_rows = $dbhA->do($stmtA); + if ($DB) {print "Inactive List Leads Deleted: $affected_rows |$stmtA|\n";} + $event_string = "|INACTIVE LIST DEL|$affected_rows|"; + &event_logger; + } } ### BEGIN Change CBHOLD status leads to CALLBK if their vicidial_callbacks time has passed @@ -1099,8 +1118,12 @@ foreach(@campaign_id) { if ($DB) {print " hopper too low ($hopper_ready_count|$hopper_level[$i]) starting hopper dump\n";} + $active_listSQL = "and active='Y'"; + if ( ($list_order_mix[$i] !~ /DISABLED/) && ($allow_inactive_list_leads > 0) ) + {$active_listSQL = '';} + ### Get list of the lists in the campaign ### - $stmtA = "SELECT list_id FROM vicidial_lists where campaign_id='$campaign_id[$i]' and active='Y';"; + $stmtA = "SELECT list_id FROM vicidial_lists where campaign_id='$campaign_id[$i]' $active_listSQL;"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; $sthArows=$sthA->rows; @@ -1480,7 +1503,7 @@ foreach(@campaign_id) if ($DBX) {print " LM $x |$list_mix_stepARY[0]|$list_mix_stepARY[2]|$LM_step_goal[$x]|$list_mix_stepARY[3]|\n";} $list_mix_dialableSQL = "(list_id='$list_mix_stepARY[0]' and status IN($list_mix_stepARY[3]))"; - $stmtA = "SELECT lead_id,list_id,gmt_offset_now,phone_number,state,status FROM vicidial_list where called_since_last_reset='N' and $list_mix_dialableSQL and lead_id NOT IN($lead_id_lists) and ($all_gmtSQL[$i]) $lead_filter_sql[$i] $order_stmt limit $LM_step_goal[$x];"; + $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 $list_mix_dialableSQL and lead_id NOT IN($lead_id_lists) and ($all_gmtSQL[$i]) $lead_filter_sql[$i] $order_stmt limit $LM_step_goal[$x];"; if ($DBX) {print " |$stmtA|\n";} $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; @@ -1503,7 +1526,7 @@ foreach(@campaign_id) $order = ( ($x * 1000000) + $rec_count); } } - $LM_results[$z] = "$order$USX$aryA[0]$USX$aryA[1]$USX$aryA[2]$USX$aryA[3]$USX$aryA[4]$USX$aryA[5]"; + $LM_results[$z] = "$order$USX$aryA[0]$USX$aryA[1]$USX$aryA[2]$USX$aryA[3]$USX$aryA[4]$USX$aryA[5]$USX$aryA[6]$USX$aryA[7]"; # if ($DBX) {print " $z|$LM_results[$z]\n";} $rec_count++; @@ -1536,11 +1559,11 @@ foreach(@campaign_id) $leads_to_hopper[$rec_countLEADS] = "$aryA[1]"; $lists_to_hopper[$rec_countLEADS] = "$aryA[2]"; $gmt_to_hopper[$rec_countLEADS] = "$aryA[3]"; - $state_to_hopper[$rec_countLEADS] = "$aryA[4]"; - $phone_to_hopper[$rec_countLEADS] = "$aryA[5]"; + $phone_to_hopper[$rec_countLEADS] = "$aryA[4]"; + $state_to_hopper[$rec_countLEADS] = "$aryA[5]"; $status_to_hopper[$rec_countLEADS] = "$aryA[6]"; - $modify_to_hopper[$rec_countLEADS] = "$aryA[6]"; - $user_to_hopper[$rec_countLEADS] = "$aryA[7]"; + $modify_to_hopper[$rec_countLEADS] = "$aryA[7]"; + $user_to_hopper[$rec_countLEADS] = "$aryA[8]"; if ($DB_show_offset) {print "LEAD_ADD: $aryA[3] $aryA[4] $aryA[5]\n";} if ($DBX) {print " $w|$LM_results[$w]\n";} $rec_countLEADS++; diff --git a/www/vicidial/AST_timeonVDADall.php b/www/vicidial/AST_timeonVDADall.php index f0066dc4..79d7a98e 100644 --- a/www/vicidial/AST_timeonVDADall.php +++ b/www/vicidial/AST_timeonVDADall.php @@ -49,10 +49,11 @@ # 90508-0623 - Changed to PHP long tags # 90518-0930 - Fixed $CALLSdisplay static assignment bug for some links(bug #210) # 90524-2231 - Changed to use functions.php for seconds to HH:MM:SS conversion +# 90602-0405 - Added list mix display in statuses and order if active # -$version = '2.0.5-40'; -$build = '90524-2231'; +$version = '2.0.5-41'; +$build = '90602-0405'; header ("Content-type: text/html; charset=utf-8"); @@ -787,7 +788,7 @@ else if (eregi('ALL-ACTIVE',$group_string)) { $multi_drop++; - $stmt="select avg(auto_dial_level),min(dial_status_a),min(dial_status_b),min(dial_status_c),min(dial_status_d),min(dial_status_e),min(lead_order),min(lead_filter_id),sum(hopper_level),min(dial_method),avg(adaptive_maximum_level),avg(adaptive_dropped_percentage),avg(adaptive_dl_diff_target),avg(adaptive_intensity),min(available_only_ratio_tally),min(adaptive_latest_server_time),min(local_call_time),avg(dial_timeout),min(dial_statuses),max(agent_pause_codes_active) from vicidial_campaigns;"; + $stmt="select avg(auto_dial_level),min(dial_status_a),min(dial_status_b),min(dial_status_c),min(dial_status_d),min(dial_status_e),min(lead_order),min(lead_filter_id),sum(hopper_level),min(dial_method),avg(adaptive_maximum_level),avg(adaptive_dropped_percentage),avg(adaptive_dl_diff_target),avg(adaptive_intensity),min(available_only_ratio_tally),min(adaptive_latest_server_time),min(local_call_time),avg(dial_timeout),min(dial_statuses),max(agent_pause_codes_active),max(list_order_mix) from vicidial_campaigns;"; $stmtB="select sum(dialable_leads),sum(calls_today),sum(drops_today),avg(drops_answers_today_pct),avg(differential_onemin),avg(agents_average_onemin),sum(balance_trunk_fill),sum(answers_today),max(status_category_1),sum(status_category_count_1),max(status_category_2),sum(status_category_count_2),max(status_category_3),sum(status_category_count_3),max(status_category_4),sum(status_category_count_4) from vicidial_campaign_stats;"; } @@ -815,13 +816,13 @@ else $closer_campaignsSQL = preg_replace("/,$/","",$closer_campaignsSQL); if ($DB > 0) {echo "\n|$closer_campaigns|$closer_campaignsSQL|$stmt|\n";} - $stmt="select auto_dial_level,dial_status_a,dial_status_b,dial_status_c,dial_status_d,dial_status_e,lead_order,lead_filter_id,hopper_level,dial_method,adaptive_maximum_level,adaptive_dropped_percentage,adaptive_dl_diff_target,adaptive_intensity,available_only_ratio_tally,adaptive_latest_server_time,local_call_time,dial_timeout,dial_statuses,agent_pause_codes_active from vicidial_campaigns where campaign_id IN ($group_SQL,$closer_campaignsSQL);"; + $stmt="select auto_dial_level,dial_status_a,dial_status_b,dial_status_c,dial_status_d,dial_status_e,lead_order,lead_filter_id,hopper_level,dial_method,adaptive_maximum_level,adaptive_dropped_percentage,adaptive_dl_diff_target,adaptive_intensity,available_only_ratio_tally,adaptive_latest_server_time,local_call_time,dial_timeout,dial_statuses,agent_pause_codes_active,list_order_mix from vicidial_campaigns where campaign_id IN ($group_SQL,$closer_campaignsSQL);"; $stmtB="select sum(dialable_leads),sum(calls_today),sum(drops_today),avg(drops_answers_today_pct),avg(differential_onemin),avg(agents_average_onemin),sum(balance_trunk_fill),sum(answers_today),max(status_category_1),sum(status_category_count_1),max(status_category_2),sum(status_category_count_2),max(status_category_3),sum(status_category_count_3),max(status_category_4),sum(status_category_count_4) from vicidial_campaign_stats where campaign_id IN ($group_SQL,$closer_campaignsSQL);"; } else { - $stmt="select avg(auto_dial_level),max(dial_status_a),max(dial_status_b),max(dial_status_c),max(dial_status_d),max(dial_status_e),max(lead_order),max(lead_filter_id),max(hopper_level),max(dial_method),max(adaptive_maximum_level),avg(adaptive_dropped_percentage),avg(adaptive_dl_diff_target),avg(adaptive_intensity),max(available_only_ratio_tally),max(adaptive_latest_server_time),max(local_call_time),max(dial_timeout),max(dial_statuses),max(agent_pause_codes_active) from vicidial_campaigns where campaign_id IN($group_SQL);"; + $stmt="select avg(auto_dial_level),max(dial_status_a),max(dial_status_b),max(dial_status_c),max(dial_status_d),max(dial_status_e),max(lead_order),max(lead_filter_id),max(hopper_level),max(dial_method),max(adaptive_maximum_level),avg(adaptive_dropped_percentage),avg(adaptive_dl_diff_target),avg(adaptive_intensity),max(available_only_ratio_tally),max(adaptive_latest_server_time),max(local_call_time),max(dial_timeout),max(dial_statuses),max(agent_pause_codes_active),max(list_order_mix) from vicidial_campaigns where campaign_id IN($group_SQL);"; $stmtB="select sum(dialable_leads),sum(calls_today),sum(drops_today),avg(drops_answers_today_pct),avg(differential_onemin),avg(agents_average_onemin),sum(balance_trunk_fill),sum(answers_today),max(status_category_1),sum(status_category_count_1),max(status_category_2),sum(status_category_count_2),max(status_category_3),sum(status_category_count_3),max(status_category_4),sum(status_category_count_4) from vicidial_campaign_stats where campaign_id IN($group_SQL);"; } @@ -849,9 +850,8 @@ else $CALLtime = $row[16]; $DIALtimeout = $row[17]; $DIALstatuses = $row[18]; - $DIALstatuses = (preg_replace("/ -$|^ /","",$DIALstatuses)); - $DIALstatuses = (ereg_replace(' ',', ',$DIALstatuses)); $agent_pause_codes_active = $row[19]; + $DIALmix = $row[20]; $stmt="select count(*) from vicidial_hopper where campaign_id IN($group_SQL);"; @@ -909,6 +909,24 @@ else $row=mysql_fetch_row($rslt); $balanceSHORT = $row[0]; + if (ereg('DISABLED',$DIALmix)) + { + $DIALstatuses = (preg_replace("/ -$|^ /","",$DIALstatuses)); + $DIALstatuses = (ereg_replace(' ',', ',$DIALstatuses)); + } + else + { + $stmt="select vcl_id from vicidial_campaigns_list_mix where campaign_id IN($group_SQL) and status='ACTIVE' limit 1;"; + $rslt=mysql_query($stmt, $link); + $Lmix_to_print = mysql_num_rows($rslt); + if ($Lmix_to_print > 0) + { + $row=mysql_fetch_row($rslt); + $DIALstatuses = "List Mix: $row[0]"; + $DIALorder = "List Mix: $row[0]"; + } + } + echo "
"; echo ""; echo "";
DIAL LEVEL:  $DIALlev    TRUNK SHORT/FILL:  $balanceSHORT / $balanceFILL