From 0aebf3d9816f9eca8cbacdf304bbcab8dbf1dc79 Mon Sep 17 00:00:00 2001 From: mattf Date: Wed, 23 Feb 2011 14:26:29 +0000 Subject: [PATCH] Added options to restrict agent lead search to the owner field equal to the user, user group or selected territories for the agent Changed Campaign VDAD Extension to Routing Extension in the campaign screen, updated help section for the field also git-svn-id: svn://192.168.202.10@1606 3d104415-ff17-0410-8863-d5cf3c621b8a --- agc_2-X/trunk/UPGRADE | 3 ++ .../trunk/extras/MySQL_AST_CREATE_tables.sql | 4 +- agc_2-X/trunk/extras/upgrade_2.4.sql | 4 ++ .../TO_BE_TRANSLATED_2.4.txt | 12 +++++ agc_2-X/trunk/www/agc/vdc_db_query.php | 52 +++++++++++++++---- agc_2-X/trunk/www/vicidial/admin.php | 29 ++++++----- 6 files changed, 80 insertions(+), 24 deletions(-) diff --git a/agc_2-X/trunk/UPGRADE b/agc_2-X/trunk/UPGRADE index 0e36cfe0..6e9831b8 100644 --- a/agc_2-X/trunk/UPGRADE +++ b/agc_2-X/trunk/UPGRADE @@ -469,6 +469,9 @@ OTHER CHANGES: Searches can optionally be restricted to campaign lists or only one list. All search queries are logged. +111. Added options to restrict agent lead search to the owner field equal to + the user, user group or selected territories for the agent. + 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 701a8db7..61e1699f 100644 --- a/agc_2-X/trunk/extras/MySQL_AST_CREATE_tables.sql +++ b/agc_2-X/trunk/extras/MySQL_AST_CREATE_tables.sql @@ -788,7 +788,7 @@ lead_order_secondary ENUM('LEAD_ASCEND','LEAD_DESCEND','CALLTIME_ASCEND','CALLTI per_call_notes ENUM('ENABLED','DISABLED') default 'DISABLED', my_callback_option ENUM('CHECKED','UNCHECKED') default 'UNCHECKED', agent_lead_search ENUM('ENABLED','DISABLED') default 'DISABLED', -agent_lead_search_method ENUM('SYSTEM','CAMPAIGNLISTS','CAMPLISTS_ALL','LIST') default 'CAMPLISTS_ALL' +agent_lead_search_method VARCHAR(30) default 'CAMPLISTS_ALL' ); CREATE TABLE vicidial_lists ( @@ -2440,7 +2440,7 @@ ALTER TABLE vicidial_call_notes_archive MODIFY notesid INT(9) UNSIGNED NOT NULL; CREATE TABLE vicidial_lead_search_log_archive LIKE vicidial_lead_search_log; ALTER TABLE vicidial_lead_search_log_archive MODIFY search_log_id INT(9) UNSIGNED NOT NULL; -UPDATE system_settings SET db_schema_version='1261',db_schema_update_date=NOW(); +UPDATE system_settings SET db_schema_version='1262',db_schema_update_date=NOW(); GRANT RELOAD ON *.* TO cron@'%'; GRANT RELOAD ON *.* TO cron@localhost; diff --git a/agc_2-X/trunk/extras/upgrade_2.4.sql b/agc_2-X/trunk/extras/upgrade_2.4.sql index 080b072b..bd1f98ad 100644 --- a/agc_2-X/trunk/extras/upgrade_2.4.sql +++ b/agc_2-X/trunk/extras/upgrade_2.4.sql @@ -686,3 +686,7 @@ ALTER TABLE vicidial_lead_search_log_archive MODIFY search_log_id INT(9) UNSIGNE UPDATE system_settings SET db_schema_version='1261',db_schema_update_date=NOW(); +ALTER TABLE vicidial_campaigns MODIFY agent_lead_search_method VARCHAR(30) default 'CAMPLISTS_ALL'; + +UPDATE system_settings SET db_schema_version='1262',db_schema_update_date=NOW(); + diff --git a/agc_2-X/trunk/translations/raw_translation_files/TO_BE_TRANSLATED_2.4.txt b/agc_2-X/trunk/translations/raw_translation_files/TO_BE_TRANSLATED_2.4.txt index d0e43292..c4c4f72e 100644 --- a/agc_2-X/trunk/translations/raw_translation_files/TO_BE_TRANSLATED_2.4.txt +++ b/agc_2-X/trunk/translations/raw_translation_files/TO_BE_TRANSLATED_2.4.txt @@ -521,6 +521,18 @@ Setting this option to ENABLED will allow agents to search for leads and view le Agent Lead Search Method|| If Agent Lead Search is enabled, this setting defines where the agent will be allowed to search for leads. SYSTEM will search the entire system, CAMPAIGNLISTS will search inside all of the active lists within the campaign, CAMPLISTS_ALL will search inside all of the active and inactive lists within the campaign, LIST will search only within the Manual Dial List ID as defined in the campaign. Default is CAMPLISTS_ALL|| LEAD SEARCHES FOR THIS TIME PERIOD|| +Routing Extension|| +This field allows for a custom outbound routing extension. This allows you to use different call handling methods depending upon how you want to route calls through your outbound campaign. Formerly called Campaign VDAD extension|| +same as|| +Will send the call only to an agent on the same server as the call is placed on|| +Used for press-1, broadcast and survey campaigns|| +Will try to first send the call to an agent on the local server, then it will look on other servers|| +DEFAULT - Will send the call to the next available agent no matter what server they are on|| +Used for Answering Machine Detection after that, same behavior as|| +Used for Answering Machine Detection after that same behavior as|| +Used for press-1, broadcast and survey campaigns with Cepstral Text-to-speech|| +Used for Answering Machine Detection then press-1, broadcast and survey campaigns with Cepstral Text-to-speech|| +One of these options with USER_ in front will only search within leads that have the owner field matching the user ID of the agent, the options with GROUP_ in front will only search within leads that have the owner field matching the user group that the user is a member of, the options with TERRITORY_ in front will only search within leads that have the owner field matching the territories that the agent has selected|| AST_LISTS_campaign_stats.php diff --git a/agc_2-X/trunk/www/agc/vdc_db_query.php b/agc_2-X/trunk/www/agc/vdc_db_query.php index eb18b9dc..5ecdcbcd 100644 --- a/agc_2-X/trunk/www/agc/vdc_db_query.php +++ b/agc_2-X/trunk/www/agc/vdc_db_query.php @@ -273,12 +273,13 @@ # 110214-2320 - Added support for lead_order_secondary option # 110215-1125 - Added support for call_notes # 110218-1519 - Added support for agent lead search +# 110222-2228 - Added owner restriction to agent lead search # -$version = '2.4-178'; -$build = '110218-1519'; +$version = '2.4-179'; +$build = '110222-2228'; $mel=1; # Mysql Error Log enabled = 1 -$mysql_log_count=385; +$mysql_log_count=387; $one_mysql_log=0; require("dbconnect.php"); @@ -8050,13 +8051,46 @@ if ($ACTION == 'SEARCHRESULTSview') exit; } + $searchownerSQL=''; + ### limit results to specified search method + # USER_, GROUP_, TERRITORY_ + if (preg_match('/USER_/',$agent_lead_search_method)) + {$searchownerSQL=" and owner='$user'";} + if (preg_match('/GROUP_/',$agent_lead_search_method)) + { + $stmt="SELECT user_group from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00386',$user,$server_ip,$session_name,$one_mysql_log);} + $groups_to_parse = mysql_num_rows($rslt); + if ($groups_to_parse > 0) + { + $rowx=mysql_fetch_row($rslt); + $searchownerSQL=" and owner='$rowx[0]'"; + } + } + if (preg_match('/TERRITORY_/',$agent_lead_search_method)) + { + $stmt="SELECT agent_territories from vicidial_live_agents where user='$user';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00387',$user,$server_ip,$session_name,$one_mysql_log);} + $terrs_to_parse = mysql_num_rows($rslt); + if ($terrs_to_parse > 0) + { + $rowx=mysql_fetch_row($rslt); + $agent_territories = $rowx[0]; + $agent_territories = preg_replace("/ -$|^ /",'',$agent_territories); + $agent_territories = preg_replace("/ /","','",$agent_territories); + $searchownerSQL=" and owner IN('$agent_territories')"; + } + } + ### limit results to specified search method # 'SYSTEM','CAMPAIGNLISTS','CAMPLISTS_ALL','LIST' - if ($agent_lead_search_method == 'SYSTEM') + if (preg_match('/SYSTEM/',$agent_lead_search_method)) {$searchmethodSQL='';} - if ($agent_lead_search_method == 'LIST') + if (preg_match('/LIST/',$agent_lead_search_method)) {$searchmethodSQL=" and list_id='$manual_dial_list_id'";} - if ($agent_lead_search_method == 'CAMPLISTS_ALL') + if (preg_match('/CAMPLISTS_ALL/',$agent_lead_search_method)) { $stmt="SELECT list_id from vicidial_lists where campaign_id='$campaign';"; $rslt=mysql_query($stmt, $link); @@ -8073,7 +8107,7 @@ if ($ACTION == 'SEARCHRESULTSview') $camp_lists = eregi_replace(".$","",$camp_lists); $searchmethodSQL=" and list_id IN($camp_lists)"; } - if ($agent_lead_search_method == 'CAMPAIGNLISTS') + if (preg_match('/CAMPAIGNLISTS/',$agent_lead_search_method)) { $stmt="SELECT list_id,active from vicidial_lists where campaign_id='$campaign' and active='Y';"; $rslt=mysql_query($stmt, $link); @@ -8093,7 +8127,7 @@ if ($ACTION == 'SEARCHRESULTSview') ##### BEGIN search queries and output ##### - $stmt="select count(*) from vicidial_list where $searchSQL $searchmethodSQL;"; + $stmt="select count(*) from vicidial_list where $searchSQL $searchownerSQL $searchmethodSQL;"; ### LOG INSERTION Search Log Table ### $SQL_log = "$stmt|"; @@ -8143,7 +8177,7 @@ if ($ACTION == 'SEARCHRESULTSview') if ($search_result_count) { - $stmt="select first_name,last_name,phone_code,phone_number,status,last_local_call_time,lead_id,city,state,postal_code from vicidial_list where $searchSQL $searchmethodSQL order by last_local_call_time desc limit 1000;"; + $stmt="select first_name,last_name,phone_code,phone_number,status,last_local_call_time,lead_id,city,state,postal_code from vicidial_list where $searchSQL $searchownerSQL $searchmethodSQL order by last_local_call_time desc limit 1000;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00380',$user,$server_ip,$session_name,$one_mysql_log);} $out_logs_to_print = mysql_num_rows($rslt); diff --git a/agc_2-X/trunk/www/vicidial/admin.php b/agc_2-X/trunk/www/vicidial/admin.php index 41f7d155..a9f19fed 100644 --- a/agc_2-X/trunk/www/vicidial/admin.php +++ b/agc_2-X/trunk/www/vicidial/admin.php @@ -2651,12 +2651,13 @@ else # 110214-0001 - Added campaign settings for lead_order_secondary, per_call_notes and my_callback_option # 110215-1721 - Added add-a-new-lead link to the lists submenu # 110215-2135 - Added agent_lead_search options to user and campaign +# 110222-2039 - Added USER, GROUP and TERRITORY restrictions to agent lead search # # 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.4-301'; -$build = '110215-2135'; +$admin_version = '2.4-302'; +$build = '110222-2039'; $STARTtime = date("U"); $SQLdate = date("Y-m-d H:i:s"); @@ -4315,14 +4316,16 @@ if ($ADD==99999)

