From: Dan Scott Date: Mon, 20 Jan 2014 03:24:07 +0000 (-0500) Subject: Create 008 - take only the first field/subfield combo X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=06ce842345c36031a704ab1e86f75332a54a614b;p=evergreen%2Fpines.git Create 008 - take only the first field/subfield combo In the event that there were multiple $a subfields in, say, 044, the create 008 function could spew raw XML into the 008 field. Avoid that by taking the primary instance. Signed-off-by: Dan Scott --- diff --git a/Open-ILS/xul/staff_client/server/cat/marcedit.js b/Open-ILS/xul/staff_client/server/cat/marcedit.js index 9237ff9b22..27f5870928 100644 --- a/Open-ILS/xul/staff_client/server/cat/marcedit.js +++ b/Open-ILS/xul/staff_client/server/cat/marcedit.js @@ -65,7 +65,7 @@ function get_new_008() { if (xml_record.datafield.(@tag == '041')) { var field = xml_record.datafield.(@tag == '041')[0]; if (field && field.subfield.(@code == 'a')) { - lang = field.subfield.(@code == 'a'); + lang = field.subfield.(@code == 'a')[0]; } } @@ -74,7 +74,7 @@ function get_new_008() { if (xml_record.datafield.(@tag == '044')) { var field = xml_record.datafield.(@tag == '044')[0]; if (field && field.subfield.(@code == 'a')) { - country = field.subfield.(@code == 'a'); + country = field.subfield.(@code == 'a')[0]; } } while (country.length < 3) country = country + ' '; @@ -85,7 +85,7 @@ function get_new_008() { if (xml_record.datafield.(@tag == '260')) { var field = xml_record.datafield.(@tag == '260')[0]; if (field && field.subfield.(@code == 'c')) { - var tmpd = field.subfield.(@code == 'c').replace(/[^0-9]/g, ''); + var tmpd = field.subfield.(@code == 'c')[0].replace(/[^0-9]/g, ''); if (tmpd.match(/^\d\d\d\d/)) { date1 = tmpd.substr(0, 4); }