X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=rt%2Flib%2FRT%2FObjectCustomFields_Overlay.pm;h=c1b8d149f4ac3d758fe9a9a002bd4b60b657095f;hb=2670e2d9870043830049599a63b9dc69c04de18e;hp=9128f14a8c8431a3e8f820a3c4f61f683ca8ce12;hpb=2dfda73eeb3eae2d4f894099754794ef07d060dd;p=freeside.git diff --git a/rt/lib/RT/ObjectCustomFields_Overlay.pm b/rt/lib/RT/ObjectCustomFields_Overlay.pm index 9128f14a8..c1b8d149f 100644 --- a/rt/lib/RT/ObjectCustomFields_Overlay.pm +++ b/rt/lib/RT/ObjectCustomFields_Overlay.pm @@ -1,8 +1,8 @@ # BEGIN BPS TAGGED BLOCK {{{ # # COPYRIGHT: -# -# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC +# +# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC # # # (Except where explicitly superseded by other copyright notices) @@ -45,6 +45,7 @@ # those contributions and any derivatives thereof. # # END BPS TAGGED BLOCK }}} + package RT::ObjectCustomFields; use strict; @@ -65,17 +66,19 @@ sub LimitToObjectId { sub LimitToLookupType { my $self = shift; my $lookup = shift; - unless ($self->{'_cfs_alias'}) { - $self->{'_cfs_alias'} = $self->NewAlias('CustomFields'); - } - $self->Join( ALIAS1 => 'main', - FIELD1 => 'CustomField', - ALIAS2 => $self->{'_cfs_alias'}, - FIELD2 => 'id' ); - $self->Limit( ALIAS => $self->{'_cfs_alias'}, - FIELD => 'LookupType', - OPERATOR => '=', - VALUE => $lookup ); + + $self->{'_cfs_alias'} ||= $self->Join( + ALIAS1 => 'main', + FIELD1 => 'CustomField', + TABLE2 => 'CustomFields', + FIELD2 => 'id', + ); + $self->Limit( + ALIAS => $self->{'_cfs_alias'}, + FIELD => 'LookupType', + OPERATOR => '=', + VALUE => $lookup, + ); } sub HasEntryForCustomField {