From 3d415c53ee75e47f2aebbf3ca540cc71d4985869 Mon Sep 17 00:00:00 2001 From: mattf Date: Sat, 1 Apr 2017 11:55:00 +0000 Subject: [PATCH] Assure that custom field form submitted after standard field submit in agent screen git-svn-id: svn://192.168.202.10@2720 3d104415-ff17-0410-8863-d5cf3c621b8a --- agc_2-X/trunk/www/agc/vdc_form_display.php | 31 +++++++++++++++++--- agc_2-X/trunk/www/agc/vicidial.php | 34 +++++++++++++++++----- 2 files changed, 54 insertions(+), 11 deletions(-) diff --git a/agc_2-X/trunk/www/agc/vdc_form_display.php b/agc_2-X/trunk/www/agc/vdc_form_display.php index 4a80b48f..7aaf350b 100644 --- a/agc_2-X/trunk/www/agc/vdc_form_display.php +++ b/agc_2-X/trunk/www/agc/vdc_form_display.php @@ -38,10 +38,12 @@ # 160912-0805 - Added debug, fixed issue with multi-selected values # 170301-0834 - Added call_id field for custom fields # 170317-0755 - Added more missing display variables +# 170331-2300 - Added more debug logging # -$version = '2.14-28'; -$build = '170317-0755'; +$version = '2.14-29'; +$build = '170331-2300'; +$php_script = 'vdc_form_display.php'; require_once("dbconnect_mysqli.php"); require_once("functions.php"); @@ -215,6 +217,7 @@ $MT[0]=''; $agents='@agents'; $script_height = ($script_height - 20); if (strlen($bgcolor) < 6) {$bgcolor='FFFFFF';} +$startMS = microtime(); $vicidial_list_fields = '|lead_id|entry_date|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|'; @@ -237,7 +240,7 @@ if ($sl_ct > 0) $VUselected_language = $row[0]; } -$stmt = "SELECT use_non_latin,timeclock_end_of_day,agentonly_callback_campaign_lock,custom_fields_enabled,enable_languages,language_method FROM system_settings;"; +$stmt = "SELECT use_non_latin,timeclock_end_of_day,agentonly_callback_campaign_lock,custom_fields_enabled,enable_languages,language_method,agent_debug_logging FROM system_settings;"; $rslt=mysql_to_mysqli($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00XXX',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -251,6 +254,7 @@ if ($qm_conf_ct > 0) $custom_fields_enabled = $row[3]; $SSenable_languages = $row[4]; $SSlanguage_method = $row[5]; + $SSagent_debug_logging = $row[6]; } ##### END SETTINGS LOOKUP ##### ########################################### @@ -266,8 +270,15 @@ if ($non_latin < 1) # default optional vars if not set if (!isset($format)) {$format="text";} if ($format == 'debug') {$DB=1;} -if (!isset($ACTION)) {$ACTION="refresh";} +if (!isset($ACTION)) {$ACTION="custom_form_frame";} if (!isset($query_date)) {$query_date = $NOW_DATE;} +if (strlen($SSagent_debug_logging) > 1) + { + if ($SSagent_debug_logging == "$user") + {$SSagent_debug_logging=1;} + else + {$SSagent_debug_logging=0;} + } $auth=0; $auth_message = user_authorization($user,$pass,'',0,$bcrypt,0,0); @@ -312,6 +323,10 @@ else ### BEGIN parse submission of the custom fields form ### if ($stage=='SUBMIT') { + if ($SSagent_debug_logging > 0) + { + $stage .= " custom_$list_id"; + } $update_sent=0; $CFoutput=''; $stmt="SHOW TABLES LIKE \"custom_$list_id\";"; @@ -479,6 +494,10 @@ if ($stage=='SUBMIT') ### END parse submission of the custom fields form ### else { + if ($SSagent_debug_logging > 0) + { + $stage .= " render $list_id"; + } echo "\n"; echo "\n"; echo "\n"; @@ -531,6 +550,10 @@ else echo "\n"; } +if ($SSagent_debug_logging > 0) + { + vicidial_ajax_log($NOW_TIME,$startMS,$link,$ACTION,$php_script,$user,$stage,$lead_id,$session_name,$stmt); + } exit; diff --git a/agc_2-X/trunk/www/agc/vicidial.php b/agc_2-X/trunk/www/agc/vicidial.php index 4f0da7ea..afe98b4d 100644 --- a/agc_2-X/trunk/www/agc/vicidial.php +++ b/agc_2-X/trunk/www/agc/vicidial.php @@ -546,10 +546,11 @@ # 170309-0705 - Small fix for INBOUND_MAN agent logging issue # 170309-1215 - Added agent_xfer_validation option # 170317-2342 - Fix for script tab ignore list script override +# 170331-2255 - Assure that custom field form submitted after standard field submit # -$version = '2.14-516c'; -$build = '170317-2342'; +$version = '2.14-517c'; +$build = '170331-2255'; $mel=1; # Mysql Error Log enabled = 1 $mysql_log_count=87; $one_mysql_log=0; @@ -4499,6 +4500,8 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} var api_switch_lead_triggered=0; var agent_xfer_validation=''; var agent_xfer_group_selected=''; + var customsubmit_trigger=0; + var updatelead_complete=0; var DiaLControl_auto_HTML = "\" border=\"0\" alt=\"You are paused\" />"; var DiaLControl_auto_HTML_ready = "\" border=\"0\" alt=\"You are active\" />"; var DiaLControl_auto_HTML_OFF = "\" border=\"0\" alt=\"pause button disabled\" />"; @@ -12263,6 +12266,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection) // Update vicidial_list lead record with all altered values from form function CustomerData_update() { + updatelead_complete=0; if ( (OtherTab == '1') && (comments_all_tabs == 'ENABLED') ) { var test_otcx = document.vicidial_form.other_tab_comments.value; @@ -12333,12 +12337,12 @@ function set_length(SLnumber,SLlength_goal,SLdirection) { if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { + updatelead_complete=1; // alert(xmlhttp.responseText); } } delete xmlhttp; } - } // ################################################################################ @@ -14300,7 +14304,7 @@ if ($useIE > 0) dialedcall_send_hangup('NO', 'YES', HKdispo_ary[0]); if (custom_fields_enabled > 0) { - vcFormIFrame.document.form_custom_fields.submit(); + customsubmit_trigger=1; } } } @@ -14425,7 +14429,7 @@ else dialedcall_send_hangup('NO', 'YES', HKdispo_ary[0]); if (custom_fields_enabled > 0) { - vcFormIFrame.document.form_custom_fields.submit(); + customsubmit_trigger=1; } } } @@ -16641,9 +16645,25 @@ function phone_number_format(formatphone) { if (custom_fields_enabled > 0) { // alert("IFRAME submitting!"); - vcFormIFrame.document.form_custom_fields.submit(); + customsubmit_trigger=1; } } + // trigger custom form submit if standard form has already been submitted or 3 seconds have gone by + if (customsubmit_trigger > 0) + { + if ( (updatelead_complete > 0) || (customsubmit_trigger > 2) ) + { + button_click_log = button_click_log + "" + SQLdate + "-----CustomFormSubmit---" + updatelead_complete + " " + customsubmit_trigger + "|"; + customsubmit_trigger=0; + vcFormIFrame.document.form_custom_fields.submit(); + } + else + { + customsubmit_trigger++; + button_click_log = button_click_log + "" + SQLdate + "-----CustomFormWait---" + updatelead_complete + " " + customsubmit_trigger + "|"; + } + } + if (UpdatESettingSChecK > 0) { UpdatESettingSChecK=0; @@ -16811,7 +16831,7 @@ function phone_number_format(formatphone) { dialedcall_send_hangup('NO', 'NO', dead_max_dispo); if (custom_fields_enabled > 0) { - vcFormIFrame.document.form_custom_fields.submit(); + customsubmit_trigger=1; } } }