diff --git a/agc_2-X/trunk/bin/AST_droplist_process.pl b/agc_2-X/trunk/bin/AST_droplist_process.pl index 9df38029..39387cb1 100644 --- a/agc_2-X/trunk/bin/AST_droplist_process.pl +++ b/agc_2-X/trunk/bin/AST_droplist_process.pl @@ -13,6 +13,7 @@ # CHANGES # 170326-1541 - First version # 170330-0934 - populate new lead with field data from dropped lead +# 170410-1331 - Added dl_minutes option # $US = '_'; @@ -213,7 +214,7 @@ if ($DB) {print "SEED TIME $secX : $year-$mon-$mday $hour:$min:$sec LOC ### Grab Server values from the database -$stmtA = "SELECT closer_campaigns,drop_statuses,duplicate_check,list_id from vicidial_drop_lists where dl_id='$dl_id';"; +$stmtA = "SELECT closer_campaigns,drop_statuses,duplicate_check,list_id,dl_minutes from vicidial_drop_lists where dl_id='$dl_id';"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; $sthArows=$sthA->rows; @@ -224,6 +225,7 @@ if ($sthArows > 0) $drop_statuses = $aryA[1]; $duplicate_check = $aryA[2]; $list_id = $aryA[3]; + $dl_minutes = $aryA[4]; $drop_statusesSQL = $drop_statuses; $drop_statusesSQL =~ s/^ |^ | -$//gi; @@ -235,7 +237,23 @@ if ($sthArows > 0) $closer_campaignsSQL =~ s/ /','/gi; $closer_campaignsSQL = "and campaign_id IN('$closer_campaignsSQL')"; - if ($DB) {print "DROP LIST RUN: |$dl_id|$list_id|\n";} + $drop_dateSQL=''; + if ($dl_minutes > 0) + { + $dl_sec = ($dl_minutes * 60); + $BDtarget = ($secX - $dl_sec); + ($Bsec,$Bmin,$Bhour,$Bmday,$Bmon,$Byear,$Bwday,$Byday,$Bisdst) = localtime($BDtarget); + $Byear = ($Byear + 1900); + $Bmon++; + if ($Bmon < 10) {$Bmon = "0$Bmon";} + if ($Bmday < 10) {$Bmday = "0$Bmday";} + if ($Bhour < 10) {$Bhour = "0$Bhour";} + if ($Bmin < 10) {$Bmin = "0$Bmin";} + if ($Bsec < 10) {$Bsec = "0$Bsec";} + $BDtsSQLdate = "$Byear-$Bmon-$Bmday $Bhour:$Bmin:$Bsec"; + $drop_dateSQL = "and drop_date >= \"$BDtsSQLdate\""; + } + if ($DB) {print "DROP LIST RUN: |$dl_id|$list_id|$dl_minutes($BDtsSQLdate)|\n";} } else { @@ -317,11 +335,11 @@ if ($duplicate_check =~ /LIST/) ##### BEGIN drop list process ##### $insert_counter=0; $duplicate_counter=0; -$stmtB="UPDATE vicidial_drop_log set drop_processed='U' where drop_processed='N' $closer_campaignsSQL $drop_statusesSQL;"; +$stmtB="UPDATE vicidial_drop_log set drop_processed='U' where drop_processed='N' $drop_dateSQL $closer_campaignsSQL $drop_statusesSQL;"; $Baffected_rows = $dbhA->do($stmtB); if ($DB) {print "DROP LOG UPDATE: |$Baffected_rows|$stmtB|\n";} -$stmtA = "SELECT lead_id,drop_date,phone_code,phone_number,campaign_id,status,uniqueid from vicidial_drop_log where drop_processed='U' $closer_campaignsSQL $drop_statusesSQL order by drop_date;"; +$stmtA = "SELECT lead_id,drop_date,phone_code,phone_number,campaign_id,status,uniqueid from vicidial_drop_log where drop_processed='U' $drop_dateSQL $closer_campaignsSQL $drop_statusesSQL order by drop_date;"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; $sthDROProws=$sthA->rows; diff --git a/agc_2-X/trunk/extras/MySQL_AST_CREATE_tables.sql b/agc_2-X/trunk/extras/MySQL_AST_CREATE_tables.sql index a9b5f6e5..34774f34 100644 --- a/agc_2-X/trunk/extras/MySQL_AST_CREATE_tables.sql +++ b/agc_2-X/trunk/extras/MySQL_AST_CREATE_tables.sql @@ -3667,6 +3667,7 @@ run_now_trigger ENUM('N','Y') default 'N', active ENUM('N','Y') default 'N', user_group VARCHAR(20) default '---ALL---', closer_campaigns TEXT, +dl_minutes MEDIUMINT(6) UNSIGNED default '0', index (dl_times), index (run_now_trigger) ) ENGINE=MyISAM; @@ -3961,4 +3962,4 @@ UPDATE vicidial_configuration set value='1766' where name='qc_database_version'; UPDATE system_settings set vdc_agent_api_active='1'; -UPDATE system_settings SET db_schema_version='1499',db_schema_update_date=NOW(),reload_timestamp=NOW(); +UPDATE system_settings SET db_schema_version='1500',db_schema_update_date=NOW(),reload_timestamp=NOW(); diff --git a/agc_2-X/trunk/extras/upgrade_2.14.sql b/agc_2-X/trunk/extras/upgrade_2.14.sql index dfd188f2..4ce2e96d 100644 --- a/agc_2-X/trunk/extras/upgrade_2.14.sql +++ b/agc_2-X/trunk/extras/upgrade_2.14.sql @@ -200,3 +200,7 @@ index(ip_address) ) ENGINE=MyISAM; UPDATE system_settings SET db_schema_version='1499',db_schema_update_date=NOW() where db_schema_version < 1499; + +ALTER TABLE vicidial_drop_lists ADD dl_minutes MEDIUMINT(6) UNSIGNED default '0'; + +UPDATE system_settings SET db_schema_version='1500',db_schema_update_date=NOW() where db_schema_version < 1500; diff --git a/agc_2-X/trunk/www/vicidial/admin.php b/agc_2-X/trunk/www/vicidial/admin.php index bfb86011..6d9be469 100644 --- a/agc_2-X/trunk/www/vicidial/admin.php +++ b/agc_2-X/trunk/www/vicidial/admin.php @@ -2233,6 +2233,8 @@ if (isset($_GET["ip_list_name"])) {$ip_list_name=$_GET["ip_list_name"];} elseif (isset($_POST["ip_list_name"])) {$ip_list_name=$_POST["ip_list_name"];} if (isset($_GET["ip_address"])) {$ip_address=$_GET["ip_address"];} elseif (isset($_POST["ip_address"])) {$ip_address=$_POST["ip_address"];} +if (isset($_GET["dl_minutes"])) {$dl_minutes=$_GET["dl_minutes"];} + elseif (isset($_POST["dl_minutes"])) {$dl_minutes=$_POST["dl_minutes"];} if (isset($script_id)) {$script_id= strtoupper($script_id);} @@ -2641,6 +2643,7 @@ if ($non_latin < 1) $allow_ip_lists = preg_replace('/[^0-9]/','',$allow_ip_lists); $modify_ip_lists = preg_replace('/[^0-9]/','',$modify_ip_lists); $ignore_ip_list = preg_replace('/[^0-9]/','',$ignore_ip_list); + $dl_minutes = preg_replace('/[^0-9]/','',$dl_minutes); $user_new_lead_limit = preg_replace('/[^-0-9]/','',$user_new_lead_limit); $drop_call_seconds = preg_replace('/[^-0-9]/','',$drop_call_seconds); @@ -4097,12 +4100,13 @@ else # 170330-0953 - Fixed translation phrases in callbacks list, issue #1006 # 170407-0744 - Added Agents count on server page # 170409-0950 - Added IP Lists (white and black) functionality +# 170410-1326 - Added dl_minutes option for drop lists # # make sure you have added a user to the vicidial_users MySQL table with at least user_level 9 to access this page the first time -$admin_version = '2.14-607a'; -$build = '170409-0950'; +$admin_version = '2.14-608a'; +$build = '170410-1326'; $STARTtime = date("U"); $SQLdate = date("Y-m-d H:i:s"); @@ -26088,7 +26092,7 @@ if ($ADD==431) } if (strlen($groups_value)>2) {$groups_value .= " -";} - $stmt="UPDATE vicidial_drop_lists set dl_name='$dl_name',dl_server='$dl_server',dl_times='$dl_times',dl_weekdays='$DL_weekdays',dl_monthdays='$dl_monthdays',list_id='$list_id',duplicate_check='$duplicate_check',run_now_trigger='$run_now_trigger',active='$active',user_group='$user_group',closer_campaigns='$groups_value' where dl_id='$dl_id';"; + $stmt="UPDATE vicidial_drop_lists set dl_name='$dl_name',dl_server='$dl_server',dl_times='$dl_times',dl_weekdays='$DL_weekdays',dl_monthdays='$dl_monthdays',list_id='$list_id',duplicate_check='$duplicate_check',run_now_trigger='$run_now_trigger',active='$active',user_group='$user_group',closer_campaigns='$groups_value',dl_minutes='$dl_minutes' where dl_id='$dl_id';"; $rslt=mysql_to_mysqli($stmt, $link); ### LOG INSERTION Admin Log Table ### @@ -26203,7 +26207,7 @@ if ($ADD==331) $o++; } - $stmt="SELECT dl_id,dl_name,last_run,dl_server,dl_times,dl_weekdays,dl_monthdays,drop_statuses,list_id,duplicate_check,run_now_trigger,active,user_group,closer_campaigns from vicidial_drop_lists where dl_id='$dl_id' $LOGadmin_viewable_groupsSQL;"; + $stmt="SELECT dl_id,dl_name,last_run,dl_server,dl_times,dl_weekdays,dl_monthdays,drop_statuses,list_id,duplicate_check,run_now_trigger,active,user_group,closer_campaigns,dl_minutes from vicidial_drop_lists where dl_id='$dl_id' $LOGadmin_viewable_groupsSQL;"; $rslt=mysql_to_mysqli($stmt, $link); $row=mysqli_fetch_row($rslt); $dl_id = $row[0]; @@ -26220,6 +26224,7 @@ if ($ADD==331) $active = $row[11]; $user_group = $row[12]; $closer_campaigns = $row[13]; + $dl_minutes = $row[14]; echo ""; @@ -26277,6 +26282,7 @@ if ($ADD==331) echo "\n"; echo "\n"; echo "$NWB#drop_lists-active$NWE\n"; + echo ""._QXZ("Gather Minutes").":   ("._QXZ("digits only").") $NWB#drop_lists-dl_minutes$NWE\n"; echo ""._QXZ("Run Now Trigger").":