From b4257b69968800ac2b304f70de7575338ef3a1df Mon Sep 17 00:00:00 2001 From: mattf Date: Sat, 3 Jul 2010 17:32:08 +0000 Subject: [PATCH] Added ability to display and edit custom fields in the lead modification page git-svn-id: svn://192.168.202.10@1464 3d104415-ff17-0410-8863-d5cf3c621b8a --- .../TO_BE_TRANSLATED_2.4.txt | 1 + agc_2-X/trunk/www/agc/vdc_form_display.php | 51 ++++++++++++--- agc_2-X/trunk/www/vicidial/admin.php | 46 +++++++------- .../trunk/www/vicidial/admin_lists_custom.php | 3 + .../trunk/www/vicidial/admin_modify_lead.php | 63 +++++++++++++++++-- 5 files changed, 130 insertions(+), 34 deletions(-) diff --git a/agc_2-X/trunk/translations/raw_translation_files/TO_BE_TRANSLATED_2.4.txt b/agc_2-X/trunk/translations/raw_translation_files/TO_BE_TRANSLATED_2.4.txt index c835772c..ba9863b0 100644 --- a/agc_2-X/trunk/translations/raw_translation_files/TO_BE_TRANSLATED_2.4.txt +++ b/agc_2-X/trunk/translations/raw_translation_files/TO_BE_TRANSLATED_2.4.txt @@ -246,6 +246,7 @@ You can also include the default ViciDial fields in a custom field setup, and yo If custom list fields are enabled on your system, FORM will open the FORM tab upon connection of a call to an agent|| Enable Custom List Fields|| This setting enables the custom list fields feature that allows for custom data fields to be defined in the administration web interface on a per-list basis and then have those fields available in a FORM tab to the agent in the agent web interface. Default is 0 for disabled|| +CUSTOM FIELDS FOR THIS LEAD|| AST_VICIDIAL_ingrouplist.php 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 cb422504..7479647e 100644 --- a/agc_2-X/trunk/www/agc/vdc_form_display.php +++ b/agc_2-X/trunk/www/agc/vdc_form_display.php @@ -9,10 +9,11 @@ # # CHANGELOG: # 100630-1119 - First build of script +# 100703-1124 - Added submit_button,admin_submit fields, which will log to admin log # -$version = '2.4-1'; -$build = '100630-1119'; +$version = '2.4-2'; +$build = '100703-1124'; require("dbconnect.php"); require("functions.php"); @@ -34,6 +35,12 @@ if (isset($_GET["uniqueid"])) {$uniqueid=$_GET["uniqueid"];} elseif (isset($_POST["uniqueid"])) {$uniqueid=$_POST["uniqueid"];} if (isset($_GET["stage"])) {$stage=$_GET["stage"];} elseif (isset($_POST["stage"])) {$stage=$_POST["stage"];} +if (isset($_GET["submit_button"])) {$submit_button=$_GET["submit_button"];} + elseif (isset($_POST["submit_button"])) {$submit_button=$_POST["submit_button"];} +if (isset($_GET["admin_submit"])) {$admin_submit=$_GET["admin_submit"];} + elseif (isset($_POST["admin_submit"])) {$admin_submit=$_POST["admin_submit"];} +if (isset($_GET["bgcolor"])) {$bgcolor=$_GET["bgcolor"];} + elseif (isset($_POST["bgcolor"])) {$bgcolor=$_POST["bgcolor"];} header ("Content-type: text/html; charset=utf-8"); header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 @@ -48,6 +55,7 @@ $ENTRYdate = date("YmdHis"); $MT[0]=''; $agents='@agents'; $script_height = ($script_height - 20); +if (strlen($bgcolor) < 6) {$bgcolor='FFFFFF';} $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|'; @@ -55,7 +63,7 @@ $IFRAME=0; ############################################# ##### START SYSTEM_SETTINGS LOOKUP ##### -$stmt = "SELECT use_non_latin,timeclock_end_of_day,agentonly_callback_campaign_lock FROM system_settings;"; +$stmt = "SELECT use_non_latin,timeclock_end_of_day,agentonly_callback_campaign_lock,custom_fields_enabled FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($DB) {echo "$stmt\n";} $qm_conf_ct = mysql_num_rows($rslt); @@ -65,6 +73,7 @@ if ($qm_conf_ct > 0) $non_latin = $row[0]; $timeclock_end_of_day = $row[1]; $agentonly_callback_campaign_lock = $row[2]; + $custom_fields_enabled = $row[3]; } ##### END SETTINGS LOOKUP ##### ########################################### @@ -109,6 +118,14 @@ $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); $LVAactive=$row[0]; +if ($custom_fields_enabled < 1) + { + echo "Custom Fields Disabled: |$custom_fields_enabled|\n"; + echo "
\n"; + echo "\n"; + echo "
\n"; + exit; + } if ( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0) or ( ($LVAactive < 1) and ($VUmodify < 1) ) ) { @@ -127,6 +144,7 @@ else ### BEGIN parse submission of the custom fields form ### if ($stage=='SUBMIT') { + $update_sent=0; $CFoutput=''; $stmt="SHOW TABLES LIKE \"custom_$list_id\";"; if ($DB>0) {echo "$stmt";} @@ -224,6 +242,8 @@ if ($stage=='SUBMIT') $list_update_count = mysql_affected_rows($link); if ($DB) {echo "$field_update|$list_table_update_SQL\n";} if (!$rslt) {die('Could not execute: ' . mysql_error());} + + $update_sent++; } if (strlen($update_SQL)>3) @@ -248,9 +268,21 @@ if ($stage=='SUBMIT') $custom_update_count = mysql_affected_rows($link); if ($DB) {echo "$field_update|$custom_table_update_SQL\n";} if (!$rslt) {die('Could not execute: ' . mysql_error());} + + $update_sent++; } -# echo "$list_update_count|$list_table_update_SQL\n
\n$custom_update_count|$custom_table_update_SQL
\n"; + if ( ($admin_submit=='YES') and ($update_sent > 0) ) + { + ### LOG INSERTION Admin Log Table ### + $ip = getenv("REMOTE_ADDR"); + $SQL_log = "$list_table_update_SQL|$custom_table_update_SQL|"; + $SQL_log = ereg_replace(';','',$SQL_log); + $SQL_log = addslashes($SQL_log); + $stmt="INSERT INTO vicidial_admin_log set event_date='$NOW_TIME', user='$user', ip_address='$ip', event_section='LEADS', event_type='MODIFY', record_id='$lead_id', event_code='ADMIN MODIFY CUSTOM LEAD', event_sql=\"$SQL_log\", event_notes='$custom_update_count|$list_update_count';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + } } else {$CFoutput .= "ERROR: no custom list fields\n";} @@ -272,7 +304,7 @@ else echo "\n"; echo "\n"; echo "\n"; - echo "ViciDiaL Form Display Script"; + echo "<title>ViciDial Form Display Script"; echo "\n"; echo "\n"; @@ -293,7 +325,8 @@ else echo " \n"; echo " \n"; echo "\n"; - echo "\n"; + echo ''; + echo "\n"; echo "
\n"; echo "\n"; echo "\n"; @@ -308,7 +341,11 @@ else echo "$CFoutput"; -# echo "



