diff --git a/UPGRADE b/UPGRADE index 7a23a0ac..b0bb8fa2 100644 --- a/UPGRADE +++ b/UPGRADE @@ -173,6 +173,16 @@ OTHER CHANGES: 42. Added new code to help deal with agents on poor network connections. New vicidial.php option is $conf_check_attempts +43. Added Custom List Fields functions to the Admin and Agent web interfaces. + To activate you need to enable custom fields in system settings, then + you can go to the Lists section to add custom fields to a list. The + fields are tied to a list, not a campaign, and they can be displayed + in a new tab in the agent interface, and there is a new option to have + the Get Call Launch open this custom fields tab upon a call being sent + to the agent. Also, the Calls Export Report and the List Download + feature include the custom fields values for the leads exported. There + is currently no way to import data through the lead loader into custom + fields. diff --git a/extras/MySQL_AST_CREATE_tables.sql b/extras/MySQL_AST_CREATE_tables.sql index 28bf644d..5cf2a5f6 100644 --- a/extras/MySQL_AST_CREATE_tables.sql +++ b/extras/MySQL_AST_CREATE_tables.sql @@ -625,7 +625,7 @@ campaign_rec_exten VARCHAR(20) default '8309', campaign_recording ENUM('NEVER','ONDEMAND','ALLCALLS','ALLFORCE') default 'ONDEMAND', campaign_rec_filename VARCHAR(50) default 'FULLDATE_CUSTPHONE', campaign_script VARCHAR(10), -get_call_launch ENUM('NONE','SCRIPT','WEBFORM') default 'NONE', +get_call_launch ENUM('NONE','SCRIPT','WEBFORM','WEBFORMTWO','FORM') default 'NONE', am_message_exten VARCHAR(100) default 'vm-goodbye', amd_send_to_vmx ENUM('Y','N') default 'N', xferconf_a_dtmf VARCHAR(50), @@ -841,7 +841,7 @@ voicemail_ext VARCHAR(10), next_agent_call ENUM('random','oldest_call_start','oldest_call_finish','overall_user_level','inbound_group_rank','campaign_rank','fewest_calls','fewest_calls_campaign','longest_wait_time') default 'longest_wait_time', fronter_display ENUM('Y','N') default 'Y', ingroup_script VARCHAR(10), -get_call_launch ENUM('NONE','SCRIPT','WEBFORM') default 'NONE', +get_call_launch ENUM('NONE','SCRIPT','WEBFORM','WEBFORMTWO','FORM') default 'NONE', xferconf_a_dtmf VARCHAR(50), xferconf_a_number VARCHAR(50), xferconf_b_dtmf VARCHAR(50), @@ -2269,7 +2269,7 @@ ALTER TABLE vicidial_agent_log_archive MODIFY agent_log_id INT(9) UNSIGNED NOT N CREATE TABLE vicidial_carrier_log_archive LIKE vicidial_carrier_log; -UPDATE system_settings SET db_schema_version='1230',db_schema_update_date=NOW(); +UPDATE system_settings SET db_schema_version='1231',db_schema_update_date=NOW(); GRANT RELOAD ON *.* TO cron@'%'; GRANT RELOAD ON *.* TO cron@localhost; diff --git a/extras/upgrade_2.4.sql b/extras/upgrade_2.4.sql index f1509c8a..f7c15ea3 100644 --- a/extras/upgrade_2.4.sql +++ b/extras/upgrade_2.4.sql @@ -393,3 +393,9 @@ UPDATE system_settings SET db_schema_version='1229',db_schema_update_date=NOW(); ALTER TABLE vicidial_lists_fields MODIFY field_type ENUM('TEXT','AREA','SELECT','MULTI','RADIO','CHECKBOX','DATE','TIME','DISPLAY','SCRIPT') default 'TEXT'; UPDATE system_settings SET db_schema_version='1230',db_schema_update_date=NOW(); + +ALTER TABLE vicidial_campaigns MODIFY get_call_launch ENUM('NONE','SCRIPT','WEBFORM','WEBFORMTWO','FORM') default 'NONE'; + +ALTER TABLE vicidial_inbound_groups MODIFY get_call_launch ENUM('NONE','SCRIPT','WEBFORM','WEBFORMTWO','FORM') default 'NONE'; + +UPDATE system_settings SET db_schema_version='1231',db_schema_update_date=NOW(); diff --git a/translations/raw_translation_files/TO_BE_TRANSLATED_2.4.txt b/translations/raw_translation_files/TO_BE_TRANSLATED_2.4.txt index 4fed6a7b..c835772c 100644 --- a/translations/raw_translation_files/TO_BE_TRANSLATED_2.4.txt +++ b/translations/raw_translation_files/TO_BE_TRANSLATED_2.4.txt @@ -242,6 +242,10 @@ Registration Password|| Login Password|| The password used for the phone user to login to the web-based client applications. IMPORTANT, this is the password only for the agent web interface phone login, to change the sip.conf or iax.conf password, or secret, for this phone device you need to modify the Registration Password in the next field|| SCRIPT will also display only, but you are able to use script variables just like in the Scripts feature. SCRIPT fields will also only display the content in the Options, and not the field name like the DISPLAY type does|| +You can also include the default ViciDial fields in a custom field setup, and you will see them in red in the list. These fields will not be added to the custom list database table, the agent interface will instead reference the vicidial_list table directly. The labels that you can use to include the default fieds are|| +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|| AST_VICIDIAL_ingrouplist.php diff --git a/www/agc/functions.php b/www/agc/functions.php new file mode 100644 index 00000000..c650f431 --- /dev/null +++ b/www/agc/functions.php @@ -0,0 +1,502 @@ + LICENSE: AGPLv2 +# +# +# CHANGES: +# 100629-1201 - First Build +# + + + +##### BEGIN gather values for display of custom list fields for a lead ##### +function custom_list_fields_values($lead_id,$list_id,$uniqueid,$user) + { + $STARTtime = date("U"); + $TODAY = date("Y-m-d"); + $NOW_TIME = date("Y-m-d H:i:s"); + + $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|'; + + require("dbconnect.php"); + + $CFoutput=''; + $stmt="SHOW TABLES LIKE \"custom_$list_id\";"; + if ($DB>0) {echo "$stmt";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'05002',$user,$server_ip,$session_name,$one_mysql_log);} + $tablecount_to_print = mysql_num_rows($rslt); + if ($tablecount_to_print > 0) + { + $stmt="SELECT count(*) from custom_$list_id;"; + if ($DB>0) {echo "$stmt";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'05003',$user,$server_ip,$session_name,$one_mysql_log);} + $fieldscount_to_print = mysql_num_rows($rslt); + if ($fieldscount_to_print > 0) + { + $rowx=mysql_fetch_row($rslt); + $custom_records_count = $rowx[0]; + + $select_SQL=''; + $stmt="SELECT field_id,field_label,field_name,field_description,field_rank,field_help,field_type,field_options,field_size,field_max,field_default,field_cost,field_required,multi_position,name_position,field_order from vicidial_lists_fields where list_id='$list_id' order by field_rank,field_order,field_label;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'05004',$user,$server_ip,$session_name,$one_mysql_log);} + $fields_to_print = mysql_num_rows($rslt); + $fields_list=''; + $o=0; + while ($fields_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $A_field_id[$o] = $rowx[0]; + $A_field_label[$o] = $rowx[1]; + $A_field_name[$o] = $rowx[2]; + $A_field_description[$o] = $rowx[3]; + $A_field_rank[$o] = $rowx[4]; + $A_field_help[$o] = $rowx[5]; + $A_field_type[$o] = $rowx[6]; + $A_field_options[$o] = $rowx[7]; + $A_field_size[$o] = $rowx[8]; + $A_field_max[$o] = $rowx[9]; + $A_field_default[$o] = $rowx[10]; + $A_field_cost[$o] = $rowx[11]; + $A_field_required[$o] = $rowx[12]; + $A_multi_position[$o] = $rowx[13]; + $A_name_position[$o] = $rowx[14]; + $A_field_order[$o] = $rowx[15]; + $A_field_value[$o] = ''; + + if (!preg_match("/\|$A_field_label[$o]\|/",$vicidial_list_fields)) + { + if ( ($A_field_type[$o]=='DISPLAY') or ($A_field_type[$o]=='SCRIPT') ) + { + $select_SQL .= "8,"; + $A_field_select[$o]='----EMPTY----'; + } + else + { + $select_SQL .= "$A_field_label[$o],"; + $A_field_select[$o]=$A_field_label[$o]; + } + } + else + {$A_field_value[$o] = '--A--' . $A_field_label[$o] . '--B--';} + $o++; + $rank_select .= ""; + } + $o++; + $rank_select .= ""; + $last_rank = $o; + $select_SQL = preg_replace("/.$/",'',$select_SQL); + + + ##### BEGIN grab the data from custom table for the lead_id + $stmt="SELECT $select_SQL FROM custom_$list_id where lead_id='$lead_id' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'05005',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $list_lead_ct = mysql_num_rows($rslt); + if ($list_lead_ct > 0) + { + $row=mysql_fetch_row($rslt); + $o=0; + while ($fields_to_print > $o) + { + $A_field_value[$o] = trim("$row[$o]"); + if ($A_field_select[$o]=='----EMPTY----') + {$A_field_value[$o]='';} + if (preg_match("/\|$A_field_label[$o]\|/",$vicidial_list_fields)) + {$A_field_value[$o] = '--A--' . $A_field_label[$o] . '--B--';} + $o++; + } + } + else + { + if ($DB) {echo "ERROR: no custom data for this lead: $lead_id\n";} + } + ##### END grab the data from custom table for the lead_id + + + $CFoutput .= "\n"; + $CFoutput .= "
\n"; + if ($fields_to_print < 1) + {$CFoutput .= "";} + + $o=0; + $last_field_rank=0; + while ($fields_to_print > $o) + { + $helpHTML=''; + if (strlen($A_field_help[$o])>0) + {$helpHTML="  help+";} + if ($last_field_rank=="$A_field_rank[$o]") + {$CFoutput .= "         ";} + else + { + $CFoutput .= "\n"; + $CFoutput .= "
There are no custom fields for this list
$helpHTML
";} + else + { + if ($last_field_rank=="$A_field_rank[$o]") + {$CFoutput .= "  ";} + else + {$CFoutput .= "
";} + } + $field_HTML=''; + + if ($A_field_type[$o]=='SELECT') + { + $field_HTML .= "\n"; + } + if ( ($A_field_type[$o]=='SELECT') or ($A_field_type[$o]=='MULTI') or ($A_field_type[$o]=='RADIO') or ($A_field_type[$o]=='CHECKBOX') ) + { + $field_options_array = explode("\n",$A_field_options[$o]); + $field_options_count = count($field_options_array); + $te=0; + while ($te < $field_options_count) + { + if (preg_match("/,/",$field_options_array[$te])) + { + $field_selected=''; + $field_options_value_array = explode(",",$field_options_array[$te]); + if ( ($A_field_type[$o]=='SELECT') or ($A_field_type[$o]=='MULTI') ) + { + if (strlen($A_field_value[$o]) > 0) + { + if (preg_match("/$field_options_value_array[0]/",$A_field_value[$o])) + {$field_selected = 'SELECTED';} + } + else + { + if ($A_field_default[$o] == "$field_options_value_array[0]") {$field_selected = 'SELECTED';} + } + $field_HTML .= "\n"; + } + if ( ($A_field_type[$o]=='RADIO') or ($A_field_type[$o]=='CHECKBOX') ) + { + if ($A_multi_position[$o]=='VERTICAL') + {$field_HTML .= "   ";} + if (strlen($A_field_value[$o]) > 0) + { + if (preg_match("/$field_options_value_array[0]/",$A_field_value[$o])) + {$field_selected = 'CHECKED';} + } + else + { + if ($A_field_default[$o] == "$field_options_value_array[0]") {$field_selected = 'CHECKED';} + } + $field_HTML .= " $field_options_value_array[1]\n"; + if ($A_multi_position[$o]=='VERTICAL') + {$field_HTML .= "
\n";} + } + } + $te++; + } + } + if ( ($A_field_type[$o]=='SELECT') or ($A_field_type[$o]=='MULTI') ) + { + $field_HTML .= "\n"; + } + if ($A_field_type[$o]=='TEXT') + { + if ($A_field_default[$o]=='NULL') {$A_field_default[$o]='';} + if (strlen($A_field_value[$o]) < 1) {$A_field_value[$o] = $A_field_default[$o];} + $field_HTML .= "\n"; + } + if ($A_field_type[$o]=='AREA') + { + if ($A_field_default[$o]=='NULL') {$A_field_default[$o]='';} + if (strlen($A_field_value[$o]) < 1) {$A_field_value[$o] = $A_field_default[$o];} + $field_HTML .= ""; + } + if ($A_field_type[$o]=='DISPLAY') + { + if ($A_field_default[$o]=='NULL') {$A_field_default[$o]='';} + $field_HTML .= "$A_field_default[$o]\n"; + } + if ($A_field_type[$o]=='SCRIPT') + { + if ($A_field_default[$o]=='NULL') {$A_field_default[$o]='';} + $field_HTML .= "$A_field_options[$o]\n"; + } + if ($A_field_type[$o]=='DATE') + { + if ( (strlen($A_field_default[$o])<1) or ($A_field_default[$o]=='NULL') ) {$A_field_default[$o]=0;} + $day_diff = $A_field_default[$o]; + $default_date = date("Y-m-d", mktime(date("H"),date("i"),date("s"),date("m"),date("d")+$day_diff,date("Y"))); + if (strlen($A_field_value[$o]) < 1) {$A_field_value[$o] = $default_date;} + + $field_HTML .= "\n"; + $field_HTML .= "\n"; + } + if ($A_field_type[$o]=='TIME') + { + $minute_diff = $A_field_default[$o]; + $default_time = date("H:i:s", mktime(date("H"),date("i")+$minute_diff,date("s"),date("m"),date("d"),date("Y"))); + $default_hour = date("H", mktime(date("H"),date("i")+$minute_diff,date("s"),date("m"),date("d"),date("Y"))); + $default_minute = date("i", mktime(date("H"),date("i")+$minute_diff,date("s"),date("m"),date("d"),date("Y"))); + if (strlen($A_field_value[$o]) > 2) + { + $default_time = $A_field_value[$o]; + $time_field_value = explode(':',$default_time); + $default_hour = $time_field_value[0]; + $default_minute = $time_field_value[1]; + } + $field_HTML .= ""; + $field_HTML .= ""; + $field_HTML .= ""; + } + + if ( ($A_name_position[$o]=='LEFT') and ($A_field_type[$o]!='SCRIPT') ) + { + $CFoutput .= " $field_HTML $helpHTML"; + } + else + { + $CFoutput .= " $field_HTML\n"; + } + + $last_field_rank=$A_field_rank[$o]; + $o++; + } + $CFoutput .= "
\n"; + } + else + {$CFoutput .= "ERROR: no custom list fields\n";} + } + else + {$CFoutput .= "ERROR: no custom list fields table\n";} + + + ##### BEGIN parsing for vicidial variables ##### + if (preg_match("/--A--/",$CFoutput)) + { + if ( (eregi('--A--user_custom_',$CFoutput)) or (eregi('--A--fullname',$CFoutput)) ) + { + $stmt = "select custom_one,custom_two,custom_three,custom_four,custom_five,full_name from vicidial_users where user='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'05006',$user,$server_ip,$session_name,$one_mysql_log);} + $VUC_ct = mysql_num_rows($rslt); + if ($VUC_ct > 0) + { + $row=mysql_fetch_row($rslt); + $user_custom_one = trim($row[0]); + $user_custom_two = trim($row[1]); + $user_custom_three = trim($row[2]); + $user_custom_four = trim($row[3]); + $user_custom_five = trim($row[4]); + $fullname = trim($row[5]); + } + } + + if (eregi('--A--dialed_',$CFoutput)) + { + $dialed_number = $phone_number; + $dialed_label = 'NONE'; + + ### find the dialed number and label for this call + $stmt = "SELECT phone_number,alt_dial from vicidial_log where uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'05008',$user,$server_ip,$session_name,$one_mysql_log);} + $vl_dialed_ct = mysql_num_rows($rslt); + if ($vl_dialed_ct > 0) + { + $row=mysql_fetch_row($rslt); + $dialed_number = $row[0]; + $dialed_label = $row[1]; + } + } + + ##### grab the data from vicidial_list for the lead_id + $stmt="SELECT lead_id,entry_date,modify_date,status,user,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 FROM vicidial_list where lead_id='$lead_id' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'05007',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $list_lead_ct = mysql_num_rows($rslt); + if ($list_lead_ct > 0) + { + $row=mysql_fetch_row($rslt); + $dispo = trim($row[3]); + $tsr = trim($row[4]); + $vendor_id = trim($row[5]); + $vendor_lead_code = trim($row[5]); + $source_id = trim($row[6]); + $list_id = trim($row[7]); + $gmt_offset_now = trim($row[8]); + $phone_code = trim($row[10]); + $phone_number = trim($row[11]); + $title = trim($row[12]); + $first_name = trim($row[13]); + $middle_initial = trim($row[14]); + $last_name = trim($row[15]); + $address1 = trim($row[16]); + $address2 = trim($row[17]); + $address3 = trim($row[18]); + $city = trim($row[19]); + $state = trim($row[20]); + $province = trim($row[21]); + $postal_code = trim($row[22]); + $country_code = trim($row[23]); + $gender = trim($row[24]); + $date_of_birth = trim($row[25]); + $alt_phone = trim($row[26]); + $email = trim($row[27]); + $security = trim($row[28]); + $comments = trim($row[29]); + $called_count = trim($row[30]); + $rank = trim($row[32]); + $owner = trim($row[33]); + } + + $CFoutput = eregi_replace('--A--lead_id--B--',"$lead_id",$CFoutput); + $CFoutput = eregi_replace('--A--vendor_id--B--',"$vendor_id",$CFoutput); + $CFoutput = eregi_replace('--A--vendor_lead_code--B--',"$vendor_lead_code",$CFoutput); + $CFoutput = eregi_replace('--A--list_id--B--',"$list_id",$CFoutput); + $CFoutput = eregi_replace('--A--gmt_offset_now--B--',"$gmt_offset_now",$CFoutput); + $CFoutput = eregi_replace('--A--phone_code--B--',"$phone_code",$CFoutput); + $CFoutput = eregi_replace('--A--phone_number--B--',"$phone_number",$CFoutput); + $CFoutput = eregi_replace('--A--title--B--',"$title",$CFoutput); + $CFoutput = eregi_replace('--A--first_name--B--',"$first_name",$CFoutput); + $CFoutput = eregi_replace('--A--middle_initial--B--',"$middle_initial",$CFoutput); + $CFoutput = eregi_replace('--A--last_name--B--',"$last_name",$CFoutput); + $CFoutput = eregi_replace('--A--address1--B--',"$address1",$CFoutput); + $CFoutput = eregi_replace('--A--address2--B--',"$address2",$CFoutput); + $CFoutput = eregi_replace('--A--address3--B--',"$address3",$CFoutput); + $CFoutput = eregi_replace('--A--city--B--',"$city",$CFoutput); + $CFoutput = eregi_replace('--A--state--B--',"$state",$CFoutput); + $CFoutput = eregi_replace('--A--province--B--',"$province",$CFoutput); + $CFoutput = eregi_replace('--A--postal_code--B--',"$postal_code",$CFoutput); + $CFoutput = eregi_replace('--A--country_code--B--',"$country_code",$CFoutput); + $CFoutput = eregi_replace('--A--gender--B--',"$gender",$CFoutput); + $CFoutput = eregi_replace('--A--date_of_birth--B--',"$date_of_birth",$CFoutput); + $CFoutput = eregi_replace('--A--alt_phone--B--',"$alt_phone",$CFoutput); + $CFoutput = eregi_replace('--A--email--B--',"$email",$CFoutput); + $CFoutput = eregi_replace('--A--security_phrase--B--',"$security_phrase",$CFoutput); + $CFoutput = eregi_replace('--A--comments--B--',"$comments",$CFoutput); + $CFoutput = eregi_replace('--A--user--B--',"$user",$CFoutput); + $CFoutput = eregi_replace('--A--pass--B--',"$pass",$CFoutput); + $CFoutput = eregi_replace('--A--campaign--B--',"$campaign",$CFoutput); + $CFoutput = eregi_replace('--A--server_ip--B--',"$server_ip",$CFoutput); + $CFoutput = eregi_replace('--A--session_id--B--',"$session_id",$CFoutput); + $CFoutput = eregi_replace('--A--dialed_number--B--',"$dialed_number",$CFoutput); + $CFoutput = eregi_replace('--A--dialed_label--B--',"$dialed_label",$CFoutput); + $CFoutput = eregi_replace('--A--source_id--B--',"$source_id",$CFoutput); + $CFoutput = eregi_replace('--A--rank--B--',"$rank",$CFoutput); + $CFoutput = eregi_replace('--A--owner--B--',"$owner",$CFoutput); + $CFoutput = eregi_replace('--A--fullname--B--',"$fullname",$CFoutput); + $CFoutput = eregi_replace('--A--uniqueid--B--',"$uniqueid",$CFoutput); + $CFoutput = eregi_replace('--A--user_custom_one--B--',"$user_custom_one",$CFoutput); + $CFoutput = eregi_replace('--A--user_custom_two--B--',"$user_custom_two",$CFoutput); + $CFoutput = eregi_replace('--A--user_custom_three--B--',"$user_custom_three",$CFoutput); + $CFoutput = eregi_replace('--A--user_custom_four--B--',"$user_custom_four",$CFoutput); + $CFoutput = eregi_replace('--A--user_custom_five--B--',"$user_custom_five",$CFoutput); + + # custom fields replacement + $o=0; + while ($fields_to_print > $o) + { + $CFoutput = eregi_replace("--A--$A_field_label[$o]--B--","$A_field_value[$o]",$CFoutput); + $o++; + } + + if ($DB > 0) {echo "$CFoutput
\n";} + } + ##### END parsing for vicidial variables ##### + + + return $CFoutput; + } +##### END gather values for display of custom list fields for a lead ##### + + + + + +##### MySQL Error Logging ##### +function mysql_error_logging($NOW_TIME,$link,$mel,$stmt,$query_id,$user,$server_ip,$session_name,$one_mysql_log) + { + $NOW_TIME = date("Y-m-d H:i:s"); + # mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00001',$user,$server_ip,$session_name,$one_mysql_log); + $errno=''; $error=''; + if ( ($mel > 0) or ($one_mysql_log > 0) ) + { + $errno = mysql_errno($link); + if ( ($errno > 0) or ($mel > 1) or ($one_mysql_log > 0) ) + { + $error = mysql_error($link); + $efp = fopen ("./vicidial_mysql_errors.txt", "a"); + fwrite ($efp, "$NOW_TIME|vdc_db_query|$query_id|$errno|$error|$stmt|$user|$server_ip|$session_name|\n"); + fclose($efp); + } + } + $one_mysql_log=0; + return $errno; + } + + +?> \ No newline at end of file diff --git a/www/agc/images/vdc_tab_form.gif b/www/agc/images/vdc_tab_form.gif new file mode 100644 index 00000000..5e424087 Binary files /dev/null and b/www/agc/images/vdc_tab_form.gif differ diff --git a/www/agc/images/vdc_tab_form_es.gif b/www/agc/images/vdc_tab_form_es.gif new file mode 100644 index 00000000..8843cbf7 Binary files /dev/null and b/www/agc/images/vdc_tab_form_es.gif differ diff --git a/www/agc/images/vdc_tab_script.gif b/www/agc/images/vdc_tab_script.gif index 58e934a7..8bf3e739 100644 Binary files a/www/agc/images/vdc_tab_script.gif and b/www/agc/images/vdc_tab_script.gif differ diff --git a/www/agc/images/vdc_tab_script_de.gif b/www/agc/images/vdc_tab_script_de.gif index d2a252c7..d9097669 100644 Binary files a/www/agc/images/vdc_tab_script_de.gif and b/www/agc/images/vdc_tab_script_de.gif differ diff --git a/www/agc/images/vdc_tab_script_es.gif b/www/agc/images/vdc_tab_script_es.gif index ba4320d4..9d966f71 100644 Binary files a/www/agc/images/vdc_tab_script_es.gif and b/www/agc/images/vdc_tab_script_es.gif differ diff --git a/www/agc/vdc_form_display.php b/www/agc/vdc_form_display.php new file mode 100644 index 00000000..cb422504 --- /dev/null +++ b/www/agc/vdc_form_display.php @@ -0,0 +1,319 @@ + 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 +# dispositions the call +# +# CHANGELOG: +# 100630-1119 - First build of script +# + +$version = '2.4-1'; +$build = '100630-1119'; + +require("dbconnect.php"); +require("functions.php"); + + +if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];} + elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];} +if (isset($_GET["list_id"])) {$list_id=$_GET["list_id"];} + elseif (isset($_POST["list_id"])) {$list_id=$_POST["list_id"];} +if (isset($_GET["user"])) {$user=$_GET["user"];} + elseif (isset($_POST["user"])) {$user=$_POST["user"];} +if (isset($_GET["pass"])) {$pass=$_GET["pass"];} + elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];} +if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} + elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];} +if (isset($_GET["session_id"])) {$session_id=$_GET["session_id"];} + elseif (isset($_POST["session_id"])) {$session_id=$_POST["session_id"];} +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"];} + +header ("Content-type: text/html; charset=utf-8"); +header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 +header ("Pragma: no-cache"); // HTTP/1.0 + +$txt = '.txt'; +$StarTtime = date("U"); +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$CIDdate = date("mdHis"); +$ENTRYdate = date("YmdHis"); +$MT[0]=''; +$agents='@agents'; +$script_height = ($script_height - 20); + +$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|'; + +$IFRAME=0; + +############################################# +##### START SYSTEM_SETTINGS LOOKUP ##### +$stmt = "SELECT use_non_latin,timeclock_end_of_day,agentonly_callback_campaign_lock 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]; + $timeclock_end_of_day = $row[1]; + $agentonly_callback_campaign_lock = $row[2]; + } +##### END SETTINGS LOOKUP ##### +########################################### + +if ($non_latin < 1) + { + $user=ereg_replace("[^-_0-9a-zA-Z]","",$user); + $pass=ereg_replace("[^-_0-9a-zA-Z]","",$pass); + $length_in_sec = ereg_replace("[^0-9]","",$length_in_sec); + $phone_code = ereg_replace("[^0-9]","",$phone_code); + $phone_number = ereg_replace("[^0-9]","",$phone_number); + } +else + { + $user = ereg_replace("'|\"|\\\\|;","",$user); + $pass = ereg_replace("'|\"|\\\\|;","",$pass); + } + + +# default optional vars if not set +if (!isset($format)) {$format="text";} + if ($format == 'debug') {$DB=1;} +if (!isset($ACTION)) {$ACTION="refresh";} +if (!isset($query_date)) {$query_date = $NOW_DATE;} + +$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;"; +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); +$auth=$row[0]; + +$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and modify_leads='1';"; +if ($DB) {echo "|$stmt|\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$VUmodify=$row[0]; + +$stmt="SELECT count(*) from vicidial_live_agents where user='$user';"; +if ($DB) {echo "|$stmt|\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$LVAactive=$row[0]; + + +if ( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0) or ( ($LVAactive < 1) and ($VUmodify < 1) ) ) + { + echo "Invalid Username/Password: |$user|$pass|\n"; + echo "
\n"; + echo "\n"; + echo "
\n"; + exit; + } +else + { + # do nothing for now + } + + +### BEGIN parse submission of the custom fields form ### +if ($stage=='SUBMIT') + { + $CFoutput=''; + $stmt="SHOW TABLES LIKE \"custom_$list_id\";"; + if ($DB>0) {echo "$stmt";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'06001',$user,$server_ip,$session_name,$one_mysql_log);} + $tablecount_to_print = mysql_num_rows($rslt); + if ($tablecount_to_print > 0) + { + $stmt="SELECT count(*) from custom_$list_id;"; + if ($DB>0) {echo "$stmt";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'06002',$user,$server_ip,$session_name,$one_mysql_log);} + $fieldscount_to_print = mysql_num_rows($rslt); + if ($fieldscount_to_print > 0) + { + $rowx=mysql_fetch_row($rslt); + $custom_records_count = $rowx[0]; + + $update_SQL=''; + $VL_update_SQL=''; + $stmt="SELECT field_id,field_label,field_name,field_description,field_rank,field_help,field_type,field_options,field_size,field_max,field_default,field_cost,field_required,multi_position,name_position,field_order from vicidial_lists_fields where list_id='$list_id' order by field_rank,field_order,field_label;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'06003',$user,$server_ip,$session_name,$one_mysql_log);} + $fields_to_print = mysql_num_rows($rslt); + $fields_list=''; + $o=0; + while ($fields_to_print > $o) + { + $new_field_value=''; + $form_field_value=''; + $rowx=mysql_fetch_row($rslt); + $A_field_id[$o] = $rowx[0]; + $A_field_label[$o] = $rowx[1]; + $A_field_name[$o] = $rowx[2]; + $A_field_type[$o] = $rowx[6]; + $A_field_size[$o] = $rowx[8]; + $A_field_max[$o] = $rowx[9]; + $A_field_required[$o] = $rowx[12]; + $A_field_value[$o] = ''; + $field_name_id = $A_field_label[$o]; + + if (isset($_GET["$field_name_id"])) {$form_field_value=$_GET["$field_name_id"];} + elseif (isset($_POST["$field_name_id"])) {$form_field_value=$_POST["$field_name_id"];} + + if ( ($A_field_type[$o]=='MULTI') or ($A_field_type[$o]=='CHECKBOX') or ($A_field_type[$o]=='RADIO') ) + { + $k=0; + $multi_count = count($form_field_value); + $multi_array = $form_field_value; + while ($k < $multi_count) + { + $new_field_value .= "$multi_array[$k],"; + $k++; + } + $form_field_value = preg_replace("/,$/","",$new_field_value); + } + + if ($A_field_type[$o]=='TIME') + { + if (isset($_GET["MINUTE_$field_name_id"])) {$form_field_valueM=$_GET["MINUTE_$field_name_id"];} + elseif (isset($_POST["MINUTE_$field_name_id"])) {$form_field_valueM=$_POST["MINUTE_$field_name_id"];} + if (isset($_GET["HOUR_$field_name_id"])) {$form_field_valueH=$_GET["HOUR_$field_name_id"];} + elseif (isset($_POST["HOUR_$field_name_id"])) {$form_field_valueH=$_POST["HOUR_$field_name_id"];} + $form_field_value = "$form_field_valueH:$form_field_valueM:00"; + } + + $A_field_value[$o] = $form_field_value; + + if ( ($A_field_type[$o]=='DISPLAY') or ($A_field_type[$o]=='SCRIPT') ) + { + $A_field_value[$o]='----IGNORE----'; + } + else + { + if (preg_match("/\|$A_field_label[$o]\|/",$vicidial_list_fields)) + { + $VL_update_SQL .= "$A_field_label[$o]='$A_field_value[$o]',"; + } + else + { + $update_SQL .= "$A_field_label[$o]='$A_field_value[$o]',"; + } + + $SUBMIT_output .= "$A_field_name[$o]: $A_field_value[$o]
"; + } + $o++; + } + + if (strlen($VL_update_SQL)>3) + { + $VL_update_SQL = preg_replace("/,$/","",$VL_update_SQL); + $list_table_update_SQL = "UPDATE vicidial_list SET $VL_update_SQL where lead_id='$lead_id';"; + + $rslt=mysql_query($list_table_update_SQL, $link); + $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());} + } + + if (strlen($update_SQL)>3) + { + $custom_record_lead_count=0; + $stmt="SELECT count(*) from custom_$list_id where lead_id='$lead_id';"; + if ($DB>0) {echo "$stmt";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'06004',$user,$server_ip,$session_name,$one_mysql_log);} + $fieldleadcount_to_print = mysql_num_rows($rslt); + if ($fieldleadcount_to_print > 0) + { + $rowx=mysql_fetch_row($rslt); + $custom_record_lead_count = $rowx[0]; + } + $update_SQL = preg_replace("/,$/","",$update_SQL); + $custom_table_update_SQL = "INSERT INTO custom_$list_id SET lead_id='$lead_id',$update_SQL;"; + if ($custom_record_lead_count > 0) + {$custom_table_update_SQL = "UPDATE custom_$list_id SET $update_SQL where lead_id='$lead_id';";} + + $rslt=mysql_query($custom_table_update_SQL, $link); + $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());} + } + +# echo "$list_update_count|$list_table_update_SQL\n
\n$custom_update_count|$custom_table_update_SQL
\n"; + } + else + {$CFoutput .= "ERROR: no custom list fields\n";} + } + else + {$CFoutput .= "ERROR: no custom list fields table\n";} + + echo "Custom Form Output:\n
\n"; + + echo "$SUBMIT_output"; + + echo "
\n"; + echo "\n"; + echo "
\n"; + } +### END parse submission of the custom fields form ### +else + { + echo "\n"; + echo "\n"; + echo "\n"; + echo "ViciDiaL Form Display Script"; + echo "\n"; + + echo "\n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + + require("functions.php"); + + $CFoutput = custom_list_fields_values($lead_id,$list_id,$uniqueid,$user); + + echo "$CFoutput"; + +# echo "



\n"; + echo "


\n"; + echo "\n"; + } + + +exit; + +?> diff --git a/www/agc/vicidial.php b/www/agc/vicidial.php index 8dcf9bbb..1c0c6d41 100644 --- a/www/agc/vicidial.php +++ b/www/agc/vicidial.php @@ -298,15 +298,18 @@ # 100616-1622 - Allowed longer manual dial numbers # 100622-2209 - Added field labels # 100625-1118 - Added poor-network-connection-mitigating code +# 100629-1158 - Added initial code for custom list fields +# 100702-1315 - Custom List Fields functionality enabled # -$version = '2.4-276'; -$build = '100625-1118'; +$version = '2.4-278'; +$build = '100702-1315'; $mel=1; # Mysql Error Log enabled = 1 $mysql_log_count=66; $one_mysql_log=0; require("dbconnect.php"); +require("functions.php"); if (isset($_GET["DB"])) {$DB=$_GET["DB"];} elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} @@ -383,7 +386,7 @@ $random = (rand(1000000, 9999999) + 10000000); ############################################# ##### START SYSTEM_SETTINGS LOOKUP ##### -$stmt = "SELECT use_non_latin,vdc_header_date_format,vdc_customer_date_format,vdc_header_phone_format,webroot_writable,timeclock_end_of_day,vtiger_url,enable_vtiger_integration,outbound_autodial_active,enable_second_webform,user_territories_active,static_agent_url FROM system_settings;"; +$stmt = "SELECT use_non_latin,vdc_header_date_format,vdc_customer_date_format,vdc_header_phone_format,webroot_writable,timeclock_end_of_day,vtiger_url,enable_vtiger_integration,outbound_autodial_active,enable_second_webform,user_territories_active,static_agent_url,custom_fields_enabled FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01001',$VD_login,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -403,6 +406,7 @@ if ($qm_conf_ct > 0) $enable_second_webform = $row[9]; $user_territories_active = $row[10]; $static_agent_url = $row[11]; + $custom_fields_enabled = $row[12]; } ##### END SETTINGS LOOKUP ##### ########################################### @@ -454,6 +458,7 @@ else $BROWSER_WIDTH = 770; # set to the minimum browser width, default=770 $MAIN_COLOR = '#CCCCCC'; # old default is E0C2D6 $SCRIPT_COLOR = '#E6E6E6'; # old default is FFE7D0 + $FORM_COLOR = '#EFEFEF'; $SIDEBAR_COLOR = '#F6F6F6'; } @@ -2980,6 +2985,8 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} var api_transferconf_override=''; var api_parkcustomer=''; var API_selected_xfergroup=''; + var custom_fields_enabled=''; + var form_contents_loaded=0; var DiaLControl_auto_HTML = "\"\"Resume\""; var DiaLControl_auto_HTML_ready = "\"\"Resume\""; var DiaLControl_auto_HTML_OFF = "\"\"Resume\""; @@ -6074,6 +6081,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} else { load_script_contents(); + FormContentsLoad(); } } @@ -6086,6 +6094,12 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} ScriptPanelToFront(); } + if (get_call_launch == 'FORM') + { + FormPanelToFront(); + } + + if (get_call_launch == 'WEBFORM') { window.open(TEMP_VDIC_web_form_address, web_form_target, 'toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1,width=640,height=450'); @@ -6461,6 +6475,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} else { load_script_contents(); + FormContentsLoad(); } } @@ -6472,6 +6487,10 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} } ScriptPanelToFront(); } + if (get_call_launch == 'FORM') + { + FormPanelToFront(); + } if (get_call_launch == 'WEBFORM') { window.open(TEMP_VDIC_web_form_address, web_form_target, 'toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1,width=640,height=450'); @@ -7408,6 +7427,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} else { load_script_contents(); + FormContentsLoad(); } } @@ -7419,6 +7439,10 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} } ScriptPanelToFront(); } + if (CalL_AutO_LauncH == 'FORM') + { + FormPanelToFront(); + } if (CalL_AutO_LauncH == 'WEBFORM') { @@ -10150,6 +10174,14 @@ function phone_number_format(formatphone) { } + +// ################################################################################ +// Refresh the FORM content + function FormContentsLoad() + { + document.getElementById('vcFormIFrame').src='./vdc_form_display.php?lead_id=' + document.vicidial_form.lead_id.value + '&list_id=' + document.vicidial_form.list_id.value + '&user=' + user + '&pass=' + pass + '&campaign=' + campaign + '&server_ip=' + server_ip + '&session_id=' + '&uniqueid=' + document.vicidial_form.uniqueid.value + '&stage=DISPLAY'; + } + // ################################################################################ // Move the Dispo frame out of the way and change the link to maximize function DispoMinimize() @@ -10430,6 +10462,8 @@ else hideDiv('MainPanel'); hideDiv('ScriptPanel'); hideDiv('ScriptRefresH'); + hideDiv('FormPanel'); + hideDiv('FormRefresH'); hideDiv('DispoSelectBox'); hideDiv('LogouTBox'); hideDiv('AgenTDisablEBoX'); @@ -10627,6 +10661,13 @@ else reselect_alt_dial = 0; } } + + // Submit custom form if it is custom_fields_enabled + if (custom_fields_enabled > 0) + { + // alert("IFRAME submitting!"); + vcFormIFrame.document.form_custom_fields.submit(); + } } if (AgentDispoing > 0) { @@ -11182,6 +11223,8 @@ else document.getElementById("MaiNfooter").style.backgroundColor=""; hideDiv('ScriptPanel'); hideDiv('ScriptRefresH'); + hideDiv('FormPanel'); + hideDiv('FormRefresH'); showDiv('MainPanel'); ShoWGenDerPulldown(); @@ -11228,6 +11271,8 @@ else { showDiv('ScriptPanel'); showDiv('ScriptRefresH'); + hideDiv('FormPanel'); + hideDiv('FormRefresH'); document.getElementById("MainTable").style.backgroundColor=""; document.getElementById("MaiNfooter").style.backgroundColor=""; panel_bgcolor=''; @@ -11236,6 +11281,18 @@ else HidEGenDerPulldown(); } + function FormPanelToFront() + { + showDiv('FormPanel'); + showDiv('FormRefresH'); + document.getElementById("MainTable").style.backgroundColor=""; + document.getElementById("MaiNfooter").style.backgroundColor=""; + panel_bgcolor=''; + document.getElementById("MainStatuSSpan").style.background = panel_bgcolor; + + HidEGenDerPulldown(); + } + function HidEGenDerPulldown() { var gIndex = 0; @@ -11323,7 +11380,10 @@ $zi=1; height=30> - + + 0) + {echo "\n";} + ?> @@ -11610,6 +11670,14 @@ if ($agent_display_dialable_leads > 0) refresh + +
MAINSCRIPTSCRIPT\"FORM\" VALIGN=MIDDLE ALIGN=CENTER>  LIVE   session ID:     Live Call
height=>
+ + + +refresh + + > @@ -12025,26 +12093,4 @@ Available Agents Transfer: 0) or ($one_mysql_log > 0) ) - { - $errno = mysql_errno($link); - if ( ($errno > 0) or ($mel > 1) or ($one_mysql_log > 0) ) - { - $error = mysql_error($link); - $efp = fopen ("./vicidial_mysql_errors.txt", "a"); - fwrite ($efp, "$NOW_TIME|vicidial |$query_id|$errno|$error|$stmt|$user|$server_ip|$session_name|\n"); - fclose($efp); - } - } - $one_mysql_log=0; - return $errno; - } - ?> diff --git a/www/vicidial/admin.php b/www/vicidial/admin.php index 09140795..210ce0a1 100644 --- a/www/vicidial/admin.php +++ b/www/vicidial/admin.php @@ -1327,6 +1327,8 @@ if (isset($_GET["label_email"])) {$label_email=$_GET["label_email"];} elseif (isset($_POST["label_email"])) {$label_email=$_POST["label_email"];} if (isset($_GET["label_comments"])) {$label_comments=$_GET["label_comments"];} elseif (isset($_POST["label_comments"])) {$label_comments=$_POST["label_comments"];} +if (isset($_GET["custom_fields_enabled"])) {$custom_fields_enabled=$_GET["custom_fields_enabled"];} + elseif (isset($_POST["custom_fields_enabled"])) {$custom_fields_enabled=$_POST["custom_fields_enabled"];} if (isset($script_id)) {$script_id= strtoupper($script_id);} @@ -1542,6 +1544,7 @@ if ($non_latin < 1) $hold_time_option_minimum = ereg_replace("[^0-9]","",$hold_time_option_minimum); $onhold_prompt_seconds = ereg_replace("[^0-9]","",$onhold_prompt_seconds); $hold_time_option_prompt_seconds = ereg_replace("[^0-9]","",$hold_time_option_prompt_seconds); + $custom_fields_enabled = ereg_replace("[^0-9]","",$custom_fields_enabled); $drop_call_seconds = ereg_replace("[^-0-9]","",$drop_call_seconds); @@ -2317,11 +2320,12 @@ else # 100616-2232 - Added VIDPROMPT call menu options # 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 # # 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-259'; -$build = '100622-1700'; +$admin_version = '2.4-260'; +$build = '100702-1142'; $STARTtime = date("U"); $SQLdate = date("Y-m-d H:i:s"); @@ -4130,7 +4134,7 @@ if ($ADD==99999)

