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

svn at svn.open-ils.org svn at svn.open-ils.org
Wed Sep 3 09:45:56 EDT 2008


Author: erickson
Date: 2008-09-03 09:45:55 -0400 (Wed, 03 Sep 2008)
New Revision: 10518

Modified:
   trunk/Open-ILS/src/perlmods/OpenILS/Application/Vandelay.pm
Log:
added fleshing of matches on queued rec retrieval.  condensed some of the retrieval code

Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Vandelay.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Vandelay.pm	2008-09-03 13:45:12 UTC (rev 10517)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Vandelay.pm	2008-09-03 13:45:55 UTC (rev 10518)
@@ -315,32 +315,20 @@
     my $evt = check_queue_perms($e, $type, $queue);
     return $evt if $evt;
 
-    if($type eq 'bib') {
-        my $record_ids = $e->search_vandelay_queued_bib_record({queue => $queue_id}, {idlist => 1});
-        for my $rec_id (@$record_ids) {
-            my $rec = $e->retrieve_vandelay_queued_bib_record([
-                $rec_id,
-                {   flesh => 1,
-                    flesh_fields => {vqbr => ['attributes']}
-                }
-            ]);
-            $rec->clear_marc if $$options{clear_marc};
-            $conn->respond($rec);
-        }
-    } else {
-        my $record_ids = $e->search_vandelay_queued_authority_record({queue => $queue_id}, {idlist => 1});
-        for my $rec_id (@$record_ids) {
-            for my $rec_id (@$record_ids) {
-                my $rec = $e->retrieve_vandelay_queued_bib_record([
-                    $rec_id,
-                    {   flesh => 1,
-                        flesh_fields => {vqar => ['attributes']}
-                    }
-                ]);
-                $rec->clear_marc if $$options{clear_marc};
-                $conn->respond($rec);
+    my $class = ($type eq 'bib') ? 'vqbr' : 'vqar';
+    my $search = ($type eq 'bib') ? '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});
+
+    for my $rec_id (@$record_ids) {
+        my $rec = $e->$retrieve([
+            $rec_id,
+            {   flesh => 1,
+                flesh_fields => {$class => ['attributes', 'matches']}
             }
-        }
+        ]);
+        $rec->clear_marc if $$options{clear_marc};
+        $conn->respond($rec);
     }
     return undef;
 }



More information about the open-ils-commits mailing list