[Rt-commit] rt branch, admin_ui, updated. 2cccdd6fe1480d3709bdd93319d8aacb6498590d
sunnavy at bestpractical.com
sunnavy at bestpractical.com
Mon Jan 11 23:11:55 EST 2010
The branch, admin_ui has been updated
via 2cccdd6fe1480d3709bdd93319d8aacb6498590d (commit)
from 77c83d7999d256345cae55a247d60648f736c02e (commit)
Summary of changes:
lib/RT/Action/UpdateCustomField.pm | 16 +---------------
lib/RT/Model/CustomField.pm | 31 ++++++-------------------------
sbin/rt-migrate-db-from-3.8 | 6 +++---
3 files changed, 10 insertions(+), 43 deletions(-)
- Log -----------------------------------------------------------------
commit 2cccdd6fe1480d3709bdd93319d8aacb6498590d
Author: sunnavy <sunnavy at bestpractical.com>
Date: Tue Jan 12 11:15:15 2010 +0800
make values_class as a real column in cf model
diff --git a/lib/RT/Action/UpdateCustomField.pm b/lib/RT/Action/UpdateCustomField.pm
index a8266ae..b4ed16b 100644
--- a/lib/RT/Action/UpdateCustomField.pm
+++ b/lib/RT/Action/UpdateCustomField.pm
@@ -43,7 +43,7 @@ sub arguments {
}
else {
$args->{values_class} = {
- render => 'hidden',
+ render_as => 'hidden',
};
}
return $args;
@@ -52,20 +52,6 @@ sub arguments {
sub take_action {
my $self = shift;
$self->SUPER::take_action;
-
- if ( $self->has_values_sources ) {
- my $attr = 'values_class';
- if ( $self->has_argument($attr) ) {
- my $method = "set_$attr";
- # for non select cfs, we supply an empty and hidden input
- # and we don't want to set_... for that.
- next unless $self->argument_value($attr);
-
- my ( $status, $msg ) =
- $self->record->$method( $self->argument_value($attr) );
- Jifty->log->error($msg) unless $status;
- }
- }
return 1;
}
diff --git a/lib/RT/Model/CustomField.pm b/lib/RT/Model/CustomField.pm
index 0e1b59f..b0a5937 100755
--- a/lib/RT/Model/CustomField.pm
+++ b/lib/RT/Model/CustomField.pm
@@ -110,6 +110,8 @@ use Jifty::DBI::Record schema {
column
include_content_for_value => type is 'text',
display_length is 60, default is '';
+ column values_class => type is 'text',
+ display_length is 60, default is 'RT::Model::CustomFieldValueCollection';
column disabled => max_length is 6, type is 'smallint', render as
'Checkbox', default is '0';
};
@@ -232,6 +234,7 @@ sub create {
repeated => 0,
link_value_to => '',
include_content_for_value => '',
+ values_class => '',
@_,
);
@@ -300,13 +303,10 @@ sub create {
lookup_type => $args{'lookup_type'},
repeated => $args{'repeated'},
link_value_to => $args{'link_value_to'},
- include_content_for_value => $args{include_content_for_value},
+ include_content_for_value => $args{'include_content_for_value'},
+ values_class => $args{'values_class'},
);
- if ( exists $args{'values_class'} ) {
- $self->set_values_class( $args{'values_class'} );
- }
-
return ( $rv, $msg ) unless exists $args{'queue'};
# Compat code -- create a new ObjectCustomField mapping
@@ -556,29 +556,10 @@ sub is_external_values {
return $selectable unless $selectable;
my $class = $self->values_class;
- return 0 if $class eq 'RT::Model::CustomFieldValueCollection';
+ return 0 if !$class || $class eq 'RT::Model::CustomFieldValueCollection';
return 1;
}
-sub values_class {
- my $self = shift;
- return '' unless $self->is_selection_type;
-
- my $class = $self->first_attribute('ValuesClass');
- $class = $class->content if $class;
- return $class || 'RT::Model::CustomFieldValueCollection';
-}
-
-sub set_values_class {
- my $self = shift;
- my $class = shift || 'RT::Model::CustomFieldValueCollection';
-
- if ( $class eq 'RT::Model::CustomFieldValueCollection' ) {
- return $self->delete_attribute('ValuesClass');
- }
- return $self->set_attribute( name => 'ValuesClass', content => $class );
-}
-
=head2 friendly_type [TYPE, MAX_valueS]
Returns a localized human-readable version of the custom field type.
diff --git a/sbin/rt-migrate-db-from-3.8 b/sbin/rt-migrate-db-from-3.8
index b296dde..b05413a 100755
--- a/sbin/rt-migrate-db-from-3.8
+++ b/sbin/rt-migrate-db-from-3.8
@@ -203,14 +203,14 @@ sub post_update_all_tables {
print "updated table $table\n";
}
- # LinkValueTo and IncludeContentForValue are real columns in rt4
- # this involves 2 tables, let's put it here for now.
+ # ValuesClass LinkValueTo and IncludeContentForValue are real columns
+ # in rt4. this involves 2 tables, let's put it here for now.
require RT::Model::CustomFieldCollection;
my $cfs =
RT::Model::CustomFieldCollection->new( current_user => RT->system_user );
$cfs->unlimit;
while ( my $cf = $cfs->next ) {
- for my $column ( qw/LinkValueTo IncludeContentForValue/ ) {
+ for my $column ( qw/LinkValueTo IncludeContentForValue ValuesClass/ ) {
my ( $attr ) = $cf->attributes->named($column);
if ( $attr ) {
my $set_method = "set_" . renaming $column;
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list