- Get Call Launch - This menu allows you to choose whether you want to auto-launch the web-form page in a separate window, auto-switch to the SCRIPT tab or do nothing when a call is sent to the agent for this campaign. + Get Call Launch - This menu allows you to choose whether you want to auto-launch the web-form page in a separate window, auto-switch to the SCRIPT tab or do nothing when a call is sent to the agent for this campaign. If custom list fields are enabled on your system, FORM will open the FORM tab upon connection of a call to an agent.
@@ -4551,7 +4555,7 @@ if ($ADD==99999)

- Get Call Launch - This menu allows you to choose whether you want to auto-launch the web-form page in a separate window, auto-switch to the SCRIPT tab or do nothing when a call is sent to the agent for this campaign. + Get Call Launch - This menu allows you to choose whether you want to auto-launch the web-form page in a separate window, auto-switch to the SCRIPT tab or do nothing when a call is sent to the agent for this campaign. If custom list fields are enabled on your system, FORM will open the FORM tab upon connection of a call to an agent.
@@ -6454,6 +6458,11 @@ if ($ADD==99999)
Enable CallCard - This setting enables the CallCard features with ViciDial to allow for callers to use pin numbers and card_ids that have a balance of minutes and those balances can have agent talk time on customer calls to in-groups deducted. Default is 0 for disabled. +
+
+
+ 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. +

