TPAC: Fix author display
authorDan Scott <dscott@laurentian.ca>
Wed, 5 Sep 2012 04:49:30 +0000 (00:49 -0400)
committerDan Scott <dscott@laurentian.ca>
Wed, 5 Sep 2012 04:50:25 +0000 (00:50 -0400)
Our generic label was getting overwritten by the first specific label,
such that all following generic labels would get the specific label.

Signed-off-by: Dan Scott <dscott@laurentian.ca>
Open-ILS/src/templates/opac/parts/record/authors.tt2

index abce758..bc61e48 100644 (file)
@@ -27,12 +27,13 @@ BLOCK build_author_links;
         term = '';
         qterm = '';
         iprop = '';
+        tlabel = '';
         FOR subfield IN node.childNodes;
             NEXT UNLESS subfield.nodeName == "subfield";
             code = subfield.getAttribute('code');
             IF code == '4';
                 relcode = subfield.textContent.substr(0,3);
-                label = relators.$relcode || label;
+                tlabel = relators.$relcode || label;
             END;
             NEXT UNLESS code.match('[a-z]');
             sf_raw = subfield.textContent;
@@ -41,7 +42,7 @@ BLOCK build_author_links;
             qterm = qterm _ ' ' _ sf_raw;
         END;
         url = mkurl(ctx.opac_root _ '/results', {query => qterm, qtype => 'author'}, ['page', 'expand']);
-        author_type = label | html;
+        author_type = (tlabel || label) | html;
         
         # schema.org changes
         IF type == 'author';