SVF in bib record summary: extract attrs on the server
authorBill Erickson <berick@esilibrary.com>
Thu, 22 Dec 2011 15:13:03 +0000 (10:13 -0500)
committerBill Erickson <berick@esilibrary.com>
Thu, 22 Dec 2011 15:22:58 +0000 (10:22 -0500)
This repairs a FIXME within the custom bib overlay code related to
parsing metabib.record_attr stores within the JS.  Instead, now we use
an attr parsing utility function which compiles a regular hash so the
client no longer needs to parse it.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Open-ILS/src/perlmods/lib/OpenILS/Application/Cat.pm
Open-ILS/xul/staff_client/server/cat/bib_brief_overlay.js

index 6a9ee33..a018e3f 100644 (file)
@@ -448,7 +448,7 @@ sub biblio_record_record_metadata {
             my $rec = $editor->retrieve_biblio_record_entry($_);
         $rec->creator($editor->retrieve_actor_user($rec->creator));
         $rec->editor($editor->retrieve_actor_user($rec->editor));
-        $rec->attrs($editor->retrieve_metabib_record_attr($rec->id));
+        $rec->attrs($U->get_bre_attrs([$rec->id], $editor)->{$rec->id});
         $rec->clear_marc; # slim the record down
         push( @results, $rec );
     }
index f939e68..de791b1 100644 (file)
@@ -97,16 +97,10 @@ function bib_brief_overlay(params) {
         // Let's loop through bre.attrs.attrs and put them with any matching
         // elements in bib_brief_overlay.xul
         if (params.bre.attrs()) {
-            // FIXME -- we should do this in the perl; what's below isn't robust
-            var attrs = JSON2js(
-                '{' +
-                params.bre.attrs().attrs().replace(
-                    '=>',':','g').replace('NULL','null','g')
-                + '}'
-            );
+            var attrs = params.bre.attrs();
             for (var attr in attrs) {
                 if (exists(attr)) {
-                    set(attr,attrs[attr]);
+                    set(attr,attrs[attr].code);
                     set_tooltip(attr,attr);
                 }
             }