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
This commit is contained in:
mattf
2011-02-23 14:26:29 +00:00
parent baae108a47
commit 0aebf3d981
6 changed files with 80 additions and 24 deletions
+3
View File
@@ -469,6 +469,9 @@ OTHER CHANGES:
Searches can optionally be restricted to campaign lists or only one Searches can optionally be restricted to campaign lists or only one
list. All search queries are logged. 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.
@@ -788,7 +788,7 @@ lead_order_secondary ENUM('LEAD_ASCEND','LEAD_DESCEND','CALLTIME_ASCEND','CALLTI
per_call_notes ENUM('ENABLED','DISABLED') default 'DISABLED', per_call_notes ENUM('ENABLED','DISABLED') default 'DISABLED',
my_callback_option ENUM('CHECKED','UNCHECKED') default 'UNCHECKED', my_callback_option ENUM('CHECKED','UNCHECKED') default 'UNCHECKED',
agent_lead_search ENUM('ENABLED','DISABLED') default 'DISABLED', 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 ( 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; 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; 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@'%';
GRANT RELOAD ON *.* TO cron@localhost; GRANT RELOAD ON *.* TO cron@localhost;
+4
View File
@@ -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(); 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();
@@ -521,6 +521,18 @@ Setting this option to ENABLED will allow agents to search for leads and view le
Agent Lead Search Method|| 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|| 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|| 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 AST_LISTS_campaign_stats.php
+43 -9
View File
@@ -273,12 +273,13 @@
# 110214-2320 - Added support for lead_order_secondary option # 110214-2320 - Added support for lead_order_secondary option
# 110215-1125 - Added support for call_notes # 110215-1125 - Added support for call_notes
# 110218-1519 - Added support for agent lead search # 110218-1519 - Added support for agent lead search
# 110222-2228 - Added owner restriction to agent lead search
# #
$version = '2.4-178'; $version = '2.4-179';
$build = '110218-1519'; $build = '110222-2228';
$mel=1; # Mysql Error Log enabled = 1 $mel=1; # Mysql Error Log enabled = 1
$mysql_log_count=385; $mysql_log_count=387;
$one_mysql_log=0; $one_mysql_log=0;
require("dbconnect.php"); require("dbconnect.php");
@@ -8050,13 +8051,46 @@ if ($ACTION == 'SEARCHRESULTSview')
exit; 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 ### limit results to specified search method
# 'SYSTEM','CAMPAIGNLISTS','CAMPLISTS_ALL','LIST' # 'SYSTEM','CAMPAIGNLISTS','CAMPLISTS_ALL','LIST'
if ($agent_lead_search_method == 'SYSTEM') if (preg_match('/SYSTEM/',$agent_lead_search_method))
{$searchmethodSQL='';} {$searchmethodSQL='';}
if ($agent_lead_search_method == 'LIST') if (preg_match('/LIST/',$agent_lead_search_method))
{$searchmethodSQL=" and list_id='$manual_dial_list_id'";} {$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';"; $stmt="SELECT list_id from vicidial_lists where campaign_id='$campaign';";
$rslt=mysql_query($stmt, $link); $rslt=mysql_query($stmt, $link);
@@ -8073,7 +8107,7 @@ if ($ACTION == 'SEARCHRESULTSview')
$camp_lists = eregi_replace(".$","",$camp_lists); $camp_lists = eregi_replace(".$","",$camp_lists);
$searchmethodSQL=" and list_id IN($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';"; $stmt="SELECT list_id,active from vicidial_lists where campaign_id='$campaign' and active='Y';";
$rslt=mysql_query($stmt, $link); $rslt=mysql_query($stmt, $link);
@@ -8093,7 +8127,7 @@ if ($ACTION == 'SEARCHRESULTSview')
##### BEGIN search queries and output ##### ##### 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 ### ### LOG INSERTION Search Log Table ###
$SQL_log = "$stmt|"; $SQL_log = "$stmt|";
@@ -8143,7 +8177,7 @@ if ($ACTION == 'SEARCHRESULTSview')
if ($search_result_count) 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); $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);} 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); $out_logs_to_print = mysql_num_rows($rslt);
+16 -13
View File
@@ -2651,12 +2651,13 @@ else
# 110214-0001 - Added campaign settings for lead_order_secondary, per_call_notes and my_callback_option # 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-1721 - Added add-a-new-lead link to the lists submenu
# 110215-2135 - Added agent_lead_search options to user and campaign # 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 # 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'; $admin_version = '2.4-302';
$build = '110215-2135'; $build = '110222-2039';
$STARTtime = date("U"); $STARTtime = date("U");
$SQLdate = date("Y-m-d H:i:s"); $SQLdate = date("Y-m-d H:i:s");
@@ -4315,14 +4316,16 @@ if ($ADD==99999)
<BR> <BR>
<A NAME="vicidial_campaigns-campaign_vdad_exten"> <A NAME="vicidial_campaigns-campaign_vdad_exten">
<BR> <BR>
<B>Campaign VDAD extension -</B> This field allows for a custom VDAD transfer extension. This allows you to use different call handling methods depending upon your campaign. <B>Routing Extension -</B> 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 <BR>- 8364 - same as 8368
- 8365 - Will send the call only to an agent on the same server as the call is on <BR>- 8365 - Will send the call only to an agent on the same server as the call is placed on
- 8366 - Used for press-1 and survey campaigns <BR>- 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 <BR>- 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 <BR>- 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 <BR>- 8369 - Used for Answering Machine Detection after that, same behavior as 8368
- 8373 - Used for Answering Machine Detection after that same behavior as 8366 <BR>- 8373 - Used for Answering Machine Detection after that same behavior as 8366
<BR>- 8374 - Used for press-1, broadcast and survey campaigns with Cepstral Text-to-speech
<BR>- 8375 - Used for Answering Machine Detection then press-1, broadcast and survey campaigns with Cepstral Text-to-speech
<BR> <BR>
<A NAME="vicidial_campaigns-am_message_exten"> <A NAME="vicidial_campaigns-am_message_exten">
@@ -4595,7 +4598,7 @@ if ($ADD==99999)
<BR> <BR>
<A NAME="vicidial_campaigns-agent_lead_search_method"> <A NAME="vicidial_campaigns-agent_lead_search_method">
<BR> <BR>
<B>Agent Lead Search Method -</B> 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. <B>Agent Lead Search Method -</B> 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.
<BR> <BR>
<A NAME="vicidial_campaigns-campaign_script"> <A NAME="vicidial_campaigns-campaign_script">
@@ -19073,7 +19076,7 @@ if ($ADD==31)
if ($SSoutbound_autodial_active > 0) if ($SSoutbound_autodial_active > 0)
{ {
echo "<tr bgcolor=#8EBCFD><td align=right>Campaign VDAD exten: </td><td align=left><input type=text name=campaign_vdad_exten size=10 maxlength=20 value=\"$campaign_vdad_exten\">$NWB#vicidial_campaigns-campaign_vdad_exten$NWE</td></tr>\n"; echo "<tr bgcolor=#8EBCFD><td align=right>Routing Extension: </td><td align=left><input type=text name=campaign_vdad_exten size=10 maxlength=20 value=\"$campaign_vdad_exten\">$NWB#vicidial_campaigns-campaign_vdad_exten$NWE</td></tr>\n";
} }
echo "<tr bgcolor=#B6D3FC><td align=right>Campaign Rec exten: </td><td align=left><input type=text name=campaign_rec_exten size=10 maxlength=10 value=\"$campaign_rec_exten\">$NWB#vicidial_campaigns-campaign_rec_exten$NWE</td></tr>\n"; echo "<tr bgcolor=#B6D3FC><td align=right>Campaign Rec exten: </td><td align=left><input type=text name=campaign_rec_exten size=10 maxlength=10 value=\"$campaign_rec_exten\">$NWB#vicidial_campaigns-campaign_rec_exten$NWE</td></tr>\n";
@@ -19087,7 +19090,7 @@ if ($ADD==31)
echo "<tr bgcolor=#B6D3FC><td align=right>Agent Lead Search: </td><td align=left><select size=1 name=agent_lead_search><option>ENABLED</option><option>DISABLED</option><option SELECTED>$agent_lead_search</option></select>$NWB#vicidial_campaigns-agent_lead_search$NWE</td></tr>\n"; echo "<tr bgcolor=#B6D3FC><td align=right>Agent Lead Search: </td><td align=left><select size=1 name=agent_lead_search><option>ENABLED</option><option>DISABLED</option><option SELECTED>$agent_lead_search</option></select>$NWB#vicidial_campaigns-agent_lead_search$NWE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Agent Lead Search Method: </td><td align=left><select size=1 name=agent_lead_search_method><option>SYSTEM</option><option>CAMPAIGNLISTS</option><option>CAMPLISTS_ALL</option><option>LIST</option><option SELECTED>$agent_lead_search_method</option></select>$NWB#vicidial_campaigns-agent_lead_search_method$NWE</td></tr>\n"; echo "<tr bgcolor=#B6D3FC><td align=right>Agent Lead Search Method: </td><td align=left><select size=1 name=agent_lead_search_method><option>SYSTEM</option><option>CAMPAIGNLISTS</option><option>CAMPLISTS_ALL</option><option>LIST</option>USER_CAMPAIGNLISTS</option><option>USER_CAMPLISTS_ALL</option><option>USER_LIST</option><option>GROUP_SYSTEM</option><option>GROUP_CAMPAIGNLISTS</option><option>GROUP_CAMPLISTS_ALL</option><option>GROUP_LIST</option><option>TERRITORY_SYSTEM</option><option>TERRITORY_CAMPAIGNLISTS</option><option>TERRITORY_CAMPLISTS_ALL</option><option>TERRITORY_LIST<option SELECTED>$agent_lead_search_method</option></select>$NWB#vicidial_campaigns-agent_lead_search_method$NWE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right><a href=\"$PHP_SELF?ADD=3111111&script_id=$script_id\">Script</a>: </td><td align=left><select size=1 name=script_id>\n"; echo "<tr bgcolor=#B6D3FC><td align=right><a href=\"$PHP_SELF?ADD=3111111&script_id=$script_id\">Script</a>: </td><td align=left><select size=1 name=script_id>\n";
echo "$scripts_list"; echo "$scripts_list";