From: Bill Erickson Date: Thu, 20 Aug 2015 04:56:54 +0000 (-0700) Subject: JBAS-769 data sanity check; add 245p X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=2623b61fa80bc942e7dcbd05f2d19ac32e647ba1;p=working%2FEvergreen.git 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 --- 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 }; }