X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=rt%2Flib%2FRT%2FObjectCustomFields_Overlay.pm;h=c1b8d149f4ac3d758fe9a9a002bd4b60b657095f;hb=e70abd21bab68b23488f7ef1ee2e693a3b365691;hp=0378bf39814403fdeb3c828418253d787a8538be;hpb=ef20b2b6b1feb47ad02b5ff7525f1a0fd11d0fa4;p=freeside.git diff --git a/rt/lib/RT/ObjectCustomFields_Overlay.pm b/rt/lib/RT/ObjectCustomFields_Overlay.pm index 0378bf398..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-2007 Best Practical Solutions, LLC +# +# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC # # # (Except where explicitly superseded by other copyright notices) @@ -24,7 +24,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301 or visit their web page on the internet at -# http://www.gnu.org/copyleft/gpl.html. +# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html. # # # CONTRIBUTION SUBMISSION POLICY: @@ -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 {