- Campaign VDAD extension - This field allows for a custom VDAD transfer extension. This allows you to use different call handling methods depending upon your campaign. - - 8364 - same as 8368 - - 8365 - Will send the call only to an agent on the same server as the call is on - - 8366 - Used for press-1 and survey campaigns - - 8367 - Will try to first send the call to an agent on the local server, then it will look on other servers - - 8368 - DEFAULT – Will send the call to the next available agent no matter what server they are on - - 8369 - Used for Answering Machine Detection after that, same behavior as 8368 - - 8373 - Used for Answering Machine Detection after that same behavior as 8366 + Routing Extension - This field allows for a custom outbound routing extension. This allows you to use different call handling methods depending upon how you want to route calls through your outbound campaign. Formerly called Campaign VDAD extension. +
- 8364 - same as 8368 +
- 8365 - Will send the call only to an agent on the same server as the call is placed on +
- 8366 - Used for press-1, broadcast and survey campaigns +
- 8367 - Will try to first send the call to an agent on the local server, then it will look on other servers +
- 8368 - DEFAULT - Will send the call to the next available agent no matter what server they are on +
- 8369 - Used for Answering Machine Detection after that, same behavior as 8368 +
- 8373 - Used for Answering Machine Detection after that same behavior as 8366 +
- 8374 - Used for press-1, broadcast and survey campaigns with Cepstral Text-to-speech +
- 8375 - Used for Answering Machine Detection then press-1, broadcast and survey campaigns with Cepstral Text-to-speech
@@ -4595,7 +4598,7 @@ if ($ADD==99999)