@@ -7192,10 +7201,12 @@ if ($ADD==11) echo "$scripts_list"; echo "$NWB#vicidial_campaigns-campaign_script$NWE\n"; - $eswHTML=''; + $eswHTML=''; $cfwHTML=''; if ($SSenable_second_webform > 0) {$eswHTML = '';} - echo "
\n"; + if ($SScustom_fields_enabled > 0) + {$cfwHTML = '';} + echo "\n"; echo "\n"; echo "
Get Call Launch: $NWB#vicidial_campaigns-get_call_launch$NWE
Get Call Launch: $NWB#vicidial_campaigns-get_call_launch$NWE
\n"; } @@ -7533,10 +7544,12 @@ if ($ADD==1111) echo "Script: $NWB#vicidial_inbound_groups-ingroup_script$NWE\n"; - $eswHTML=''; + $eswHTML=''; $cfwHTML=''; if ($SSenable_second_webform > 0) {$eswHTML = '';} - echo "Get Call Launch: $NWB#vicidial_inbound_groups-get_call_launch$NWE\n"; + if ($SScustom_fields_enabled > 0) + {$cfwHTML = '';} + echo "Get Call Launch: $NWB#vicidial_inbound_groups-get_call_launch$NWE\n"; echo "\n"; echo "\n"; } @@ -14213,7 +14226,7 @@ if ($ADD==411111111111111) echo "
VICIDIAL SYSTEM SETTINGS MODIFIED\n"; - $stmt="UPDATE system_settings set use_non_latin='$use_non_latin',webroot_writable='$webroot_writable',enable_queuemetrics_logging='$enable_queuemetrics_logging',queuemetrics_server_ip='$queuemetrics_server_ip',queuemetrics_dbname='$queuemetrics_dbname',queuemetrics_login='$queuemetrics_login',queuemetrics_pass='$queuemetrics_pass',queuemetrics_url='$queuemetrics_url',queuemetrics_log_id='$queuemetrics_log_id',queuemetrics_eq_prepend='$queuemetrics_eq_prepend',vicidial_agent_disable='$vicidial_agent_disable',allow_sipsak_messages='$allow_sipsak_messages',admin_home_url='$admin_home_url',enable_agc_xfer_log='$enable_agc_xfer_log',timeclock_end_of_day='$timeclock_end_of_day',vdc_header_date_format='$vdc_header_date_format',vdc_customer_date_format='$vdc_customer_date_format',vdc_header_phone_format='$vdc_header_phone_format',vdc_agent_api_active='$vdc_agent_api_active',enable_vtiger_integration='$enable_vtiger_integration',vtiger_server_ip='$vtiger_server_ip',vtiger_dbname='$vtiger_dbname',vtiger_login='$vtiger_login',vtiger_pass='$vtiger_pass',vtiger_url='$vtiger_url',qc_features_active='$qc_features_active',outbound_autodial_active='$outbound_autodial_active',outbound_calls_per_second='$outbound_calls_per_second',enable_tts_integration='$enable_tts_integration',agentonly_callback_campaign_lock='$agentonly_callback_campaign_lock',sounds_central_control_active='$sounds_central_control_active',sounds_web_server='$sounds_web_server',sounds_web_directory='$sounds_web_directory',active_voicemail_server='$active_voicemail_server',auto_dial_limit='$auto_dial_limit',user_territories_active='$user_territories_active',allow_custom_dialplan='$allow_custom_dialplan',enable_second_webform='$enable_second_webform',default_webphone='$default_webphone',default_external_server_ip='$default_external_server_ip',webphone_url='$webphone_url',enable_agc_dispo_log='$enable_agc_dispo_log',custom_dialplan_entry='$custom_dialplan_entry',queuemetrics_loginout='$queuemetrics_loginout',callcard_enabled='$callcard_enabled',queuemetrics_callstatus='$queuemetrics_callstatus',default_codecs='$default_codecs',admin_web_directory='$admin_web_directory',label_title='$label_title',label_first_name='$label_first_name',label_middle_initial='$label_middle_initial',label_last_name='$label_last_name',label_address1='$label_address1',label_address2='$label_address2',label_address3='$label_address3',label_city='$label_city',label_state='$label_state',label_province='$label_province',label_postal_code='$label_postal_code',label_vendor_lead_code='$label_vendor_lead_code',label_gender='$label_gender',label_phone_number='$label_phone_number',label_phone_code='$label_phone_code',label_alt_phone='$label_alt_phone',label_security_phrase='$label_security_phrase',label_email='$label_email',label_comments='$label_comments';"; + $stmt="UPDATE system_settings set use_non_latin='$use_non_latin',webroot_writable='$webroot_writable',enable_queuemetrics_logging='$enable_queuemetrics_logging',queuemetrics_server_ip='$queuemetrics_server_ip',queuemetrics_dbname='$queuemetrics_dbname',queuemetrics_login='$queuemetrics_login',queuemetrics_pass='$queuemetrics_pass',queuemetrics_url='$queuemetrics_url',queuemetrics_log_id='$queuemetrics_log_id',queuemetrics_eq_prepend='$queuemetrics_eq_prepend',vicidial_agent_disable='$vicidial_agent_disable',allow_sipsak_messages='$allow_sipsak_messages',admin_home_url='$admin_home_url',enable_agc_xfer_log='$enable_agc_xfer_log',timeclock_end_of_day='$timeclock_end_of_day',vdc_header_date_format='$vdc_header_date_format',vdc_customer_date_format='$vdc_customer_date_format',vdc_header_phone_format='$vdc_header_phone_format',vdc_agent_api_active='$vdc_agent_api_active',enable_vtiger_integration='$enable_vtiger_integration',vtiger_server_ip='$vtiger_server_ip',vtiger_dbname='$vtiger_dbname',vtiger_login='$vtiger_login',vtiger_pass='$vtiger_pass',vtiger_url='$vtiger_url',qc_features_active='$qc_features_active',outbound_autodial_active='$outbound_autodial_active',outbound_calls_per_second='$outbound_calls_per_second',enable_tts_integration='$enable_tts_integration',agentonly_callback_campaign_lock='$agentonly_callback_campaign_lock',sounds_central_control_active='$sounds_central_control_active',sounds_web_server='$sounds_web_server',sounds_web_directory='$sounds_web_directory',active_voicemail_server='$active_voicemail_server',auto_dial_limit='$auto_dial_limit',user_territories_active='$user_territories_active',allow_custom_dialplan='$allow_custom_dialplan',enable_second_webform='$enable_second_webform',default_webphone='$default_webphone',default_external_server_ip='$default_external_server_ip',webphone_url='$webphone_url',enable_agc_dispo_log='$enable_agc_dispo_log',custom_dialplan_entry='$custom_dialplan_entry',queuemetrics_loginout='$queuemetrics_loginout',callcard_enabled='$callcard_enabled',queuemetrics_callstatus='$queuemetrics_callstatus',default_codecs='$default_codecs',admin_web_directory='$admin_web_directory',label_title='$label_title',label_first_name='$label_first_name',label_middle_initial='$label_middle_initial',label_last_name='$label_last_name',label_address1='$label_address1',label_address2='$label_address2',label_address3='$label_address3',label_city='$label_city',label_state='$label_state',label_province='$label_province',label_postal_code='$label_postal_code',label_vendor_lead_code='$label_vendor_lead_code',label_gender='$label_gender',label_phone_number='$label_phone_number',label_phone_code='$label_phone_code',label_alt_phone='$label_alt_phone',label_security_phrase='$label_security_phrase',label_email='$label_email',label_comments='$label_comments',custom_fields_enabled='$custom_fields_enabled';"; $rslt=mysql_query($stmt, $link); ### LOG INSERTION Admin Log Table ### @@ -17635,10 +17648,12 @@ if ($ADD==31) {echo " LIST OVERRIDE ACTIVE";} echo "\n"; - $eswHTML=''; + $eswHTML=''; $cfwHTML=''; if ($SSenable_second_webform > 0) {$eswHTML = '';} - echo "Get Call Launch: $NWB#vicidial_campaigns-get_call_launch$NWE\n"; + if ($SScustom_fields_enabled > 0) + {$cfwHTML = '';} + echo "Get Call Launch: $NWB#vicidial_campaigns-get_call_launch$NWE\n"; echo "Answering Machine Message:
audio chooser $NWB#vicidial_campaigns-am_message_exten$NWE\n"; $stmt="SELECT count(*) from vicidial_lists where campaign_id='$campaign_id' and am_message_exten_override != '' and active='Y';"; @@ -20469,10 +20484,12 @@ if ($ADD==3111) echo "Ignore List Script Override: $NWB#vicidial_inbound_groups-ignore_list_script_override$NWE\n"; - $eswHTML=''; + $eswHTML=''; $cfwHTML=''; if ($SSenable_second_webform > 0) {$eswHTML = '';} - echo "Get Call Launch: $NWB#vicidial_inbound_groups-get_call_launch$NWE\n"; + if ($SScustom_fields_enabled > 0) + {$cfwHTML = '';} + echo "Get Call Launch: $NWB#vicidial_inbound_groups-get_call_launch$NWE\n"; echo "Transfer-Conf DTMF 1: $NWB#vicidial_inbound_groups-xferconf_a_dtmf$NWE\n"; @@ -23467,7 +23484,7 @@ if ($ADD==311111111111111) echo "\n"; + echo "\n"; + if ($SSallow_custom_dialplan > 0) { echo "\n"; diff --git a/www/vicidial/admin_lists_custom.php b/www/vicidial/admin_lists_custom.php index c5b05b64..28bd1de6 100644 --- a/www/vicidial/admin_lists_custom.php +++ b/www/vicidial/admin_lists_custom.php @@ -120,6 +120,8 @@ $STARTtime = date("U"); $TODAY = date("Y-m-d"); $NOW_TIME = date("Y-m-d H:i:s"); +$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|'; + ############################################# ##### START SYSTEM_SETTINGS LOOKUP ##### $stmt = "SELECT use_non_latin,custom_fields_enabled FROM system_settings;"; @@ -191,6 +193,10 @@ else + @@ -209,6 +215,10 @@ function close_help(taskspan,taskhelp) } + + ADMINISTRATION: Lists Custom Fields <?php @@ -218,92 +228,99 @@ function close_help(taskspan,taskhelp) if ($action == "HELP") { ?> - <TABLE WIDTH=98% BGCOLOR=#E6E6E6 cellpadding=2 cellspacing=0><TR><TD ALIGN=LEFT><FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=4> + + + +
+
\n"; echo ""; - $stmt="SELECT version,install_date,use_non_latin,webroot_writable,enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_url,queuemetrics_log_id,queuemetrics_eq_prepend,vicidial_agent_disable,allow_sipsak_messages,admin_home_url,enable_agc_xfer_log,db_schema_version,auto_user_add_value,timeclock_end_of_day,timeclock_last_reset_date,vdc_header_date_format,vdc_customer_date_format,vdc_header_phone_format,vdc_agent_api_active,qc_last_pull_time,enable_vtiger_integration,vtiger_server_ip,vtiger_dbname,vtiger_login,vtiger_pass,vtiger_url,qc_features_active,outbound_autodial_active,outbound_calls_per_second,enable_tts_integration,agentonly_callback_campaign_lock,sounds_central_control_active,sounds_web_server,sounds_web_directory,active_voicemail_server,auto_dial_limit,user_territories_active,allow_custom_dialplan,db_schema_update_date,enable_second_webform,default_webphone,default_external_server_ip,webphone_url,enable_agc_dispo_log,custom_dialplan_entry,queuemetrics_loginout,callcard_enabled,queuemetrics_callstatus,default_codecs,admin_web_directory,label_title,label_first_name,label_middle_initial,label_last_name,label_address1,label_address2,label_address3,label_city,label_state,label_province,label_postal_code,label_vendor_lead_code,label_gender,label_phone_number,label_phone_code,label_alt_phone,label_security_phrase,label_email,label_comments from system_settings;"; + $stmt="SELECT version,install_date,use_non_latin,webroot_writable,enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_url,queuemetrics_log_id,queuemetrics_eq_prepend,vicidial_agent_disable,allow_sipsak_messages,admin_home_url,enable_agc_xfer_log,db_schema_version,auto_user_add_value,timeclock_end_of_day,timeclock_last_reset_date,vdc_header_date_format,vdc_customer_date_format,vdc_header_phone_format,vdc_agent_api_active,qc_last_pull_time,enable_vtiger_integration,vtiger_server_ip,vtiger_dbname,vtiger_login,vtiger_pass,vtiger_url,qc_features_active,outbound_autodial_active,outbound_calls_per_second,enable_tts_integration,agentonly_callback_campaign_lock,sounds_central_control_active,sounds_web_server,sounds_web_directory,active_voicemail_server,auto_dial_limit,user_territories_active,allow_custom_dialplan,db_schema_update_date,enable_second_webform,default_webphone,default_external_server_ip,webphone_url,enable_agc_dispo_log,custom_dialplan_entry,queuemetrics_loginout,callcard_enabled,queuemetrics_callstatus,default_codecs,admin_web_directory,label_title,label_first_name,label_middle_initial,label_last_name,label_address1,label_address2,label_address3,label_city,label_state,label_province,label_postal_code,label_vendor_lead_code,label_gender,label_phone_number,label_phone_code,label_alt_phone,label_security_phrase,label_email,label_comments,custom_fields_enabled from system_settings;"; $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); $version = $row[0]; @@ -23544,6 +23561,7 @@ if ($ADD==311111111111111) $label_security_phrase = $row[71]; $label_email = $row[72]; $label_comments = $row[73]; + $custom_fields_enabled = $row[74]; echo "
MODIFY VICIDIAL SYSTEM SETTINGS
\n"; echo "\n"; @@ -23694,6 +23712,8 @@ if ($ADD==311111111111111) echo "
Enable CallCard: $NWB#settings-callcard_enabled$NWE
Enable Custom List Fields: $NWB#settings-custom_fields_enabled$NWE
Custom Dialplan Entry: $NWB#settings-custom_dialplan_entry$NWE

