Tpac; bookbag MARC retrieved via unapi
authorBill Erickson <berick@esilibrary.com>
Tue, 1 Nov 2011 15:35:41 +0000 (11:35 -0400)
committerMike Rylander <mrylander@gmail.com>
Tue, 1 Nov 2011 16:27:39 +0000 (12:27 -0400)
Make sure the bookbag interface has access to metabib.record_attr's by
retrieving and parsing the marcxml via unapi (get_records_and_facets).

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Mike Rylander <mrylander@gmail.com>
Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm

index fe0da83..c84bed4 100644 (file)
@@ -1399,14 +1399,13 @@ sub load_myopac_bookbags {
         my $items = $U->bib_container_items_via_search($bookbag->id, $query)
             or return Apache2::Const::HTTP_INTERNAL_SERVER_ERROR;
 
-        # Maybe save a little memory by creating only one XML::LibXML::Document
-        # instance for each record, even if record is repeated across bookbags.
+        my (undef, @recs) = $self->get_records_and_facets(
+            [ map {$_->target_biblio_record_entry->id} @$items ],
+            undef, 
+            {flesh => '{mra}'}
+        );
 
-        foreach my $rec (map { $_->target_biblio_record_entry } @$items) {
-            next if $ctx->{bookbags_marc_xml}{$rec->id};
-            $ctx->{bookbags_marc_xml}{$rec->id} =
-                (new XML::LibXML)->parse_string($rec->marc);
-        }
+        $ctx->{bookbags_marc_xml}{$_->{id}} = $_->{marc_xml} for @recs;
 
         $bookbag->items($items);
     }