[Rt-commit] r2137 - in rt/branches/3.2-RELEASE: . lib/RT
jesse at bestpractical.com
jesse at bestpractical.com
Fri Jan 28 10:27:57 EST 2005
Author: jesse
Date: Fri Jan 28 10:27:55 2005
New Revision: 2137
Modified:
rt/branches/3.2-RELEASE/ (props changed)
rt/branches/3.2-RELEASE/lib/RT/Tickets_Overlay.pm
rt/branches/3.2-RELEASE/lib/RT/Tickets_Overlay_SQL.pm
Log:
r3935 at hualien: jesse | 2005-01-26T17:15:42.847181Z
RT-Ticket: 6378
RT-Status: resolved
RT-Update: correspond
Added a flag to allow tools to use the RT API to search for deleted tickets.
(Ruslan)
Modified: rt/branches/3.2-RELEASE/lib/RT/Tickets_Overlay.pm
==============================================================================
--- rt/branches/3.2-RELEASE/lib/RT/Tickets_Overlay.pm (original)
+++ rt/branches/3.2-RELEASE/lib/RT/Tickets_Overlay.pm Fri Jan 28 10:27:55 2005
@@ -73,6 +73,10 @@
=begin testing
ok (require RT::Tickets);
+ok( my $testtickets = RT::Tickets->new( $RT::SystemUser ) );
+ok( $testtickets->LimitStatus( VALUE => 'deleted' ) );
+# Should be zero until 'allow_deleted_search'
+ok( $testtickets->Count == 0 );
=end testing
@@ -1038,6 +1042,11 @@
OPERATOR is one of = or !=.
VALUE is a status.
+RT adds Status != 'deleted' until object has
+allow_deleted_search internal property set.
+$tickets->{'allow_deleted_search'} = 1;
+$tickets->LimitStatus( VALUE => 'deleted' );
+
=cut
sub LimitStatus {
@@ -1896,7 +1905,8 @@
#TODO we should be doing this in the where clause.
#but you can't do multiple clauses on the same field just yet :/
- if ($Ticket->__Value('Status') eq 'deleted') {
+ if ( $Ticket->__Value('Status') eq 'deleted' &&
+ !$self->{'allow_deleted_search'} ) {
return($self->Next());
}
# Since Ticket could be granted with more rights instead
@@ -2221,5 +2231,24 @@
$self->RedoSearch();
}
+
+=head1 FLAGS
+
+RT::Tickets supports several flags which alter search behavior:
+
+
+allow_deleted_search (Otherwise never show deleted tickets in search results)
+looking_at_type (otherwise limit to type=ticket)
+
+These flags are set by calling
+
+$tickets->{'flagname'} = 1;
+
+BUG: There should be an API for this
+
+=cut
+
1;
+
+
Modified: rt/branches/3.2-RELEASE/lib/RT/Tickets_Overlay_SQL.pm
==============================================================================
--- rt/branches/3.2-RELEASE/lib/RT/Tickets_Overlay_SQL.pm (original)
+++ rt/branches/3.2-RELEASE/lib/RT/Tickets_Overlay_SQL.pm Fri Jan 28 10:27:55 2005
@@ -509,8 +509,12 @@
$self->SUPER::Limit( FIELD => 'Type', OPERATOR => '=', VALUE => 'ticket');
}
- # We never ever want to show deleted tickets
- $self->SUPER::Limit(FIELD => 'Status' , OPERATOR => '!=', VALUE => 'deleted');
+ # We don't want deleted tickets unless 'allow_deleted_search' is set
+ unless( $self->{'allow_deleted_search'} ) {
+ $self->SUPER::Limit(FIELD => 'Status',
+ OPERATOR => '!=',
+ VALUE => 'deleted');
+ }
# set SB's dirty flag
More information about the Rt-commit
mailing list