ViciDial Lists Custom Fields Help


- Field Label - This is the database field identifier for this field. This needs to be a unique identifier within the custom fields for this list. Do not use any spaces or punctuation for this field. max 50 characters, minimum of 2 characters. + Field Label - This is the database field identifier for this field. This needs to be a unique identifier within the custom fields for this list. Do not use any spaces or punctuation for this field. max 50 characters, minimum of 2 characters. You can also include the default ViciDial fields in a custom field setup, and you will see them in red in the list. These fields will not be added to the custom list database table, the agent interface will instead reference the vicidial_list table directly. The labels that you can use to include the default fieds are - + 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


- Field Name - This is the name of the field as it will appear to an agent through their interface. You can use spaces in this field, but no punctuation characters, maximum of 50 characters and minimum of 2 characters. + Field Name - This is the name of the field as it will appear to an agent through their interface. You can use spaces in this field, but no punctuation characters, maximum of 50 characters and minimum of 2 characters.


- Field Description - The description of this field as it will appear in the administration interface. This is an optional field with a maximum of 100 characters. + Field Description - The description of this field as it will appear in the administration interface. This is an optional field with a maximum of 100 characters.


- Field Rank - The order in which these fields is displayed to the agent from lowest on top to highest on the bottom. + Field Rank - The order in which these fields is displayed to the agent from lowest on top to highest on the bottom.


