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 "\n"; + echo "\n"; echo "\n"; diff --git a/agc_2-X/trunk/www/vicidial/admin_header.php b/agc_2-X/trunk/www/vicidial/admin_header.php index 36490869..cdb93826 100644 --- a/agc_2-X/trunk/www/vicidial/admin_header.php +++ b/agc_2-X/trunk/www/vicidial/admin_header.php @@ -480,7 +480,15 @@ $admin_home_url_LU = $row[0];   >User Status > + 0) or ($user_territories_active > 0) ) + { ?> + + > +
\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
\n"; echo "\n"; @@ -19236,6 +19247,8 @@ if ($ADD==311111111111111) echo "
Max FILL Calls per Second: $NWB#settings-outbound_calls_per_second$NWE
User Territories Active: $NWB#settings-user_territories_active$NWE
QC Features Active: $NWB#settings-qc_features_active$NWE
QC Last Pull Time: $qc_last_pull_time
  >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';} + + + +?> + + + + +VICIDIAL ADMINISTRATION: User Territories +<?php + + + + + + +### BEGIN change territory owner for one account +if ( ($action == "CHANGE_TERRITORY_OWNER_ACCOUNT") and ($enable_vtiger_integration > 0) ) + { + echo "\n"; + echo "
\n"; + echo ""; + + echo "
Vtiger Change Territory Owner\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "
Account ID:
New Owner:
\n"; + exit; + } +### END change territory owner for one account + + +### BEGIN process change territory owner for one account +if ( ($action == "PROCESS_CHANGE_TERRITORY_OWNER_ACCOUNT") and ($enable_vtiger_integration > 0) ) + { + echo "\n"; + + if ( (strlen($accountid)<1) or (strlen($user)<1) ) + { + echo "ERROR: Account ID and User must be filled in
\n"; + } + else + { + $stmtV="SELECT tickersymbol from vtiger_account where accountid='$accountid';"; + $rsltV=mysql_query($stmtV, $linkV); + if ($DB) {echo "$stmtV\n";} + $vat_ct = mysql_num_rows($rsltV); + if ($vat_ct > 0) + { + $row=mysql_fetch_row($rsltV); + $territory = $row[0]; + + $stmt="SELECT count(*) from vicidial_user_territories where territory='$territory' and user='$user';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] < 1) + { + $stmt="INSERT INTO vicidial_user_territories SET territory='$territory',user='$user',level='STANDARD_AGENT';"; + $rslt=mysql_query($stmt, $link); + + echo "NOTICE: Had to add user territory: $user $territory
\n"; + + ### LOG INSERTION Admin Log Table ### + $SQL_log = "$stmt|$stmtB|"; + $SQL_log = ereg_replace(';','',$SQL_log); + $SQL_log = addslashes($SQL_log); + $stmt="INSERT INTO vicidial_admin_log set event_date='$NOW_TIME', user='$PHP_AUTH_USER', ip_address='$ip', event_section='TERRITORIES', event_type='ADD', record_id='$territory', event_code='ADMIN ADD USER TERRITORY', event_sql=\"$SQL_log\", event_notes='';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + } + + $stmtV="SELECT id from vtiger_users where user_name='$user';"; + $rsltV=mysql_query($stmtV, $linkV); + if ($DB) {echo "$stmtV\n";} + $vtu_ct = mysql_num_rows($rsltV); + if ($vtu_ct > 0) + { + $row=mysql_fetch_row($rsltV); + $user_id = $row[0]; + + $stmt="UPDATE vtiger_crmentity SET smownerid='$user_id',smcreatorid='$user_id',modifiedby='$user_id' where crmid='$accountid';"; + $rsltV=mysql_query($stmt, $linkV); + $changed = mysql_affected_rows($linkV); + + $stmtB="UPDATE vtiger_tracker SET user_id='$user_id' where item_id='$accountid';"; + $rsltV=mysql_query($stmtB, $linkV); + + + echo "Vtiger Territory Owner Changed: $user $territory
\n"; + echo "Records Changed: $changed
\n"; + + ### LOG INSERTION Admin Log Table ### + $SQL_log = "$stmt|$stmtB|"; + $SQL_log = ereg_replace(';','',$SQL_log); + $SQL_log = addslashes($SQL_log); + $stmt="INSERT INTO vicidial_admin_log set event_date='$NOW_TIME', user='$PHP_AUTH_USER', ip_address='$ip', event_section='VTIGER', event_type='MODIFY', record_id='$accountid', event_code='VTIGER MODIFY TERRITORY OWNER ACCOUNT', event_sql=\"$SQL_log\", event_notes='';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + } + } + } + exit; + } +### END process change territory owner for one account + + + + + +##### BEGIN Set variables to make header show properly ##### +$ADD = '0'; +$hh = 'users'; +$LOGast_admin_access = '1'; +$ADMIN = 'admin.php'; +$page_width='770'; +$section_width='750'; +$header_font_size='3'; +$subheader_font_size='2'; +$subcamp_font_size='2'; +$header_selected_bold=''; +$header_nonselected_bold=''; +$users_color = '#FFFF99'; +$users_font = 'BLACK'; +$users_color = '#E6E6E6'; +$subcamp_color = '#C6C6C6'; +##### END Set variables to make header show properly ##### + +require("admin_header.php"); + +$colspan='3'; + +?> + BGCOLOR=#E6E6E6 cellpadding=2 cellspacing=0> + + + + + 0) + { ?> + + + + + +
  ">List Territories   ?action=ADD_TERRITORY">Add Territory   ?action=ADD_USER_TERRITORY">Add User Territory   ?action=CHANGE_TERRITORY_OWNER">Change Vtiger Territory Owner
  \n"; + +$STARTtime = date("U"); +$TODAY = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$FILE_datetime = $STARTtime; + +$ip = getenv("REMOTE_ADDR"); +$date = date("r"); +$browser = getenv("HTTP_USER_AGENT"); +$script_name = getenv("SCRIPT_NAME"); +$server_name = getenv("SERVER_NAME"); +$server_port = getenv("SERVER_PORT"); +if (eregi("443",$server_port)) {$HTTPprotocol = 'https://';} + else {$HTTPprotocol = 'http://';} +$admDIR = "$HTTPprotocol$server_name:$server_port$script_name"; +$admDIR = eregi_replace('audio_store.php','',$admDIR); +$admSCR = 'admin.php'; +$NWB = "   \"HELP\""; + +$secX = date("U"); +$pulldate0 = "$year-$mon-$mday $hour:$min:$sec"; + + + + + + + +### BEGIN change territory owner in the system +if ( ($action == "CHANGE_TERRITORY_OWNER") and ($enable_vtiger_integration > 0) ) + { + echo "
\n"; + echo ""; + + echo "
Vtiger Change Territory Owner\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + + echo "\n"; + + echo "\n"; + echo "
Territory:
New Owner:
\n"; + } +### END change territory owner in the system + + +### BEGIN process change territory owner in the system +if ( ($action == "PROCESS_CHANGE_TERRITORY_OWNER") and ($enable_vtiger_integration > 0) ) + { + if ( (strlen($territory)<1) or (strlen($user)<1) ) + { + echo "ERROR: Territory and User must be filled in
\n"; + } + else + { + $stmt="SELECT count(*) from vicidial_user_territories where territory='$territory' and user='$user';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] < 1) + { + $stmt="INSERT INTO vicidial_user_territories SET territory='$territory',user='$user',level='TOP_AGENT';"; + $rslt=mysql_query($stmt, $link); + + $stmtB="UPDATE vicidial_user_territories SET level='STANDARD_AGENT' where territory='$territory' and user!='$user' and level='TOP_AGENT';"; + $rslt=mysql_query($stmtB, $link); + + echo "NOTICE: Had to add user territory: $user $territory
\n"; + + ### LOG INSERTION Admin Log Table ### + $SQL_log = "$stmt|$stmtB|"; + $SQL_log = ereg_replace(';','',$SQL_log); + $SQL_log = addslashes($SQL_log); + $stmt="INSERT INTO vicidial_admin_log set event_date='$NOW_TIME', user='$PHP_AUTH_USER', ip_address='$ip', event_section='TERRITORIES', event_type='ADD', record_id='$territory', event_code='ADMIN ADD USER TERRITORY', event_sql=\"$SQL_log\", event_notes='';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + } + + $stmtV="SELECT id from vtiger_users where user_name='$user';"; + $rsltV=mysql_query($stmtV, $linkV); + if ($DB) {echo "$stmtV\n";} + $vtu_ct = mysql_num_rows($rsltV); + if ($vtu_ct > 0) + { + $row=mysql_fetch_row($rsltV); + $user_id = $row[0]; + + $stmt="UPDATE vtiger_crmentity SET smownerid='$user_id',smcreatorid='$user_id',modifiedby='$user_id' where crmid IN(SELECT accountid from vtiger_account where tickersymbol='$territory');"; + $rsltV=mysql_query($stmt, $linkV); + $changed = mysql_affected_rows($linkV); + + $stmtB="UPDATE vtiger_tracker vt, vtiger_account va SET user_id='$user_id' where vt.item_id=va.accountid and va.tickersymbol='$territory';"; + $rsltV=mysql_query($stmtB, $linkV); + + + echo "Vtiger Territory Owner Changed: $user $territory       Records Changed: $changed
\n"; + + ### LOG INSERTION Admin Log Table ### + $SQL_log = "$stmt|$stmtB|"; + $SQL_log = ereg_replace(';','',$SQL_log); + $SQL_log = addslashes($SQL_log); + $stmt="INSERT INTO vicidial_admin_log set event_date='$NOW_TIME', user='$PHP_AUTH_USER', ip_address='$ip', event_section='VTIGER', event_type='MODIFY', record_id='$territory', event_code='VTIGER MODIFY TERRITORY OWNER', event_sql=\"$SQL_log\", event_notes='';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + } + } + $action = "MODIFY_TERRITORY"; + } +### END process change territory owner in the system + + + + + +### BEGIN add user territory page +if ($action == "ADD_USER_TERRITORY") + { + echo "
\n"; + echo ""; + + echo "
Add User Territory\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Agent:
Territory:
Level:
\n"; + } +### END add user territory page + + +### BEGIN process add user territory page +if ($action == "PROCESS_ADD_USER_TERRITORY") + { + if ( (strlen($territory)<1) or (strlen($user)<1) or (strlen($level)<1) ) + { + echo "ERROR: Territory, User and Level must be filled in
\n"; + } + else + { + $stmt="SELECT count(*) from vicidial_user_territories where territory='$territory' and user='$user';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + { + echo "ERROR: this territory user is already in the system
\n"; + } + else + { + $stmt="INSERT INTO vicidial_user_territories SET territory='$territory',user='$user',level='$level';"; + $rslt=mysql_query($stmt, $link); + + if ($level == "TOP_AGENT") + { + $stmtB="UPDATE vicidial_user_territories SET level='STANDARD_AGENT' where territory='$territory' and user!='$user' and level='TOP_AGENT';"; + $rslt=mysql_query($stmtB, $link); + } + + echo "User Territory Added: $user $territory
\n"; + + ### LOG INSERTION Admin Log Table ### + $SQL_log = "$stmt|$stmtB|"; + $SQL_log = ereg_replace(';','',$SQL_log); + $SQL_log = addslashes($SQL_log); + $stmt="INSERT INTO vicidial_admin_log set event_date='$NOW_TIME', user='$PHP_AUTH_USER', ip_address='$ip', event_section='TERRITORIES', event_type='ADD', record_id='$territory', event_code='ADMIN ADD USER TERRITORY', event_sql=\"$SQL_log\", event_notes='';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + } + } + $action = "MODIFY_TERRITORY"; + } +### END process add user territory page + + +### BEGIN process modify user territory page +if ($action == "PROCESS_MODIFY_USER_TERRITORY") + { + if ( (strlen($territory)<1) or (strlen($user)<1) or (strlen($level)<1) ) + { + echo "ERROR: Territory, User and Level must be filled in
\n"; + } + else + { + $stmt="SELECT count(*) from vicidial_user_territories where territory='$territory' and user='$user';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] < 0) + { + echo "ERROR: this territory user is not in the system
\n"; + } + else + { + $stmt="UPDATE vicidial_user_territories SET level='$level' where territory='$territory' and user='$user';"; + $rslt=mysql_query($stmt, $link); + + if ($level == "TOP_AGENT") + { + $stmtB="UPDATE vicidial_user_territories SET level='STANDARD_AGENT' where territory='$territory' and user!='$user' and level='TOP_AGENT';"; + $rslt=mysql_query($stmtB, $link); + } + + echo "User Territory Modified: $user $territory
\n"; + + ### LOG INSERTION Admin Log Table ### + $SQL_log = "$stmt|$stmtB|"; + $SQL_log = ereg_replace(';','',$SQL_log); + $SQL_log = addslashes($SQL_log); + $stmt="INSERT INTO vicidial_admin_log set event_date='$NOW_TIME', user='$PHP_AUTH_USER', ip_address='$ip', event_section='TERRITORIES', event_type='MODIFY', record_id='$territory', event_code='ADMIN MODIFY USER TERRITORY', event_sql=\"$SQL_log\", event_notes='';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + } + } + $action = "MODIFY_TERRITORY"; + } +### END process modify user territory page + + +### BEGIN delete user territory page +if ($action == "DELETE_USER_TERRITORY") + { + if ( (strlen($territory)<1) or (strlen($user)<1) ) + { + echo "ERROR: Territory and User must be filled in
\n"; + } + else + { + $stmt="SELECT count(*) from vicidial_user_territories where territory='$territory' and user='$user';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] < 0) + { + echo "ERROR: this territory user is not in the system
\n"; + } + else + { + $stmt="DELETE from vicidial_user_territories where territory='$territory' and user='$user';"; + $rslt=mysql_query($stmt, $link); + + echo "User Territory Deleted: $user $territory
\n"; + + ### LOG INSERTION Admin Log Table ### + $SQL_log = "$stmt|$stmtB|"; + $SQL_log = ereg_replace(';','',$SQL_log); + $SQL_log = addslashes($SQL_log); + $stmt="INSERT INTO vicidial_admin_log set event_date='$NOW_TIME', user='$PHP_AUTH_USER', ip_address='$ip', event_section='TERRITORIES', event_type='DELETE', record_id='$territory', event_code='ADMIN DELETE USER TERRITORY', event_sql=\"$SQL_log\", event_notes='';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + } + } + $action = "MODIFY_TERRITORY"; + } +### END delete user territory page + + + + + + +### BEGIN add territory page +if ($action == "ADD_TERRITORY") + { + echo "
\n"; + echo ""; + + echo "
Add Territory\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Territory:
Territory Description:
\n"; + } +### END add territory page + + +### BEGIN process add territory page +if ($action == "PROCESS_ADD_TERRITORY") + { + if ( (strlen($territory)<1) or (strlen($territory_description)<1) ) + { + echo "ERROR: Territory and Territory Description must be filled in
\n"; + } + else + { + $stmt="SELECT count(*) from vicidial_territories where territory='$territory';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + { + echo "ERROR: there is already a territory in the system with this name
\n"; + } + else + { + $stmt="INSERT INTO vicidial_territories SET territory='$territory',territory_description='$territory_description';"; + $rslt=mysql_query($stmt, $link); + + echo "Territory Added: $territory
\n"; + + ### LOG INSERTION Admin Log Table ### + $SQL_log = "$stmt|"; + $SQL_log = ereg_replace(';','',$SQL_log); + $SQL_log = addslashes($SQL_log); + $stmt="INSERT INTO vicidial_admin_log set event_date='$NOW_TIME', user='$PHP_AUTH_USER', ip_address='$ip', event_section='TERRITORIES', event_type='ADD', record_id='$territory', event_code='ADMIN ADD TERRITORY', event_sql=\"$SQL_log\", event_notes='';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + } + } + $action = "LIST_ALL_TERRITORIES"; + } +### END process add territory page + + +### BEGIN delete territory page +if ($action == "DELETE_TERRITORY") + { + if (strlen($territory)<1) + { + echo "ERROR: Territory must be filled in
\n"; + } + else + { + $stmt="SELECT count(*) from vicidial_territories where territory='$territory';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] < 0) + { + echo "ERROR: This territory is not in the system with this name
\n"; + } + else + { + $stmt="DELETE from vicidial_territories where territory='$territory';"; + $rslt=mysql_query($stmt, $link); + + echo "Territory Deleted: $territory
\n"; + + ### LOG INSERTION Admin Log Table ### + $SQL_log = "$stmt|"; + $SQL_log = ereg_replace(';','',$SQL_log); + $SQL_log = addslashes($SQL_log); + $stmt="INSERT INTO vicidial_admin_log set event_date='$NOW_TIME', user='$PHP_AUTH_USER', ip_address='$ip', event_section='TERRITORIES', event_type='DELETE', record_id='$territory', event_code='ADMIN DELETE TERRITORY', event_sql=\"$SQL_log\", event_notes='';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + } + } + $action = "LIST_ALL_TERRITORIES"; + } +### END delete territory page + + +### BEGIN process modify territory page +if ($action == "PROCESS_MODIFY_TERRITORY") + { + if ( (strlen($territory)<1) or (strlen($territory_description)<1) ) + { + echo "ERROR: Territory and Territory Description must be filled in
\n"; + } + else + { + $stmt="SELECT count(*) from vicidial_territories where territory='$territory';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] < 1) + { + echo "ERROR: This territory is not in the system with this name
\n"; + } + else + { + $stmt="UPDATE vicidial_territories SET territory_description='$territory_description' where territory='$territory';"; + $rslt=mysql_query($stmt, $link); + + echo "Territory Modified: $territory
\n"; + + ### LOG INSERTION Admin Log Table ### + $SQL_log = "$stmt|"; + $SQL_log = ereg_replace(';','',$SQL_log); + $SQL_log = addslashes($SQL_log); + $stmt="INSERT INTO vicidial_admin_log set event_date='$NOW_TIME', user='$PHP_AUTH_USER', ip_address='$ip', event_section='TERRITORIES', event_type='MODIFY', record_id='$territory', event_code='ADMIN MODIFY TERRITORY', event_sql=\"$SQL_log\", event_notes='';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + } + } + $action = "MODIFY_TERRITORY"; + } +### END process modify territory page + + +### BEGIN modify territory page +if ($action == "MODIFY_TERRITORY") + { + $stmt="SELECT territory,territory_description from vicidial_territories where territory='$territory';"; + $rslt=mysql_query($stmt, $link); + $territories_to_print = mysql_num_rows($rslt); + if ($territories_to_print > 0) + { + $rowx=mysql_fetch_row($rslt); + + echo "
\n"; + echo ""; + + echo "
Modify Territory\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + + $stmt = "SELECT count(*) FROM vicidial_user_territories where territory='$territory';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $vut_ct = mysql_num_rows($rslt); + if ($vut_ct > 0) + { + $row=mysql_fetch_row($rslt); + $user_count = $row[0]; + } + echo ""; + + if ($enable_vtiger_integration > 0) + { + $stmtV = "SELECT count(*) FROM vtiger_account where tickersymbol='$territory';"; + $rsltV=mysql_query($stmtV, $linkV); + if ($DB) {echo "$stmtV\n";} + $vta_ct = mysql_num_rows($rsltV); + if ($vta_ct > 0) + { + $row=mysql_fetch_row($rsltV); + $vtiger_count = $row[0]; + } + echo ""; + } + echo "\n"; + echo "
Territory: $rowx[0]
Territory Description:
Agents: $user_count
Vtiger Accounts: $vtiger_count
\n"; + echo "

\n"; + + echo "\n"; + + $stmt="SELECT vut.user,level,full_name from vicidial_user_territories vut,vicidial_users vu where vut.territory='$territory' and vut.user=vu.user order by vu.user;"; + $rslt=mysql_query($stmt, $link); + $territories_to_print = mysql_num_rows($rslt); + $o=0; + while ($territories_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $o++; + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + if ($enable_vtiger_integration > 0) + { + $stmtV="SELECT id from vtiger_users where user_name='$rowx[0]';"; + $rsltV=mysql_query($stmtV, $linkV); + if ($DB) {echo "$stmtV\n";} + $vtu_ct = mysql_num_rows($rsltV); + if ($vtu_ct > 0) + { + $row=mysql_fetch_row($rsltV); + $user_id = $row[0]; + + $stmtV = "SELECT count(*) FROM vtiger_account where tickersymbol='$territory' and accountid IN(SELECT crmid from vtiger_crmentity where smownerid='$user_id');"; + $rsltV=mysql_query($stmtV, $linkV); + if ($DB) {echo "$stmtV\n";} + $vca_ct = mysql_num_rows($rsltV); + if ($vca_ct > 0) + { + $row=mysql_fetch_row($rsltV); + echo ""; + } + } + } + echo ""; + echo ""; + echo "\n"; + } + + echo "
Users in this Territory:
$o$rowx[0]$rowx[2]Accounts: $row[0]"; + echo "
"; + echo ""; + echo ""; + echo ""; + echo " "; + echo ""; + echo "
"; + echo "
DELETE
\n"; + echo "


\n"; + + echo "Delete This Territory\n"; + echo "

\n"; + } + else + { + echo "ERROR: Territory not found: $territory
\n"; + } + } +### END modify territory page + + + + + +### BEGIN list all territories in the system +if ($action == "LIST_ALL_TERRITORIES") + { + echo " +
\n"; + echo ""; + echo "
List All Territories:\n"; + echo "
\n"; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + if ($enable_vtiger_integration > 0) + { + echo "\n"; + } + echo "\n"; + + $stmt = "SELECT territory_id,territory,territory_description FROM vicidial_territories order by territory;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $vt_ct = mysql_num_rows($rslt); + $i=0; + while ($vt_ct > $i) + { + $row=mysql_fetch_row($rslt); + $Lterritory_id[$i] = $row[0]; + $Lterritory[$i] = $row[1]; + $Lterritory_description[$i] = $row[2]; + $i++; + } + $i=0; + while ($vt_ct > $i) + { + $stmt = "SELECT count(*) FROM vicidial_user_territories where territory='$Lterritory[$i]';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $vut_ct = mysql_num_rows($rslt); + if ($vut_ct > 0) + { + $row=mysql_fetch_row($rslt); + $Lterritory_count[$i] = $row[0]; + } + + if ($enable_vtiger_integration > 0) + { + $stmtV = "SELECT count(*) FROM vtiger_account where tickersymbol='$Lterritory[$i]';"; + $rsltV=mysql_query($stmtV, $linkV); + if ($DB) {echo "$stmtV\n";} + $va_ct = mysql_num_rows($rsltV); + if ($va_ct > 0) + { + $row=mysql_fetch_row($rsltV); + $Lvtiger_count[$i] = $row[0]; + } + } + + if (eregi("1$|3$|5$|7$|9$", $i)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + if ($enable_vtiger_integration > 0) + { + echo ""; + } + echo "\n"; + + $i++; + } + echo "
#IDTERRITORYDESCRIPTIONAGENTSVT ACCOUNTS
$i $Lterritory_id[$i] $Lterritory[$i] $Lterritory_description[$i] $Lterritory_count[$i] $Lvtiger_count[$i]


\n"; + echo "\n"; + echo "
\n"; + } +### END list all territories in the system + + + + + + + + +?> + + + +
User Territories     VERSION:     BUILD: