diff --git a/UPGRADE b/UPGRADE index 2ff77b75..8c8dd6d3 100644 --- a/UPGRADE +++ b/UPGRADE @@ -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 diff --git a/www/agc/functions.php b/www/agc/functions.php index ae49287f..45152d85 100644 --- a/www/agc/functions.php +++ b/www/agc/functions.php @@ -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 .= "\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 .= " "._QXZ("$field_options_value_array[1]")."\n"; if ($A_multi_position[$o]=='VERTICAL') {$field_HTML .= "
\n";} + $te_printed++; } } $te++; @@ -444,6 +451,32 @@ function custom_list_fields_values($lead_id,$list_id,$uniqueid,$user,$DB,$call_i { $field_HTML .= "\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 "\n"; - + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; return $CFoutput; } diff --git a/www/agc/vicidial.php b/www/agc/vicidial.php index 531e313d..10130752 100644 --- a/www/agc/vicidial.php +++ b/www/agc/vicidial.php @@ -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) diff --git a/www/vicidial/help.php b/www/vicidial/help.php index de0e298d..da2d0db9 100644 --- a/www/vicidial/help.php +++ b/www/vicidial/help.php @@ -2238,7 +2238,7 @@ if ($SSqc_features_active > 0)

- - + -