\n"; + if ($submit_button=='YES') + { + echo "\n"; + echo "

\n"; + } echo "


\n"; echo "\n"; } diff --git a/agc_2-X/trunk/www/vicidial/admin.php b/agc_2-X/trunk/www/vicidial/admin.php index 210ce0a1..0ecd256a 100644 --- a/agc_2-X/trunk/www/vicidial/admin.php +++ b/agc_2-X/trunk/www/vicidial/admin.php @@ -2321,11 +2321,12 @@ else # 100621-1010 - Added admin_web_directory system setting # 100622-1700 - Added custom agent field names for default fields # 100702-1142 - Added FORM get_call_launch option for custom list fields tab in agent interface +# 100703-1322 - Added LEADS ability to admin log display # # make sure you have added a user to the vicidial_users MySQL table with at least user_level 8 to access this page the first time -$admin_version = '2.4-260'; -$build = '100702-1142'; +$admin_version = '2.4-261'; +$build = '100703-1322'; $STARTtime = date("U"); $SQLdate = date("Y-m-d H:i:s"); @@ -25787,25 +25788,26 @@ if ($ADD==720000000000000) { $row=mysql_fetch_row($rslt); - if (eregi("USER|AGENT",$row[4])) {$record_link = "ADD=3&user=$row[6]";} - if (eregi('CAMPAIGN',$row[4])) {$record_link = "ADD=31&campaign_id=$row[6]";} - if (eregi('LIST',$row[4])) {$record_link = "ADD=311&list_id=$row[6]";} - if (eregi('SCRIPT',$row[4])) {$record_link = "ADD=3111111&script_id=$row[6]";} - if (eregi('FILTER',$row[4])) {$record_link = "ADD=31111111&lead_filter_id=$row[6]";} - if (eregi('INGROUP',$row[4])) {$record_link = "ADD=3111&group_id=$row[6]";} - if (eregi('DID',$row[4])) {$record_link = "ADD=3311&did_id=$row[6]";} - if (eregi('USERGROUP',$row[4])) {$record_link = "ADD=311111&user_group=$row[6]";} - if (eregi('REMOTEAGENT',$row[4])) {$record_link = "ADD=31111&remote_agent_id=$row[6]";} - if (eregi('PHONE',$row[4])) {$record_link = "ADD=10000000000";} - if (eregi('CALLTIME',$row[4])) {$record_link = "ADD=311111111&call_time_id=$row[6]";} - if (eregi('SHIFT',$row[4])) {$record_link = "ADD=331111111&shift_id=$row[6]";} - if (eregi('CONFTEMPLATE',$row[4])) {$record_link = "ADD=331111111111&template_id=$row[6]";} - if (eregi('CARRIER',$row[4])) {$record_link = "ADD=341111111111&carrier_id=$row[6]";} - if (eregi('SERVER',$row[4])) {$record_link = "ADD=311111111111&server_id=$row[6]";} - if (eregi('CONFERENCE',$row[4])) {$record_link = "ADD=1000000000000";} - if (eregi('SYSTEM',$row[4])) {$record_link = "ADD=311111111111111";} - if (eregi('CATEGOR',$row[4])) {$record_link = "ADD=331111111111111";} - if (eregi('GROUPALIAS',$row[4])) {$record_link = "ADD=33111111111&group_alias_id=$row[6]";} + if (eregi("USER|AGENT",$row[4])) {$record_link = "$PHP_SELF?ADD=3&user=$row[6]";} + if (eregi('CAMPAIGN',$row[4])) {$record_link = "$PHP_SELF?ADD=31&campaign_id=$row[6]";} + if (eregi('LIST',$row[4])) {$record_link = "$PHP_SELF?ADD=311&list_id=$row[6]";} + if (eregi('SCRIPT',$row[4])) {$record_link = "$PHP_SELF?ADD=3111111&script_id=$row[6]";} + if (eregi('FILTER',$row[4])) {$record_link = "$PHP_SELF?ADD=31111111&lead_filter_id=$row[6]";} + if (eregi('INGROUP',$row[4])) {$record_link = "$PHP_SELF?ADD=3111&group_id=$row[6]";} + if (eregi('DID',$row[4])) {$record_link = "$PHP_SELF?ADD=3311&did_id=$row[6]";} + if (eregi('USERGROUP',$row[4])) {$record_link = "$PHP_SELF?ADD=311111&user_group=$row[6]";} + if (eregi('REMOTEAGENT',$row[4])) {$record_link = "$PHP_SELF?ADD=31111&remote_agent_id=$row[6]";} + if (eregi('PHONE',$row[4])) {$record_link = "$PHP_SELF?ADD=10000000000";} + if (eregi('CALLTIME',$row[4])) {$record_link = "$PHP_SELF?ADD=311111111&call_time_id=$row[6]";} + if (eregi('SHIFT',$row[4])) {$record_link = "$PHP_SELF?ADD=331111111&shift_id=$row[6]";} + if (eregi('CONFTEMPLATE',$row[4])) {$record_link = "$PHP_SELF?ADD=331111111111&template_id=$row[6]";} + if (eregi('CARRIER',$row[4])) {$record_link = "$PHP_SELF?ADD=341111111111&carrier_id=$row[6]";} + if (eregi('SERVER',$row[4])) {$record_link = "$PHP_SELF?ADD=311111111111&server_id=$row[6]";} + if (eregi('CONFERENCE',$row[4])) {$record_link = "$PHP_SELF?ADD=1000000000000";} + if (eregi('SYSTEM',$row[4])) {$record_link = "$PHP_SELF?ADD=311111111111111";} + if (eregi('CATEGOR',$row[4])) {$record_link = "$PHP_SELF?ADD=331111111111111";} + if (eregi('GROUPALIAS',$row[4])) {$record_link = "$PHP_SELF?ADD=33111111111&group_alias_id=$row[6]";} + if (eregi('LEADS',$row[4])) {$record_link = "./admin_modify_lead.php?lead_id=$row[6]";} if (eregi("1$|3$|5$|7$|9$", $o)) {$bgcolor='bgcolor="#B9CBFD"';} @@ -25819,7 +25821,7 @@ if ($ADD==720000000000000) echo " $row[5]"; echo " $row[6]"; echo " $row[7]"; - echo " GOTO"; + echo " GOTO"; echo "\n"; $logs_printed .= "'$row[0]',"; $o++; diff --git a/agc_2-X/trunk/www/vicidial/admin_lists_custom.php b/agc_2-X/trunk/www/vicidial/admin_lists_custom.php index 28bd1de6..9e057311 100644 --- a/agc_2-X/trunk/www/vicidial/admin_lists_custom.php +++ b/agc_2-X/trunk/www/vicidial/admin_lists_custom.php @@ -87,6 +87,9 @@ if ( (strlen($field_max) < 1) or ($field_max < 1) ) if ($non_latin < 1) { + $PHP_AUTH_USER = ereg_replace("[^-_0-9a-zA-Z]","",$PHP_AUTH_USER); + $PHP_AUTH_PW = ereg_replace("[^-_0-9a-zA-Z]","",$PHP_AUTH_PW); + $list_id = ereg_replace("[^0-9]","",$list_id); $field_id = ereg_replace("[^0-9]","",$field_id); $field_rank = ereg_replace("[^0-9]","",$field_rank); diff --git a/agc_2-X/trunk/www/vicidial/admin_modify_lead.php b/agc_2-X/trunk/www/vicidial/admin_modify_lead.php index 8f6de5df..33308e54 100644 --- a/agc_2-X/trunk/www/vicidial/admin_modify_lead.php +++ b/agc_2-X/trunk/www/vicidial/admin_modify_lead.php @@ -36,6 +36,7 @@ # 100405-1333 - Changed to show logs of non-found leads # 100618-0148 - Added Middle name modify and fixes statuses list # 100622-0945 - Added field labels +# 100703-1122 - Added custom fields display/edit # require("dbconnect.php"); @@ -138,8 +139,8 @@ if (isset($_GET["modify_agent_logs"])) {$modify_agent_logs=$_GET["modify_agent if (isset($_GET["add_closer_record"])) {$add_closer_record=$_GET["add_closer_record"];} elseif (isset($_POST["add_closer_record"])) {$add_closer_record=$_POST["add_closer_record"];} -$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); -$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); +$PHP_AUTH_USER = ereg_replace("[^-_0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^-_0-9a-zA-Z]","",$PHP_AUTH_PW); $STARTtime = date("U"); $TODAY = date("Y-m-d"); @@ -147,24 +148,34 @@ $NOW_TIME = date("Y-m-d H:i:s"); ############################################# ##### START SYSTEM_SETTINGS LOOKUP ##### -$stmt = "SELECT use_non_latin FROM system_settings;"; +$stmt = "SELECT use_non_latin,custom_fields_enabled FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($DB) {echo "$stmt\n";} $qm_conf_ct = mysql_num_rows($rslt); if ($qm_conf_ct > 0) { $row=mysql_fetch_row($rslt); - $non_latin = $row[0]; + $non_latin = $row[0]; + $custom_fields_enabled = $row[1]; } ##### END SETTINGS LOOKUP ##### ########################################### if ($non_latin < 1) { + $PHP_AUTH_USER = ereg_replace("[^-_0-9a-zA-Z]","",$PHP_AUTH_USER); + $PHP_AUTH_PW = ereg_replace("[^-_0-9a-zA-Z]","",$PHP_AUTH_PW); + $old_phone = ereg_replace("[^0-9]","",$old_phone); $phone_number = ereg_replace("[^0-9]","",$phone_number); $alt_phone = ereg_replace("[^0-9]","",$alt_phone); + } # end of non_latin +else + { + $PHP_AUTH_USER = ereg_replace("'|\"|\\\\|;","",$PHP_AUTH_USER); + $PHP_AUTH_PW = ereg_replace("'|\"|\\\\|;","",$PHP_AUTH_PW); } + if (strlen($phone_number)<6) {$phone_number=$old_phone;} $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7 and modify_leads='1';"; @@ -721,6 +732,34 @@ else echo "

