From: Dan Scott Date: Tue, 16 Dec 2014 04:23:49 +0000 (-0500) Subject: LP#1402905 Use stricter matching for UPC values X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=be2529e3f41bacc1658e6540083c5582aa03d944;p=evergreen%2Fpines.git LP#1402905 Use stricter matching for UPC values Per http://www.loc.gov/marc/bibliographic/bd024.html we should be checking to see if either the ind1 is "1" or if there's a subfield 2 with a value of "upc" before assuming that any "Other standard identifier" 024 field is a UPC value. Signed-off-by: Dan Scott Signed-off-by: Ben Shum --- diff --git a/Open-ILS/src/templates/opac/parts/misc_util.tt2 b/Open-ILS/src/templates/opac/parts/misc_util.tt2 index a8d18f9382..07bec5c028 100644 --- a/Open-ILS/src/templates/opac/parts/misc_util.tt2 +++ b/Open-ILS/src/templates/opac/parts/misc_util.tt2 @@ -137,10 +137,17 @@ args.isbns.push(isbn.textContent); END; + # UPCs can be identified either by ind1="1" or subfield 2 of "upc" args.upcs = []; - FOR upc IN xml.findnodes('//*[@tag="024"]/*[@code="a"]'); + FOR upc IN xml.findnodes('//*[@tag="024" and @ind="1"]/*[@code="a"]'); args.upcs.push(upc.textContent); END; + FOR upcfield IN xml.findnodes('//*[@tag="024"]/*[@code="2" and text()="upc"]'); + my_parent = upcfield.parentNode(); + FOR upc IN my_parent.findnodes('./*[@code="a"]'); + args.upcs.push(upc.textContent); + END; + END; args.upc = args.upcs.0; # use first UPC as the default args.issns = [];