diff --git a/agc_2-X/trunk/bin/Vtiger_OUT_sync2VICIDIAL_file.pl b/agc_2-X/trunk/bin/Vtiger_OUT_sync2VICIDIAL_file.pl
index 3fde5cb5..58c1d2cc 100644
--- a/agc_2-X/trunk/bin/Vtiger_OUT_sync2VICIDIAL_file.pl
+++ b/agc_2-X/trunk/bin/Vtiger_OUT_sync2VICIDIAL_file.pl
@@ -736,7 +736,7 @@ while ($sthBrowsC > $i)
if ($VL_exists > 0)
{
$user='';
- $stmtA = "SELECT user FROM vicidial_user_territories where territory='$territory';";
+ $stmtA = "SELECT user FROM vicidial_user_territories where territory='$territory' order by level desc,user;";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
diff --git a/agc_2-X/trunk/docs/ALTERNATE_NUMBER_DIALING.txt b/agc_2-X/trunk/docs/ALTERNATE_NUMBER_DIALING.txt
index 48ae7ae7..9ee5674a 100644
--- a/agc_2-X/trunk/docs/ALTERNATE_NUMBER_DIALING.txt
+++ b/agc_2-X/trunk/docs/ALTERNATE_NUMBER_DIALING.txt
@@ -12,7 +12,7 @@ vicidial.php agent screen and vdc_db_query.php scripts have been changed to allo
AST_VDauto_dial.pl, AST_VDauto_dial_FILL.pl and the VDhangup process in FastAGI_log.pl have all been modified to work with the new alt number data structure.
-non_agent_api.php needs to be changed to accept new multiple-al-numbers per inserted lead.
+non_agent_api.php needs to be changed to accept new multiple-alt-numbers per inserted lead.
File structure for CLI lead loader goes here:
diff --git a/agc_2-X/trunk/extras/MySQL_AST_CREATE_tables.sql b/agc_2-X/trunk/extras/MySQL_AST_CREATE_tables.sql
index 70adf25f..1159f9ba 100644
--- a/agc_2-X/trunk/extras/MySQL_AST_CREATE_tables.sql
+++ b/agc_2-X/trunk/extras/MySQL_AST_CREATE_tables.sql
@@ -1101,7 +1101,8 @@ sounds_central_control_active ENUM('0','1') default '0',
sounds_web_server VARCHAR(15) default '127.0.0.1',
sounds_web_directory VARCHAR(255) default '',
active_voicemail_server VARCHAR(15) default '',
-auto_dial_limit VARCHAR(5) default '4'
+auto_dial_limit VARCHAR(5) default '4',
+user_territories_active ENUM('0','1') default '0'
);
CREATE TABLE vicidial_campaigns_list_mix (
@@ -1506,10 +1507,18 @@ unique index menuoption (menu_id, option_value)
CREATE TABLE vicidial_user_territories (
user VARCHAR(20) NOT NULL,
territory VARCHAR(100) default '',
+level ENUM('TOP_AGENT','STANDARD_AGENT','BOTTOM_AGENT') default 'STANDARD_AGENT',
index (user),
unique index userterritory (user, territory)
);
+CREATE TABLE vicidial_territories (
+territory_id MEDIUMINT(8) UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL,
+territory VARCHAR(100) default '',
+territory_description VARCHAR(255) default '',
+unique index uniqueterritory (territory)
+);
+
ALTER TABLE vicidial_campaign_server_stats ENGINE=HEAP;
@@ -1606,7 +1615,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='1143';
+UPDATE system_settings SET db_schema_version='1144';
GRANT RELOAD ON *.* TO cron@'%';
GRANT RELOAD ON *.* TO cron@localhost;
diff --git a/agc_2-X/trunk/extras/upgrade_2.2.0.sql b/agc_2-X/trunk/extras/upgrade_2.2.0.sql
index 48d3141a..c37318c3 100644
--- a/agc_2-X/trunk/extras/upgrade_2.2.0.sql
+++ b/agc_2-X/trunk/extras/upgrade_2.2.0.sql
@@ -103,3 +103,16 @@ ALTER TABLE system_settings ADD active_voicemail_server VARCHAR(15) default '';
ALTER TABLE system_settings ADD auto_dial_limit VARCHAR(5) default '4';
UPDATE system_settings SET db_schema_version='1143';
+
+CREATE TABLE vicidial_territories (
+territory_id MEDIUMINT(8) UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL,
+territory VARCHAR(100) default '',
+territory_description VARCHAR(255) default '',
+unique index uniqueterritory (territory)
+);
+
+ALTER TABLE vicidial_user_territories ADD level ENUM('TOP_AGENT','STANDARD_AGENT','BOTTOM_AGENT') default 'STANDARD_AGENT';
+
+ALTER TABLE system_settings ADD user_territories_active ENUM('0','1') default '0';
+
+UPDATE system_settings SET db_schema_version='1144';
diff --git a/agc_2-X/trunk/translations/raw_translation_files/TO_BE_TRANSLATED_2.2.0.txt b/agc_2-X/trunk/translations/raw_translation_files/TO_BE_TRANSLATED_2.2.0.txt
index c7be9e45..64844a25 100644
--- a/agc_2-X/trunk/translations/raw_translation_files/TO_BE_TRANSLATED_2.2.0.txt
+++ b/agc_2-X/trunk/translations/raw_translation_files/TO_BE_TRANSLATED_2.2.0.txt
@@ -119,8 +119,42 @@ Active Voicemail Server||
In multi-server systems, this is the server that will handle all voicemail boxes. This server is also where the dial-in generated prompts will be uploaded from, the 8168 recordings||
Auto Dial Limit||
This is the maximum limit of the auto dial level in the campaign screen||
+User Territories are not active on this system||
+User Territories||
+List All Territories:||
+User Territories Active||
+This setting allows you to enable the User Territories setttings from the user modification screen. This feature was added to allow for more integration with a customized Vtiger installation but can have applications in a pure ViciDial system as well. Default is 0 for disabled||
+List Territories||
+Add Territory||
+Add User Territory||
+Territory||
+Territory Description||
+Territory and Territory Description must be filled in||
+there is already a territory in the system with this name||
+Territory Added||
+Modify Territory||
+Territory not found||
+This territory is not in the system with this name||
+Territory Modified||
+Territory must be filled in||
+Territory Deleted||
+Delete This Territory||
+Vtiger Accounts||
+Agents||
+Territory, User and Level must be filled in||
+this territory user is already in the system||
+User Territory Added||
+this territory user is not in the system||
+User Territory Modified||
+Territory and User must be filled in||
+User Territory Deleted||
+Vtiger Change Territory Owner||
+Had to add user territory||
+Vtiger Territory Owner Changed||
+Records Changed||
+add-file: user_territories.php
add-file: audio_store.php
############################################################ CLIENT
diff --git a/agc_2-X/trunk/www/vicidial/admin.php b/agc_2-X/trunk/www/vicidial/admin.php
index 700e0284..da54f227 100644
--- a/agc_2-X/trunk/www/vicidial/admin.php
+++ b/agc_2-X/trunk/www/vicidial/admin.php
@@ -1024,6 +1024,8 @@ if (isset($_GET["active_voicemail_server"])) {$active_voicemail_server=$_GET["
elseif (isset($_POST["active_voicemail_server"])) {$active_voicemail_server=$_POST["active_voicemail_server"];}
if (isset($_GET["auto_dial_limit"])) {$auto_dial_limit=$_GET["auto_dial_limit"];}
elseif (isset($_POST["auto_dial_limit"])) {$auto_dial_limit=$_POST["auto_dial_limit"];}
+if (isset($_GET["user_territories_active"])) {$user_territories_active=$_GET["user_territories_active"];}
+ elseif (isset($_POST["user_territories_active"])) {$user_territories_active=$_POST["user_territories_active"];}
if (isset($script_id)) {$script_id= strtoupper($script_id);}
if (isset($lead_filter_id)) {$lead_filter_id = strtoupper($lead_filter_id);}
@@ -1215,6 +1217,7 @@ $track_in_vdac = ereg_replace("[^0-9]","",$track_in_vdac);
$menu_repeat = ereg_replace("[^0-9]","",$menu_repeat);
$agentonly_callback_campaign_lock = ereg_replace("[^0-9]","",$agentonly_callback_campaign_lock);
$sounds_central_control_active = ereg_replace("[^0-9]","",$sounds_central_control_active);
+$user_territories_active = ereg_replace("[^0-9]","",$user_territories_active);
### DIGITS and COLONS
$shift_length = ereg_replace("[^\:0-9]","",$shift_length);
@@ -1766,11 +1769,12 @@ $dialplan_entry = ereg_replace("\r","",$dialplan_entry);
# 90511-0910 - Added agentonly_callback_campaign_lock to system_settings
# 90512-0440 - Added sounds settings to system_settings table
# 90514-0607 - Added select prompts from list in call menu and in-group screens
+# 90521-0029 - Added select prompts from list in call menu and in-group screens
#
# 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.2.0-185';
-$build = '90514-0607';
+$admin_version = '2.2.0-186';
+$build = '90521-0029';
$STARTtime = date("U");
$SQLdate = date("Y-m-d H:i:s");
@@ -1816,7 +1820,7 @@ if ($force_logout)
#############################################
##### START SYSTEM_SETTINGS LOOKUP #####
-$stmt = "SELECT use_non_latin,auto_dial_limit FROM system_settings;";
+$stmt = "SELECT use_non_latin,auto_dial_limit,user_territories_active FROM system_settings;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$qm_conf_ct = mysql_num_rows($rslt);
@@ -1824,8 +1828,9 @@ $i=0;
while ($i < $qm_conf_ct)
{
$row=mysql_fetch_row($rslt);
- $non_latin = $row[0];
- $SSauto_dial_limit = $row[1];
+ $non_latin = $row[0];
+ $SSauto_dial_limit = $row[1];
+ $SSuser_territories_active = $row[2];
$i++;
}
##### END SETTINGS LOOKUP #####
@@ -5244,6 +5249,11 @@ FR_SPAC 00 00 00 00 00 - France space separated phone number
Max FILL Calls per Second - This setting determines the maximum number of calls that can be placed by the auto-FILL outbound auto-dialing script on for all servers, per second. Must be from 1 to 200. Default is 40.
+
+
+
+User Territories Active - This setting allows you to enable the User Territories setttings from the user modification screen. This feature was added to allow for more integration with a customized Vtiger installation but can have applications in a pure ViciDial system as well. Default is 0 for disabled.
+
@@ -11636,7 +11646,7 @@ if ($ADD==411111111111111)
echo "
VICIDIAL SYSTEM SETTINGS MODIFIED\n";
- $stmt="UPDATE system_settings set use_non_latin='$use_non_latin',webroot_writable='$webroot_writable',enable_queuemetrics_logging='$enable_queuemetrics_logging',queuemetrics_server_ip='$queuemetrics_server_ip',queuemetrics_dbname='$queuemetrics_dbname',queuemetrics_login='$queuemetrics_login',queuemetrics_pass='$queuemetrics_pass',queuemetrics_url='$queuemetrics_url',queuemetrics_log_id='$queuemetrics_log_id',queuemetrics_eq_prepend='$queuemetrics_eq_prepend',vicidial_agent_disable='$vicidial_agent_disable',allow_sipsak_messages='$allow_sipsak_messages',admin_home_url='$admin_home_url',enable_agc_xfer_log='$enable_agc_xfer_log',timeclock_end_of_day='$timeclock_end_of_day',vdc_header_date_format='$vdc_header_date_format',vdc_customer_date_format='$vdc_customer_date_format',vdc_header_phone_format='$vdc_header_phone_format',vdc_agent_api_active='$vdc_agent_api_active',enable_vtiger_integration='$enable_vtiger_integration',vtiger_server_ip='$vtiger_server_ip',vtiger_dbname='$vtiger_dbname',vtiger_login='$vtiger_login',vtiger_pass='$vtiger_pass',vtiger_url='$vtiger_url',qc_features_active='$qc_features_active',outbound_autodial_active='$outbound_autodial_active',outbound_calls_per_second='$outbound_calls_per_second',agentonly_callback_campaign_lock='$agentonly_callback_campaign_lock',sounds_central_control_active='$sounds_central_control_active',sounds_web_server='$sounds_web_server',sounds_web_directory='$sounds_web_directory',active_voicemail_server='$active_voicemail_server',auto_dial_limit='$auto_dial_limit';";
+ $stmt="UPDATE system_settings set use_non_latin='$use_non_latin',webroot_writable='$webroot_writable',enable_queuemetrics_logging='$enable_queuemetrics_logging',queuemetrics_server_ip='$queuemetrics_server_ip',queuemetrics_dbname='$queuemetrics_dbname',queuemetrics_login='$queuemetrics_login',queuemetrics_pass='$queuemetrics_pass',queuemetrics_url='$queuemetrics_url',queuemetrics_log_id='$queuemetrics_log_id',queuemetrics_eq_prepend='$queuemetrics_eq_prepend',vicidial_agent_disable='$vicidial_agent_disable',allow_sipsak_messages='$allow_sipsak_messages',admin_home_url='$admin_home_url',enable_agc_xfer_log='$enable_agc_xfer_log',timeclock_end_of_day='$timeclock_end_of_day',vdc_header_date_format='$vdc_header_date_format',vdc_customer_date_format='$vdc_customer_date_format',vdc_header_phone_format='$vdc_header_phone_format',vdc_agent_api_active='$vdc_agent_api_active',enable_vtiger_integration='$enable_vtiger_integration',vtiger_server_ip='$vtiger_server_ip',vtiger_dbname='$vtiger_dbname',vtiger_login='$vtiger_login',vtiger_pass='$vtiger_pass',vtiger_url='$vtiger_url',qc_features_active='$qc_features_active',outbound_autodial_active='$outbound_autodial_active',outbound_calls_per_second='$outbound_calls_per_second',agentonly_callback_campaign_lock='$agentonly_callback_campaign_lock',sounds_central_control_active='$sounds_central_control_active',sounds_web_server='$sounds_web_server',sounds_web_directory='$sounds_web_directory',active_voicemail_server='$active_voicemail_server',auto_dial_limit='$auto_dial_limit',user_territories_active='$user_territories_active';";
$rslt=mysql_query($stmt, $link);
### LOG INSERTION Admin Log Table ###
@@ -19056,7 +19066,7 @@ if ($ADD==311111111111111)
echo "
| \n";
echo "";
- $stmt="SELECT version,install_date,use_non_latin,webroot_writable,enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_url,queuemetrics_log_id,queuemetrics_eq_prepend,vicidial_agent_disable,allow_sipsak_messages,admin_home_url,enable_agc_xfer_log,db_schema_version,auto_user_add_value,timeclock_end_of_day,timeclock_last_reset_date,vdc_header_date_format,vdc_customer_date_format,vdc_header_phone_format,vdc_agent_api_active,qc_last_pull_time,enable_vtiger_integration,vtiger_server_ip,vtiger_dbname,vtiger_login,vtiger_pass,vtiger_url,qc_features_active,outbound_autodial_active,outbound_calls_per_second,agentonly_callback_campaign_lock,sounds_central_control_active,sounds_web_server,sounds_web_directory,active_voicemail_server,auto_dial_limit from system_settings;";
+ $stmt="SELECT version,install_date,use_non_latin,webroot_writable,enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_url,queuemetrics_log_id,queuemetrics_eq_prepend,vicidial_agent_disable,allow_sipsak_messages,admin_home_url,enable_agc_xfer_log,db_schema_version,auto_user_add_value,timeclock_end_of_day,timeclock_last_reset_date,vdc_header_date_format,vdc_customer_date_format,vdc_header_phone_format,vdc_agent_api_active,qc_last_pull_time,enable_vtiger_integration,vtiger_server_ip,vtiger_dbname,vtiger_login,vtiger_pass,vtiger_url,qc_features_active,outbound_autodial_active,outbound_calls_per_second,agentonly_callback_campaign_lock,sounds_central_control_active,sounds_web_server,sounds_web_directory,active_voicemail_server,auto_dial_limit,user_territories_active from system_settings;";
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$version = $row[0];
@@ -19099,6 +19109,7 @@ if ($ADD==311111111111111)
$sounds_web_directory = $row[37];
$active_voicemail_server = $row[38];
$auto_dial_limit = $row[39];
+ $user_territories_active = $row[40];
echo " MODIFY VICIDIAL SYSTEM SETTINGS | |
| >Time Sheet | |
| + >User Territories | |
>
diff --git a/agc_2-X/trunk/www/vicidial/audio_store.php b/agc_2-X/trunk/www/vicidial/audio_store.php
index b520c0a9..b2798c3b 100644
--- a/agc_2-X/trunk/www/vicidial/audio_store.php
+++ b/agc_2-X/trunk/www/vicidial/audio_store.php
@@ -43,7 +43,7 @@ header ("Pragma: no-cache"); // HTTP/1.0
#############################################
##### START SYSTEM_SETTINGS LOOKUP #####
-$stmt = "SELECT use_non_latin,sounds_central_control_active,sounds_web_server,sounds_web_directory FROM system_settings;";
+$stmt = "SELECT use_non_latin,sounds_central_control_active,sounds_web_server,sounds_web_directory,outbound_autodial_active FROM system_settings;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$ss_conf_ct = mysql_num_rows($rslt);
@@ -54,6 +54,7 @@ if ($ss_conf_ct > 0)
$sounds_central_control_active = $row[1];
$sounds_web_server = $row[2];
$sounds_web_directory = $row[3];
+ $SSoutbound_autodial_active = $row[4];
}
##### END SETTINGS LOOKUP #####
###########################################
diff --git a/agc_2-X/trunk/www/vicidial/user_territories.php b/agc_2-X/trunk/www/vicidial/user_territories.php
new file mode 100644
index 00000000..cc367998
--- /dev/null
+++ b/agc_2-X/trunk/www/vicidial/user_territories.php
@@ -0,0 +1,945 @@
+ LICENSE: AGPLv2
+#
+# This territories script is for use with custom tables in Vtiger which is why
+# it is separate from the standard admin.php script. user_territories_active in
+# the system_settings table must be active for this script to work.
+#
+# CHANGES
+# 90520-1928 - first build
+#
+
+$version = '2.2.0-1';
+$build = '90520-1928';
+
+$MT[0]='';
+
+require("dbconnect.php");
+
+$PHP_SELF=$_SERVER['PHP_SELF'];
+if (isset($_GET["action"])) {$action=$_GET["action"];}
+ elseif (isset($_POST["action"])) {$action=$_POST["action"];}
+if (isset($_GET["DB"])) {$DB=$_GET["DB"];}
+ elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];}
+if (isset($_GET["territory"])) {$territory=$_GET["territory"];}
+ elseif (isset($_POST["territory"])) {$territory=$_POST["territory"];}
+if (isset($_GET["territory_description"])) {$territory_description=$_GET["territory_description"];}
+ elseif (isset($_POST["territory_description"])) {$territory_description=$_POST["territory_description"];}
+if (isset($_GET["user"])) {$user=$_GET["user"];}
+ elseif (isset($_POST["user"])) {$user=$_POST["user"];}
+if (isset($_GET["level"])) {$level=$_GET["level"];}
+ elseif (isset($_POST["level"])) {$level=$_POST["level"];}
+if (isset($_GET["accountid"])) {$accountid=$_GET["accountid"];}
+ elseif (isset($_POST["accountid"])) {$accountid=$_POST["accountid"];}
+if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];}
+ elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];}
+
+
+header ("Content-type: text/html; charset=utf-8");
+header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
+header ("Pragma: no-cache"); // HTTP/1.0
+
+#############################################
+##### START SYSTEM_SETTINGS LOOKUP #####
+$stmt = "SELECT use_non_latin,user_territories_active,enable_vtiger_integration,outbound_autodial_active,vtiger_server_ip,vtiger_dbname,vtiger_login,vtiger_pass,vtiger_url FROM system_settings;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$ss_conf_ct = mysql_num_rows($rslt);
+if ($ss_conf_ct > 0)
+ {
+ $row=mysql_fetch_row($rslt);
+ $non_latin = $row[0];
+ $user_territories_active = $row[1];
+ $enable_vtiger_integration = $row[2];
+ $SSoutbound_autodial_active = $row[3];
+ $vtiger_server_ip = $row[4];
+ $vtiger_dbname = $row[5];
+ $vtiger_login = $row[6];
+ $vtiger_pass = $row[7];
+ $vtiger_url = $row[8];
+ }
+##### END SETTINGS LOOKUP #####
+###########################################
+
+
+### check if sounds server matches this server IP, if not then exit with an error
+if ($user_territories_active < 1)
+ {
+ echo "ERROR: User Territories are not active on this system\n";
+ exit;
+ }
+
+if ($non_latin < 1)
+ {
+ ### Clean Variable Values ###
+ $DB = ereg_replace("[^0-9]","",$DB);
+ $action = ereg_replace("[^\_0-9a-zA-Z]","",$action);
+ $territory = ereg_replace("[^-\_0-9a-zA-Z]","",$territory);
+ $territory_description = ereg_replace("[^ -\_\.\,0-9a-zA-Z]","",$territory_description);
+ $user = ereg_replace("[^-\_0-9a-zA-Z]","",$user);
+ $level = ereg_replace("[^\_A-Z]","",$level);
+ $old_territory = ereg_replace("[^-\_0-9a-zA-Z]","",$old_territory);
+ $old_user = ereg_replace("[^-\_0-9a-zA-Z]","",$old_user);
+ }
+
+$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER'];
+$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW'];
+$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER);
+$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW);
+
+$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7 and modify_users='1'";
+if ($DB) {echo "|$stmt|\n";}
+$rslt=mysql_query($stmt, $link);
+$row=mysql_fetch_row($rslt);
+$auth=$row[0];
+
+if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
+ {
+ Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
+ Header("HTTP/1.0 401 Unauthorized");
+ echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n";
+ exit;
+ }
+
+if ($enable_vtiger_integration > 0)
+ {
+ ### connect to your vtiger database
+ $linkV=mysql_connect("$vtiger_server_ip", "$vtiger_login","$vtiger_pass");
+ if (!$linkV) {die("Could not connect: $vtiger_server_ip|$vtiger_dbname|$vtiger_login|$vtiger_pass" . mysql_error());}
+ mysql_select_db("$vtiger_dbname", $linkV);
+ }
+
+
+if (strlen($action) < 1)
+ {$action = 'LIST_ALL_TERRITORIES';}
+
+
+
+?>
+
+
+
+
+
|