\n"; } + + + ### iframe for custom fields display/editing + if ($custom_fields_enabled > 0) + { + $stmt="SHOW TABLES LIKE \"custom_$list_id\";"; + if ($DB>0) {echo "$stmt";} + $rslt=mysql_query($stmt, $link); + $tablecount_to_print = mysql_num_rows($rslt); + if ($tablecount_to_print > 0) + { + $stmt="SELECT count(*) from custom_$list_id where lead_id='$lead_id';"; + if ($DB>0) {echo "$stmt";} + $rslt=mysql_query($stmt, $link); + $fieldscount_to_print = mysql_num_rows($rslt); + if ($fieldscount_to_print > 0) + { + $rowx=mysql_fetch_row($rslt); + $custom_records_count = $rowx[0]; + + echo "CUSTOM FIELDS FOR THIS LEAD:
\n"; + echo "\n"; + echo "

"; + } + } + } + + echo "CALLS TO THIS LEAD:\n"; echo "\n"; echo "\n"; @@ -816,7 +855,21 @@ else } - echo "
# DATE/TIME LENGTH STATUS TSR CAMPAIGN LIST LEAD HANGUP REASON PHONE
\n"; + echo "

\n"; + + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level >= 9 and modify_leads='1';"; + if ($DB) {echo "|$stmt|\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $admin_display=$row[0]; + if ($admin_display > 0) + { + echo "Click here to see Lead Modify changes to this lead\n"; + } + + echo "\n"; }