- Field Order - If more than one field has the same rank, they will be placed on the same line and they will be placed in order by this value from lowest to highest, left to right. + Field Order - If more than one field has the same rank, they will be placed on the same line and they will be placed in order by this value from lowest to highest, left to right.


- Field Help - Optional field, if you fill it in, the agent will be able to see this text when they click on a help link next to the field in their agent interface. + Field Help - Optional field, if you fill it in, the agent will be able to see this text when they click on a help link next to the field in their agent interface.


- Field Type - This option defines the type of field that will be displayed. TEXT is a standard single-line entry form, AREA is a multi-line text box, SELECT is a single-selection pull-down menu, MULTI is a multiple-select box, RADIO is a list of radio buttons where only one option can be selected, CHECKBOX is a list of checkboxes where multiple options can be selected, DATE is a year month day calendar popup where the agent can select the date and TIME is a time selection box. The default is TEXT. For the SELECT, MULTI, RADIO and CHECKBOX options you must define the option values below in the Field Options box. DISPLAY will display only and not allow for modification by the agent. SCRIPT will also display only, but you are able to use script variables just like in the Scripts feature. SCRIPT fields will also only display the content in the Options, and not the field name like the DISPLAY type does. + Field Type - This option defines the type of field that will be displayed. TEXT is a standard single-line entry form, AREA is a multi-line text box, SELECT is a single-selection pull-down menu, MULTI is a multiple-select box, RADIO is a list of radio buttons where only one option can be selected, CHECKBOX is a list of checkboxes where multiple options can be selected, DATE is a year month day calendar popup where the agent can select the date and TIME is a time selection box. The default is TEXT. For the SELECT, MULTI, RADIO and CHECKBOX options you must define the option values below in the Field Options box. DISPLAY will display only and not allow for modification by the agent. SCRIPT will also display only, but you are able to use script variables just like in the Scripts feature. SCRIPT fields will also only display the content in the Options, and not the field name like the DISPLAY type does.


