diff --git a/UPGRADE b/UPGRADE
index fe02d625..2690d8f0 100644
--- a/UPGRADE
+++ b/UPGRADE
@@ -53,7 +53,9 @@ REQUIRED STEPS!!!
OTHER CHANGES:
-1. Nothing yet, 2.7 was just branched, trunk becomes 2.8
+1. Added outbound state call time holidays functionality. Only works if the
+ "state" field is populated properly in your leads.
+
diff --git a/bin/AST_VDhopper.pl b/bin/AST_VDhopper.pl
index 5a0b65ef..9d967677 100644
--- a/bin/AST_VDhopper.pl
+++ b/bin/AST_VDhopper.pl
@@ -1,6 +1,6 @@
#!/usr/bin/perl
#
-# AST_VDhopper.pl version 2.6
+# AST_VDhopper.pl version 2.8
#
# DESCRIPTION:
# Updates the VICIDIAL leads hopper for the streamlined
@@ -75,6 +75,7 @@
# 121205-1621 - Added parentheses around filter SQL when in SQL queries
# 121223-1540 - Fix for issue #627 preventing issues when filter is deleted, DomeDan
# 130219-1501 - Fixed issue with other campaign dnc
+# 130510-0904 - Added state call time holidays functionality
#
# constants
@@ -102,6 +103,7 @@ if ($sec < 10) {$sec = "0$sec";}
$file_date = "$year-$mon-$mday";
$now_date = "$year-$mon-$mday $hour:$min:$sec";
$VDL_date = "$year-$mon-$mday 00:00:01";
+$YMD = "$year-$mon-$mday";
### get date-time of one hour ago ###
$VDL_hour = ($secX - (60 * 60));
@@ -1274,13 +1276,12 @@ foreach(@campaign_id)
{
if (length($state_rules[$b])>1)
{
- $stmtA = "SELECT state_call_time_id,state_call_time_state,state_call_time_name,state_call_time_comments,sct_default_start,sct_default_stop,sct_sunday_start,sct_sunday_stop,sct_monday_start,sct_monday_stop,sct_tuesday_start,sct_tuesday_stop,sct_wednesday_start,sct_wednesday_stop,sct_thursday_start,sct_thursday_stop,sct_friday_start,sct_friday_stop,sct_saturday_start,sct_saturday_stop from vicidial_state_call_times where state_call_time_id='$state_rules[$b]';";
+ $stmtA = "SELECT state_call_time_id,state_call_time_state,state_call_time_name,state_call_time_comments,sct_default_start,sct_default_stop,sct_sunday_start,sct_sunday_stop,sct_monday_start,sct_monday_stop,sct_tuesday_start,sct_tuesday_stop,sct_wednesday_start,sct_wednesday_stop,sct_thursday_start,sct_thursday_stop,sct_friday_start,sct_friday_stop,sct_saturday_start,sct_saturday_stop,ct_holidays from vicidial_state_call_times where state_call_time_id='$state_rules[$b]';";
if ($DBX) {print " |$stmtA|\n";}
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
- $rec_count=0;
- while ($sthArows > $rec_count)
+ if ($sthArows > 0)
{
@aryA = $sthA->fetchrow_array;
$Gstate_call_time_id = $aryA[0];
@@ -1301,11 +1302,53 @@ foreach(@campaign_id)
$Gsct_friday_stop = $aryA[17];
$Gsct_saturday_start = $aryA[18];
$Gsct_saturday_stop = $aryA[19];
+ $Sct_holidays = $aryA[20];
$ct_states .="'$Gstate_call_time_state',";
- $rec_count++;
}
$sthA->finish();
+ ### BEGIN Check for outbound state holiday ###
+
+ if (length($Sct_holidays)>2)
+ {
+ $Sct_holidaysSQL = $Sct_holidays;
+ $Sct_holidaysSQL =~ s/^\||\|$//gi;
+ $Sct_holidaysSQL =~ s/\|/','/gi;
+ $Sct_holidaysSQL = "'$Sct_holidaysSQL'";
+
+ $stmtA = "SELECT holiday_id,holiday_date,holiday_name,ct_default_start,ct_default_stop from vicidial_call_time_holidays where holiday_id IN($Sct_holidaysSQL) and holiday_status='ACTIVE' and holiday_date='$YMD' order by holiday_id;";
+ if ($DBX) {print " |$stmtA|\n";}
+ $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
+ $sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
+ $sthArows=$sthA->rows;
+ if ($sthArows > 0)
+ {
+ @aryA = $sthA->fetchrow_array;
+ $holiday_id = $aryA[0];
+ $holiday_date = $aryA[1];
+ $holiday_name = $aryA[2];
+ $Gsct_default_start = $aryA[3];
+ $Gsct_default_stop = $aryA[4];
+ $Gsct_sunday_start = $aryA[3];
+ $Gsct_sunday_stop = $aryA[4];
+ $Gsct_monday_start = $aryA[3];
+ $Gsct_monday_stop = $aryA[4];
+ $Gsct_tuesday_start = $aryA[3];
+ $Gsct_tuesday_stop = $aryA[4];
+ $Gsct_wednesday_start = $aryA[3];
+ $Gsct_wednesday_stop = $aryA[4];
+ $Gsct_thursday_start = $aryA[3];
+ $Gsct_thursday_stop = $aryA[4];
+ $Gsct_friday_start = $aryA[3];
+ $Gsct_friday_stop = $aryA[4];
+ $Gsct_saturday_start = $aryA[3];
+ $Gsct_saturday_stop = $aryA[4];
+ if ($DBX) {print "STATE CALL TIME HOLIDAY FOUND! |$Gstate_call_time_id|$Gstate_call_time_state|$holiday_id|$holiday_date|$holiday_name|$Gsct_default_start|$Gsct_default_stop|\n";}
+ }
+ $sthA->finish();
+ }
+ ### END Check for outbound state holiday ###
+
$r=0;
$state_gmt='';
$del_state_gmt='';
diff --git a/extras/MySQL_AST_CREATE_tables.sql b/extras/MySQL_AST_CREATE_tables.sql
index a9577d15..72e41875 100644
--- a/extras/MySQL_AST_CREATE_tables.sql
+++ b/extras/MySQL_AST_CREATE_tables.sql
@@ -1288,7 +1288,8 @@ sct_friday_start SMALLINT(4) unsigned default '0',
sct_friday_stop SMALLINT(4) unsigned default '0',
sct_saturday_start SMALLINT(4) unsigned default '0',
sct_saturday_stop SMALLINT(4) unsigned default '0',
-user_group VARCHAR(20) default '---ALL---'
+user_group VARCHAR(20) default '---ALL---',
+ct_holidays TEXT default ''
);
CREATE TABLE vicidial_campaign_stats (
@@ -3123,4 +3124,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='1349',db_schema_update_date=NOW();
+UPDATE system_settings SET db_schema_version='1350',db_schema_update_date=NOW();
diff --git a/extras/upgrade_2.8.sql b/extras/upgrade_2.8.sql
index 4008d951..e03e4a03 100644
--- a/extras/upgrade_2.8.sql
+++ b/extras/upgrade_2.8.sql
@@ -1 +1,5 @@
UPDATE system_settings SET db_schema_version='1349',version='2.8b0.5',db_schema_update_date=NOW() where db_schema_version < 1349;
+
+ALTER TABLE vicidial_state_call_times ADD ct_holidays TEXT default '';
+
+UPDATE system_settings SET db_schema_version='1350',db_schema_update_date=NOW() where db_schema_version < 1350;
diff --git a/translations/raw_translation_files/TO_BE_TRANSLATED_2.8.txt b/translations/raw_translation_files/TO_BE_TRANSLATED_2.8.txt
new file mode 100644
index 00000000..d6838687
--- /dev/null
+++ b/translations/raw_translation_files/TO_BE_TRANSLATED_2.8.txt
@@ -0,0 +1,21 @@
+############################################################ ADMIN
+Active Outbound Holiday Definitions for this Record||
+Modify Call Time State Holiday||
+
+
+########################## CHANGES TO EXISTING PHRASES IN ADMIN TRANSLATION
+
+
+
+############################################################ CLIENT
+
+
+########################## CHANGES TO EXISTING PHRASES IN AGENT TRANSLATION
+
+
+############################################################ MANAGER Manual
+
+
+
+############################################################ AGENT Manual
+
diff --git a/www/vicidial/admin.php b/www/vicidial/admin.php
index beb9860b..4b7e7f12 100644
--- a/www/vicidial/admin.php
+++ b/www/vicidial/admin.php
@@ -3245,12 +3245,13 @@ else
# 130425-0700 - Added DROP option for survey_no_response_action to go to campaign drop method
# 130503-1509 - Added red color to server table on reports page if asterisk out of sync
# 130508-2306 - Branched 2.7, trunk becomes 2.8
+# 130510-1350 - Added outbound state call time holidays functionality
#
# make sure you have added a user to the vicidial_users MySQL table with at least user_level 8 to access this page the first time
-$admin_version = '2.8-402a';
-$build = '130508-2306';
+$admin_version = '2.8-403a';
+$build = '130510-1350';
$STARTtime = date("U");
$SQLdate = date("Y-m-d H:i:s");
@@ -3704,6 +3705,7 @@ if ($ADD==3111111) {$hh='scripts'; echo "Modify Script";}
if ($ADD==31111111) {$hh='filters'; echo "Modify Filter";}
if ($ADD==311111111) {$hh='admin'; $sh='times'; echo "Modify Call Time";}
if ($ADD==321111111) {$hh='admin'; $sh='times'; echo "Modify Call Time State Definitions List";}
+if ($ADD==322111111) {$hh='admin'; $sh='times'; echo "Modify Call Time State Holiday";}
if ($ADD==331111111) {$hh='admin'; $sh='shifts'; echo "Modify Shift";}
if ($ADD==3111111111) {$hh='admin'; $sh='times'; echo "Modify State Call Time";}
if ($ADD==3211111111) {$hh='admin'; $sh='times'; echo "Modify Holiday";}
@@ -30202,6 +30204,75 @@ if ($ADD==321111111)
}
+######################
+# ADD=322111111 modify state call time definition info in the system, ADD/REMOVE
+######################
+
+if ($ADD==322111111)
+ {
+ if ($LOGmodify_call_times==1)
+ {
+ if ( ($SSadmin_modify_refresh > 1) and ($modify_refresh_set < 1) )
+ {
+ $modify_url = "$PHP_SELF?ADD=3111111111&call_time_id=$call_time_id";
+ $modify_footer_refresh=1;
+ }
+ ### add-remove holiday rule
+ if ( ($stage=="ADD") and (strlen($holiday_rule)>0) )
+ {
+ $stmt="SELECT ct_holidays from vicidial_state_call_times where state_call_time_id='$call_time_id';";
+ $rslt=mysql_query($stmt, $link);
+ $row=mysql_fetch_row($rslt);
+ $ct_holidays = $row[0];
+
+ if (eregi("\|$",$ct_holidays))
+ {$ct_holidays = "$ct_holidays$holiday_rule\|";}
+ else
+ {$ct_holidays = "$ct_holidays\|$holiday_rule\|";}
+ $stmt="UPDATE vicidial_state_call_times set ct_holidays='$ct_holidays' where state_call_time_id='$call_time_id';";
+ $rslt=mysql_query($stmt, $link);
+
+ ### LOG INSERTION Admin Log Table ###
+ $SQL_log = "$stmt|";
+ $SQL_log = ereg_replace(';','',$SQL_log);
+ $SQL_log = addslashes($SQL_log);
+ $stmt="INSERT INTO vicidial_admin_log set event_date='$SQLdate', user='$PHP_AUTH_USER', ip_address='$ip', event_section='CALLTIMES', event_type='MODIFY', record_id='$call_time_id', event_code='ADMIN MODIFY STATE CALL TIME ADD HOLIDAY RULE', event_sql=\"$SQL_log\", event_notes='Holiday Rule Added: $holiday_rule';";
+ if ($DB) {echo "|$stmt|\n";}
+ $rslt=mysql_query($stmt, $link);
+
+ echo "Holiday Rule Added: $holiday_rule
\n";
+ }
+ if ( ($stage=="REMOVE") and (strlen($holiday_rule)>0) )
+ {
+ $stmt="SELECT ct_holidays from vicidial_state_call_times where state_call_time_id='$call_time_id';";
+ $rslt=mysql_query($stmt, $link);
+ $row=mysql_fetch_row($rslt);
+ $ct_holidays = $row[0];
+
+ $ct_holidays = eregi_replace("\|$holiday_rule\|",'|',$ct_holidays);
+ $stmt="UPDATE vicidial_state_call_times set ct_holidays='$ct_holidays' where state_call_time_id='$call_time_id';";
+ $rslt=mysql_query($stmt, $link);
+
+ ### LOG INSERTION Admin Log Table ###
+ $SQL_log = "$stmt|";
+ $SQL_log = ereg_replace(';','',$SQL_log);
+ $SQL_log = addslashes($SQL_log);
+ $stmt="INSERT INTO vicidial_admin_log set event_date='$SQLdate', user='$PHP_AUTH_USER', ip_address='$ip', event_section='CALLTIMES', event_type='MODIFY', record_id='$call_time_id', event_code='ADMIN MODIFY STATE CALL TIME REMOVE HOLIDAY RULE', event_sql=\"$SQL_log\", event_notes='Holiday Rule Removed: $holiday_rule';";
+ if ($DB) {echo "|$stmt|\n";}
+ $rslt=mysql_query($stmt, $link);
+
+ echo "Holiday Rule Removed: $holiday_rule
\n";
+ }
+
+ $ADD=3111111111;
+ }
+ else
+ {
+ echo "You are not authorized to view this page. Please go back.";
+ }
+ }
+
+
######################
# ADD=311111111 modify call time definition info in the system
######################
@@ -30447,7 +30518,7 @@ if ($ADD==3111111111)
echo "
\n";
echo "";
- $stmt="SELECT state_call_time_id,state_call_time_state,state_call_time_name,state_call_time_comments,sct_default_start,sct_default_stop,sct_sunday_start,sct_sunday_stop,sct_monday_start,sct_monday_stop,sct_tuesday_start,sct_tuesday_stop,sct_wednesday_start,sct_wednesday_stop,sct_thursday_start,sct_thursday_stop,sct_friday_start,sct_friday_stop,sct_saturday_start,sct_saturday_stop,user_group from vicidial_state_call_times where state_call_time_id='$call_time_id' $LOGadmin_viewable_groupsSQL;";
+ $stmt="SELECT state_call_time_id,state_call_time_state,state_call_time_name,state_call_time_comments,sct_default_start,sct_default_stop,sct_sunday_start,sct_sunday_stop,sct_monday_start,sct_monday_stop,sct_tuesday_start,sct_tuesday_stop,sct_wednesday_start,sct_wednesday_stop,sct_thursday_start,sct_thursday_stop,sct_friday_start,sct_friday_stop,sct_saturday_start,sct_saturday_stop,user_group,ct_holidays from vicidial_state_call_times where state_call_time_id='$call_time_id' $LOGadmin_viewable_groupsSQL;";
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$state_call_time_state =$row[1];
@@ -30470,6 +30541,7 @@ if ($ADD==3111111111)
$ct_saturday_start = $row[18];
$ct_saturday_stop = $row[19];
$user_group = $row[20];
+ $ct_holidays = $row[21];
echo "";
@@ -30494,8 +30566,65 @@ if ($ADD==3111111111)
echo "| Thursday Start: | | Thursday Stop: | $NWB#vicidial_call_times-ct_sunday_start$NWE | \n";
echo "| Friday Start: | | Friday Stop: | $NWB#vicidial_call_times-ct_sunday_start$NWE | \n";
echo "| Saturday Start: | | Saturday Stop: | $NWB#vicidial_call_times-ct_sunday_start$NWE | \n";
-
echo " | \n";
+ echo "| | \n";
+
+
+
+ $ct_hrs=1;
+ $b=0;
+ $hrs_SQL ='';
+ if (strlen($ct_holidays)>2)
+ {
+ $holiday_rules = explode('|',$ct_holidays);
+ $ct_hrs = ((count($holiday_rules)) - 1);
+ }
+ echo "| Active Outbound Holiday Definitions for this Record: | \n";
+ echo " | \n";
+ while($ct_hrs >= $b)
+ {
+ if (strlen($holiday_rules[$b])>0)
+ {
+ $stmt="SELECT holiday_date,holiday_name from vicidial_call_time_holidays where holiday_id='$holiday_rules[$b]';";
+ $rslt=mysql_query($stmt, $link);
+ $row=mysql_fetch_row($rslt);
+ echo "| $holiday_rules[$b] - REMOVE | $row[0] - $row[1] | \n";
+ $hrs_SQL .= "'$holiday_rules[$b]',";
+ $hrs_holiday_SQL .= "'$row[0]',";
+ }
+ $b++;
+ }
+ if (strlen($hrs_SQL)>2)
+ {
+ $hrs_SQL = "$hrs_SQL''";
+ $hrs_holiday_SQL = "$hrs_holiday_SQL''";
+ $hrs_SQL = "where holiday_id NOT IN($hrs_SQL) and holiday_date NOT IN($hrs_holiday_SQL) $LOGadmin_viewable_groupsSQL";
+ }
+ else
+ {$hrs_SQL="$whereLOGadmin_viewable_groupsSQL";}
+ $stmt="SELECT holiday_id,holiday_date from vicidial_call_time_holidays $hrs_SQL order by holiday_date;";
+ $rslt=mysql_query($stmt, $link);
+ $hct_to_print = mysql_num_rows($rslt);
+ $hct_list='';
+
+ $o=0;
+ while ($hct_to_print > $o)
+ {
+ $rowx=mysql_fetch_row($rslt);
+ $hct_list .= "\n";
+ $o++;
+ }
+ echo " | | \n";
+ echo " | \n";
+
+
+
echo " |
\n";
echo "CALL TIMES USING THIS STATE CALL TIME:
\n";
echo "\n";
@@ -30606,6 +30735,21 @@ if ($ADD==3211111111)
$o++;
}
+ echo "
\n";
+ echo "STATE CALL TIMES USING THIS HOLIDAY:
\n";
+ echo "\n";
+
+ $stmt="SELECT state_call_time_id,state_call_time_state,state_call_time_name from vicidial_state_call_times where ct_holidays LIKE \"%|$holiday_id|%\";";
+ $rslt=mysql_query($stmt, $link);
+ $camps_to_print = mysql_num_rows($rslt);
+ $o=0;
+ while ($camps_to_print > $o)
+ {
+ $row=mysql_fetch_row($rslt);
+ echo "| $row[0] | $row[1] - $row[2]
|
\n";
+ $o++;
+ }
+
echo "
\n";
echo "
\n";