- Agent Lead Search Method - If Agent Lead Search is enabled, this setting defines where the agent will be allowed to search for leads. SYSTEM will search the entire system, CAMPAIGNLISTS will search inside all of the active lists within the campaign, CAMPLISTS_ALL will search inside all of the active and inactive lists within the campaign, LIST will search only within the Manual Dial List ID as defined in the campaign. Default is CAMPLISTS_ALL. + Agent Lead Search Method - If Agent Lead Search is enabled, this setting defines where the agent will be allowed to search for leads. SYSTEM will search the entire system, CAMPAIGNLISTS will search inside all of the active lists within the campaign, CAMPLISTS_ALL will search inside all of the active and inactive lists within the campaign, LIST will search only within the Manual Dial List ID as defined in the campaign. Default is CAMPLISTS_ALL. One of these options with USER_ in front will only search within leads that have the owner field matching the user ID of the agent, the options with GROUP_ in front will only search within leads that have the owner field matching the user group that the user is a member of, the options with TERRITORY_ in front will only search within leads that have the owner field matching the territories that the agent has selected.
@@ -19073,7 +19076,7 @@ if ($ADD==31) if ($SSoutbound_autodial_active > 0) { - echo "Campaign VDAD exten: $NWB#vicidial_campaigns-campaign_vdad_exten$NWE\n"; + echo "Routing Extension: $NWB#vicidial_campaigns-campaign_vdad_exten$NWE\n"; } echo "Campaign Rec exten: $NWB#vicidial_campaigns-campaign_rec_exten$NWE\n"; @@ -19087,7 +19090,7 @@ if ($ADD==31) echo "Agent Lead Search: $NWB#vicidial_campaigns-agent_lead_search$NWE\n"; - echo "Agent Lead Search Method: $NWB#vicidial_campaigns-agent_lead_search_method$NWE\n"; + echo "Agent Lead Search Method: $NWB#vicidial_campaigns-agent_lead_search_method$NWE\n"; echo "Script: