TPac; improved UPC extraction
authorBill Erickson <berick@esilibrary.com>
Mon, 24 Oct 2011 17:52:14 +0000 (13:52 -0400)
committerLebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Fri, 4 Nov 2011 21:06:10 +0000 (17:06 -0400)
Handle the case where a record has multiple UPC's.  When this occurs,
use the first UPC as the value for added content lookups as necessary.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Lebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Open-ILS/src/templates/opac/parts/misc_util.tt2

index 38944f6..3089984 100644 (file)
@@ -7,7 +7,11 @@
         FOR isbn IN xml.findnodes('//*[@tag="020"]/*[@code="a"]');
             args.isbns.push(isbn.textContent);
         END;
-        args.upc = xml.findnodes('//*[@tag="024"]/*[@code="a"]').textContent;
+        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.title = xml.findnodes('//*[@tag="245"]/*[@code="a"]').textContent;
         args.title_extended = xml.findnodes('//*[@tag="245"]').textContent;