From 0f7bab7be9b762600b6801dee4e8d7cef3b6b468 Mon Sep 17 00:00:00 2001 From: Jason Etheridge Date: Thu, 8 Dec 2011 17:48:42 -0500 Subject: [PATCH] support SVF in staff client bib record summary This is in support of https://bugs.launchpad.net/evergreen/+bug/822928, re: Cat Date So for example, let's suppose you want to store a "Cat Date" in MARC tag 915, subfield a. You could do this in the database: INSERT INTO config.record_attr_definition (name,label,filter,sorter,tag,sf_list) VALUES ( 'cat_date', 'Cat Date', 'f', 't', '915', 'd' ); Add this to server/locale/en-US/cat_custom.properties (optional but recommended): staff.cat.bib_brief.cat_date.label=Cat Date: staff.cat.bib_brief.cat_date.accesskey= And then add something like this to server/skin/custom.js: try { netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces['nsIPrefBranch']); prefs.setCharPref( 'oils.bib_brief.horizontal.dynamic_grid_replacement.data', js2JSON([ ["title", "edition", "editor", "cat_date"], ["author", "pubdate", "edit_date", "holds"], ["bib_call_number", "tcn", "create_date", "items"] ]) ); prefs.setCharPref( 'oils.bib_brief.alternate_copy_summary.dynamic_grid_replacement.data', js2JSON([ ["title", "edition", "editor", "cat_date"], ["author", "pubdate", "edit_date", "holds"], ["call_number", "tcn", "create_date", "items"] ]) ); } catch(E) { dump('Error in custom.js trying to set oils.bib_brief.*.dynamic_grid_replacement.data: ' + E + '\n'); } Finally, re-ingest any records with tag 915d (you can simply edit the MARC via the MARC Editor for a specific record, or if the ingest.reingest.force_on_same_marc row in config.internal_flag is enabled and you're not doing this during library hours, you can re-ingest all records with UPDATE biblio.record_entry SET marc = marc;) Signed-off-by: Jason Etheridge Signed-off-by: Bill Erickson --- Open-ILS/src/perlmods/lib/OpenILS/Application/Cat.pm | 7 ++++--- .../xul/staff_client/server/cat/bib_brief_overlay.js | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat.pm index 8e311f6b7b..6a9ee333bf 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat.pm @@ -427,9 +427,9 @@ __PACKAGE__->register_method( method => "biblio_record_record_metadata", api_name => "open-ils.cat.biblio.record.metadata.retrieve", authoritative => 1, - argc => 1, #(session_id, biblio_tree ) - notes => "Walks the tree and commits any changed nodes " . - "adds any new nodes, and deletes any deleted nodes", + argc => 2, #(session_id, list of bre ids ) + notes => "Returns a list of slim-downed bre objects based on the " . + "ids passed in", ); sub biblio_record_record_metadata { @@ -448,6 +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->clear_marc; # slim the record down push( @results, $rec ); } diff --git a/Open-ILS/xul/staff_client/server/cat/bib_brief_overlay.js b/Open-ILS/xul/staff_client/server/cat/bib_brief_overlay.js index bc6d784148..f939e68cbb 100644 --- a/Open-ILS/xul/staff_client/server/cat/bib_brief_overlay.js +++ b/Open-ILS/xul/staff_client/server/cat/bib_brief_overlay.js @@ -94,6 +94,24 @@ 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') + + '}' + ); + for (var attr in attrs) { + if (exists(attr)) { + set(attr,attrs[attr]); + set_tooltip(attr,attr); + } + } + } + // Let's fetch a bib call number, if the "bib_call_number" field exists // in our display if (exists('bib_call_number')) { -- 2.11.0