3 # Copyright (c) 1996-2003 Jesse Vincent <jesse@bestpractical.com>
5 # (Except where explictly superceded by other copyright notices)
7 # This work is made available to you under the terms of Version 2 of
8 # the GNU General Public License. A copy of that license should have
9 # been provided with this software, but in any event can be snarfed
12 # This work is distributed in the hope that it will be useful, but
13 # WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 # General Public License for more details.
17 # Unless otherwise specified, all modifications, corrections or
18 # extensions to this work which alter its source code become the
19 # property of Best Practical Solutions, LLC when submitted for
20 # inclusion in the work.
26 RT::Links - A collection of Link objects
31 my $links = new RT::Links($CurrentUser);
41 ok (require RT::Links);
48 no warnings qw(redefine);
54 my %args = ( ENTRYAGGREGATOR => 'AND',
58 #if someone's trying to search for tickets, try to resolve the uris for searching.
60 if ( ( $args{'OPERATOR'} eq '=') and
61 ( $args{'FIELD'} eq 'Base') or ($args{'FIELD'} eq 'Target')
63 my $dummy = RT::URI->new($self->CurrentUser);
64 $dummy->FromURI($args{'VALUE'});
69 # If we're limiting by target, order by base
70 # (Order by the thing that's changing)
72 if ( ($args{'FIELD'} eq 'Target') or
73 ($args{'FIELD'} eq 'LocalTarget') ) {
74 $self->OrderBy (ALIAS => 'main',
78 elsif ( ($args{'FIELD'} eq 'Base') or
79 ($args{'FIELD'} eq 'LocalBase') ) {
80 $self->OrderBy (ALIAS => 'main',
86 $self->SUPER::Limit(%args);
92 =head2 LimitRefersTo URI
94 find all things that refer to URI
102 $self->Limit(FIELD => 'Type', VALUE => 'RefersTo');
103 $self->Limit(FIELD => 'Target', VALUE => $URI);
107 # {{{ LimitReferredToBy
109 =head2 LimitReferredToBy URI
111 find all things that URI refers to
115 sub LimitReferredToBy {
119 $self->Limit(FIELD => 'Type', VALUE => 'RefersTo');
120 $self->Limit(FIELD => 'Base', VALUE => $URI);