[open-ils-commits] r10622 - trunk/Open-ILS/src/perlmods/OpenILS/Application

svn at svn.open-ils.org svn at svn.open-ils.org
Wed Sep 17 13:49:35 EDT 2008


Author: erickson
Date: 2008-09-17 13:49:32 -0400 (Wed, 17 Sep 2008)
New Revision: 10622

Modified:
   trunk/Open-ILS/src/perlmods/OpenILS/Application/Vandelay.pm
Log:
added limit/offset support to queued record retrieval method

Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Vandelay.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Vandelay.pm	2008-09-17 17:22:33 UTC (rev 10621)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Vandelay.pm	2008-09-17 17:49:32 UTC (rev 10622)
@@ -314,6 +314,9 @@
     my($self, $conn, $auth, $queue_id, $options) = @_;
     my $e = new_editor(authtoken => $auth);
     return $e->event unless $e->checkauth;
+    $options ||= {};
+    my $limit = $$options{limit} || 20;
+    my $offset = $$options{offset} || 0;
 
     my $type = $self->{record_type};
     my $queue;
@@ -330,15 +333,20 @@
         'search_vandelay_queued_bib_record' : 'search_vandelay_queued_authority_record';
     my $retrieve = ($type eq 'bib') ? 
         'retrieve_vandelay_queued_bib_record' : 'retrieve_vandelay_queued_authority_record';
-    my $record_ids = $e->$search({queue => $queue_id}, {idlist => 1});
 
+    my $record_ids = $e->$search([
+            {queue => $queue_id}, 
+            {order_by => {$class => 'id'}, limit => $limit, offset => $offset}
+        ],
+        {idlist => 1}
+    );
+
     for my $rec_id (@$record_ids) {
-        my $rec = $e->$retrieve([
-            $rec_id,
-            {   flesh => 1,
-                flesh_fields => {$class => ['attributes', 'matches']}
-            }
-        ]);
+        my $params = {   
+            flesh => 1,
+            flesh_fields => {$class => ['attributes', 'matches']},
+        };
+        my $rec = $e->$retrieve([$rec_id, $params]);
         $rec->clear_marc if $$options{clear_marc};
         next if $self->api_name =~ /matches/ and not @{$rec->matches};
         $conn->respond($rec);



More information about the open-ils-commits mailing list