This commit was generated by cvs2svn to compensate for changes in r9232,
[freeside.git] / rt / lib / RT / ObjectCustomFields_Overlay.pm
index a496c4b..c1b8d14 100644 (file)
@@ -1,8 +1,8 @@
 # BEGIN BPS TAGGED BLOCK {{{
 # 
 # COPYRIGHT:
-#  
-# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC 
+# 
+# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC
 #                                          <jesse@bestpractical.com>
 # 
 # (Except where explicitly superseded by other copyright notices)
@@ -22,7 +22,9 @@
 # 
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301 or visit their web page on the internet at
+# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
 # 
 # 
 # CONTRIBUTION SUBMISSION POLICY:
@@ -43,6 +45,7 @@
 # those contributions and any derivatives thereof.
 # 
 # END BPS TAGGED BLOCK }}}
+
 package RT::ObjectCustomFields;
 
 use strict;
@@ -63,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 {