[Rt-commit] r14827 - in rt/branches/3.6-EXPERIMENTAL-PAGING: lib/RT

ruz at bestpractical.com ruz at bestpractical.com
Tue Aug 5 19:50:00 EDT 2008


Author: ruz
Date: Tue Aug  5 19:49:58 2008
New Revision: 14827

Modified:
   rt/branches/3.6-EXPERIMENTAL-PAGING/   (props changed)
   rt/branches/3.6-EXPERIMENTAL-PAGING/lib/RT/SearchBuilder.pm

Log:
 r14820 at cubic-pc:  cubic | 2008-08-05 05:03:41 +0400
 * generalize FilterRecord method


Modified: rt/branches/3.6-EXPERIMENTAL-PAGING/lib/RT/SearchBuilder.pm
==============================================================================
--- rt/branches/3.6-EXPERIMENTAL-PAGING/lib/RT/SearchBuilder.pm	(original)
+++ rt/branches/3.6-EXPERIMENTAL-PAGING/lib/RT/SearchBuilder.pm	Tue Aug  5 19:49:58 2008
@@ -337,6 +337,39 @@
 
 # }}}
 
+=head2 Next
+
+Returns next record in the collection, but only if it's not filtered
+by L</FilterRecord> method.
+
+See also L<DBIx::SearchBuilder/Next>.
+
+=cut
+
+sub Next {
+    my $self = shift;
+
+    my $record = $self->SUPER::Next( @_ );
+    # if there never was any record
+    return $record unless $record;
+    # filtered out
+    return $self->Next( @_ ) if $self->FilterRecord( $record );
+    # fine
+    return $record;
+}
+
+=head2 FilterRecord
+
+Method for subclassing, returns true if record should skipped
+from results otherwise boolean value. Record is passed as only
+value.
+
+Called from L</Next> method and other.
+
+=cut
+
+sub FilterRecord { return 0 }
+
 # {{{ sub ItemsArrayRef
 
 =head2 ItemsArrayRef


More information about the Rt-commit mailing list