diff --git a/UPGRADE b/UPGRADE
index a073e8f6..ec62efd1 100644
--- a/UPGRADE
+++ b/UPGRADE
@@ -245,7 +245,15 @@ NOTE: Upgrading from 1.1.12-3 to 2.0.1 is at the bottom
drop inbound group to override campaign settings for leads within a
specific list
-
+62. Added Agent-selectable territories list upon login to select what list
+ territories they want to place calls in.
+ REQUIREMENTS:
+ - Must have System Setting "User Territories Active" enabled
+ - Must have Campaign "No Hopper Dialing" enabled
+ - Must have Campaign "Owner Only Dialing" set to TERRITORY
+ - Must have Campaign "Agent Select Territories" enabled
+ - Must have User "Agent Choose Territories" enabled
+ - Leads must have the owner field set to desired territory
diff --git a/docs/QUEUEMETRICS.txt b/docs/QUEUEMETRICS.txt
index 6a013c61..98027d56 100644
--- a/docs/QUEUEMETRICS.txt
+++ b/docs/QUEUEMETRICS.txt
@@ -145,6 +145,15 @@ index(call_id)
);
+
+# NOTE: by default QueueMetrics does not index the time_id and call_id field. We strongly recommend you add these indexes:
+
+CREATE INDEX time_id on queue_log(time_id);
+CREATE INDEX call_id on queue_log(call_id);
+
+
+
+
partition: set to "P01" for the first partition, should match up with configuration.properties presets
time_id: epoch, unixtime (seconds since 1970-01-01 00:00:00) [1170345603]
@@ -209,6 +218,7 @@ serverid: number of the server the call came from [for VICIDIAL use the database
+### For documentation ONLY, these fields should already exist:
On the vicidial database side of things, we will add the following columns to the system_settings table:
enable_queuemetrics_logging ENUM('0','1') default '0',
queuemetrics_server_ip VARCHAR(15),
@@ -297,6 +307,12 @@ er=queuemetrics&password=javadude
+# NOTE: by default QueueMetrics does not index the time_id and call_id field. We strongly recommend you add these indexes:
+mysql queuemetrics
+CREATE INDEX time_id on queue_log(time_id);
+CREATE INDEX call_id on queue_log(call_id);
+
+
@@ -330,16 +346,18 @@ How to install Queue Metrics on OpenSuSE v.11.1 (32 or 64 bit) with a system tha
15) mysql queuemetrics --execute="GRANT ALL PRIVILEGES ON queuemetrics.* TO queuemetrics@localhost IDENTIFIED BY 'javadude';"
16) mysql queuemetrics --execute="GRANT ALL PRIVILEGES ON queuemetrics.* TO queuemetrics@'%' IDENTIFIED BY 'javadude';"
17) mysql queuemetrics --user=queuemetrics --password=javadude < /srv/tomcat6/webapps/QM/WEB-INF/README/queuemetrics_sample.sql
-18) rctomcat6 start
+18) mysql queuemetrics --execute="CREATE INDEX time_id on queue_log(time_id);"
+19) mysql queuemetrics --execute="CREATE INDEX call_id on queue_log(call_id);"
+20) rctomcat6 start
-19) Edit /srv/tomcat6/webapps/QM/WEB-INF/configuration.properties and change the entry to the following:
+21) Edit /srv/tomcat6/webapps/QM/WEB-INF/configuration.properties and change the entry to the following:
- # This is the default queue log file.
- default.queue_log_file=sql:P01
-20) Edit /srv/tomcat6/webapps/QM/WEB-INF/web.xml and change the IP address of the following entry:
+22) Edit /srv/tomcat6/webapps/QM/WEB-INF/web.xml and change the IP address of the following entry:
- jdbc:mysql://10.0.0.4/queuemetrics?autoReconnect=true&zeroDateTimeBehavior=convertToNull&jdbcCompliantTruncation=false&user=queuemetrics&password=javadude
-21) Go to http://:8080/QM and it should tell you the schema is old, just click next or yes to everything and have fun
+23) Go to http://:8080/QM and it should tell you the schema is old, just click next or yes to everything and have fun
diff --git a/extras/MySQL_AST_CREATE_tables.sql b/extras/MySQL_AST_CREATE_tables.sql
index 7a394aab..e66cc4cd 100644
--- a/extras/MySQL_AST_CREATE_tables.sql
+++ b/extras/MySQL_AST_CREATE_tables.sql
@@ -306,7 +306,8 @@ index (status),
index (gmt_offset_now),
index (postal_code),
index (last_local_call_time),
-index (rank)
+index (rank),
+index (owner)
);
CREATE TABLE vicidial_hopper (
@@ -351,6 +352,7 @@ external_pause VARCHAR(20) default '',
external_dial VARCHAR(100) default '',
agent_log_id INT(9) UNSIGNED default '0',
last_state_change DATETIME,
+agent_territories TEXT,
index (random_id),
index (last_call_time),
index (last_update_time),
@@ -515,7 +517,8 @@ delete_from_dnc ENUM('0','1') default '0',
email VARCHAR(100) default '',
user_code VARCHAR(100) default '',
territory VARCHAR(100) default '',
-allow_alerts ENUM('0','1') default '0'
+allow_alerts ENUM('0','1') default '0',
+agent_choose_territories ENUM('0','1') default '1'
);
@@ -675,7 +678,8 @@ no_hopper_dialing ENUM('Y','N') default 'N',
agent_dial_owner_only ENUM('NONE','USER','TERRITORY','USER_GROUP') default 'NONE',
agent_display_dialable_leads ENUM('Y','N') default 'N',
web_form_address_two TEXT,
-waitforsilence_options VARCHAR(25) default ''
+waitforsilence_options VARCHAR(25) default '',
+agent_select_territories ENUM('Y','N') default 'N'
);
CREATE TABLE vicidial_lists (
@@ -1810,6 +1814,15 @@ old_messages INT(4) default '0',
email VARCHAR(100)
);
+CREATE TABLE vicidial_user_territory_log (
+user VARCHAR(20),
+campaign_id VARCHAR(20),
+event_date DATETIME,
+agent_territories TEXT,
+index (user),
+index (event_date)
+);
+
ALTER TABLE vicidial_campaign_server_stats ENGINE=HEAP;
@@ -1934,7 +1947,7 @@ CREATE INDEX phone_number on vicidial_closer_log (phone_number);
CREATE INDEX date_user on vicidial_closer_log (call_date,user);
CREATE INDEX comment_a on live_inbound_log (comment_a);
-UPDATE system_settings SET db_schema_version='1175',db_schema_update_date=NOW();
+UPDATE system_settings SET db_schema_version='1176',db_schema_update_date=NOW();
GRANT RELOAD ON *.* TO cron@'%';
GRANT RELOAD ON *.* TO cron@localhost;
diff --git a/extras/upgrade_2.2.0.sql b/extras/upgrade_2.2.0.sql
index 545976e1..d2a5283b 100644
--- a/extras/upgrade_2.2.0.sql
+++ b/extras/upgrade_2.2.0.sql
@@ -566,3 +566,22 @@ ALTER TABLE vicidial_lists ADD am_message_exten_override VARCHAR(100) default ''
ALTER TABLE vicidial_lists ADD drop_inbound_group_override VARCHAR(20) default '';
UPDATE system_settings SET db_schema_version='1175',db_schema_update_date=NOW();
+
+ALTER TABLE vicidial_campaigns ADD agent_select_territories ENUM('Y','N') default 'N';
+
+ALTER TABLE vicidial_users ADD agent_choose_territories ENUM('0','1') default '1';
+
+ALTER TABLE vicidial_live_agents ADD agent_territories TEXT;
+
+CREATE INDEX owner ON vicidial_list (owner);
+
+CREATE TABLE vicidial_user_territory_log (
+user VARCHAR(20),
+campaign_id VARCHAR(20),
+event_date DATETIME,
+agent_territories TEXT,
+index (user),
+index (event_date)
+);
+
+UPDATE system_settings SET db_schema_version='1176',db_schema_update_date=NOW();
diff --git a/translations/raw_translation_files/TO_BE_TRANSLATED_2.2.0.txt b/translations/raw_translation_files/TO_BE_TRANSLATED_2.2.0.txt
index c7122bfc..8feae818 100644
--- a/translations/raw_translation_files/TO_BE_TRANSLATED_2.2.0.txt
+++ b/translations/raw_translation_files/TO_BE_TRANSLATED_2.2.0.txt
@@ -336,6 +336,10 @@ Answering Machine Message Override||
If this field is set, this will override the Answering Machine Message set in the campaign for customers in this list. Default is not set||
Drop Inbound Group Override||
If this field is set, this in-group will be used for outbound calls within this list that drop from the outbound campaign instead of the drop in-group set in the campaign detail screen. Default is not set||
+Agent Select Territories||
+If this option is enabled and the agent belongs to at least one territory, the agent will have the option of selecting territories to dial leads from. The agent will see a list of available territories upon login and they will have the ability to go back to that territory list when paused to change their territories. For this function to work the Owner Only Dialing option must be set to TERRITORY and User Terriories must be enabled in the System Settings.
+Agent Choose Territories||
+This option if set to 1 allows the user to choose the territories that they will receive calls from when they login to a MANUAL or INBOUND_MAN campaign. Otherwise the user will be set to use all of the territories that they are set to belong to in the User Territories administrative section||
add-file: user_territories.php
diff --git a/www/agc/vdc_db_query.php b/www/agc/vdc_db_query.php
index 6018446a..3e91fc18 100644
--- a/www/agc/vdc_db_query.php
+++ b/www/agc/vdc_db_query.php
@@ -13,7 +13,7 @@
# - $pass
# optional variables:
# - $format - ('text','debug')
-# - $ACTION - ('regCLOSER','manDiaLnextCALL','manDiaLskip','manDiaLonly','manDiaLlookCALL','manDiaLlogCALL','userLOGout','updateDISPO','updateLEAD','VDADpause','VDADready','VDADcheckINCOMING','UpdatEFavoritEs','CalLBacKLisT','CalLBacKCounT','PauseCodeSubmit','LogiNCamPaigns','alt_phone_change','AlertControl','AGENTSview','CALLSINQUEUEview','CALLSINQUEUEgrab','DiaLableLeaDsCounT')
+# - $ACTION - ('regCLOSER','regTERRITORY','manDiaLnextCALL','manDiaLskip','manDiaLonly','manDiaLlookCALL','manDiaLlogCALL','userLOGout','updateDISPO','updateLEAD','VDADpause','VDADready','VDADcheckINCOMING','UpdatEFavoritEs','CalLBacKLisT','CalLBacKCounT','PauseCodeSubmit','LogiNCamPaigns','alt_phone_change','AlertControl','AGENTSview','CALLSINQUEUEview','CALLSINQUEUEgrab','DiaLableLeaDsCounT')
# - $stage - ('start','finish','lookup','new')
# - $closer_choice - ('CL_TESTCAMP_L CL_OUT123_L -')
# - $conf_exten - ('8600011',...)
@@ -85,6 +85,7 @@
# - $wrapup - ('WRAPUP','')
# - $vtiger_callback_id - ('16534'...)
# - $nodeletevdac - ('0','1')
+# - $agent_territories - ('ABC001','ABC002'...)
#
# CHANGELOG:
# 50629-1044 - First build of script
@@ -214,12 +215,13 @@
# 90916-1839 - Added nodeletevdac
# 90917-2246 - Fixed auto-alt-dial DNC check bug
# 90924-1544 - Added List callerid override option
+# 90930-1638 - Added agent_territories feature
#
-$version = '2.2.0-124';
-$build = '90924-1544';
+$version = '2.2.0-125';
+$build = '90930-1638';
$mel=1; # Mysql Error Log enabled = 1
-$mysql_log_count=252;
+$mysql_log_count=256;
$one_mysql_log=0;
require("dbconnect.php");
@@ -393,7 +395,8 @@ if (isset($_GET["no_delete_sessions"])) {$no_delete_sessions=$_GET["no_delete
elseif (isset($_POST["no_delete_sessions"])) {$no_delete_sessions=$_POST["no_delete_sessions"];}
if (isset($_GET["nodeletevdac"])) {$nodeletevdac=$_GET["nodeletevdac"];}
elseif (isset($_POST["nodeletevdac"])) {$nodeletevdac=$_POST["nodeletevdac"];}
-
+if (isset($_GET["agent_territories"])) {$agent_territories=$_GET["agent_territories"];}
+ elseif (isset($_POST["agent_territories"])) {$agent_territories=$_POST["agent_territories"];}
header ("Content-type: text/html; charset=utf-8");
header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
@@ -786,6 +789,64 @@ if ($ACTION == 'regCLOSER')
+#################################################################################
+### regTERRITORY - update the vicidial_live_agents table to reflect the territory
+### choices made upon login or while paused (agent_territories)
+#################################################################################
+if ($ACTION == 'regTERRITORY')
+ {
+ $row=''; $rowx='';
+ $channel_live=1;
+ if ( (strlen($agent_territories)<1) || (strlen($user)<1) )
+ {
+ $channel_live=0;
+ echo "Territory Choice $agent_territories is not valid\n";
+ exit;
+ }
+ else
+ {
+ if (preg_match("/^MGRLOCK/",$agent_territories))
+ {
+ $stmt="SELECT territory FROM vicidial_user_territories where user='$user';";
+ $rslt=mysql_query($stmt, $link);
+ if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00253',$user,$server_ip,$session_name,$one_mysql_log);}
+ $territories_ct = mysql_num_rows($rslt);
+ if ($DB) {echo "$territories_ct|$stmt\n";}
+ $k=0;
+ $agent_territories='';
+ while ($territories_ct > $k)
+ {
+ $row=mysql_fetch_row($rslt);
+ $agent_territories .= " $row[0]";
+ $k++;
+ }
+ $agent_territories .= " -";
+
+ $stmt="UPDATE vicidial_live_agents set agent_territories='$agent_territories',last_state_change='$NOW_TIME' where user='$user' and server_ip='$server_ip';";
+ if ($format=='debug') {echo "\n";}
+ $rslt=mysql_query($stmt, $link);
+ if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00254',$user,$server_ip,$session_name,$one_mysql_log);}
+ }
+ else
+ {
+ $stmt="UPDATE vicidial_live_agents set agent_territories='$agent_territories',last_state_change='$NOW_TIME' where user='$user' and server_ip='$server_ip';";
+ if ($format=='debug') {echo "\n";}
+ $rslt=mysql_query($stmt, $link);
+ if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00255',$user,$server_ip,$session_name,$one_mysql_log);}
+ }
+
+ $stmt="INSERT INTO vicidial_user_territory_log set user='$user',campaign_id='$campaign',event_date='$NOW_TIME',agent_territories='$agent_territories';";
+ if ($format=='debug') {echo "\n";}
+ $rslt=mysql_query($stmt, $link);
+ if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00256',$user,$server_ip,$session_name,$one_mysql_log);}
+ }
+ echo "Territory Choice $agent_territories has been registered to user $user\n";
+ }
+
+
+
+
+
################################################################################
### For every process below, lookup the current agent_log_id for the user
################################################################################
diff --git a/www/agc/vicidial.php b/www/agc/vicidial.php
index 2ab61926..d0e3eba1 100644
--- a/www/agc/vicidial.php
+++ b/www/agc/vicidial.php
@@ -36,7 +36,6 @@
# 50817-1113 - Fixes to auto_dialing call receipt
# 50817-1234 - Added inbound call receipt capability
# 50817-1541 - Added customer time display
-# 50817-1541 - Added customer time display
# 50818-1327 - Added stop-all-recordings-after-each-vicidial-call option
# 50818-1703 - Added pretty login section
# 50825-1200 - Modified form field lengths, added double-click dispositions
@@ -257,10 +256,11 @@
# 90920-2108 - Changed web forms to use window.open instead of traditional links(IE7 compatibility issue)
# 90923-1310 - Rolled back last change
# 90928-1955 - Added lead update before closer transfer
+# 90930-2243 - Added Territory selection functions
#
-$version = '2.2.0-234';
-$build = '90928-1955';
+$version = '2.2.0-235';
+$build = '90930-2243';
$mel=1; # Mysql Error Log enabled = 1
$mysql_log_count=61;
$one_mysql_log=0;
@@ -338,7 +338,7 @@ $random = (rand(1000000, 9999999) + 10000000);
#############################################
##### START SYSTEM_SETTINGS LOOKUP #####
-$stmt = "SELECT use_non_latin,vdc_header_date_format,vdc_customer_date_format,vdc_header_phone_format,webroot_writable,timeclock_end_of_day,vtiger_url,enable_vtiger_integration,outbound_autodial_active,enable_second_webform FROM system_settings;";
+$stmt = "SELECT use_non_latin,vdc_header_date_format,vdc_customer_date_format,vdc_header_phone_format,webroot_writable,timeclock_end_of_day,vtiger_url,enable_vtiger_integration,outbound_autodial_active,enable_second_webform,user_territories_active FROM system_settings;";
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01001',$VD_login,$server_ip,$session_name,$one_mysql_log);}
if ($DB) {echo "$stmt\n";}
@@ -357,6 +357,7 @@ while ($i < $qm_conf_ct)
$enable_vtiger_integration = $row[7];
$outbound_autodial_active = $row[8];
$enable_second_webform = $row[9];
+ $user_territories_active = $row[10];
$i++;
}
@@ -513,7 +514,7 @@ if ($MGR_override > 0)
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01059',$VD_login,$server_ip,$session_name,$one_mysql_log);}
- print "\n";
+ echo "\n";
### Add a record to the vicidial_admin_log
$SQL_log = "$stmt|";
@@ -797,7 +798,7 @@ $VDloginDISPLAY=0;
$login=strtoupper($VD_login);
$password=strtoupper($VD_pass);
##### grab the full name of the agent
- $stmt="SELECT full_name,user_level,hotkeys_active,agent_choose_ingroups,scheduled_callbacks,agentonly_callbacks,agentcall_manual,vicidial_recording,vicidial_transfers,closer_default_blended,user_group,vicidial_recording_override,alter_custphone_override,alert_enabled,agent_shift_enforcement_override,shift_override_flag,allow_alerts,closer_campaigns from vicidial_users where user='$VD_login' and pass='$VD_pass'";
+ $stmt="SELECT full_name,user_level,hotkeys_active,agent_choose_ingroups,scheduled_callbacks,agentonly_callbacks,agentcall_manual,vicidial_recording,vicidial_transfers,closer_default_blended,user_group,vicidial_recording_override,alter_custphone_override,alert_enabled,agent_shift_enforcement_override,shift_override_flag,allow_alerts,closer_campaigns,agent_choose_territories from vicidial_users where user='$VD_login' and pass='$VD_pass'";
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01007',$VD_login,$server_ip,$session_name,$one_mysql_log);}
$row=mysql_fetch_row($rslt);
@@ -819,6 +820,7 @@ $VDloginDISPLAY=0;
$VU_shift_override_flag = $row[15];
$VU_allow_alerts = $row[16];
$VU_closer_campaigns = $row[17];
+ $VU_agent_choose_territories = $row[18];
if ( ($VU_alert_enabled > 0) and ($VU_allow_alerts > 0) ) {$VU_alert_enabled = 'ON';}
else {$VU_alert_enabled = 'OFF';}
@@ -895,7 +897,7 @@ $VDloginDISPLAY=0;
$stmt="SELECT shift_id,shift_start_time,shift_length,shift_weekdays from vicidial_shifts where $LOGgroup_shiftsSQL order by shift_id";
$rslt=mysql_query($stmt, $link);
- if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01056',$user,$server_ip,$session_name,$one_mysql_log);}
+ if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01056',$VD_login,$server_ip,$session_name,$one_mysql_log);}
$shifts_to_print = mysql_num_rows($rslt);
$o=0;
@@ -962,10 +964,6 @@ $VDloginDISPLAY=0;
-
-
-
-
if ($WeBRooTWritablE > 0)
{
fwrite ($fp, "vdweb|GOOD|$date|$VD_login|$VD_pass|$ip|$browser|$LOGfullname|\n");
@@ -1089,7 +1087,7 @@ $VDloginDISPLAY=0;
$HKstatusnames = substr("$HKstatusnames", 0, -1);
##### grab the campaign settings
- $stmt="SELECT park_ext,park_file_name,web_form_address,allow_closers,auto_dial_level,dial_timeout,dial_prefix,campaign_cid,campaign_vdad_exten,campaign_rec_exten,campaign_recording,campaign_rec_filename,campaign_script,get_call_launch,am_message_exten,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,alt_number_dialing,scheduled_callbacks,wrapup_seconds,wrapup_message,closer_campaigns,use_internal_dnc,allcalls_delay,omit_phone_code,agent_pause_codes_active,no_hopper_leads_logins,campaign_allow_inbound,manual_dial_list_id,default_xfer_group,xfer_groups,disable_alter_custphone,display_queue_count,manual_dial_filter,agent_clipboard_copy,use_campaign_dnc,three_way_call_cid,dial_method,three_way_dial_prefix,web_form_target,vtiger_screen_login,agent_allow_group_alias,default_group_alias,quick_transfer_button,prepopulate_transfer_preset,view_calls_in_queue,view_calls_in_queue_launch,call_requeue_button,pause_after_each_call,no_hopper_dialing,agent_dial_owner_only,agent_display_dialable_leads,web_form_address_two FROM vicidial_campaigns where campaign_id = '$VD_campaign';";
+ $stmt="SELECT park_ext,park_file_name,web_form_address,allow_closers,auto_dial_level,dial_timeout,dial_prefix,campaign_cid,campaign_vdad_exten,campaign_rec_exten,campaign_recording,campaign_rec_filename,campaign_script,get_call_launch,am_message_exten,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,alt_number_dialing,scheduled_callbacks,wrapup_seconds,wrapup_message,closer_campaigns,use_internal_dnc,allcalls_delay,omit_phone_code,agent_pause_codes_active,no_hopper_leads_logins,campaign_allow_inbound,manual_dial_list_id,default_xfer_group,xfer_groups,disable_alter_custphone,display_queue_count,manual_dial_filter,agent_clipboard_copy,use_campaign_dnc,three_way_call_cid,dial_method,three_way_dial_prefix,web_form_target,vtiger_screen_login,agent_allow_group_alias,default_group_alias,quick_transfer_button,prepopulate_transfer_preset,view_calls_in_queue,view_calls_in_queue_launch,call_requeue_button,pause_after_each_call,no_hopper_dialing,agent_dial_owner_only,agent_display_dialable_leads,web_form_address_two,agent_select_territories FROM vicidial_campaigns where campaign_id = '$VD_campaign';";
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01013',$VD_login,$server_ip,$session_name,$one_mysql_log);}
if ($DB) {echo "$stmt\n";}
@@ -1149,6 +1147,14 @@ $VDloginDISPLAY=0;
$agent_dial_owner_only = $row[52];
$agent_display_dialable_leads = $row[53];
$web_form_address_two = $row[54];
+ $agent_select_territories = $row[55];
+
+ if ($user_territories_active < 1)
+ {$agent_select_territories = 0;}
+ if (preg_match("/Y/",$agent_select_territories))
+ {$agent_select_territories=1;}
+ else
+ {$agent_select_territories=0;}
if (preg_match("/Y/",$agent_display_dialable_leads))
{$agent_display_dialable_leads=1;}
@@ -1208,7 +1214,7 @@ $VDloginDISPLAY=0;
}
}
- $stmt = "select group_web_vars from vicidial_campaign_agents where campaign_id='$VD_campaign' and user='$user';";
+ $stmt = "select group_web_vars from vicidial_campaign_agents where campaign_id='$VD_campaign' and user='$VD_login';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01056',$VD_login,$server_ip,$session_name,$one_mysql_log);}
@@ -1222,7 +1228,7 @@ $VDloginDISPLAY=0;
if ( (!ereg('DISABLED',$VU_vicidial_recording_override)) and ($VU_vicidial_recording > 0) )
{
$campaign_recording = $VU_vicidial_recording_override;
- print "\n";
+ echo "\n";
}
if ( ($VC_scheduled_callbacks=='Y') and ($VU_scheduled_callbacks=='1') )
{$scheduled_callbacks='1';}
@@ -1295,6 +1301,27 @@ $VDloginDISPLAY=0;
else
{$closer_campaigns = "''";}
+ ##### gather territory listings for this agent if select territories is enabled
+ $VARterritories='';
+ if ($agent_select_territories > 0)
+ {
+ $stmt="SELECT territory from vicidial_user_territories where user='$VD_login';";
+ $rslt=mysql_query($stmt, $link);
+ if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01XXX',$VD_login,$server_ip,$session_name,$one_mysql_log);}
+ if ($DB) {echo "$stmt\n";}
+ $territory_ct = mysql_num_rows($rslt);
+ $territoryCT=0;
+ while ($territoryCT < $territory_ct)
+ {
+ $row=mysql_fetch_row($rslt);
+ $territories[$territoryCT] =$row[0];
+ $VARterritories = "$VARterritories'$territories[$territoryCT]',";
+ $territoryCT++;
+ }
+ $VARterritories = substr("$VARterritories", 0, -1);
+ echo "\n";
+ }
+
##### grab the allowable inbound groups to choose from for transfer options
$xfer_groups = preg_replace("/^ | -$/","",$xfer_groups);
$xfer_groups = preg_replace("/ /","','",$xfer_groups);
@@ -1355,7 +1382,7 @@ $VDloginDISPLAY=0;
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
$campaign_leads_to_call = $row[0];
- print "\n";
+ echo "\n";
}
else
@@ -1673,15 +1700,15 @@ else
{
$VICIDiaL_park_on_extension = "$park_ext";
$VICIDiaL_park_on_filename = "$park_file_name";
- print "\n";
+ echo "\n";
}
- print "\n";
+ echo "\n";
# If a web form address is not set, use the default one
if (strlen($web_form_address)>0)
{
$VICIDiaL_web_form_address = "$web_form_address";
- print "\n";
+ echo "\n";
}
else
{
@@ -1695,12 +1722,12 @@ else
if (strlen($web_form_address_two)>0)
{
$VICIDiaL_web_form_address_two = "$web_form_address_two";
- print "\n";
+ echo "\n";
}
else
{
$VICIDiaL_web_form_address_two = "$VICIDiaL_web_form_address";
- print "\n";
+ echo "\n";
$VICIDiaL_web_form_address_two_enc = rawurlencode($VICIDiaL_web_form_address_two);
}
$VICIDiaL_web_form_address_two_enc = rawurlencode($VICIDiaL_web_form_address_two);
@@ -1709,12 +1736,12 @@ else
if ($allow_closers=="Y")
{
$VICIDiaL_allow_closers = 1;
- print "\n";
+ echo "\n";
}
else
{
$VICIDiaL_allow_closers = 0;
- print "\n";
+ echo "\n";
}
@@ -1760,7 +1787,7 @@ else
$i++;
}
if ($prev_login_ct > 0)
- {print "\n";}
+ {echo "\n";}
else
{
##### grab the next available vicidial_conference room and reserve it
@@ -1776,14 +1803,14 @@ else
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01034',$VD_login,$server_ip,$session_name,$one_mysql_log);}
- $stmt="SELECT conf_exten from vicidial_conferences where server_ip='$server_ip' and ( (extension='$SIP_user') or (extension='$user') );";
+ $stmt="SELECT conf_exten from vicidial_conferences where server_ip='$server_ip' and ( (extension='$SIP_user') or (extension='$VD_login') );";
if ($format=='debug') {echo "\n";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01035',$VD_login,$server_ip,$session_name,$one_mysql_log);}
$row=mysql_fetch_row($rslt);
$session_id = $row[0];
}
- print "\n";
+ echo "\n";
}
### mark leads that were not dispositioned during previous calls as ERI
@@ -1792,30 +1819,30 @@ else
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01036',$VD_login,$server_ip,$session_name,$one_mysql_log);}
$affected_rows = mysql_affected_rows($link);
- print "\n";
+ echo "\n";
$stmt="DELETE from vicidial_hopper where status IN('QUEUE','INCALL','DONE') and user ='$VD_login';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01037',$VD_login,$server_ip,$session_name,$one_mysql_log);}
$affected_rows = mysql_affected_rows($link);
- print "\n";
+ echo "\n";
$stmt="DELETE from vicidial_live_agents where user ='$VD_login';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01038',$VD_login,$server_ip,$session_name,$one_mysql_log);}
$affected_rows = mysql_affected_rows($link);
- print "\n";
+ echo "\n";
$stmt="DELETE from vicidial_live_inbound_agents where user ='$VD_login';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01039',$VD_login,$server_ip,$session_name,$one_mysql_log);}
$affected_rows = mysql_affected_rows($link);
- print "\n";
+ echo "\n";
- # print "You have logged in as user: $VD_login on phone: $SIP_user to campaign: $VD_campaign \n";
+ # echo "You have logged in as user: $VD_login on phone: $SIP_user to campaign: $VD_campaign \n";
$VICIDiaL_is_logged_in=1;
### set the callerID for manager middleware-app to connect the phone to the user
@@ -1846,7 +1873,7 @@ else
if ( ($enable_sipsak_messages > 0) and ($allow_sipsak_messages > 0) and (eregi("SIP",$protocol)) )
{
$SIPSAK_prefix = 'LIN-';
- print "\n";
+ echo "\n";
passthru("/usr/local/bin/sipsak -M -O desktop -B \"$SIPSAK_prefix$VD_campaign\" -r 5060 -s sip:$extension@$phone_ip > /dev/null");
$SIqueryCID = "$SIPSAK_prefix$VD_campaign$DS$CIDdate";
}
@@ -1857,7 +1884,7 @@ else
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01041',$VD_login,$server_ip,$session_name,$one_mysql_log);}
$affected_rows = mysql_affected_rows($link);
- print "\n";
+ echo "\n";
##### grab the campaign_weight and number of calls today on that campaign for the agent
$stmt="SELECT campaign_weight,calls_today FROM vicidial_campaign_agents where user='$VD_login' and campaign_id = '$VD_campaign';";
@@ -1881,12 +1908,12 @@ else
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01043',$VD_login,$server_ip,$session_name,$one_mysql_log);}
$affected_rows = mysql_affected_rows($link);
- print "\n";
+ echo "\n";
}
if ($auto_dial_level > 0)
{
- print "\n";
+ echo "\n";
$closer_chooser_string='';
@@ -1895,7 +1922,7 @@ else
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01044',$VD_login,$server_ip,$session_name,$one_mysql_log);}
$affected_rows = mysql_affected_rows($link);
- print "\n";
+ echo "\n";
if ($enable_queuemetrics_logging > 0)
{
@@ -1907,14 +1934,14 @@ else
$rslt=mysql_query($stmt, $linkB);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'01045',$VD_login,$server_ip,$session_name,$one_mysql_log);}
$affected_rows = mysql_affected_rows($linkB);
- print "\n";
+ echo "\n";
$stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtimE',call_id='NONE',queue='NONE',agent='Agent/$VD_login',verb='PAUSEALL',serverid='$queuemetrics_log_id';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $linkB);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'01046',$VD_login,$server_ip,$session_name,$one_mysql_log);}
$affected_rows = mysql_affected_rows($linkB);
- print "\n";
+ echo "\n";
mysql_close($linkB);
mysql_select_db("$VARDB_database", $link);
@@ -1935,7 +1962,7 @@ else
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01047',$VD_login,$server_ip,$session_name,$one_mysql_log);}
$affected_rows = mysql_affected_rows($link);
- print "\n";
+ echo "\n";
if ($enable_queuemetrics_logging > 0)
{
@@ -1947,14 +1974,14 @@ else
$rslt=mysql_query($stmt, $linkB);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'01048',$VD_login,$server_ip,$session_name,$one_mysql_log);}
$affected_rows = mysql_affected_rows($linkB);
- print "\n";
+ echo "\n";
$stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtimE',call_id='NONE',queue='NONE',agent='Agent/$VD_login',verb='PAUSEALL',serverid='$queuemetrics_log_id';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $linkB);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'01049',$VD_login,$server_ip,$session_name,$one_mysql_log);}
$affected_rows = mysql_affected_rows($linkB);
- print "\n";
+ echo "\n";
mysql_close($linkB);
mysql_select_db("$VARDB_database", $link);
@@ -2013,12 +2040,12 @@ else
if (ereg('MSIE',$browser))
{
$useIE=1;
- print "\n";
+ echo "\n";
}
else
{
$useIE=0;
- print "\n";
+ echo "\n";
}
$StarTtimE = date("U");
@@ -2030,7 +2057,7 @@ else
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01050',$VD_login,$server_ip,$session_name,$one_mysql_log);}
$affected_rows = mysql_affected_rows($link);
$agent_log_id = mysql_insert_id($link);
- print "\n";
+ echo "\n";
$stmt="UPDATE vicidial_live_agents SET agent_log_id='$agent_log_id' where user='$VD_login';";
if ($DB) {echo "$stmt\n";}
@@ -2227,6 +2254,8 @@ $CCAL_OUT .= "";
var VU_hotkeys_active = '';
var VU_agent_choose_ingroups = '';
var VU_agent_choose_ingroups_DV = '';
+ var agent_choose_territories = '';
+ var agent_select_territories = '';
var VU_closer_campaigns = '';
var CallBackDatETimE = '';
var CallBackrecipient = '';
@@ -2251,6 +2280,8 @@ $CCAL_OUT .= "";
var VD_statuses_ct = '';
VARingroups = new Array();
var INgroupCOUNT = '';
+ VARterritories = new Array();
+ var territoryCOUNT = '';
VARxfergroups = new Array();
VARxfergroupsnames = new Array();
var XFgroupCOUNT = '';
@@ -7401,7 +7432,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";}
{
var CloserSelectListValue = document.vicidial_form.CloserSelectList.value;
var CSCchange = 0;
- var regCS = new RegExp(" "+taskCSgrp+" ","ig");
+ var regCS = new RegExp(" " + taskCSgrp + " ","ig");
var regCSall = new RegExp("-ALL-----","ig");
var regCSallADD = new RegExp("-----ADD-ALL-----","ig");
var regCSallDELETE = new RegExp("-----DELETE-ALL-----","ig");
@@ -7427,7 +7458,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";}
var live_CSC_LIST_value = " ";
while (loop_ct < INgroupCOUNT)
{
- var regCSL = new RegExp(" "+VARingroups[loop_ct]+" ","ig");
+ var regCSL = new RegExp(" " + VARingroups[loop_ct] + " ","ig");
if (CloserSelectListValue.match(regCSL)) {CSCcolumn = 'DELETE';}
else {CSCcolumn = 'ADD';}
if ( ( (VARingroups[loop_ct] == taskCSgrp) && (taskCSchange == 'DELETE') ) || (taskCSgrp.match(regCSallDELETE)) ) {CSCcolumn = 'ADD';}
@@ -7518,6 +7549,142 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";}
}
+// ################################################################################
+// Generate the Territory Chooser panel
+ function TerritorySelectContent_create()
+ {
+ if (agent_select_territories == '1')
+ {
+ if (agent_choose_territories > 0)
+ {
+ var live_TERR_HTML = "
";
if ($enable_vtiger_integration > 0)
{
- $stmtV="SELECT id from vtiger_users where user_name='$rowx[0]';";
+ $stmtV="SELECT id from vtiger_users where user_name='$Tuser[$o]';";
$rsltV=mysql_query($stmtV, $linkV);
if ($DB) {echo "$stmtV\n";}
$vtu_ct = mysql_num_rows($rsltV);
@@ -910,21 +933,35 @@ if ($action == "MODIFY_TERRITORY")
if ($vca_ct > 0)
{
$row=mysql_fetch_row($rsltV);
- echo "