diff --git a/www/agc/functions.php b/www/agc/functions.php index cd9b04b6..24a9e61a 100644 --- a/www/agc/functions.php +++ b/www/agc/functions.php @@ -4,7 +4,7 @@ # # functions for agent scripts # -# Copyright (C) 2015 Matt Florell LICENSE: AGPLv2 +# Copyright (C) 2016 Matt Florell LICENSE: AGPLv2 # # # CHANGES: @@ -30,6 +30,7 @@ # 150724-0843 - Added vicidial_ajax_log function # 150923-2017 - Added DID custom fields # 160510-2151 - Fixed issues with select lists and common contents +# 160913-0827 - Fixed issues with multiple selected values in custom fields # # $mysql_queries = 20 @@ -227,7 +228,7 @@ function user_authorization($user,$pass,$user_option,$user_update,$bcrypt,$retur ##### BEGIN custom_list_fields_values - gather values for display of custom list fields for a lead ##### -function custom_list_fields_values($lead_id,$list_id,$uniqueid,$user) +function custom_list_fields_values($lead_id,$list_id,$uniqueid,$user,$DB) { $STARTtime = date("U"); $TODAY = date("Y-m-d"); @@ -391,6 +392,7 @@ function custom_list_fields_values($lead_id,$list_id,$uniqueid,$user) $field_options_array = explode("\n",$A_field_options[$o]); $field_options_count = count($field_options_array); $te=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) { if (preg_match("/,/",$field_options_array[$te])) @@ -401,8 +403,10 @@ function custom_list_fields_values($lead_id,$list_id,$uniqueid,$user) { if (strlen($A_field_value[$o]) > 0) { - if (preg_match("/^$field_options_value_array[0]$/",$A_field_value[$o])) + $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 ($DB > 0) {echo "DEBUG2: |$field_options_value_array[0]|$A_field_value[$o]|$field_selected|\n";} } else { @@ -416,8 +420,10 @@ function custom_list_fields_values($lead_id,$list_id,$uniqueid,$user) {$field_HTML .= "   ";} if (strlen($A_field_value[$o]) > 0) { - if (preg_match("/^$field_options_value_array[0]$/",$A_field_value[$o])) + $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 = 'CHECKED';} + if ($DB > 0) {echo "DEBUG3: |$temp_options_value|$A_field_value[$o]|$field_selected|\n";} } else { diff --git a/www/agc/vdc_form_display.php b/www/agc/vdc_form_display.php index 174f599e..ddc0f6c2 100644 --- a/www/agc/vdc_form_display.php +++ b/www/agc/vdc_form_display.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2016 Matt Florell 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 @@ -35,10 +35,11 @@ # 150609-1923 - Added list_description variable # 150923-2027 - Added DID custom variables # 160129-1019 - Added missing pass field to SUBMIT stage form +# 160912-0805 - Added debug, fixed issue with multi-selected values # -$version = '2.12-25'; -$build = '150923-2027'; +$version = '2.12-26'; +$build = '160912-0805'; require_once("dbconnect_mysqli.php"); require_once("functions.php"); @@ -188,6 +189,9 @@ 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["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} + if ($bcrypt == 'OFF') {$bcrypt=0;} @@ -509,7 +513,7 @@ else require_once("functions.php"); - $CFoutput = custom_list_fields_values($lead_id,$list_id,$uniqueid,$user); + $CFoutput = custom_list_fields_values($lead_id,$list_id,$uniqueid,$user,$DB); echo "$CFoutput";