# 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)
#
# 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:
# those contributions and any derivatives thereof.
#
# END BPS TAGGED BLOCK }}}
+
package RT::ObjectCustomFields;
use strict;
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 {