Fix for gender custom field population in agent screen, Issue #1205

git-svn-id: svn://192.168.202.10@3219 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2020-04-06 16:20:00 +00:00
parent 3b4571bd04
commit bd85bdf7b4
3 changed files with 72 additions and 10 deletions
+36 -3
View File
@@ -4,7 +4,7 @@
#
# functions for agent scripts
#
# Copyright (C) 2019 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2020 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
#
# CHANGES:
@@ -48,6 +48,7 @@
# 180503-1817 - Added code for SWITCH field type
# 181004-1644 - Fix for defaut field in AREA type
# 191013-1029 - Fixes for PHP7
# 200406-1204 - Fix for gender default field population
#
# $mysql_queries = 26
@@ -539,7 +540,14 @@ function custom_list_fields_values($lead_id,$list_id,$uniqueid,$user,$DB,$call_i
if ($A_field_type[$o]=='SELECT')
{
$field_HTML .= "<select size=1 name=$A_field_label[$o] id=$A_field_label[$o]>\n";
$change_trigger='';
$default_field_flag=0;
if (preg_match("/\|$A_field_label[$o]\|/i",'|gender|'))
{
$change_trigger="onchange=\"update_default_vd_select('$A_field_label[$o]');\"";
$default_field_flag++;
}
$field_HTML .= "<select size=1 name=$A_field_label[$o] id=$A_field_label[$o] $change_trigger>\n";
}
if ($A_field_type[$o]=='MULTI')
{
@@ -557,7 +565,25 @@ function custom_list_fields_values($lead_id,$list_id,$uniqueid,$user,$DB,$call_i
{
$field_selected='';
$field_options_value_array = explode(",",$field_options_array[$te]);
if ( ($A_field_type[$o]=='SELECT') or ($A_field_type[$o]=='MULTI') )
if ($A_field_type[$o]=='SELECT')
{
if (strlen($A_field_value[$o]) > 0)
{
$temp_opt_val = $field_options_value_array[0];
if ( (preg_match("/^$temp_opt_val$/",$A_field_value[$o])) or (preg_match("/,$temp_opt_val$/",$A_field_value[$o])) or (preg_match("/$temp_opt_val,/",$A_field_value[$o])) )
{$field_selected = 'SELECTED';}
if ($default_field_flag > 0)
{$field_selected = '--A--gender'.$field_options_value_array[0].'SELECT--B--';}
if ($DB > 0) {echo "DEBUG2: |$field_options_value_array[0]|$A_field_value[$o]|$field_selected|\n";}
}
else
{
if ($A_field_default[$o] == "$field_options_value_array[0]") {$field_selected = 'SELECTED';}
}
$field_HTML .= "<option value=\"$field_options_value_array[0]\" $field_selected>"._QXZ("$field_options_value_array[1]")."</option>\n";
$te_printed++;
}
if ($A_field_type[$o]=='MULTI')
{
if (strlen($A_field_value[$o]) > 0)
{
@@ -1271,6 +1297,13 @@ function custom_list_fields_values($lead_id,$list_id,$uniqueid,$user,$DB,$call_i
$CFoutput = preg_replace('/--A--list_name--B--/i',"$list_name",$CFoutput);
$CFoutput = preg_replace('/--A--list_description--B--/i',"$list_description",$CFoutput);
if ($gender == 'U') {$CFoutput = preg_replace('/--A--genderUSELECT--B--/i','SELECTED',$CFoutput);}
if ($gender == 'M') {$CFoutput = preg_replace('/--A--genderMSELECT--B--/i','SELECTED',$CFoutput);}
if ($gender == 'F') {$CFoutput = preg_replace('/--A--genderFSELECT--B--/i','SELECTED',$CFoutput);}
$CFoutput = preg_replace('/--A--genderUSELECT--B--/i','',$CFoutput);
$CFoutput = preg_replace('/--A--genderMSELECT--B--/i','',$CFoutput);
$CFoutput = preg_replace('/--A--genderFSELECT--B--/i','',$CFoutput);
$CFoutput = preg_replace('/--A--TABLEper_call_notes--B--/i',"$NOTESout",$CFoutput);
$CFoutput = preg_replace("/LOCALFQDN/",$FQDN,$CFoutput);
+32 -4
View File
@@ -1,7 +1,7 @@
<?php
# vdc_form_display.php
#
# Copyright (C) 2018 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2020 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# This script is designed display the contents of the FORM tab in the agent
# interface, as well as take submission of the form submission when the agent
@@ -43,10 +43,11 @@
# 171021-1339 - Fix to update default field if duplicate field in custom fields changed
# 171116-2333 - Added code for duplicate fields
# 180503-1813 - Added code for SWITCH field type
# 200406-1137 - Added hide_gender and gender default population
#
$version = '2.14-33';
$build = '180503-1813';
$version = '2.14-34';
$build = '200406-1137';
$php_script = 'vdc_form_display.php';
require_once("dbconnect_mysqli.php");
@@ -197,6 +198,8 @@ if (isset($_GET["did_custom_four"])) {$did_custom_four=$_GET["did_custom_four"
elseif (isset($_POST["did_custom_four"])) {$did_custom_four=$_POST["did_custom_four"];}
if (isset($_GET["did_custom_five"])) {$did_custom_five=$_GET["did_custom_five"];}
elseif (isset($_POST["did_custom_five"])) {$did_custom_five=$_POST["did_custom_five"];}
if (isset($_GET["hide_gender"])) {$hide_gender=$_GET["hide_gender"];}
elseif (isset($_POST["hide_gender"])) {$hide_gender=$_POST["hide_gender"];}
if (isset($_GET["DB"])) {$DB=$_GET["DB"];}
elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];}
@@ -583,10 +586,35 @@ if ($SUBMIT_only < 1)
echo " document.getElementById(taskspan).style.background = \"white\";\n";
echo " }\n";
echo " function update_default_vd_field(taskfield) \n";
echo " {\n";
echo " {\n";
echo " var tempvalue = document.getElementById(taskfield).value;\n";
echo " parent.document.getElementById(taskfield).value = tempvalue;\n";
echo " }\n";
if ($hide_gender > 0)
{
echo " function update_default_vd_select(taskfield) \n";
echo " {\n";
echo " var taskIndex = document.getElementById(taskfield).selectedIndex;\n";
echo " var taskValue = document.getElementById(taskfield).options[taskIndex].value;\n";
echo " parent.document.getElementById(taskfield).value = taskValue;\n";
echo " }\n";
}
else
{
echo " function update_default_vd_select(taskfield) \n";
echo " {\n";
echo " var taskIndex = document.getElementById(taskfield).selectedIndex;\n";
echo " var taskValue = document.getElementById(taskfield).options[taskIndex].value;\n";
echo " var gIndex = 0;\n";
echo " if (taskValue == 'U') {var gIndex = 0;}\n";
echo " if (taskValue == 'M') {var gIndex = 1;}\n";
echo " if (taskValue == 'F') {var gIndex = 2;}\n";
echo " parent.document.getElementById('gender_list').selectedIndex = gIndex;\n";
echo " var genderIndex = parent.document.getElementById('gender_list').selectedIndex;\n";
echo " var genderValue = parent.document.getElementById('gender_list').options[genderIndex].value;\n";
echo " parent.document.getElementById('gender').value = genderValue;\n";
echo " }\n";
}
echo " function update_dup_field(taskmasterfield,taskupdatefields,taskupdatecount,taskdefaultflag,taskdefaultfield) \n";
echo " {\n";
# echo " alert('1: ' + taskmasterfield + ' 2: ' + taskupdatefields + ' 3: ' + taskupdatecount + ' 4: ' + taskdefaultflag);\n";
+4 -3
View File
@@ -633,10 +633,11 @@
# 200310-1116 - Added manual_dial_cid AGENT_PHONE_OVERRIDE option
# 200403-1539 - Added Manual Dial API outbound_cid function
# 200406-0949 - Fix for manual dial box with no phone number, Issue #1188
# 200406-1205 - Fix for gender custom field population, Issue #1205
#
$version = '2.14-602c';
$build = '200406-0949';
$version = '2.14-603c';
$build = '200406-1205';
$mel=1; # Mysql Error Log enabled = 1
$mysql_log_count=91;
$one_mysql_log=0;
@@ -17954,7 +17955,7 @@ function phone_number_format(formatphone) {
var form_entry_list_id = document.vicidial_form.entry_list_id.value;
if (form_entry_list_id.length > 2)
{form_list_id = form_entry_list_id}
var temp_vcFormIFrame_url = './<?php echo $vdc_form_display ?>?lead_id=' + document.vicidial_form.lead_id.value + '&list_id=' + form_list_id + '&user=' + user + '&pass=' + pass + '&campaign=' + campaign + '&server_ip=' + server_ip + '&session_id=' + '&uniqueid=' + document.vicidial_form.uniqueid.value + '&stage=DISPLAY' + "&campaign=" + campaign + "&phone_login=" + phone_login + "&original_phone_login=" + original_phone_login +"&phone_pass=" + phone_pass + "&fronter=" + fronter + "&closer=" + user + "&group=" + group + "&channel_group=" + group + "&SQLdate=" + SQLdate + "&epoch=" + UnixTime + "&customer_zap_channel=" + lastcustchannel + "&customer_server_ip=" + lastcustserverip +"&server_ip=" + server_ip + "&SIPexten=" + extension + "&session_id=" + session_id + "&phone=" + document.vicidial_form.phone_number.value + "&parked_by=" + document.vicidial_form.lead_id.value +"&dispo=" + LeaDDispO + '' +"&dialed_number=" + dialed_number + '' +"&dialed_label=" + dialed_label + '' +"&camp_script=" + campaign_script + '' +"&in_script=" + CalL_ScripT_id + '' +"&script_width=" + script_width + '' +"&script_height=" + script_height + '' +"&fullname=" + LOGfullname + '' +"&agent_email=" + LOGemail + '' +"&recording_filename=" + recording_filename + '' +"&recording_id=" + recording_id + '' +"&user_custom_one=" + VU_custom_one + '' +"&user_custom_two=" + VU_custom_two + '' +"&user_custom_three=" + VU_custom_three + '' +"&user_custom_four=" + VU_custom_four + '' +"&user_custom_five=" + VU_custom_five + '' +"&did_id=" + did_id + '' +"&did_extension=" + did_extension + '' +"&did_pattern=" + did_pattern + '' +"&did_description=" + did_description + '' +"&closecallid=" + closecallid + '' +"&xfercallid=" + xfercallid + '' + "&agent_log_id=" + agent_log_id + "&call_id=" + LasTCID + "&user_group=" + VU_user_group + "&called_count=" + document.vicidial_form.called_count.value + '' + "&did_custom_one=" + did_custom_one + "&did_custom_two=" + did_custom_two + "&did_custom_three=" + did_custom_three + "&did_custom_four=" + did_custom_four + "&did_custom_five=" + did_custom_five + "&web_vars=" + LIVE_web_vars + '' +"&preset_number_a=" + CalL_XC_a_NuMber + '' +"&preset_number_b=" + CalL_XC_b_NuMber + '' +"&preset_number_c=" + CalL_XC_c_NuMber + '' +"&preset_number_d=" + CalL_XC_d_NuMber + '' +"&preset_number_e=" + CalL_XC_e_NuMber + '' +"&preset_dtmf_a=" + CalL_XC_a_Dtmf + '' +"&preset_dtmf_b=" + CalL_XC_b_Dtmf + '';
var temp_vcFormIFrame_url = './<?php echo $vdc_form_display ?>?lead_id=' + document.vicidial_form.lead_id.value + '&list_id=' + form_list_id + '&user=' + user + '&pass=' + pass + '&campaign=' + campaign + '&server_ip=' + server_ip + '&session_id=' + '&uniqueid=' + document.vicidial_form.uniqueid.value + '&stage=DISPLAY' + "&campaign=" + campaign + "&phone_login=" + phone_login + "&original_phone_login=" + original_phone_login +"&phone_pass=" + phone_pass + "&fronter=" + fronter + "&closer=" + user + "&group=" + group + "&channel_group=" + group + "&SQLdate=" + SQLdate + "&epoch=" + UnixTime + "&customer_zap_channel=" + lastcustchannel + "&customer_server_ip=" + lastcustserverip +"&server_ip=" + server_ip + "&SIPexten=" + extension + "&session_id=" + session_id + "&phone=" + document.vicidial_form.phone_number.value + "&parked_by=" + document.vicidial_form.lead_id.value +"&dispo=" + LeaDDispO + '' +"&dialed_number=" + dialed_number + '' +"&dialed_label=" + dialed_label + '' +"&camp_script=" + campaign_script + '' +"&in_script=" + CalL_ScripT_id + '' +"&script_width=" + script_width + '' +"&script_height=" + script_height + '' +"&fullname=" + LOGfullname + '' +"&agent_email=" + LOGemail + '' +"&recording_filename=" + recording_filename + '' +"&recording_id=" + recording_id + '' +"&user_custom_one=" + VU_custom_one + '' +"&user_custom_two=" + VU_custom_two + '' +"&user_custom_three=" + VU_custom_three + '' +"&user_custom_four=" + VU_custom_four + '' +"&user_custom_five=" + VU_custom_five + '' +"&did_id=" + did_id + '' +"&did_extension=" + did_extension + '' +"&did_pattern=" + did_pattern + '' +"&did_description=" + did_description + '' +"&closecallid=" + closecallid + '' +"&xfercallid=" + xfercallid + '' + "&agent_log_id=" + agent_log_id + "&call_id=" + LasTCID + "&user_group=" + VU_user_group + "&called_count=" + document.vicidial_form.called_count.value + '' + "&did_custom_one=" + did_custom_one + "&did_custom_two=" + did_custom_two + "&did_custom_three=" + did_custom_three + "&did_custom_four=" + did_custom_four + "&did_custom_five=" + did_custom_five + "&web_vars=" + LIVE_web_vars + '' +"&preset_number_a=" + CalL_XC_a_NuMber + '' +"&preset_number_b=" + CalL_XC_b_NuMber + '' +"&preset_number_c=" + CalL_XC_c_NuMber + '' +"&preset_number_d=" + CalL_XC_d_NuMber + '' +"&preset_number_e=" + CalL_XC_e_NuMber + '' +"&preset_dtmf_a=" + CalL_XC_a_Dtmf + '' +"&preset_dtmf_b=" + CalL_XC_b_Dtmf + "&hide_gender=" + hide_gender + '';
document.getElementById('vcFormIFrame').src = temp_vcFormIFrame_url;
// alert_box(temp_vcFormIFrame_url);
form_list_id = '';