Added extension append cidname options

Added custom reports link variables

git-svn-id: svn://192.168.202.10@2825 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2017-09-30 13:14:52 +00:00
parent 21693613a7
commit d355b2f13a
9 changed files with 269 additions and 67 deletions
+15 -6
View File
@@ -216,6 +216,7 @@
# 170903-0929 - Added additional xfer_log details
# 170914-1634 - Added Asterisk 13 compatibility
# 170921-2008 - Fix for CALLID in beginning of recording filename
# 170930-0913 - Added extension append options
#
$script = 'agi-VDAD_ALL_inbound.agi';
@@ -3852,19 +3853,27 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) && ($MCdrop_override
{
if ($extension_appended_cidname =~ /Y/)
{
$eac_cbc=0;
$stmtA = "SELECT extension FROM vicidial_live_agents where user='$VDADuser' order by last_call_time limit 1;";
$eac_extension='';
$stmtA = "SELECT extension,campaign_id FROM vicidial_live_agents where user='$VDADuser' order by last_call_time limit 1;";
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
$dbhP=$dbhA; $mysql_count='02149'; $MEL_aff_rows=$sthArows; &mysql_error_logging;
while ($sthArows > $eac_cbc)
if ($sthArows > 0)
{
@aryA = $sthA->fetchrow_array;
$eac_extension = $aryA[0];
$eac_extension =~ s/SIP\/|IAX2\/|Zap\/|DAHDI\/|Local\///gi;
$eac_cbc++;
if ($extension_appended_cidname =~ /USER/)
{
$eac_extension = $VDADuser;
}
else
{
$eac_extension = $aryA[0];
$eac_extension =~ s/SIP\/|IAX2\/|Zap\/|DAHDI\/|Local\///gi;
}
if ($extension_appended_cidname =~ /WITH_CAMPAIGN/)
{$eac_extension .= " $aryA[1]";}
}
$sthA->finish();
+34 -17
View File
@@ -117,6 +117,7 @@
# 161102-1037 - Fixed QM partition problem
# 161201-1003 - Fixed LRERR logging issue
# 170921-2007 - Fix for CALLID in beginning of recording filename
# 170930-0913 - Added extension append options
#
$script = 'agi-VDAD_ALL_outbound.agi';
@@ -2709,30 +2710,38 @@ while ($drop_timer <= $DROP_TIME)
}
### END routing-initiated agent call recording for ALLCALLS/ALLFORCE ###
}
if ($extension_appended_cidname =~ /Y/)
if ($extension_appended_cidname =~ /Y|USER/)
{
$eac_cbc=0;
$stmtA = "SELECT extension FROM vicidial_live_agents where user='$VDADuser' order by last_call_time limit 1;";
$eac_extension='';
$stmtA = "SELECT extension,campaign_id FROM vicidial_live_agents where user='$VDADuser' order by last_call_time limit 1;";
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
$dbhP=$dbhA; $mysql_count='01068'; $MEL_aff_rows=$sthArows; &mysql_error_logging;
while ($sthArows > $eac_cbc)
if ($sthArows > 0)
{
@aryA = $sthA->fetchrow_array;
$eac_extension = $aryA[0];
$eac_extension =~ s/SIP\/|IAX2\/|Zap\/|DAHDI\/|Local\///gi;
$eac_cbc++;
if ($extension_appended_cidname =~ /USER/)
{
$eac_extension = $VDADuser;
}
else
{
$eac_extension = $aryA[0];
$eac_extension =~ s/SIP\/|IAX2\/|Zap\/|DAHDI\/|Local\///gi;
}
if ($extension_appended_cidname =~ /WITH_CAMPAIGN/)
{$eac_extension .= " $aryA[1]";}
}
$sthA->finish();
$newcallerid = "\"$callerid $eac_extension <$phone_number>\"";
$newcallerid = "\"$callerid $eac_extension <$VDADphone>\"";
$AGI->set_callerid($newcallerid);
}
else
{
$newcallerid = "\"$callerid <$phone_number>\"";
$newcallerid = "\"$callerid <$VDADphone>\"";
$AGI->set_callerid($newcallerid);
}
}
@@ -3427,28 +3436,36 @@ while ($drop_timer <= $DROP_TIME)
if ($extension_appended_cidname =~ /Y/)
{
$eac_cbc=0;
$stmtA = "SELECT extension FROM vicidial_live_agents where user='$VDADuser' order by last_call_time limit 1;";
$eac_extension='';
$stmtA = "SELECT extension,campaign_id FROM vicidial_live_agents where user='$VDADuser' order by last_call_time limit 1;";
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
$dbhP=$dbhA; $mysql_count='01069'; $MEL_aff_rows=$sthArows; &mysql_error_logging;
while ($sthArows > $eac_cbc)
if ($sthArows > 0)
{
@aryA = $sthA->fetchrow_array;
$eac_extension = $aryA[0];
$eac_extension =~ s/SIP\/|IAX2\/|Zap\/|DAHDI\/|Local\///gi;
$eac_cbc++;
if ($extension_appended_cidname =~ /USER/)
{
$eac_extension = $VDADuser;
}
else
{
$eac_extension = $aryA[0];
$eac_extension =~ s/SIP\/|IAX2\/|Zap\/|DAHDI\/|Local\///gi;
}
if ($extension_appended_cidname =~ /WITH_CAMPAIGN/)
{$eac_extension .= " $aryA[1]";}
}
$sthA->finish();
$newcallerid = "\"$callerid $eac_extension <$phone_number>\"";
$newcallerid = "\"$callerid $eac_extension <$VDADphone>\"";
$AGI->set_callerid($newcallerid);
}
else
{
$newcallerid = "\"$callerid <$phone_number>\"";
$newcallerid = "\"$callerid <$VDADphone>\"";
$AGI->set_callerid($newcallerid);
}
}
+34 -17
View File
@@ -118,6 +118,7 @@
# 161115-1359 - Forked to BETA script, added vdad_debug_logging option
# 161201-1003 - Fixed LRERR logging issue
# 170921-2007 - Fix for CALLID in beginning of recording filename
# 170930-0913 - Added extension append options
#
$script = 'agi-VDAD_ALL_outboundBETA.agi';
@@ -2819,28 +2820,36 @@ while ($drop_timer <= $DROP_TIME)
}
if ($extension_appended_cidname =~ /Y/)
{
$eac_cbc=0;
$stmtA = "SELECT extension FROM vicidial_live_agents where user='$VDADuser' order by last_call_time limit 1;";
$eac_extension='';
$stmtA = "SELECT extension,campaign_id FROM vicidial_live_agents where user='$VDADuser' order by last_call_time limit 1;";
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
$dbhP=$dbhA; $mysql_count='01068'; $MEL_aff_rows=$sthArows; &mysql_error_logging;
while ($sthArows > $eac_cbc)
$dbhP=$dbhA; $mysql_count='01069'; $MEL_aff_rows=$sthArows; &mysql_error_logging;
if ($sthArows > 0)
{
@aryA = $sthA->fetchrow_array;
$eac_extension = $aryA[0];
$eac_extension =~ s/SIP\/|IAX2\/|Zap\/|DAHDI\/|Local\///gi;
$eac_cbc++;
if ($extension_appended_cidname =~ /USER/)
{
$eac_extension = $VDADuser;
}
else
{
$eac_extension = $aryA[0];
$eac_extension =~ s/SIP\/|IAX2\/|Zap\/|DAHDI\/|Local\///gi;
}
if ($extension_appended_cidname =~ /WITH_CAMPAIGN/)
{$eac_extension .= " $aryA[1]";}
}
$sthA->finish();
$newcallerid = "\"$callerid $eac_extension <$phone_number>\"";
$newcallerid = "\"$callerid $eac_extension <$VDADphone>\"";
$AGI->set_callerid($newcallerid);
}
else
{
$newcallerid = "\"$callerid <$phone_number>\"";
$newcallerid = "\"$callerid <$VDADphone>\"";
$AGI->set_callerid($newcallerid);
}
}
@@ -3544,28 +3553,36 @@ while ($drop_timer <= $DROP_TIME)
if ($extension_appended_cidname =~ /Y/)
{
$eac_cbc=0;
$stmtA = "SELECT extension FROM vicidial_live_agents where user='$VDADuser' order by last_call_time limit 1;";
$eac_extension='';
$stmtA = "SELECT extension,campaign_id FROM vicidial_live_agents where user='$VDADuser' order by last_call_time limit 1;";
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
$dbhP=$dbhA; $mysql_count='01069'; $MEL_aff_rows=$sthArows; &mysql_error_logging;
while ($sthArows > $eac_cbc)
if ($sthArows > 0)
{
@aryA = $sthA->fetchrow_array;
$eac_extension = $aryA[0];
$eac_extension =~ s/SIP\/|IAX2\/|Zap\/|DAHDI\/|Local\///gi;
$eac_cbc++;
if ($extension_appended_cidname =~ /USER/)
{
$eac_extension = $VDADuser;
}
else
{
$eac_extension = $aryA[0];
$eac_extension =~ s/SIP\/|IAX2\/|Zap\/|DAHDI\/|Local\///gi;
}
if ($extension_appended_cidname =~ /WITH_CAMPAIGN/)
{$eac_extension .= " $aryA[1]";}
}
$sthA->finish();
$newcallerid = "\"$callerid $eac_extension <$phone_number>\"";
$newcallerid = "\"$callerid $eac_extension <$VDADphone>\"";
$AGI->set_callerid($newcallerid);
}
else
{
$newcallerid = "\"$callerid <$phone_number>\"";
$newcallerid = "\"$callerid <$VDADphone>\"";
$AGI->set_callerid($newcallerid);
}
}
+5 -4
View File
@@ -873,7 +873,7 @@ xferconf_e_number VARCHAR(50) default '',
use_custom_cid ENUM('Y','N','AREACODE','USER_CUSTOM_1','USER_CUSTOM_2','USER_CUSTOM_3','USER_CUSTOM_4','USER_CUSTOM_5') default 'N',
scheduled_callbacks_alert ENUM('NONE','BLINK','RED','BLINK_RED','BLINK_DEFER','RED_DEFER','BLINK_RED_DEFER') default 'NONE',
queuemetrics_callstatus_override ENUM('DISABLED','NO','YES') default 'DISABLED',
extension_appended_cidname ENUM('Y','N') default 'N',
extension_appended_cidname ENUM('Y','N','Y_USER','Y_WITH_CAMPAIGN','Y_USER_WITH_CAMPAIGN') default 'N',
scheduled_callbacks_count ENUM('LIVE','ALL_ACTIVE') default 'ALL_ACTIVE',
manual_dial_override ENUM('NONE','ALLOW_ALL','DISABLE_ALL') default 'NONE',
blind_monitor_warning ENUM('DISABLED','ALERT','NOTICE','AUDIO','ALERT_NOTICE','ALERT_AUDIO','NOTICE_AUDIO','ALL') default 'DISABLED',
@@ -1158,7 +1158,7 @@ xferconf_c_number VARCHAR(50) default '',
xferconf_d_number VARCHAR(50) default '',
xferconf_e_number VARCHAR(50) default '',
ignore_list_script_override ENUM('Y','N') default 'N',
extension_appended_cidname ENUM('Y','N') default 'N',
extension_appended_cidname ENUM('Y','N','Y_USER','Y_WITH_CAMPAIGN','Y_USER_WITH_CAMPAIGN') default 'N',
uniqueid_status_display ENUM('DISABLED','ENABLED','ENABLED_PREFIX','ENABLED_PRESERVE') default 'DISABLED',
uniqueid_status_prefix VARCHAR(50) default '',
hold_time_option_minimum SMALLINT(5) default '0',
@@ -3484,7 +3484,8 @@ report_name VARCHAR(100) COLLATE utf8_unicode_ci DEFAULT NULL,
date_added DATETIME DEFAULT NULL,
user VARCHAR(20) COLLATE utf8_unicode_ci DEFAULT NULL,
domain VARCHAR(70) COLLATE utf8_unicode_ci DEFAULT NULL,
path_name VARCHAR(100) COLLATE utf8_unicode_ci DEFAULT NULL,
path_name TEXT COLLATE utf8_unicode_ci DEFAULT NULL,
custom_variables TEXT COLLATE utf8_unicode_ci DEFAULT NULL,
date_modified TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
user_modify VARCHAR(20) COLLATE utf8_unicode_ci DEFAULT NULL,
PRIMARY KEY (custom_report_id),
@@ -4085,4 +4086,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='1518',db_schema_update_date=NOW(),reload_timestamp=NOW();
UPDATE system_settings SET db_schema_version='1519',db_schema_update_date=NOW(),reload_timestamp=NOW();
+9
View File
@@ -393,3 +393,12 @@ UPDATE system_settings SET db_schema_version='1517',db_schema_update_date=NOW()
ALTER TABLE vicidial_dnccom_scrub_log ADD flag_projdnc ENUM('','0','1') default '' AFTER flag_dnc;
UPDATE system_settings SET db_schema_version='1518',db_schema_update_date=NOW() where db_schema_version < 1518;
ALTER TABLE vicidial_campaigns MODIFY extension_appended_cidname ENUM('Y','N','Y_USER','Y_WITH_CAMPAIGN','Y_USER_WITH_CAMPAIGN') default 'N';
ALTER TABLE vicidial_inbound_groups MODIFY extension_appended_cidname ENUM('Y','N','Y_USER','Y_WITH_CAMPAIGN','Y_USER_WITH_CAMPAIGN') default 'N';
ALTER TABLE vicidial_custom_reports MODIFY path_name TEXT COLLATE utf8_unicode_ci DEFAULT NULL;
ALTER TABLE vicidial_custom_reports ADD custom_variables TEXT COLLATE utf8_unicode_ci DEFAULT NULL AFTER path_name;
UPDATE system_settings SET db_schema_version='1519',db_schema_update_date=NOW() where db_schema_version < 1519;
+11 -8
View File
@@ -2767,7 +2767,6 @@ if ($non_latin < 1)
$agent_xfer_dial_with_customer = preg_replace('/[^NY]/','',$agent_xfer_dial_with_customer);
$agent_xfer_park_customer_dial = preg_replace('/[^NY]/','',$agent_xfer_park_customer_dial);
$agent_fullscreen = preg_replace('/[^NY]/','',$agent_fullscreen);
$extension_appended_cidname = preg_replace('/[^NY]/','',$extension_appended_cidname);
$onhold_prompt_no_block = preg_replace('/[^NY]/','',$onhold_prompt_no_block);
$hold_time_option_no_block = preg_replace('/[^NY]/','',$hold_time_option_no_block);
$wait_time_option_no_block = preg_replace('/[^NY]/','',$wait_time_option_no_block);
@@ -3193,6 +3192,7 @@ if ($non_latin < 1)
$inbound_survey_callmenu = preg_replace('/[^-_0-9a-zA-Z]/','',$inbound_survey_callmenu);
$filename_override = preg_replace('/[^-_0-9a-zA-Z]/','',$filename_override);
$did_id = preg_replace('/[^-_0-9a-zA-Z]/','',$did_id);
$extension_appended_cidname = preg_replace('/[^-_0-9a-zA-Z]/','',$extension_appended_cidname);
### ALPHA-NUMERIC and underscore and dash and slash and dot
$menu_timeout_prompt = preg_replace('/[^-\/\|\._0-9a-zA-Z]/','',$menu_timeout_prompt);
@@ -4182,12 +4182,13 @@ else
# 170920-2153 - Added expired_lists_inactive system setting and functions
# 170923-1425 - Added did_system_filter system setting and functions
# 170926-1618 - Fix for Test Call function for Asterisk 13
# 170930-0853 - Added extension_appended_cidname options and custom reports variable display
#
# 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-631a';
$build = '170926-1618';
$admin_version = '2.14-632a';
$build = '170930-0853';
$STARTtime = date("U");
$SQLdate = date("Y-m-d H:i:s");
@@ -22504,7 +22505,7 @@ if ($ADD==31)
echo "<tr bgcolor=#$SSstd_row4_background><td align=right>"._QXZ("No Agent Call URL").": </td><td align=left><input type=text name=na_call_url size=70 maxlength=5000 value=\"$na_call_url\">$NWB#campaigns-na_call_url$NWE</td></tr>\n";
echo "<tr bgcolor=#$SSstd_row4_background><td align=right>"._QXZ("Extension Append CID").": </td><td align=left><select size=1 name=extension_appended_cidname><option value='Y'>"._QXZ("Y")."</option><option value='N'>"._QXZ("N")."</option><option value='$extension_appended_cidname' SELECTED>"._QXZ("$extension_appended_cidname")."</option></select>$NWB#campaigns-extension_appended_cidname$NWE</td></tr>\n";
echo "<tr bgcolor=#$SSstd_row4_background><td align=right>"._QXZ("Extension Append CID").": </td><td align=left><select size=1 name=extension_appended_cidname><option value='Y'>"._QXZ("Y")."</option><option value='N'>"._QXZ("N")."</option><option value='Y_USER'>"._QXZ("Y_USER")."</option><option value='Y_WITH_CAMPAIGN'>"._QXZ("Y_WITH_CAMPAIGN")."</option><option value='Y_USER_WITH_CAMPAIGN'>"._QXZ("Y_USER_WITH_CAMPAIGN")."</option><option value='$extension_appended_cidname' SELECTED>"._QXZ("$extension_appended_cidname")."</option></select>$NWB#campaigns-extension_appended_cidname$NWE</td></tr>\n";
echo "<tr bgcolor=#$SSstd_row3_background><td align=right>"._QXZ("Blind Monitor Warning").": </td><td align=left><select size=1 name=blind_monitor_warning><option value='DISABLED'>"._QXZ("DISABLED")."</option><option value='ALERT'>"._QXZ("ALERT")."</option><option value='NOTICE'>"._QXZ("NOTICE")."</option><option value='AUDIO'>"._QXZ("AUDIO")."</option><option value='ALERT_NOTICE'>"._QXZ("ALERT_NOTICE")."</option><option value='ALERT_AUDIO'>"._QXZ("ALERT_AUDIO")."</option><option value='NOTICE_AUDIO'>"._QXZ("NOTICE_AUDIO")."</option><option value='ALL'>"._QXZ("ALL")."</option><option value='$blind_monitor_warning' SELECTED>"._QXZ("$blind_monitor_warning")."</option></select>$NWB#campaigns-blind_monitor_warning$NWE</td></tr>\n";
@@ -27394,7 +27395,7 @@ if ($ADD==3111)
echo "<tr bgcolor=#$SSstd_row4_background><td align=right>"._QXZ("No Agent Call URL").": </td><td align=left><input type=text name=na_call_url size=70 maxlength=5000 value=\"$na_call_url\">$NWB#inbound_groups-na_call_url$NWE</td></tr>\n";
echo "<tr bgcolor=#$SSstd_row4_background><td align=right>"._QXZ("Extension Append CID").": </td><td align=left><select size=1 name=extension_appended_cidname><option value='Y'>"._QXZ("Y")."</option><option value='N'>"._QXZ("N")."</option><option value='$extension_appended_cidname' SELECTED>"._QXZ("$extension_appended_cidname")."</option></select>$NWB#inbound_groups-extension_appended_cidname$NWE</td></tr>\n";
echo "<tr bgcolor=#$SSstd_row4_background><td align=right>"._QXZ("Extension Append CID").": </td><td align=left><select size=1 name=extension_appended_cidname><option value='Y'>"._QXZ("Y")."</option><option value='N'>"._QXZ("N")."</option><option value='Y_USER'>"._QXZ("Y_USER")."</option><option value='Y_WITH_CAMPAIGN'>"._QXZ("Y_WITH_CAMPAIGN")."</option><option value='Y_USER_WITH_CAMPAIGN'>"._QXZ("Y_USER_WITH_CAMPAIGN")."</option><option value='$extension_appended_cidname' SELECTED>"._QXZ("$extension_appended_cidname")."</option></select>$NWB#inbound_groups-extension_appended_cidname$NWE</td></tr>\n";
echo "<tr bgcolor=#$SSstd_row4_background><td align=right>"._QXZ("Uniqueid Status Display").": </td><td align=left><select size=1 name=uniqueid_status_display><option value='DISABLED'>"._QXZ("DISABLED")."</option><option value='ENABLED'>"._QXZ("ENABLED")."</option><option value='ENABLED_PREFIX'>"._QXZ("ENABLED_PREFIX")."</option><option value='ENABLED_PRESERVE'>"._QXZ("ENABLED_PRESERVE")."</option><option value='$uniqueid_status_display' SELECTED>"._QXZ("$uniqueid_status_display")."</option></select>$NWB#inbound_groups-uniqueid_status_display$NWE</td></tr>\n";
@@ -39323,15 +39324,17 @@ if ($ADD==999999)
echo "<BR>\n";
echo "<B>"._QXZ("Custom Reports")."</B><BR>\n";
echo "<UL>\n";
$report_links_stmt="SELECT report_name, domain, path_name from vicidial_custom_reports where report_name in ('".implode("','", $allowed_reports_array)."')";
$report_links_stmt="SELECT report_name, domain, path_name, custom_variables from vicidial_custom_reports where report_name in ('".implode("','", $allowed_reports_array)."')";
$report_links_rslt=mysql_to_mysqli($report_links_stmt, $link);
while ($report_links_row=mysqli_fetch_array($report_links_rslt))
{
$domain=$report_links_row["domain"];
$path_name=$report_links_row["path_name"];
$custom_variables=ConvertPresets($report_links_row["custom_variables"]);
# $custom_variables=$report_links_row["custom_variables"];
$report_name=$report_links_row["report_name"];
echo "<LI><a href=\"".$domain.$path_name."\"><FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK size=2>"._QXZ("$report_name")."</a></FONT>\n";
echo "<LI><a href=\"".$domain.$path_name."?".$custom_variables."\"><FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK size=2>"._QXZ("$report_name")."</a></FONT>\n";
}
echo "</UL>\n";
}
+34
View File
@@ -31,6 +31,7 @@
# 170409-1003 - Added IP List features to user_authorization
# 170503-2130 - Patched sec_convert to fix rounding time bug, issue #1011
# 170526-2142 - Added additional auth variable filtering, issue #1016
# 170930-0852 - Added code for custom reports variable display
#
##### BEGIN validate user login credentials, check for failed lock out #####
@@ -1402,6 +1403,39 @@ function hex2rgb($hex) {
$rgb = array($r, $g, $b);
return $rgb; // returns an array with the rgb values
}
function ConvertPresets($URL_string)
{
$from_array=array(
"--A--today--B--",
"--A--yesterday--B--",
"--A--datetime--B--",
"--A--filedatetime--B--",
"--A--6days--B--",
"--A--7days--B--",
"--A--8days--B--",
"--A--13days--B--",
"--A--14days--B--",
"--A--15days--B--",
"--A--30days--B--"
);
$to_array=array(
date("Y-m-d"),
date("Y-m-d", time()-86400),
date("Y-m-d H:i:s"),
date("YmdHis"),
date("Y-m-d", time()-(86400*6)),
date("Y-m-d", time()-(86400*7)),
date("Y-m-d", time()-(86400*8)),
date("Y-m-d", time()-(86400*13)),
date("Y-m-d", time()-(86400*14)),
date("Y-m-d", time()-(86400*15)),
date("Y-m-d", time()-(86400*30))
);
$URL_string = strtr($URL_string, array_combine($from_array, $to_array));
return $URL_string;
}
function createDateRangeArray($strDateFrom,$strDateTo)
{
+25 -2
View File
@@ -135,6 +135,7 @@
# 170825-1129 - Added auto_reports-filename_override entry
# 170920-2156 - Added expired_lists_inactive entry
# 170923-1458 - Added settings-did_system_filter entry
# 170930-0906 - Added new extension append cidname options and custom reports help
#
@@ -1979,7 +1980,7 @@ if ($SSqc_features_active > 0)
<BR>
<A NAME="campaigns-extension_appended_cidname">
<BR>
<B><?php echo _QXZ("Extension Append CID"); ?> -</B><?php echo _QXZ("If enabled, the calls placed from this campaign will have a space and the phone extension of the agent appended to the end of the CallerID name for the call before it is sent to the agent. Default is N for disabled."); ?>
<B><?php echo _QXZ("Extension Append CID"); ?> -</B><?php echo _QXZ("If enabled, the calls placed from this campaign will have a space and the phone extension of the agent appended to the end of the CallerID name for the call before it is sent to the agent. Default is N for disabled. If USER is part of the option, then the user ID will be used instead of the phone extension. If WITH_CAMPAIGN is used, then another spae and the campaign ID will be included as well."); ?>
<BR>
<A NAME="campaigns-pllb_grouping">
@@ -2994,7 +2995,7 @@ if ($SSqc_features_active > 0)
<BR>
<A NAME="inbound_groups-extension_appended_cidname">
<BR>
<B><?php echo _QXZ("Extension Append CID"); ?> -</B><?php echo _QXZ("If enabled, the calls coming in from this in-group will have a space and the phone extension of the agent appended to the end of the CallerID name for the call before it is sent to the agent. Default is N for disabled."); ?>
<B><?php echo _QXZ("Extension Append CID"); ?> -</B><?php echo _QXZ("If enabled, the calls coming in from this in-group will have a space and the phone extension of the agent appended to the end of the CallerID name for the call before it is sent to the agent. Default is N for disabled. If USER is part of the option, then the user ID will be used instead of the phone extension. If WITH_CAMPAIGN is used, then another spae and the campaign ID will be included as well."); ?>
<BR>
<A NAME="inbound_groups-uniqueid_status_display">
@@ -6865,6 +6866,28 @@ if ($SSqc_features_active > 0)
<B><?php echo _QXZ("Path name"); ?> -</B><?php echo _QXZ("The path on the domain where the report is located. When the domain is blank it is assumed that the report is housed on the local web server."); ?>
<BR>
<A NAME="custom_reports_admin-constants">
<BR>
<B><?php echo _QXZ("Preset constants"); ?> -</B><?php echo _QXZ("Here is where a user can define a preset value to pass to the report when it is accessed from the custom report link. This is useful if the user is viewing a report that accepts multiple variables that change the report output and there is a certain set of report parameters the user frequently uses and they wish to save time by coming to the report with those values already set."); ?>
<BR>
<B><?php echo _QXZ("Variable name"); ?> -</B><?php echo _QXZ("The enters the variable name here. Names allow alphanumeric characters, underscores, and to a limited extent brackets. Brackets are used to pass an array to the report and should be placed at the end of the variable name, such as 'var_name[]'. The interface will condense brackets by removing any characters within a pair of them, and will also remove unmatched brackets."); ?>
<BR>
<B><?php echo _QXZ("Value"); ?> -</B><?php echo _QXZ("Then, the user enters a variable value in the \"Value\" field, either by selecting a pre-defined variable value or a custom value. With the exception of 'datetime' and 'filedatetime', all pre-defined variables are dates in yyyy-mm-dd format. The predefined values are: 'today' for today's date, 'yesterday' for yesterday's date, 'datetime' which is a timestamp in the format of 'yyyy-mm-dd hh:ii:ss', 'filedatetime' which is an all-numeric timestamp in the format 'yyyymmddhhiiss', and 6/7/8/13/14/15/30days, all of which are the date 6/7/etc days ago. If the user would like to define their own value for the variable, they can set the value to \"Custom Value\", then fill out the custom value in the field to the right. Click 'ADD' to add the variable name/value pair to the presets to include in the report. Values will be URL-encoded prior to being entered in the database."); ?>
<BR><BR>
<A NAME="custom_reports_admin-current_constants">
<BR>
<B><?php echo _QXZ("Current constants"); ?> -</B><?php echo _QXZ("Any report constant the user has entered to add to the report is displayed here. They are not editable, but they can be removed by clicking 'REMOVE' and then re-entered."); ?>
<BR><BR>
<A NAME="custom_reports_admin-preset_constants">
<BR>
<B><?php echo _QXZ("Preset constants"); ?> -</B><?php echo _QXZ("This textarea field is where presets for the current custom reports are displayed and can be edited. The name/value pairs are displayed per-line and are fully editable. Users can also remove variables simply by deleting the line they are displayed on, or can enter new name/value pairs per line. Variables can also be separated by an ampersand as in the typical URL GET display - the dialer interface will make the necessary adjustments to display them properly in this textarea field."); ?>
<BR><BR>
<A NAME="custom_reports_admin-custom_reports_user_groups">
<BR>
<B><?php echo _QXZ("User groups"); ?> -</B><?php echo _QXZ("The user groups that will be allowed to view this report. When a user goes to the reports page, if they belong to a user group that has access to any of the custom reports, they can see a Custom Reports section on this page with links to every custom report they can view."); ?>
+102 -13
View File
@@ -14,6 +14,7 @@
# 170822-2313 - Added screen colors
# 170823-1411 - Fixed delete bug
# 170829-0040 - Added screen color settings
# 170930-0908 - Added custom variables
#
$startMS = microtime();
@@ -32,6 +33,8 @@ if (isset($_GET["domain"])) {$domain=$_GET["domain"];}
elseif (isset($_POST["domain"])) {$domain=$_POST["domain"];}
if (isset($_GET["path_name"])) {$path_name=$_GET["path_name"];}
elseif (isset($_POST["path_name"])) {$path_name=$_POST["path_name"];}
if (isset($_GET["presets_string"])) {$presets_string=$_GET["presets_string"];}
elseif (isset($_POST["presets_string"])) {$presets_string=$_POST["presets_string"];}
if (isset($_GET["slave"])) {$slave=$_GET["slave"];}
elseif (isset($_POST["slave"])) {$slave=$_POST["slave"];}
if (isset($_GET["custom_reports_user_groups"])) {$custom_reports_user_groups=$_GET["custom_reports_user_groups"];}
@@ -48,6 +51,8 @@ if (isset($_GET["upd_report_name"])) {$upd_report_name=$_GET["upd_report_name
elseif (isset($_POST["upd_report_name"])) {$upd_report_name=$_POST["upd_report_name"];}
if (isset($_GET["upd_path_name"])) {$upd_path_name=$_GET["upd_path_name"];}
elseif (isset($_POST["upd_path_name"])) {$upd_path_name=$_POST["upd_path_name"];}
if (isset($_GET["upd_presets_string"])) {$upd_presets_string=$_GET["upd_presets_string"];}
elseif (isset($_POST["upd_presets_string"])) {$upd_presets_string=$_POST["upd_presets_string"];}
if (isset($_GET["upd_slave"])) {$upd_slave=$_GET["upd_slave"];}
elseif (isset($_POST["upd_slave"])) {$upd_slave=$_POST["upd_slave"];}
if (isset($_GET["upd_domain"])) {$upd_domain=$_GET["upd_domain"];}
@@ -220,7 +225,7 @@ if ($add_custom_report=="ADD REPORT") {
if (in_array($report_name, $Vreports)) {
$error_msg="<BR><B>"._QXZ("CANNOT ADD REPORT, REPORT NAME ALREADY IN USE FOR STANDARD VICIDIAL REPORT")."</B><BR>";
} else {
$ins_stmt="insert into vicidial_custom_reports(report_name, date_added, user, domain, path_name) VALUES('$report_name', now(), '$PHP_AUTH_USER', '$domain', '$path_name')";
$ins_stmt="insert into vicidial_custom_reports(report_name, date_added, user, domain, path_name, custom_variables) VALUES('$report_name', now(), '$PHP_AUTH_USER', '$domain', '$path_name', '$presets_string')";
$ins_rslt=mysql_to_mysqli($ins_stmt, $link);
if (mysqli_affected_rows($link)<1) {
$error_msg="<BR><B>"._QXZ("INSERT FAILED")."</B><BR>";
@@ -259,7 +264,7 @@ if ($add_custom_report=="ADD REPORT") {
$old_rpt_row=mysqli_fetch_row($old_rpt_rslt);
$old_rpt_name=$old_rpt_row[0];
$upd_stmt="update vicidial_custom_reports set report_name='$upd_report_name', date_added=now(), user='$PHP_AUTH_USER', domain='$upd_domain', path_name='$upd_path_name' where custom_report_id='$upd_custom_report_id'";
$upd_stmt="update vicidial_custom_reports set report_name='$upd_report_name', date_added=now(), user='$PHP_AUTH_USER', domain='$upd_domain', path_name='$upd_path_name', custom_variables='$upd_presets_string' where custom_report_id='$upd_custom_report_id'";
$upd_rslt=mysql_to_mysqli($upd_stmt, $link);
if (mysqli_affected_rows($link)<1) {
$error_msg="<BR><B>"._QXZ("UPDATE FAILED")."</B><BR>";
@@ -326,6 +331,26 @@ function SubmitIDValues(id_no) {
DMfieldName="domain"+id_no;
PNfieldName="path_name"+id_no;
UGfieldName="custom_reports_user_groups"+id_no;
CVfieldName="presets_string"+id_no;
var new_constants_string="";
var custom_variables = document.getElementById(CVfieldName).value.replace(/\n+/g, '&');
// custom_variables = document.getElementById(CVfieldName).value.replace(/\n/g, '&');
var ALL_presets_array=custom_variables.split("\&");
for (y=0; y<ALL_presets_array.length; y++) {
if (ALL_presets_array[y].length>0) {
var key_value=ALL_presets_array[y].split("\=");
if (key_value.length>=2)
{
key_value[0]=key_value[0].replace(/[^a-z0-9_\[\]]/gi, '');
key_value[0]=key_value[0].replace(/\[[^\]]+/gi, '[');
key_value[0]=key_value[0].replace(/\].*/gi, ']');
key_value[1]=key_value[1].replace(/[^- \.\:\/\@\_0-9a-zA-Z]/gi, '');
key_value[1]=encodeURIComponent(key_value[1]);
new_constants_string+="&"+key_value[0]+"="+key_value[1];
}
}
}
var selectedUGstr = "";
@@ -335,6 +360,7 @@ function SubmitIDValues(id_no) {
document.getElementById("upd_domain").value=document.getElementById(DMfieldName).value;
// document.getElementById("upd_slave").value=document.getElementById(SLfieldName).value;
document.getElementById("upd_path_name").value=document.getElementById(PNfieldName).value;
document.getElementById("upd_presets_string").value=new_constants_string;
//for (i=0;i<document.getElementById(SLfieldName).length;i++) {
// if (document.getElementById(SLfieldName)[i].selected) {
@@ -350,9 +376,60 @@ function SubmitIDValues(id_no) {
document.getElementById("updateForm").submit();
}
function AddConstant() {
var current_constants=document.getElementById('presets_string').value;
var new_variable_name=document.getElementById('new_preset_name').value;
new_variable_name=new_variable_name.replace(/[^a-z0-9_\[\]]/gi, '');
new_variable_name=new_variable_name.replace(/\[[^\]]+/gi, '[');
new_variable_name=new_variable_name.replace(/\].*/gi, ']');
var new_variable_value="";
for (x=0;x<document.getElementById('new_preset_value').length;x++) {
if (document.getElementById('new_preset_value')[x].selected && document.getElementById('new_preset_value')[x].value!="") {
new_variable_value = "--A--"+document.getElementById('new_preset_value')[x].value+"--B--";
}
}
if (new_variable_value=='') {new_variable_value=document.getElementById('new_preset_custom').value;}
new_variable_name=new_variable_name.replace(/[^- \.\:\/\@\_0-9a-zA-Z]/gi, '');
new_variable_value=encodeURIComponent(new_variable_value);
current_constants+="&"+new_variable_name+"="+new_variable_value;
current_constants = current_constants.replace(/^&/, '');
document.getElementById('presets_string').value=current_constants;
var ALL_presets_array=current_constants.split("\&");
var SpanInnerHTML="<table width='100%' border='0' cellpadding='3'>";
for (y=0; y<ALL_presets_array.length; y++) {
var key_value=ALL_presets_array[y].split("\=");
SpanInnerHTML+="<tr><td align='left'>"+key_value[0]+"</td><td align='left'>"+key_value[1]+"</td><td align='center'><input type='button' onClick='RemoveConstant("+y+")' value='REMOVE'></td></tr>";
}
SpanInnerHTML+="</table>";
document.getElementById('new_presets').innerHTML=SpanInnerHTML;
}
function RemoveConstant(array_index) {
var current_constants=document.getElementById('presets_string').value;
var new_constants_string="";
var ALL_presets_array=current_constants.split("\&");
var SpanInnerHTML="<table width='100%' border='0' cellpadding='3'>";
var x=0;
for (y=0; y<ALL_presets_array.length; y++) {
if (y!=array_index) {
new_constants_string+="&"+ALL_presets_array[y];
var key_value=ALL_presets_array[y].split("\=");
SpanInnerHTML+="<tr><td align='left'>"+key_value[0]+"</td><td align='left'>"+key_value[1]+"</td><td align='center'><input type='button' onClick='RemoveConstant("+x+")' value='REMOVE'></td></tr>";
x++;
}
}
SpanInnerHTML+="</table>";
new_constants_string = new_constants_string.replace(/^&/, '');
document.getElementById('new_presets').innerHTML=SpanInnerHTML;
document.getElementById('presets_string').value=new_constants_string;
}
</script>
<?php
echo "<link rel=\"stylesheet\" href=\"calendar.css\">\n";
echo "<link rel=\"stylesheet\" href=\"vicidial_stylesheet.php\">\n";
echo "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
echo "<TITLE>"._QXZ("ADMINISTRATION").": "._QXZ("Custom Reports");
@@ -390,12 +467,17 @@ function SubmitIDValues(id_no) {
echo "$error_msg";
echo "<br><B>"._QXZ("ADD A NEW CUSTOM REPORT")."</B><form action=$PHP_SELF method=GET>\n";
echo "<br><form action=$PHP_SELF method=GET>\n";
echo "<center><TABLE width=$section_width cellspacing=3>\n";
echo "<tr><td align='left' colspan='2'><FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2><B>"._QXZ("ADD A NEW CUSTOM REPORT")."</B></FONT></td></tr>\n";
echo "<tr bgcolor=#".$SSstd_row2_background."><td align=right>"._QXZ("Report Name").": </td><td align=left><input type=text name=report_name size=20 maxlength=100>$NWB#custom_reports_admin-report_name$NWE</td></tr>\n";
echo "<tr bgcolor=#".$SSstd_row2_background."><td align=right>"._QXZ("Domain").": </td><td align=left><input type=text name=domain size=20 maxlength=70> (leave blank if on same server as dialer admin)$NWB#custom_reports_admin-domain$NWE</td></tr>\n";
echo "<tr bgcolor=#".$SSstd_row2_background."><td align=right>"._QXZ("Path Name").": </td><td align=left><input type=text name=path_name size=20 maxlength=100>$NWB#custom_reports_admin-path_name$NWE</td></tr>\n";
echo "<tr bgcolor=#".$SSstd_row2_background."><td align=right>"._QXZ("Domain").": </td><td align=left><input type=text name='domain' id='domain' size=20 maxlength=70> (leave blank if on same server as dialer admin)$NWB#custom_reports_admin-domain$NWE</td></tr>\n";
echo "<tr bgcolor=#".$SSstd_row2_background."><td align=right>"._QXZ("Path Name").": </td><td align=left><input type=text id='path_name' name='path_name' size=20>$NWB#custom_reports_admin-path_name$NWE</td></tr>\n";
echo "<tr bgcolor=#".$SSstd_row2_background."><td align=right>"._QXZ("Preset constants").": </td><td align=left>Variable name: <input type='text' id='new_preset_name' name='new_preset_name' size='10' maxlength='100'>&nbsp;&nbsp;Value: ";
echo "<select name='new_preset_value' id='new_preset_value'><option value=''>Custom value --->></option><option value='today'>today</option><option value='yesterday'>yesterday</option><option value='datetime'>datetime</option><option value='filedatetime'>filedatetime</option><option value='6days'>6days</option><option value='7days'>7days</option><option value='8days'>8days</option><option value='13days'>13days</option><option value='14days'>14days</option><option value='15days'>15days</option><option value='30days'>30days</option></select>&nbsp;";
echo "<input type='text' name='new_preset_custom' id='new_preset_custom' size='10' maxlength='100'>&nbsp;<input type='button' onClick='AddConstant()' value='ADD'>$NWB#custom_reports_admin-constants$NWE</td></tr>\n";
echo "<tr bgcolor=#".$SSstd_row2_background."><td align=right>Current constants:</td><td align=left><span id='new_presets'></span>$NWB#custom_reports_admin-current_constants$NWE<input type='hidden' name='presets_string' id='presets_string'></td></tr>\n";
# echo "<tr bgcolor=#".$SSstd_row2_background."><td align=right>"._QXZ("Use slave").": </td><td align=left><select size=1 name=slave><option value='Y'>"._QXZ("Y")."</option><option value='N' selected>"._QXZ("N")."</option></select>$NWB#custom_reports_admin-use_slave$NWE</td></tr>\n";
echo "<tr bgcolor=#".$SSstd_row2_background."><td align=right>"._QXZ("User groups").": </td><td align=left><select size=5 name=custom_reports_user_groups[] multiple><option value='---ALL---'>"._QXZ("ALL USER GROUPS")."</option>";
@@ -428,7 +510,8 @@ function SubmitIDValues(id_no) {
echo "<tr bgcolor='#000000'>";
echo "<td><font size=1 color=white align=left>"._QXZ("REPORT NAME")."</font></td>";
echo "<td><font size=1 color=white align=left>"._QXZ("DOMAIN")."</font></td>";
echo "<td><font size=1 color=white align=left>"._QXZ("PATH NAME")."</font></td>";
# echo "<td><font size=1 color=white align=left>"._QXZ("PATH NAME")."</font></td>";
echo "<td><font size=1 color=white align=left>"._QXZ("PRESET CONSTANTS")."$NWB#custom_reports_admin-preset_constants$NWE</font></td>";
echo "<td>&nbsp;</td>";
# echo "<td><font size=1 color=white align=left>"._QXZ("SLAVE")."</font></td>";
echo "<td><font size=1 color=white align=left>"._QXZ("USER GROUPS")."</font></td>";
@@ -440,7 +523,6 @@ function SubmitIDValues(id_no) {
$current_rpt_name=$rpt_row["report_name"];
if ($bgcolor==$SSstd_row3_background) {$bgcolor=$SSstd_row4_background;} else {$bgcolor=$SSstd_row3_background;}
echo "<tr bgcolor='#".$bgcolor."'>";
$UGarray=array();
$UGstmt="select user_group from vicidial_user_groups where allowed_custom_reports like '%$current_rpt_name%' $LOGadmin_viewable_groupsSQL";
@@ -449,13 +531,15 @@ function SubmitIDValues(id_no) {
array_push($UGarray, $UGrow[0]);
}
$custom_variables=preg_replace("/\&/", "\n", urldecode($rpt_row["custom_variables"]));
echo "<td align=left><input type=text id=report_name".$id." name=report_name".$id." size=20 maxlength=100 value='".$rpt_row["report_name"]."'></td>\n";
echo "<td align=left><input type=text id=domain".$id." name=domain".$id." size=20 maxlength=70 value='".$rpt_row["domain"]."'></td>\n";
echo "<td align=left><input type=text id=path_name".$id." name=path_name".$id." size=20 maxlength=100 value='".$rpt_row["path_name"]."'></td>\n";
echo "<td align=center nowrap><a href='".$rpt_row["domain"].$rpt_row["path_name"]."' target='_blank'>TEST LINK</a></td>";
echo "<tr bgcolor='#".$bgcolor."'>";
echo "<td align=left><input type=text class='form_field' id='report_name".$id."' name='report_name".$id."' size=20 maxlength=100 value='".$rpt_row["report_name"]."'></td>\n";
echo "<td align=left><input type=text class='form_field' id='domain".$id."' name='domain".$id."' size=20 maxlength=70 value='".$rpt_row["domain"]."'></td>\n";
echo "<td align=left rowspan='2'><textarea class='form_field' rows='5' cols='35' id='presets_string".$id."' name='presets_string".$id."'>".$custom_variables."</textarea></td>\n";
echo "<td align=center nowrap rowspan='2'><a href='".$rpt_row["domain"].$rpt_row["path_name"]."?".$rpt_row["custom_variables"]."' target='_blank'>TEST LINK</a></td>";
# echo "<td align=left><select size=1 id=slave".$id." name=slave".$id."><option value='Y'>"._QXZ("Y")."</option><option value='N'>"._QXZ("N")."</option><option value='".$rpt_row["use_slave_server"]."' selected>"._QXZ($rpt_row["use_slave_server"])."</option></select></td>\n";
echo "<td align=left><select size=5 id=custom_reports_user_groups".$id." name=custom_reports_user_groups".$id." multiple><option value='---ALL---'>"._QXZ("ALL USER GROUPS")."</option>";
echo "<td align=left rowspan='2'><select size=5 class='form_field' id=custom_reports_user_groups".$id." name=custom_reports_user_groups".$id." multiple><option value='---ALL---'>"._QXZ("ALL USER GROUPS")."</option>";
$stmt="SELECT user_group,group_name from vicidial_user_groups $whereLOGadmin_viewable_groupsSQL order by user_group;";
$rslt=mysql_to_mysqli($stmt, $link);
@@ -467,7 +551,11 @@ function SubmitIDValues(id_no) {
echo "<option value='$ug_row[0]' $x>$ug_row[1]</option>";
$i++;
}
echo "<td align='center'><input type='button' value='"._QXZ("UPDATE")."' onClick=\"SubmitIDValues($id)\"><BR><BR><a href='vicidial_custom_reports_admin.php?delete_custom_report=".$id."'>"._QXZ("DELETE")."</a></td>";
echo "<td align='center'><font size=1><input type='button' class='blue_btn' value='"._QXZ("UPDATE")."' onClick=\"SubmitIDValues($id)\"></td>";
echo "</tr>";
echo "<tr bgcolor='#".$bgcolor."'>";
echo "<td colspan='2' align=left nowrap><font size='1'>PATH:<input type=text class='form_field' id='path_name".$id."' name='path_name".$id."' size=40 maxlength=100 value='".$rpt_row["path_name"]."'></font></td>\n";
echo "<td align='center'><a href='vicidial_custom_reports_admin.php?delete_custom_report=".$id."'>"._QXZ("DELETE")."</a></font></td>";
echo "</tr>\n";
}
@@ -478,6 +566,7 @@ function SubmitIDValues(id_no) {
echo "<input type=hidden name='upd_domain' id='upd_domain'>";
# echo "<input type=hidden name='upd_slave' id='upd_slave'>";
echo "<input type=hidden name='upd_path_name' id='upd_path_name'>";
echo "<input type=hidden name='upd_presets_string' id='upd_presets_string'>";
echo "<input type=hidden name='upd_custom_reports_user_groups' id='upd_custom_reports_user_groups'>";
echo "</form>";