Expanded required custom fields types

git-svn-id: svn://192.168.202.10@2694 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2017-03-03 17:10:04 +00:00
parent 8a8494bcbb
commit 28185fa529
4 changed files with 143 additions and 7 deletions
+2 -1
View File
@@ -109,7 +109,8 @@ OTHER CHANGES:
18. Added option for custom list fields to be required for all calls or only
inbound calls. Will prevent agent hanging up call if field is not filled
in. Must also have campaign option enabled for it to work. Will work for
the following custom field types: TEXT, AREA, DATE
the following custom field types:
TEXT, AREA, DATE, SELECT, MULTI, RADIO, CHECKBOX
+38 -2
View File
@@ -33,6 +33,7 @@
# 160913-0827 - Fixed issues with multiple selected values in custom fields
# 170228-2258 - Changes to allow URLs in SCRIPT field types
# 170301-0837 - Added functionality for required custom fields
# 170303-1207 - Expanded required custom fields types
#
# $mysql_queries = 20
@@ -238,6 +239,10 @@ function custom_list_fields_values($lead_id,$list_id,$uniqueid,$user,$DB,$call_i
$vicidial_list_fields = '|lead_id|vendor_lead_code|source_id|list_id|gmt_offset_now|called_since_last_reset|phone_code|phone_number|title|first_name|middle_initial|last_name|address1|address2|address3|city|state|province|postal_code|country_code|gender|date_of_birth|alt_phone|email|security_phrase|comments|called_count|last_local_call_time|rank|owner|';
$custom_required_fields='|';
$custom_required_fields_check='|';
$custom_required_fields_radio='|';
$custom_required_fields_select='|';
$custom_required_fields_multi='|';
require("dbconnect_mysqli.php");
@@ -394,7 +399,7 @@ function custom_list_fields_values($lead_id,$list_id,$uniqueid,$user,$DB,$call_i
{
$field_options_array = explode("\n",$A_field_options[$o]);
$field_options_count = count($field_options_array);
$te=0;
$te=0; $te_printed=0;
if ($DB > 0) {echo "DEBUG: |$A_field_id[$o]|$A_field_label[$o]|$A_field_name[$o]|$A_field_type[$o]|$A_field_options[$o]|$field_options_count|\n";}
while ($te < $field_options_count)
{
@@ -416,6 +421,7 @@ function custom_list_fields_values($lead_id,$list_id,$uniqueid,$user,$DB,$call_i
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]=='RADIO') or ($A_field_type[$o]=='CHECKBOX') )
{
@@ -435,6 +441,7 @@ function custom_list_fields_values($lead_id,$list_id,$uniqueid,$user,$DB,$call_i
$field_HTML .= "<input type=$A_field_type[$o] name=$A_field_label[$o][] id=$A_field_label[$o][] value=\"$field_options_value_array[0]\" $field_selected> "._QXZ("$field_options_value_array[1]")."\n";
if ($A_multi_position[$o]=='VERTICAL')
{$field_HTML .= "<BR>\n";}
$te_printed++;
}
}
$te++;
@@ -444,6 +451,32 @@ function custom_list_fields_values($lead_id,$list_id,$uniqueid,$user,$DB,$call_i
{
$field_HTML .= "</select>\n";
}
# If options were printed for SELECT, MULTI, RADIO or CHECKBOX and required is set, mark as a required field
if ($te_printed > 0)
{
if ($A_field_type[$o]=='SELECT')
{
if ( ($A_field_required[$o] == 'Y') or ( ($A_field_required[$o] == 'INBOUND_ONLY') and (preg_match("/^Y\d\d\d\d\d\d\d/",$call_id)) ) )
{$custom_required_fields_select .= "$A_field_label[$o]|";}
}
if ($A_field_type[$o]=='MULTI')
{
if ( ($A_field_required[$o] == 'Y') or ( ($A_field_required[$o] == 'INBOUND_ONLY') and (preg_match("/^Y\d\d\d\d\d\d\d/",$call_id)) ) )
{$custom_required_fields_multi .= "$A_field_label[$o]|";}
}
if ($A_field_type[$o]=='RADIO')
{
if ( ($A_field_required[$o] == 'Y') or ( ($A_field_required[$o] == 'INBOUND_ONLY') and (preg_match("/^Y\d\d\d\d\d\d\d/",$call_id)) ) )
{$custom_required_fields_radio .= "$A_field_label[$o]|";}
}
if ($A_field_type[$o]=='CHECKBOX')
{
if ( ($A_field_required[$o] == 'Y') or ( ($A_field_required[$o] == 'INBOUND_ONLY') and (preg_match("/^Y\d\d\d\d\d\d\d/",$call_id)) ) )
{$custom_required_fields_check .= "$A_field_label[$o]|";}
}
}
if ($A_field_type[$o]=='TEXT')
{
if ($A_field_default[$o]=='NULL') {$A_field_default[$o]='';}
@@ -979,7 +1012,10 @@ function custom_list_fields_values($lead_id,$list_id,$uniqueid,$user,$DB,$call_i
}
##### END parsing for vicidial variables #####
echo "<input type=hidden name=custom_required id=custom_required value=\"$custom_required_fields\">\n";
echo "<input type=hidden name=custom_required_check id=custom_required_check value=\"$custom_required_fields_check\">\n";
echo "<input type=hidden name=custom_required_radio id=custom_required_radio value=\"$custom_required_fields_radio\">\n";
echo "<input type=hidden name=custom_required_select id=custom_required_select value=\"$custom_required_fields_select\">\n";
echo "<input type=hidden name=custom_required_multi id=custom_required_multi value=\"$custom_required_fields_multi\">\n";
return $CFoutput;
}
+102 -3
View File
@@ -542,10 +542,11 @@
# 170220-1306 - Added external_lead_id trigger for switch_lead API function
# 170223-2122 - Fixed rare recording issue
# 170301-0839 - Added functionality for required custom fields
# 170303-1206 - Expanded required custom fields types
#
$version = '2.14-512c';
$build = '170301-0839';
$version = '2.14-513c';
$build = '170303-1206';
$mel=1; # Mysql Error Log enabled = 1
$mysql_log_count=87;
$one_mysql_log=0;
@@ -11705,8 +11706,13 @@ function set_length(SLnumber,SLlength_goal,SLdirection)
if (custom_fields_enabled > 0)
{
var temp_custom_required = vcFormIFrame.document.form_custom_fields.custom_required.value;
// alert_box("checking for required custom fields: " + temp_custom_required);
var temp_custom_required_check = vcFormIFrame.document.form_custom_fields.custom_required_check.value;
var temp_custom_required_radio = vcFormIFrame.document.form_custom_fields.custom_required_radio.value;
var temp_custom_required_select = vcFormIFrame.document.form_custom_fields.custom_required_select.value;
var temp_custom_required_multi = vcFormIFrame.document.form_custom_fields.custom_required_multi.value;
// alert_box("checking for required custom fields: " + temp_custom_required + "-" + temp_custom_required_check + "-" + temp_custom_required_radio + "-" + temp_custom_required_select + "-" + temp_custom_required_multi + "-");
// check TEXT, AREA and DATE required custom fields
if (temp_custom_required.length > 2)
{
var CFR_array=temp_custom_required.split('|');
@@ -11723,6 +11729,99 @@ function set_length(SLnumber,SLlength_goal,SLdirection)
CFR_tick++;
}
}
// check CHECKBOX required custom fields
if (temp_custom_required_check.length > 2)
{
var CFR_arrayC = temp_custom_required_check.split('|');
var CFR_countC = CFR_arrayC.length;
var CFR_tick=0;
while (CFR_tick < CFR_countC)
{
var CFR_field = CFR_arrayC[CFR_tick] + '[]';
if (CFR_field.length > 2)
{
var CFR_field_boxes = vcFormIFrame.document.getElementsByName(CFR_field);
if (CFR_field_boxes.length > 0)
{
var CFR_len = CFR_field_boxes.length;
var CFR_checked=0;
for (var i=0; i < CFR_len; i++)
{
if (CFR_field_boxes[i].checked) {CFR_checked++;};
}
if (CFR_checked < 1){required_fail++; error_field_list = error_field_list + " CHECKBOX: " + CFR_arrayC[CFR_tick];}
}
}
CFR_tick++;
}
}
// check RADIO required custom fields
if (temp_custom_required_radio.length > 2)
{
var CFR_arrayR = temp_custom_required_radio.split('|');
var CFR_countR = CFR_arrayR.length;
var CFR_tick=0;
while (CFR_tick < CFR_countR)
{
var CFR_field = CFR_arrayR[CFR_tick] + '[]';
if (CFR_field.length > 2)
{
var CFR_field_boxes = vcFormIFrame.document.getElementsByName(CFR_field);
if (CFR_field_boxes.length > 0)
{
var CFR_len = CFR_field_boxes.length;
var CFR_checked=0;
for (var i=0; i < CFR_len; i++)
{
if (CFR_field_boxes[i].checked) {CFR_checked++;};
}
if (CFR_checked < 1){required_fail++; error_field_list = error_field_list + " RADIO: " + CFR_arrayR[CFR_tick];}
}
}
CFR_tick++;
}
}
// check SELECT required custom fields
if (temp_custom_required_select.length > 2)
{
var CFR_arrayS = temp_custom_required_select.split('|');
var CFR_countS = CFR_arrayS.length;
var CFR_tick=0;
while (CFR_tick < CFR_countS)
{
var CFR_field = CFR_arrayS[CFR_tick];
if (CFR_field.length > 0)
{
var temp_field_check = vcFormIFrame.document.getElementById(CFR_field);
var temp_field_check_value = temp_field_check.options[temp_field_check.selectedIndex].value;
if (temp_field_check_value.length < 1){required_fail++; error_field_list = error_field_list + " SELECT: " + CFR_field;}
}
CFR_tick++;
}
}
// check MULTI required custom fields
if (temp_custom_required_multi.length > 2)
{
var CFR_arrayM = temp_custom_required_multi.split('|');
var CFR_countM = CFR_arrayM.length;
var CFR_tick=0;
while (CFR_tick < CFR_countM)
{
var CFR_field = CFR_arrayM[CFR_tick] + '[]';
if (CFR_field.length > 2)
{
var CFR_field_box = vcFormIFrame.document.getElementById(CFR_field);
var CFR_len = CFR_field_box.options.length;
var CFR_selected=0;
for (var i=0; i < CFR_len; i++)
{
if (CFR_field_box.options[i].selected ==true) {CFR_selected++;};
}
if (CFR_selected < 1){required_fail++; error_field_list = error_field_list + " MULTI: " + CFR_arrayM[CFR_tick];}
}
CFR_tick++;
}
}
}
}
if (required_fail > 0)
+1 -1
View File
@@ -2238,7 +2238,7 @@ if ($SSqc_features_active > 0)
<BR>
<A NAME="lists_fields-field_required">
<BR>
<B><?php echo _QXZ("Field Required"); ?> -</B><?php echo _QXZ("If the campaign option allowing required fields is also enabled, this field allows you to force an agent to fill in this field before they can hang up the call. Y will affect all calls, INBOUND_ONLY will only affect calls received by the agent through an In-Group. This option will only work for the following custom field types: TEXT, AREA, DATE. Default is N."); ?>
<B><?php echo _QXZ("Field Required"); ?> -</B><?php echo _QXZ("If the campaign option allowing required fields is also enabled, this field allows you to force an agent to fill in this field before they can hang up the call. Y will affect all calls, INBOUND_ONLY will only affect calls received by the agent through an In-Group. This option will only work for the following custom field types: TEXT, AREA, DATE, SELECT, MULTI, RADIO, CHECKBOX. Default is N."); ?>
<BR>
<A NAME="lists_fields-name_position">