Added outbound state call time holidays functionality
git-svn-id: svn://192.168.202.10@1983 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
@@ -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.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -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='';
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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<BR>\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<BR>\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 "<TABLE><TR><TD>\n";
|
||||
echo "<FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>";
|
||||
|
||||
$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 "<FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>";
|
||||
|
||||
@@ -30494,8 +30566,65 @@ if ($ADD==3111111111)
|
||||
echo "<tr bgcolor=#B6D3FC><td align=right>Thursday Start:</td><td align=left><input type=text name=ct_thursday_start size=5 maxlength=4 value=\"$ct_thursday_start\"> </td><td align=right>Thursday Stop:</td><td align=left><input type=text name=ct_thursday_stop size=5 maxlength=4 value=\"$ct_thursday_stop\"> $NWB#vicidial_call_times-ct_sunday_start$NWE</td></tr>\n";
|
||||
echo "<tr bgcolor=#B6D3FC><td align=right>Friday Start:</td><td align=left><input type=text name=ct_friday_start size=5 maxlength=4 value=\"$ct_friday_start\"> </td><td align=right>Friday Stop:</td><td align=left><input type=text name=ct_friday_stop size=5 maxlength=4 value=\"$ct_friday_stop\"> $NWB#vicidial_call_times-ct_sunday_start$NWE</td></tr>\n";
|
||||
echo "<tr bgcolor=#B6D3FC><td align=right>Saturday Start:</td><td align=left><input type=text name=ct_saturday_start size=5 maxlength=4 value=\"$ct_saturday_start\"> </td><td align=right>Saturday Stop:</td><td align=left><input type=text name=ct_saturday_stop size=5 maxlength=4 value=\"$ct_saturday_stop\"> $NWB#vicidial_call_times-ct_sunday_start$NWE</td></tr>\n";
|
||||
|
||||
echo "<tr bgcolor=#B6D3FC><td align=center colspan=4><input type=submit name=SUBMIT value=SUBMIT></td></tr>\n";
|
||||
echo "<tr bgcolor=#B6D3FC><td align=center colspan=4> </td></tr>\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 "<tr bgcolor=#B6D3FC><td align=center rowspan=$ct_hrs>Active Outbound Holiday Definitions for this Record: </td>\n";
|
||||
echo "<td align=center colspan=3> </td></tr>\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 "<tr bgcolor=#B6D3FC><td align=right colspan=2><a href=\"$PHP_SELF?ADD=3211111111&holiday_id=$holiday_rules[$b]\">$holiday_rules[$b] </a> - <a href=\"$PHP_SELF?ADD=322111111&call_time_id=$call_time_id&holiday_rule=$holiday_rules[$b]&stage=REMOVE\">REMOVE </a></td><td align=left>$row[0] - $row[1]</td></tr>\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 .= "<option value=\"$rowx[0]\">$rowx[0] - $rowx[1]</option>\n";
|
||||
$o++;
|
||||
}
|
||||
echo "<tr bgcolor=#B6D3FC><td align=right><form action=$PHP_SELF method=POST>\n";
|
||||
echo "<input type=hidden name=ADD value=322111111>\n";
|
||||
echo "<input type=hidden name=stage value=\"ADD\">\n";
|
||||
echo "<input type=hidden name=call_time_id value=\"$call_time_id\">\n";
|
||||
echo "Add inbound holiday rule: </td><td align=left colspan=2><select size=1 name=holiday_rule>\n";
|
||||
echo "$hct_list";
|
||||
echo "</select></td>\n";
|
||||
echo "<td align=center colspan=4><input type=submit name=SUBMIT value=SUBMIT></FORM></td></tr>\n";
|
||||
|
||||
|
||||
|
||||
echo "</TABLE><BR><BR>\n";
|
||||
echo "<B>CALL TIMES USING THIS STATE CALL TIME:</B><BR>\n";
|
||||
echo "<TABLE>\n";
|
||||
@@ -30606,6 +30735,21 @@ if ($ADD==3211111111)
|
||||
$o++;
|
||||
}
|
||||
|
||||
echo "</TABLE><BR><BR>\n";
|
||||
echo "<B>STATE CALL TIMES USING THIS HOLIDAY:</B><BR>\n";
|
||||
echo "<TABLE>\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 "<TR><TD><a href=\"$PHP_SELF?ADD=3111111111&call_time_id=$row[0]\">$row[0] </a></TD><TD> $row[1] - $row[2]<BR></TD></TR>\n";
|
||||
$o++;
|
||||
}
|
||||
|
||||
echo "</TABLE>\n";
|
||||
echo "</center><BR><BR>\n";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user