[Rt-commit] rt branch, 4.0/fix-cf-valuesclass-updates, created. rt-4.0.2-39-gf578138
Emannuel Lacour
elacour at bestpractical.com
Tue Aug 30 08:27:04 EDT 2011
The branch, 4.0/fix-cf-valuesclass-updates has been created
at f5781388c9791751a4b5cd822aae6ebdcf9c1cfa (commit)
- Log -----------------------------------------------------------------
commit 979df9045cfde58529ae522f6995d7fe8114f621
Author: Emmanuel Lacour <elacour at easter-eggs.com>
Date: Tue Aug 30 14:18:42 2011 +0200
Fix CF ValuesClass updating in API
* RT::CustomField->ValidateValuesClass must allow "0" as RT::Record->_Set replace undef value by 0
* add missing ValuesClass column definition
diff --git a/lib/RT/CustomField.pm b/lib/RT/CustomField.pm
index 031fa9e..15abd5e 100644
--- a/lib/RT/CustomField.pm
+++ b/lib/RT/CustomField.pm
@@ -673,7 +673,7 @@ sub ValidateValuesClass {
my $self = shift;
my $class = shift;
- return 1 if !defined $class || $class eq 'RT::CustomFieldValues';
+ return 1 if !defined $class || ! $class || $class eq 'RT::CustomFieldValues';
return 1 if grep $class eq $_, RT->Config->Get('CustomFieldValuesSources');
return undef;
}
@@ -1966,6 +1966,8 @@ sub _CoreAccessible {
{read => 1, write => 1, sql_type => -4, length => 0, is_blob => 1, is_numeric => 0, type => 'text', default => ''},
Repeated =>
{read => 1, write => 1, sql_type => 5, length => 6, is_blob => 0, is_numeric => 1, type => 'smallint(6)', default => '0'},
+ ValuesClass =>
+ {read => 1, write => 1, sql_type => 12, length => 64, is_blob => 0, is_numeric => 0, type => 'varchar(64)', default => ''},
BasedOn =>
{read => 1, write => 1, sql_type => 4, length => 11, is_blob => 0, is_numeric => 1, type => 'int(11)', default => ''},
Description =>
commit f5781388c9791751a4b5cd822aae6ebdcf9c1cfa
Author: Emmanuel Lacour <elacour at easter-eggs.com>
Date: Tue Aug 30 14:22:37 2011 +0200
Fix CF ValuesClass update in web UI
* update only if needed
* display localized update result
diff --git a/share/html/Admin/CustomFields/Modify.html b/share/html/Admin/CustomFields/Modify.html
index 9ff7a9b..4c97f20 100644
--- a/share/html/Admin/CustomFields/Modify.html
+++ b/share/html/Admin/CustomFields/Modify.html
@@ -195,7 +195,15 @@ if ( $ARGS{'Update'} && $id ne 'new' ) {
Object => $CustomFieldObj,
ARGSRef => \%ARGS
);
- $CustomFieldObj->SetValuesClass( $ValuesClass );
+ if ( ( $ValuesClass ne $CustomFieldObj->ValuesClass ) || ( ! $CustomFieldObj->ValuesClass && $ValuesClass eq 'RT::CustomFieldValues' ) ) {
+ my $original = $CustomFieldObj->ValuesClass || '';
+ my ($good, $msg) = $CustomFieldObj->SetValuesClass( $ValuesClass );
+ if ( $good ) {
+ $msg = loc("[_1] changed from '[_2]' to '[_3]'",
+ loc("Field values source"), $original, $ValuesClass );
+ }
+ push @results, $msg;
+ }
# Set the render type if we have it, but unset it if the new type doesn't
# support render types
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list