- Field Options - For the SELECT, MULTI, RADIO and CHECKBOX field types, you must define the option values in this box. You must put a list of comma separated option label and option text here with each option one its own line. The first value should have no spaces in it, and neither values should have any punctuation. For example - electric_meter, Electric Meter + Field Options - For the SELECT, MULTI, RADIO and CHECKBOX field types, you must define the option values in this box. You must put a list of comma separated option label and option text here with each option one its own line. The first value should have no spaces in it, and neither values should have any punctuation. For example - electric_meter, Electric Meter


- Option Position - For CHECKBOX and RADIO field types only, if set to HORIZONTAL the options will appear on the same line possibly wrapping to the line below if there are many options. If set to VERTICAL there will be only one option per line. Default is HORIZONTAL. + Option Position - For CHECKBOX and RADIO field types only, if set to HORIZONTAL the options will appear on the same line possibly wrapping to the line below if there are many options. If set to VERTICAL there will be only one option per line. Default is HORIZONTAL.


- Field Size - This setting will mean different things depending on what the field type is. For TEXT fields, the size is the number of characters that will show in the field. For AREA fields, the size is the width of the text box in characters. For MULTI fields, this setting defines the number of options to be shown in the multi select list. For SELECT, RADIO, CHECKBOX, DATE and TIME this setting is ignored. + Field Size - This setting will mean different things depending on what the field type is. For TEXT fields, the size is the number of characters that will show in the field. For AREA fields, the size is the width of the text box in characters. For MULTI fields, this setting defines the number of options to be shown in the multi select list. For SELECT, RADIO, CHECKBOX, DATE and TIME this setting is ignored.


