+sub LimitToLookupType {
+ my $self = shift;
+ my $lookup = shift;
+
+ $self->{'_cfs_alias'} ||= $self->Join(
+ ALIAS1 => 'main',
+ FIELD1 => 'CustomField',
+ TABLE2 => 'CustomFields',
+ FIELD2 => 'id',
+ );
+ $self->Limit(
+ ALIAS => $self->{'_cfs_alias'},
+ FIELD => 'LookupType',
+ OPERATOR => '=',
+ VALUE => $lookup,
+ );
+}