From 2623b61fa80bc942e7dcbd05f2d19ac32e647ba1 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Wed, 19 Aug 2015 21:56:54 -0700 Subject: [PATCH] JBAS-769 data sanity check; add 245p Don't assume the nodes below a MARC tag are element nodes. Apparently, in some cases, they were text nodes or possibly some other node type. Signed-off-by: Bill Erickson --- Open-ILS/web/opac/extras/circ/alt_holds_print.js | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/Open-ILS/web/opac/extras/circ/alt_holds_print.js b/Open-ILS/web/opac/extras/circ/alt_holds_print.js index 21e8971ae0..20d109e02a 100644 --- a/Open-ILS/web/opac/extras/circ/alt_holds_print.js +++ b/Open-ILS/web/opac/extras/circ/alt_holds_print.js @@ -11,6 +11,7 @@ function get_marc_bits(marcxml) { var m100c = ''; var m245a = ''; var m245b = ''; + var m245p = ''; var xmlDoc = new DOMParser().parseFromString(marcxml, 'text/xml'); @@ -20,15 +21,20 @@ function get_marc_bits(marcxml) { var tag = node.getAttribute('tag'); if (tag == '100') { dojo.forEach(node.childNodes, function(sub_node) { - var code = sub_node.getAttribute('code'); - if (code == 'a') m100a = sub_node.textContent; - if (code == 'c') m100c = sub_node.textContent; + if (sub_node.nodeType == Node.ELEMENT_NODE) { + var code = sub_node.getAttribute('code'); + if (code == 'a') m100a = sub_node.textContent; + if (code == 'c') m100c = sub_node.textContent; + } }); } else if (tag == '245') { dojo.forEach(node.childNodes, function(sub_node) { - var code = sub_node.getAttribute('code'); - if (code == 'a') m245a = sub_node.textContent; - if (code == 'b') m245b = sub_node.textContent; + if (sub_node.nodeType == Node.ELEMENT_NODE) { + var code = sub_node.getAttribute('code'); + if (code == 'a') m245a = sub_node.textContent; + if (code == 'b') m245b = sub_node.textContent; + if (code == 'p') m245p = sub_node.textContent; + } }); } } @@ -36,7 +42,7 @@ function get_marc_bits(marcxml) { return { author : m100a + ' ' + m100c, - title : m245a + ' ' + m245b + title : m245a + ' ' + m245b + ' ' + m245p }; } -- 2.11.0