Added HIDDEN and READONLY field types for custom list fields.

Fixed issue changing DISPLAY and SCIRPT field types to other types.

git-svn-id: svn://192.168.202.10@1684 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2011-06-30 16:14:30 +00:00
parent 3fcb5ee887
commit aeb0b4adc2
7 changed files with 58 additions and 15 deletions
+2
View File
@@ -626,6 +626,8 @@ OTHER CHANGES:
139. Added ability to define the agent screen status fields shown to the agent:
Call ID, Lead ID and List ID
140. Added HIDDEN and READONLY field types for custom list fields.
+2 -2
View File
@@ -2261,7 +2261,7 @@ field_name VARCHAR(5000),
field_description VARCHAR(100),
field_rank SMALLINT(5),
field_help VARCHAR(1000),
field_type ENUM('TEXT','AREA','SELECT','MULTI','RADIO','CHECKBOX','DATE','TIME','DISPLAY','SCRIPT') default 'TEXT',
field_type ENUM('TEXT','AREA','SELECT','MULTI','RADIO','CHECKBOX','DATE','TIME','DISPLAY','SCRIPT','HIDDEN','READONLY') default 'TEXT',
field_options VARCHAR(5000),
field_size SMALLINT(5),
field_max SMALLINT(5),
@@ -2531,7 +2531,7 @@ ALTER TABLE vicidial_closer_log_archive MODIFY closecallid INT(9) UNSIGNED NOT N
CREATE TABLE vicidial_outbound_ivr_log_archive LIKE vicidial_outbound_ivr_log;
UPDATE system_settings SET db_schema_version='1283',db_schema_update_date=NOW();
UPDATE system_settings SET db_schema_version='1284',db_schema_update_date=NOW();
GRANT RELOAD ON *.* TO cron@'%';
GRANT RELOAD ON *.* TO cron@localhost;
+4
View File
@@ -859,3 +859,7 @@ UPDATE system_settings SET db_schema_version='1282',db_schema_update_date=NOW()
ALTER TABLE system_settings ADD queuemetrics_pe_phone_append ENUM('0','1') default '0';
UPDATE system_settings SET db_schema_version='1283',db_schema_update_date=NOW() where db_schema_version < 1283;
ALTER TABLE vicidial_lists_fields MODIFY field_type ENUM('TEXT','AREA','SELECT','MULTI','RADIO','CHECKBOX','DATE','TIME','DISPLAY','SCRIPT','HIDDEN','READONLY') default 'TEXT';
UPDATE system_settings SET db_schema_version='1284',db_schema_update_date=NOW() where db_schema_version < 1284;
@@ -139,7 +139,7 @@ For the SELECT, MULTI, RADIO and CHECKBOX field types, you must define the optio
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||
This setting will mean different things depending on what the field type is. For TEXT, HIDDEN and READONLY 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 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||
@@ -638,6 +638,7 @@ You can select which variables for calls will be displayed in the status line of
CAMPAIGNS USING THIS SCREEN LABEL||
QueueMetrics Phone Environment Phone Append||
This option, if enabled, will append the agent phone login to the data4 record in the queue log table if the Campaign Phone Environment field is populated. Default is 0 for disabled||
HIDDEN will not show the agent the field, but will allow the field to have data imported into it and exported from it, as well as have it available to the script tab and web form address. READONLY will display the value of the data in the field, but will not allow the agent to alter the data||
lead_report_export.php
+10 -3
View File
@@ -4,12 +4,13 @@
#
# functions for agent scripts
#
# Copyright (C) 2010 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2011 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
#
# CHANGES:
# 100629-1201 - First Build
# 101124-0625 - Added lookup_gmt and dialable_gmt functions
# 110630-0026 - Added HIDDEN and READONLY field types
#
@@ -152,7 +153,7 @@ function custom_list_fields_values($lead_id,$list_id,$uniqueid,$user)
{$CFoutput .= "right";}
$CFoutput .= "><font size=2>";
}
if ($A_field_type[$o]!='SCRIPT')
if ( ($A_field_type[$o]!='SCRIPT') and ($A_field_type[$o]!='HIDDEN') )
{$CFoutput .= "<B>$A_field_name[$o]</B>";}
if ( ($A_name_position[$o]=='TOP') or ($A_field_type[$o]=='SCRIPT') )
{$CFoutput .= " &nbsp; <span style=\"position:static;\" id=P_HELP_$A_field_label[$o]></span><span style=\"position:static;background:white;\" id=HELP_$A_field_label[$o]> $helpHTML</span><BR>";}
@@ -239,6 +240,12 @@ function custom_list_fields_values($lead_id,$list_id,$uniqueid,$user)
if ($A_field_default[$o]=='NULL') {$A_field_default[$o]='';}
$field_HTML .= "$A_field_default[$o]\n";
}
if ($A_field_type[$o]=='READONLY')
{
if (strlen($A_field_value[$o]) < 1) {$A_field_value[$o] = $A_field_default[$o];}
if ($A_field_default[$o]=='NULL') {$A_field_default[$o]='';}
$field_HTML .= "$A_field_value[$o]\n";
}
if ($A_field_type[$o]=='SCRIPT')
{
if ($A_field_default[$o]=='NULL') {$A_field_default[$o]='';}
@@ -317,7 +324,7 @@ function custom_list_fields_values($lead_id,$list_id,$uniqueid,$user)
$field_HTML .= "</SELECT>";
}
if ( ($A_name_position[$o]=='LEFT') and ($A_field_type[$o]!='SCRIPT') )
if ( ($A_name_position[$o]=='LEFT') and ($A_field_type[$o]!='SCRIPT') and ($A_field_type[$o]!='HIDDEN') )
{
$CFoutput .= " $field_HTML <span style=\"position:static;\" id=P_HELP_$A_field_label[$o]></span><span style=\"position:static;background:white;\" id=HELP_$A_field_label[$o]> $helpHTML</span>";
}
+1 -1
View File
@@ -306,7 +306,7 @@ if ($stage=='SUBMIT')
$A_field_value[$o] = $form_field_value;
if ( ($A_field_type[$o]=='DISPLAY') or ($A_field_type[$o]=='SCRIPT') )
if ( ($A_field_type[$o]=='DISPLAY') or ($A_field_type[$o]=='SCRIPT') or ($A_field_type[$o]=='HIDDEN') or ($A_field_type[$o]=='READONLY') )
{
$A_field_value[$o]='----IGNORE----';
}
+37 -8
View File
@@ -1,7 +1,7 @@
<?php
# admin_lists_custom.php
#
# Copyright (C) 2010 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2011 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# this screen manages the custom lists fields in ViciDial
#
@@ -16,10 +16,11 @@
# 100728-1724 - Added field validation for select lists and checkbox/radio buttons
# 100916-1754 - Do not show help in example form if help is empty
# 101228-2049 - Fixed missing PHP long tag
# 110629-1438 - Fixed change from DISPLAY or SCRIPT to other field type error, added HIDDEN and READONLY field types
#
$admin_version = '2.4-10';
$build = '101228-2049';
$admin_version = '2.4-11';
$build = '110629-1438';
require("dbconnect.php");
@@ -277,7 +278,7 @@ if ($action == "HELP")
<A NAME="vicidial_lists_fields-field_type">
<BR>
<B>Field Type -</B> 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.
<B>Field Type -</B> 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. HIDDEN will not show the agent the field, but will allow the field to have data imported into it and exported from it, as well as have it available to the script tab and web form address. READONLY will display the value of the data in the field, but will not allow the agent to alter the data.
<BR><BR>
<A NAME="vicidial_lists_fields-field_options">
@@ -297,7 +298,7 @@ if ($action == "HELP")
<A NAME="vicidial_lists_fields-field_max">
<BR>
<B>Field Max -</B> 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.
<B>Field Max -</B> This setting will mean different things depending on what the field type is. For TEXT, HIDDEN and READONLY 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.
<BR><BR>
<A NAME="vicidial_lists_fields-field_default">
@@ -1066,10 +1067,20 @@ if ( ($action == "MODIFY_CUSTOM_FIELDS") and ($list_id > 99) )
$field_HTML .= "<textarea name=$A_field_label[$o] id=$A_field_label[$o] ROWS=$A_field_max[$o] COLS=$A_field_size[$o]></textarea>";
}
if ($A_field_type[$o]=='DISPLAY')
{
if ($A_field_default[$o]=='NULL') {$A_field_default[$o]='';}
$field_HTML .= "\n";
}
if ($A_field_type[$o]=='READONLY')
{
if ($A_field_default[$o]=='NULL') {$A_field_default[$o]='';}
$field_HTML .= "$A_field_default[$o]\n";
}
if ($A_field_type[$o]=='HIDDEN')
{
if ($A_field_default[$o]=='NULL') {$A_field_default[$o]='';}
$field_HTML .= "-- HIDDEN --\n";
}
if ($A_field_type[$o]=='SCRIPT')
{
if ($A_field_default[$o]=='NULL') {$A_field_default[$o]='';}
@@ -1213,6 +1224,8 @@ if ( ($action == "MODIFY_CUSTOM_FIELDS") and ($list_id > 99) )
echo "<option>TIME</option>\n";
echo "<option>DISPLAY</option>\n";
echo "<option>SCRIPT</option>\n";
echo "<option>HIDDEN</option>\n";
echo "<option>READONLY</option>\n";
echo "<option selected>$A_field_type[$o]</option>\n";
echo "</select> $NWB#vicidial_lists_fields-field_type$NWE </td></tr>\n";
echo "<tr $bgcolor><td align=right>Field Options $A_field_rank[$o]: </td><td align=left><textarea name=field_options ROWS=5 COLS=60>$A_field_options[$o]</textarea> $NWB#vicidial_lists_fields-field_options$NWE </td></tr>\n";
@@ -1276,6 +1289,8 @@ if ( ($action == "MODIFY_CUSTOM_FIELDS") and ($list_id > 99) )
echo "<option>TIME</option>\n";
echo "<option>DISPLAY</option>\n";
echo "<option>SCRIPT</option>\n";
echo "<option>HIDDEN</option>\n";
echo "<option>READONLY</option>\n";
echo "<option selected>TEXT</option>\n";
echo "</select> $NWB#vicidial_lists_fields-field_type$NWE </td></tr>\n";
echo "<tr $bgcolor><td align=right>Field Options: </td><td align=left><textarea name=field_options ROWS=5 COLS=60></textarea> $NWB#vicidial_lists_fields-field_options$NWE </td></tr>\n";
@@ -1529,7 +1544,7 @@ function add_field_function($DB,$link,$linkCUSTOM,$ip,$user,$table_exists,$field
if ($field_cost < 1) {$field_cost=1;};
$field_sql .= "VARCHAR($field_cost) ";
}
if ($field_type=='TEXT')
if ( ($field_type=='TEXT') or ($field_type=='HIDDEN') or ($field_type=='READONLY') )
{
if ($field_max < 1) {$field_max=1;};
$field_sql .= "VARCHAR($field_max) ";
@@ -1597,7 +1612,21 @@ function add_field_function($DB,$link,$linkCUSTOM,$ip,$user,$table_exists,$field
##### BEGIN modify field function
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,$vicidial_list_fields)
{
$field_sql = "ALTER TABLE custom_$list_id MODIFY $field_label ";
$field_db_exists=0;
if ( ($field_type=='DISPLAY') or ($field_type=='SCRIPT') or (preg_match("/\|$field_label\|/",$vicidial_list_fields)) )
{$field_db_exists=1;}
else
{
$stmt="SHOW COLUMNS from custom_$list_id LIKE '$field_label';";
if ($DB>0) {echo "$stmt";}
$rslt=mysql_query($stmt, $link);
$field_db_exists = mysql_num_rows($rslt);
}
if ($field_db_exists > 0)
{$field_sql = "ALTER TABLE custom_$list_id MODIFY $field_label ";}
else
{$field_sql = "ALTER TABLE custom_$list_id ADD $field_label ";}
$field_options_ENUM='';
$field_cost=1;
if ( ($field_type=='SELECT') or ($field_type=='RADIO') )
@@ -1636,7 +1665,7 @@ function modify_field_function($DB,$link,$linkCUSTOM,$ip,$user,$table_exists,$fi
$field_cost = strlen($field_options_ENUM);
$field_sql .= "VARCHAR($field_cost) ";
}
if ($field_type=='TEXT')
if ( ($field_type=='TEXT') or ($field_type=='HIDDEN') or ($field_type=='READONLY') )
{
$field_sql .= "VARCHAR($field_max) ";
$field_cost = ($field_max + $field_cost);