[Rt-commit] [svn] r1971 - in rt/branches/3.3-TESTING: . lib/RT
jesse at pallas.eruditorum.org
jesse at pallas.eruditorum.org
Tue Dec 7 21:38:15 EST 2004
Author: jesse
Date: Tue Dec 7 21:38:14 2004
New Revision: 1971
Modified:
rt/branches/3.3-TESTING/ (props changed)
rt/branches/3.3-TESTING/lib/RT/Record.pm
Log:
r9530 at tinbook: jesse | 2004-12-08T02:38:06.660707Z
Refactored RT::Record->CustomFieldValues to be more careful to not
accidentally load all ticket custom field values when asked for a
bogus custom field. Thanks to Ruslan for a pointer to the bug.
Modified: rt/branches/3.3-TESTING/lib/RT/Record.pm
==============================================================================
--- rt/branches/3.3-TESTING/lib/RT/Record.pm (original)
+++ rt/branches/3.3-TESTING/lib/RT/Record.pm Tue Dec 7 21:38:14 2004
@@ -1735,12 +1735,10 @@
my $field = shift;
my $cf_values = RT::ObjectCustomFieldValues->new( $self->CurrentUser );
- $cf_values->LimitToObject($self);
- $cf_values->OrderBy( FIELD => 'id', ORDER => 'ASC' );
-
- # If we've been handed a value that contains a non-digit, it's a name. \
- # Resolve it into an id.
- if ( $field =~ /\D/ ) {
+ # If we've been handed a value that contains at least one non-digit,
+ # it's a name. Resolve it into an id.
+ #
+ if ( $field =~ /\D+/ ) {
# Look up the field ID.
my $cfs = RT::CustomFields->new( $self->CurrentUser );
@@ -1755,7 +1753,15 @@
}
}
- $cf_values->LimitToCustomField($field) if ( $field =~ /^\d+$/o);
+ # If we now have a custom field id, let's limit things down
+ # If we don't have a custom field ID, the $cf_values object will be empty
+ if ( $field =~ /^\d+$/o) {
+ $cf_values->LimitToCustomField($field) ;
+ $cf_values->LimitToObject($self);
+ $cf_values->OrderBy( FIELD => 'id', ORDER => 'ASC' );
+
+ }
+
return ($cf_values);
}
More information about the Rt-commit
mailing list