[Rt-commit] r2437 - in rt/branches/PLATANO-EXPERIMENTAL-CSS: .
lib/RT lib/t/regression
jesse at bestpractical.com
jesse at bestpractical.com
Mon Mar 14 03:01:17 EST 2005
Author: jesse
Date: Mon Mar 14 03:01:16 2005
New Revision: 2437
Modified:
rt/branches/PLATANO-EXPERIMENTAL-CSS/ (props changed)
rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/RT/Record.pm
rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/RT/Ticket_Overlay.pm
rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/RT/Transaction_Overlay.pm
rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/t/regression/16-transaction_cf_tests.t
Log:
r8597 at hualien: jesse | 2005-03-14 02:42:30 -0500
r8485 at hualien: jesse | 2005-03-14 02:27:37 -0500
r5943 at hualien: jesse | 2005-02-24 16:42:01 -0500
Upgraded a private _LookupTypes method to a public CustomFieldUpdateTypes method to make it easier to ad custom fields to other objects
Modified: rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/RT/Record.pm
==============================================================================
--- rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/RT/Record.pm (original)
+++ rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/RT/Record.pm Mon Mar 14 03:01:16 2005
@@ -1443,14 +1443,14 @@
$cfs->UnLimit;
# XXX handle multiple types properly
- foreach my $lookup ($self->_LookupTypes) {
- $cfs->LimitToLookupType($lookup);
- $cfs->LimitToGlobalOrObjectId($self->_LookupId($lookup));
- }
+ $cfs->LimitToLookupType($self->CustomFieldLookupType);
+ $cfs->LimitToGlobalOrObjectId($self->_LookupId($self->CustomFieldLookupType));
return $cfs;
}
+# TODO: This _only_ works for RT::Class classes. it doesn't work, for example, for RT::FM classes.
+
sub _LookupId {
my $self = shift;
my $lookup = shift;
@@ -1464,7 +1464,27 @@
return $self->Id;
}
-sub _LookupTypes { ref($_[0]) }
+
+=head2 CustomFieldLookupType
+
+Returns the path RT uses to figure out which custom fields apply to this object.
+
+=cut
+
+sub CustomFieldLookupType {
+ my $self = shift;
+ return ref($self);
+}
+
+#TODO Deprecated API. Destroy in 3.6
+sub _LookupTypes {
+ my $self = shift;
+ $RT::Logger->warning("_LookupTypes call is deprecated. Replace with CustomFieldLookupType");
+ $RT::Logger->warning("Besides, it was a private API. Were you doing using it?");
+
+ return($self->CustomFieldLookupType);
+
+}
# {{{ AddCustomFieldValue
@@ -1754,7 +1774,7 @@
# Look up the field ID.
my $cfs = RT::CustomFields->new( $self->CurrentUser );
$cfs->LimitToGlobalOrObjectId( $self->Id() );
- $cfs->LimitToLookupType($self->_LookupTypes);
+ $cfs->LimitToLookupType($self->CustomFieldLookupType);
$cfs->Limit( FIELD => 'Name', OPERATOR => '=', VALUE => $field );
if ( $cfs->First ) {
Modified: rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/RT/Ticket_Overlay.pm
==============================================================================
--- rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/RT/Ticket_Overlay.pm (original)
+++ rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/RT/Ticket_Overlay.pm Mon Mar 14 03:01:16 2005
@@ -3660,7 +3660,7 @@
# }}}
-sub _LookupTypes {
+sub CustomFieldLookupType {
"RT::Queue-RT::Ticket";
}
Modified: rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/RT/Transaction_Overlay.pm
==============================================================================
--- rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/RT/Transaction_Overlay.pm (original)
+++ rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/RT/Transaction_Overlay.pm Mon Mar 14 03:01:16 2005
@@ -989,7 +989,7 @@
unless ( $field =~ /^\d+$/o ) {
my $CFs = RT::CustomFields->new( $self->CurrentUser );
$CFs->Limit( FIELD => 'Name', VALUE => $field);
- $CFs->LimitToLookupType($self->_LookupTypes);
+ $CFs->LimitToLookupType($self->CustomFieldLookupType);
$CFs->LimitToGlobalOrObjectId($self->Object->QueueObj->id);
$field = $CFs->First->id if $CFs->First;
}
@@ -999,7 +999,7 @@
# }}}
-sub _LookupTypes {
+sub CustomFieldLookupType {
"RT::Queue-RT::Ticket-RT::Transaction";
}
Modified: rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/t/regression/16-transaction_cf_tests.t
==============================================================================
--- rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/t/regression/16-transaction_cf_tests.t (original)
+++ rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/t/regression/16-transaction_cf_tests.t Mon Mar 14 03:01:16 2005
@@ -15,7 +15,7 @@
ok($id,$msg);
my $cf = RT::CustomField->new($RT::SystemUser);
-($id,$msg) = $cf->Create(Name => 'Txnfreeform-'.$$, Type => 'Freeform', MaxValues => '0', LookupType => RT::Transaction->_LookupTypes );
+($id,$msg) = $cf->Create(Name => 'Txnfreeform-'.$$, Type => 'Freeform', MaxValues => '0', LookupType => RT::Transaction->CustomFieldLookupType );
ok($id,$msg);
More information about the Rt-commit
mailing list