From 4c8fc7fbb8733e27d480b838df2e86f1f1cc7ce7 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Thu, 20 Feb 2014 14:48:53 -0500 Subject: [PATCH] LP#1053397 MR holds displays selected formats In a patron's holds list, only show formats in the format column matching the patron's selected hold formats. Signed-off-by: Bill Erickson Signed-off-by: Mike Rylander Signed-off-by: Dan Wells --- Open-ILS/src/templates/opac/myopac/holds.tt2 | 20 +++++++++++--- .../src/templates/opac/parts/misc_util.tt2 | 27 +++++++++++++------ 2 files changed, 35 insertions(+), 12 deletions(-) diff --git a/Open-ILS/src/templates/opac/myopac/holds.tt2 b/Open-ILS/src/templates/opac/myopac/holds.tt2 index 0a7b04a2c8..b08d2306cf 100644 --- a/Open-ILS/src/templates/opac/myopac/holds.tt2 +++ b/Open-ILS/src/templates/opac/myopac/holds.tt2 @@ -150,10 +150,22 @@
- [% IF attrs.all_formats.size %] - [% FOR format IN attrs.all_formats %] - [% format.label | html %] - [% END %] + [% + formats = attrs.all_formats.size; + IF ahr.hold_type == 'M'; + # only show selected formats for metarecords + formats = []; + FOR ccvm IN hold.metarecord_selected_filters.icons; + format = {}; + format.icon = PROCESS get_ccvm_icon id=ccvm.id search_label=1; + format.label = PROCESS get_ccvm_label id=ccvm.id search_label=1; + formats.push(format); + END; + END; + FOR format IN formats + %] + [% format.label | html %] [% END %]
diff --git a/Open-ILS/src/templates/opac/parts/misc_util.tt2 b/Open-ILS/src/templates/opac/parts/misc_util.tt2 index 589a2c16b1..c003c15cc2 100644 --- a/Open-ILS/src/templates/opac/parts/misc_util.tt2 +++ b/Open-ILS/src/templates/opac/parts/misc_util.tt2 @@ -88,6 +88,13 @@ END; END; + BLOCK get_ccvm_icon; + ccvm = ctx.get_ccvm(id); # caches internally + label = PROCESS get_ccvm_label id=id search_label=search_label; + ctx.media_prefix _ '/images/format_icons/' _ ccvm.ctype _ '/' _ ccvm.code _ '.png'; + END; + + # Extract MARC fields from XML # get_marc_attrs( { marc_xml => doc } ) BLOCK get_marc_attrs; @@ -440,16 +447,20 @@ FOR node IN xml.findnodes(formats_xpath); IF node AND node.textContent; type = node.textContent; - label = PROCESS get_ccvm_label id=node.getAttribute('cvmid') search_label=1; - itemtype = schema_typemap.$type || 'CreativeWork'; - icon = ctx.media_prefix _ '/images/format_icons/' _ icon_style _ '/' _ type _ '.png'; - # collect all formats for metarecord support - args.all_formats.push({label => label, icon => icon, itemtype => itemtype}); + format = {}; + format.icon = PROCESS get_ccvm_icon + id=node.getAttribute('cvmid') search_label=1; + format.label = PROCESS get_ccvm_label + id=node.getAttribute('cvmid') search_label=1; + format.itemtype = schema_typemap.$type || 'CreativeWork'; + + args.all_formats.push(format); # metarecords want all formats + IF !args.format_label; # use the first format as the default - args.format_label = label; - args.schema.itemtype = itemtype; - args.format_icon = icon; + args.format_label = format.label; + args.schema.itemtype = format.itemtype; + args.format_icon = format.icon; END; END; END; -- 2.43.2