From: Dan Scott Date: Mon, 19 Aug 2013 15:36:51 +0000 (-0400) Subject: Move schema.org availability logic into misc_utils.tt2 X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=refs%2Fheads%2Fuser%2Fdbs%2Fschema_holdings;p=working%2FEvergreen.git Move schema.org availability logic into misc_utils.tt2 Might as well make the availability logic reusable, if we opt to mark up the search results pages with schema.org at some point in the future. Signed-off-by: Dan Scott --- diff --git a/Open-ILS/src/templates/opac/parts/misc_util.tt2 b/Open-ILS/src/templates/opac/parts/misc_util.tt2 index cdea2adbcd..363318d852 100644 --- a/Open-ILS/src/templates/opac/parts/misc_util.tt2 +++ b/Open-ILS/src/templates/opac/parts/misc_util.tt2 @@ -91,6 +91,17 @@ schema_typemap.e = 'http://schema.org/Map'; schema_typemap.j = 'http://schema.org/MusicAlbum'; + # Hard-coded to match defaults in config.copy_status for all OPAC-visible statuses + schema_copy_status = {}; + schema_copy_status.0 = ''; # Available + schema_copy_status.1 = ''; # Checked out + schema_copy_status.5 = ''; # In process + schema_copy_status.6 = ''; # In transit + schema_copy_status.7 = ''; # Reshelving + schema_copy_status.8 = ''; # On holds shelf + schema_copy_status.9 = ''; # On order + schema_copy_status.12 = ''; # Reserves + args.isbns = []; FOR isbn IN xml.findnodes('//*[@tag="020"]/*[@code="a"]'); args.isbns.push(isbn.textContent); diff --git a/Open-ILS/src/templates/opac/parts/record/copy_table.tt2 b/Open-ILS/src/templates/opac/parts/record/copy_table.tt2 index d38c61e8ba..c7dbdea653 100644 --- a/Open-ILS/src/templates/opac/parts/record/copy_table.tt2 +++ b/Open-ILS/src/templates/opac/parts/record/copy_table.tt2 @@ -176,16 +176,7 @@ END; # FOREACH bib END %] [%- END %] [%- - # Hard-coded to match defaults in config.copy_status - IF (copy_info.status_code == 0 OR copy_info.status_code == 7); - ''; - ELSIF copy_info.status_code == 1; - ''; - ELSIF copy_info.status_code == 9; - ''; - ELSIF copy_info.status_code == 12; - ''; - END; + schema_copy_status.${copy_info.status_code}; copy_info.copy_status | html; -%] [% @@ -201,7 +192,7 @@ END; # FOREACH bib [% IF copy_info.notes; %] [% FOREACH note IN copy_info.notes; %] -  [% note.title | html %]: [% note.value | html %] +  [% note.title | html %]: [% note.value | html %] [% END %] [% END %]