- Field Max - This setting will mean different things depending on what the field type is. For TEXT fields, the size is the maximum number of characters that are allowed in the field. For AREA fields, this field defines the number of rows of text visible in the text box. For MULTI, SELECT, RADIO, CHECKBOX, DATE and TIME this setting is ignored. + Field Max - This setting will mean different things depending on what the field type is. For TEXT fields, the size is the maximum number of characters that are allowed in the field. For AREA fields, this field defines the number of rows of text visible in the text box. For MULTI, SELECT, RADIO, CHECKBOX, DATE and TIME this setting is ignored.


- Field Default - This optional field lets you define what value to assign to a field if nothing is loaded into that field. Default is NULL which disables the default function. For DATE field types, the default is always set to today unless a number is put in in which case the date will be that many days plus or minus today. For TIME field types, the default is always set to the current server time unless a number is put in in which case the time will be that many minutes plus or minus current time. + Field Default - This optional field lets you define what value to assign to a field if nothing is loaded into that field. Default is NULL which disables the default function. For DATE field types, the default is always set to today unless a number is put in in which case the date will be that many days plus or minus today. For TIME field types, the default is always set to the current server time unless a number is put in in which case the time will be that many minutes plus or minus current time.


- Field Cost - This read only field tells you what the cost of this field is in the custom field table for this list. There is no hard limit for the number of custom fields you can have in a list, but the total of the cost of all fields for the list must be below 65000. This typically allows for hundreds of fields, but if you specify several TEXT fields that are hundreds or thousands of characters in length then you may hit this limit quickly. If you need that much text in a field you should choose an AREA type, which are stored differently and do not use as much table space. + Field Cost - This read only field tells you what the cost of this field is in the custom field table for this list. There is no hard limit for the number of custom fields you can have in a list, but the total of the cost of all fields for the list must be below 65000. This typically allows for hundreds of fields, but if you specify several TEXT fields that are hundreds or thousands of characters in length then you may hit this limit quickly. If you need that much text in a field you should choose an AREA type, which are stored differently and do not use as much table space.


- Field Required - If set to Y, this field will force the agent to enter text or select an option for this field. Default is N. + Field Required - If set to Y, this field will force the agent to enter text or select an option for this field. Default is N.


- Field Name Position - If set to LEFT, this field name will appear to the left of the field, if set to TOP the field name will take up the entire line and appear above the field. Default is LEFT. + Field Name Position - If set to LEFT, this field name will appear to the left of the field, if set to TOP the field name will take up the entire line and appear above the field. Default is LEFT.


- Copy Option - When copying field definitions from one list to another, you have a few options for how the copying process works. APPEND will add the fields that are not present in the destination list, if there are matching field labels those will remained untouched, no custom field data will be deleted or modified using this option. UPDATE will update the common field_label fields in the destination list to the field definitions from the source list. custom field data may be modified or lost using this option. REPLACE will remove all existing custom fields in the destination list and replace them with the custom fields from the source list, all custom field data will be deleted using this option. + Copy Option - When copying field definitions from one list to another, you have a few options for how the copying process works. APPEND will add the fields that are not present in the destination list, if there are matching field labels those will remained untouched, no custom field data will be deleted or modified using this option. UPDATE will update the common field_label fields in the destination list to the field definitions from the source list. custom field data may be modified or lost using this option. REPLACE will remove all existing custom fields in the destination list and replace them with the custom fields from the source list, all custom field data will be deleted using this option.

