[open-ils-commits] [GIT] Evergreen ILS branch rel_2_2 updated. ba607151a6307de5e9587b2aaa111c56149b12d5

Evergreen Git git at git.evergreen-ils.org
Wed Jul 11 16:12:28 EDT 2012


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".

The branch, rel_2_2 has been updated
       via  ba607151a6307de5e9587b2aaa111c56149b12d5 (commit)
      from  410d25c385b0fba65589e800be9f4ac16c36f93d (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit ba607151a6307de5e9587b2aaa111c56149b12d5
Author: Dan Scott <dan at coffeecode.net>
Date:   Fri Jun 15 13:25:29 2012 -0400

    TPAC: Handle multiple matches for an XPath expression
    
    Per LP 1009980, "If a record has multiple subfield b's in the 260 field,
    tpac will not display the publisher or publication date in the record
    details page and will not display the publisher on the search results
    page".
    
    This is because we're calling textContent on a nodeset, rather than an
    individual node, and therefore get null back rather than any content.
    
    To avoid this, always expect a nodeset and iterate over it to populate a
    list of the strings.  To maintain the same semantics of expecting a
    single text string back for, say, args.pubdate, we define the list as
    args.pubdates (plural name), and then grab the first item from the list
    and populate that as args.pubdate (singular name).
    
    Signed-off-by: Dan Scott <dan at coffeecode.net>
    Signed-off-by: Ben Shum <bshum at biblio.org>

diff --git a/Open-ILS/src/templates/opac/parts/misc_util.tt2 b/Open-ILS/src/templates/opac/parts/misc_util.tt2
index 3b9f9a2..0906c06 100644
--- a/Open-ILS/src/templates/opac/parts/misc_util.tt2
+++ b/Open-ILS/src/templates/opac/parts/misc_util.tt2
@@ -14,13 +14,24 @@
         FOR isbn IN xml.findnodes('//*[@tag="020"]/*[@code="a"]');
             args.isbns.push(isbn.textContent);
         END;
+
         args.upcs = [];
         FOR upc IN xml.findnodes('//*[@tag="024"]/*[@code="a"]');
             args.upcs.push(upc.textContent);
         END;
         args.upc = args.upcs.0; # use first UPC as the default
-        args.issn = xml.findnodes('//*[@tag="022"]/*[@code="a"]').textContent;
-        args.author = xml.findnodes('//*[@tag="100"]/*[@code="a"]').textContent;
+
+        args.issns = [];
+        FOR sub IN xml.findnodes('//*[@tag="022"]/*[@code="a"]');
+            args.issns.push(sub.textContent);
+        END;
+        args.issn = (args.issns.size) ? args.issn.0 : '';
+
+        args.authors = [];
+        FOR sub IN xml.findnodes('//*[@tag="100"]/*[@code="a"]');
+            args.authors.push(sub.textContent);
+        END;
+        args.author = (args.authors.size) ? args.authors.0 : '';
 
         # Include subfields 'abnp' to generate a more comprehensive title display in search results
         titresults = xml.findnodes('//*[@tag="245"]/*[@code="a" or @code="b" or @code="n" or @code="p"]');
@@ -36,23 +47,55 @@
             FOR sub IN titsubs; titsubs_content.push(sub.textContent); END;
         args.title_extended = titsubs_content.join(" ");
 
-        args.publisher = xml.findnodes('//*[@tag="260"]/*[@code="b"]').textContent;
-        args.pubdate = xml.findnodes('//*[@tag="260"]/*[@code="c"]').textContent;
-        args.summary = xml.findnodes('//*[@tag="520"]/*[@code="a"]').textContent;
-        args.edition = xml.findnodes('//*[@tag="250"]/*[@code="a"]').textContent ||
-            xml.findnodes('//*[@tag="534"]/*[@code="b"]').textContent ||
-            xml.findnodes('//*[@tag="775"]/*[@code="b"]').textContent;
-        phys = xml.findnodes(
+        args.publishers = [];
+        FOR sub IN xml.findnodes('//*[@tag="260"]/*[@code="b"]');
+            args.publishers.push(sub.textContent);
+        END;
+        args.publisher = (args.publishers.size) ? args.publishers.0 : '';
+
+        args.pubdates = [];
+        FOR sub IN xml.findnodes('//*[@tag="260"]/*[@code="c"]');
+            args.pubdates.push(sub.textContent);
+        END;
+        args.pubdate = (args.pubdates.size) ? args.pubdates.0 : '';
+
+        args.summaries = [];
+        FOR sub IN xml.findnodes('//*[@tag="520"]/*[@code="a"]');
+            args.summaries.push(sub.textContent);
+        END;
+        args.summary = (args.summary.size) ? args.summary.0 : '';
+
+        args.editions = [];
+        ed_hunt = xml.findnodes('//*[@tag="250"]/*[@code="a"]') &&
+            xml.findnodes('//*[@tag="534"]/*[@code="b"]') &&
+            xml.findnodes('//*[@tag="775"]/*[@code="b"]');
+        FOR sub IN ed_hunt;
+            args.editions.push(sub.textContent);
+        END;
+        args.edition = (args.editions.size) ? args.editions.0 : '';
+
+        phys_content = [];
+        FOR sub IN xml.findnodes(
             '//*[@tag="300"]/*[@code="a" or @code="b" or @code="c" or @code="e"]'
         );
-        phys_content = [];
-        FOR p IN phys; phys_content.push(p.textContent); END;
+            phys_content.push(sub.textContent);
+        END;
         args.phys_desc = phys_content.join("");
 
-        args.contents = xml.findnodes('//*[@tag="505"]').textContent;
+        args.contents_list = [];
+        FOR sub IN xml.findnodes('//*[@tag="505"]');
+            args.contents_list.push(sub.textContent);
+        END;
+        args.contents = args.contents_list.join(" ");
+        args.content = (args.contents.size) ? args.contents.0 : '';
 
         # MARC Callnumber
-        args.marc_cn = xml.findnodes('//*[@tag="092" or @tag="099"]/*').textContent;
+        args.marc_cns = [];
+        FOR sub IN xml.findnodes('//*[@tag="092" or @tag="099"]/*');
+            args.marc_cns.push(sub.textContent);
+        END;
+        args.marc_cn = (args.marc_cns.size ) ? args.marc_cns.0 : '';
+            
 
         # clean up the ISBN
         args.isbn_clean = args.isbns.0.replace('\ .*', '');

-----------------------------------------------------------------------

Summary of changes:
 Open-ILS/src/templates/opac/parts/misc_util.tt2 |   69 ++++++++++++++++++----
 1 files changed, 56 insertions(+), 13 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list