+ + 99) and ($source_list_id while ($fields_to_print > $o) { ### delete field function - delete_field_function($DB,$link,$linkCUSTOM,$ip,$user,$table_exists,$A_field_id[$o],$list_id,$A_field_label[$o],$A_field_name[$o],$A_field_description[$o],$A_field_rank[$o],$A_field_help[$o],$A_field_type[$o],$A_field_options[$o],$A_field_size[$o],$A_field_max[$o],$A_field_default[$o],$A_field_required[$o],$A_field_cost[$o],$A_multi_position[$o],$A_name_position[$o],$A_field_order[$o]); + delete_field_function($DB,$link,$linkCUSTOM,$ip,$user,$table_exists,$A_field_id[$o],$list_id,$A_field_label[$o],$A_field_name[$o],$A_field_description[$o],$A_field_rank[$o],$A_field_help[$o],$A_field_type[$o],$A_field_options[$o],$A_field_size[$o],$A_field_max[$o],$A_field_default[$o],$A_field_required[$o],$A_field_cost[$o],$A_multi_position[$o],$A_name_position[$o],$A_field_order[$o],$vicidial_list_fields); echo "SUCCESS: Custom Field Deleted - $list_id|$A_field_label[$o]\n
"; $o++; @@ -530,7 +547,7 @@ if ( ($action == "COPY_FIELDS_SUBMIT") and ($list_id > 99) and ($source_list_id if ($new_field_exists < 1) { ### add field function - add_field_function($DB,$link,$linkCUSTOM,$ip,$user,$table_exists,$A_field_id[$o],$list_id,$A_field_label[$o],$A_field_name[$o],$A_field_description[$o],$A_field_rank[$o],$A_field_help[$o],$A_field_type[$o],$A_field_options[$o],$A_field_size[$o],$A_field_max[$o],$A_field_default[$o],$A_field_required[$o],$A_field_cost[$o],$A_multi_position[$o],$A_name_position[$o],$A_field_order[$o]); + add_field_function($DB,$link,$linkCUSTOM,$ip,$user,$table_exists,$A_field_id[$o],$list_id,$A_field_label[$o],$A_field_name[$o],$A_field_description[$o],$A_field_rank[$o],$A_field_help[$o],$A_field_type[$o],$A_field_options[$o],$A_field_size[$o],$A_field_max[$o],$A_field_default[$o],$A_field_required[$o],$A_field_cost[$o],$A_multi_position[$o],$A_name_position[$o],$A_field_order[$o],$vicidial_list_fields); echo "SUCCESS: Custom Field Added - $list_id|$A_field_label[$o]\n
"; @@ -587,7 +604,7 @@ if ( ($action == "COPY_FIELDS_SUBMIT") and ($list_id > 99) and ($source_list_id $current_field_id = $rowx[0]; ### modify field function - modify_field_function($DB,$link,$linkCUSTOM,$ip,$user,$table_exists,$current_field_id,$list_id,$A_field_label[$o],$A_field_name[$o],$A_field_description[$o],$A_field_rank[$o],$A_field_help[$o],$A_field_type[$o],$A_field_options[$o],$A_field_size[$o],$A_field_max[$o],$A_field_default[$o],$A_field_required[$o],$A_field_cost[$o],$A_multi_position[$o],$A_name_position[$o],$A_field_order[$o]); + modify_field_function($DB,$link,$linkCUSTOM,$ip,$user,$table_exists,$current_field_id,$list_id,$A_field_label[$o],$A_field_name[$o],$A_field_description[$o],$A_field_rank[$o],$A_field_help[$o],$A_field_type[$o],$A_field_options[$o],$A_field_size[$o],$A_field_max[$o],$A_field_default[$o],$A_field_required[$o],$A_field_cost[$o],$A_multi_position[$o],$A_name_position[$o],$A_field_order[$o],$vicidial_list_fields); echo "SUCCESS: Custom Field Modified - $list_id|$A_field_label[$o]\n
"; } @@ -681,7 +698,7 @@ if ( ($action == "DELETE_CUSTOM_FIELD") and ($list_id > 99) and ($field_id > 0) else { ### delete field function - delete_field_function($DB,$link,$linkCUSTOM,$ip,$user,$table_exists,$field_id,$list_id,$field_label,$field_name,$field_description,$field_rank,$field_help,$field_type,$field_options,$field_size,$field_max,$field_default,$field_required,$field_cost,$multi_position,$name_position,$field_order); + delete_field_function($DB,$link,$linkCUSTOM,$ip,$user,$table_exists,$field_id,$list_id,$field_label,$field_name,$field_description,$field_rank,$field_help,$field_type,$field_options,$field_size,$field_max,$field_default,$field_required,$field_cost,$multi_position,$name_position,$field_order,$vicidial_list_fields); echo "SUCCESS: Custom Field Deleted - $list_id|$field_label\n
"; } @@ -725,7 +742,7 @@ if ( ($action == "ADD_CUSTOM_FIELD") and ($list_id > 99) ) else { ### add field function - add_field_function($DB,$link,$linkCUSTOM,$ip,$user,$table_exists,$field_id,$list_id,$field_label,$field_name,$field_description,$field_rank,$field_help,$field_type,$field_options,$field_size,$field_max,$field_default,$field_required,$field_cost,$multi_position,$name_position,$field_order); + add_field_function($DB,$link,$linkCUSTOM,$ip,$user,$table_exists,$field_id,$list_id,$field_label,$field_name,$field_description,$field_rank,$field_help,$field_type,$field_options,$field_size,$field_max,$field_default,$field_required,$field_cost,$multi_position,$name_position,$field_order,$vicidial_list_fields); echo "SUCCESS: Custom Field Added - $list_id|$field_label\n
"; } @@ -772,7 +789,7 @@ if ( ($action == "MODIFY_CUSTOM_FIELD_SUBMIT") and ($list_id > 99) and ($field_i else { ### modify field function - modify_field_function($DB,$link,$linkCUSTOM,$ip,$user,$table_exists,$field_id,$list_id,$field_label,$field_name,$field_description,$field_rank,$field_help,$field_type,$field_options,$field_size,$field_max,$field_default,$field_required,$field_cost,$multi_position,$name_position,$field_order); + modify_field_function($DB,$link,$linkCUSTOM,$ip,$user,$table_exists,$field_id,$list_id,$field_label,$field_name,$field_description,$field_rank,$field_help,$field_type,$field_options,$field_size,$field_max,$field_default,$field_required,$field_cost,$multi_position,$name_position,$field_order,$vicidial_list_fields); echo "SUCCESS: Custom Field Modified - $list_id|$field_label\n
"; } @@ -865,12 +882,18 @@ if ( ($action == "MODIFY_CUSTOM_FIELDS") and ($list_id > 99) ) $o=0; while ($fields_to_print > $o) { + $LcolorB=''; $LcolorE=''; + if (preg_match("/\|$A_field_label[$o]\|/",$vicidial_list_fields)) + { + $LcolorB=''; + $LcolorE=''; + } if (eregi("1$|3$|5$|7$|9$", $o)) {$bgcolor='bgcolor="#B9CBFD"';} else {$bgcolor='bgcolor="#9BB9FB"';} echo "$A_field_rank[$o] - $A_field_order[$o]     "; - echo " $A_field_label[$o]     "; + echo " $LcolorB$A_field_label[$o]$LcolorE     "; echo " $A_field_name[$o]     "; echo " $A_field_type[$o]     "; echo " $A_field_cost[$o]     \n"; @@ -933,7 +956,7 @@ if ( ($action == "MODIFY_CUSTOM_FIELDS") and ($list_id > 99) ) } if ($A_field_type[$o]=='MULTI') { - $field_HTML .= "\n"; } if ( ($A_field_type[$o]=='SELECT') or ($A_field_type[$o]=='MULTI') or ($A_field_type[$o]=='RADIO') or ($A_field_type[$o]=='CHECKBOX') ) { @@ -1072,6 +1095,12 @@ if ( ($action == "MODIFY_CUSTOM_FIELDS") and ($list_id > 99) ) $o=0; while ($fields_to_print > $o) { + $LcolorB=''; $LcolorE=''; + if (preg_match("/\|$A_field_label[$o]\|/",$vicidial_list_fields)) + { + $LcolorB=''; + $LcolorE=''; + } if (eregi("1$|3$|5$|7$|9$", $o)) {$bgcolor='bgcolor="#B9CBFD"';} else @@ -1084,7 +1113,7 @@ if ( ($action == "MODIFY_CUSTOM_FIELDS") and ($list_id > 99) ) echo "\n"; echo "\n"; echo "
\n"; - echo "\n"; + echo "\n"; echo "
Field Label $A_field_rank[$o]: $A_field_label[$o] $NWB#vicidial_lists_fields-field_label$NWE
Field Label $A_field_rank[$o]: $LcolorB$A_field_label[$o]$LcolorE $NWB#vicidial_lists_fields-field_label$NWE
Field Rank $A_field_rank[$o]: \n"; + echo "\n"; + + if ($custom_fields_enabled > 0) + { + echo "

\n"; + + echo "Custom Fields:
\n"; + echo "\n"; + } echo "
\n"; echo "Campaigns:
\n"; diff --git a/www/vicidial/list_download.php b/www/vicidial/list_download.php index d1bcb77b..0719ec5e 100644 --- a/www/vicidial/list_download.php +++ b/www/vicidial/list_download.php @@ -13,6 +13,7 @@ # 90721-1238 - Added rank and owner as vicidial_list fields # 100119-1039 - Filtered comments for \n newlines # 100508-1439 - Added header row to output +# 100702-1335 - Added custom fields # require("dbconnect.php"); @@ -33,14 +34,15 @@ if (strlen($shift)<2) {$shift='ALL';} ############################################# ##### 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 ##### ########################################### @@ -113,7 +115,8 @@ header('Pragma: public'); ob_clean(); flush(); -echo "lead_id\tentry_date\tmodify_date\tstatus\tuser\tvendor_lead_code\tsource_id\tlist_id\tgmt_offset_now\tcalled_since_last_reset\tphone_code\tphone_number\ttitle\tfirst_name\tmiddle_initial\tlast_name\taddress1\taddress2\taddress3\tcity\tstate\tprovince\tpostal_code\tcountry_code\tgender\tdate_of_birth\talt_phone\temail\tsecurity_phrase\tcomments\tcalled_count\tlast_local_call_time\trank\towner\r\n"; +$header_row = "lead_id\tentry_date\tmodify_date\tstatus\tuser\tvendor_lead_code\tsource_id\tlist_id\tgmt_offset_now\tcalled_since_last_reset\tphone_code\tphone_number\ttitle\tfirst_name\tmiddle_initial\tlast_name\taddress1\taddress2\taddress3\tcity\tstate\tprovince\tpostal_code\tcountry_code\tgender\tdate_of_birth\talt_phone\temail\tsecurity_phrase\tcomments\tcalled_count\tlast_local_call_time\trank\towner"; +$header_columns=''; $stmt="select lead_id,entry_date,modify_date,status,user,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 from vicidial_list where list_id='$list_id';"; $rslt=mysql_query($stmt, $link); @@ -126,7 +129,70 @@ while ($i < $leads_to_print) $row[29] = preg_replace("/\n|\r/",'!N',$row[29]); - echo "$row[0]\t$row[1]\t$row[2]\t$row[3]\t$row[4]\t$row[5]\t$row[6]\t$row[7]\t$row[8]\t$row[9]\t$row[10]\t$row[11]\t$row[12]\t$row[13]\t$row[14]\t$row[15]\t$row[16]\t$row[17]\t$row[18]\t$row[19]\t$row[20]\t$row[21]\t$row[22]\t$row[23]\t$row[24]\t$row[25]\t$row[26]\t$row[27]\t$row[28]\t$row[29]\t$row[30]\t$row[31]\t$row[32]\t$row[33]\r\n"; + $row_data[$i] .= "$row[0]\t$row[1]\t$row[2]\t$row[3]\t$row[4]\t$row[5]\t$row[6]\t$row[7]\t$row[8]\t$row[9]\t$row[10]\t$row[11]\t$row[12]\t$row[13]\t$row[14]\t$row[15]\t$row[16]\t$row[17]\t$row[18]\t$row[19]\t$row[20]\t$row[21]\t$row[22]\t$row[23]\t$row[24]\t$row[25]\t$row[26]\t$row[27]\t$row[28]\t$row[29]\t$row[30]\t$row[31]\t$row[32]\t$row[33]"; + $export_lead_id[$i] = $row[0]; + + $i++; + } + + +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 = "describe custom_$list_id;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $columns_ct = mysql_num_rows($rslt); + $u=0; + while ($columns_ct > $u) + { + $row=mysql_fetch_row($rslt); + $column = $row[0]; + if ($u > 0) + {$header_columns .= "\t$column";} + $u++; + } + if ($columns_ct > 1) + { + $i=0; + while ($i < $leads_to_print) + { + $stmt = "SELECT * from custom_$list_id where lead_id='$export_lead_id[$i]' limit 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $customfield_ct = mysql_num_rows($rslt); + if ($customfield_ct > 0) + { + $row=mysql_fetch_row($rslt); + $t=1; + while ($columns_ct > $t) + { + $custom_data[$i] .= "\t$row[$t]"; + $t++; + } + } + + $custom_data[$i] = preg_replace("/\r\n/",'!N',$custom_data[$i]); + $custom_data[$i] = preg_replace("/\n/",'!N',$custom_data[$i]); + + $i++; + } + } + } + } + + +echo "$header_row$header_columns\r\n"; + +$i=0; +while ($i < $leads_to_print) + { + echo "$row_data[$i]$custom_data[$i]\r\n"; $i++; }