From c9de0c9670414827c3ef1bb1f2a09d5238f48644 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Thu, 16 May 2013 09:11:50 -0400 Subject: [PATCH] Repair faulty MARC editor authority validation Repair how the JS inspects the results of open-ils.search.authority.simple_heading.from_xml.batch.atomic, which is used to look up matches for authority validation. It returns a more complex structure in the brave new world of authority control sets. Signed-off-by: Bill Erickson Signed-off-by: Mike Rylander --- Open-ILS/xul/staff_client/server/cat/marcedit.js | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/Open-ILS/xul/staff_client/server/cat/marcedit.js b/Open-ILS/xul/staff_client/server/cat/marcedit.js index 1fbf544dd6..b3eb53aa08 100644 --- a/Open-ILS/xul/staff_client/server/cat/marcedit.js +++ b/Open-ILS/xul/staff_client/server/cat/marcedit.js @@ -1616,11 +1616,28 @@ function validateAuthority (button) { 'subfields' : sf_list }) ); + + // matches = [ { "$csetId" : [ ... ] } ] + + var found = false; + if (matches[0]) { // probably set + for (var cset in matches[0]) { + var arr = matches[0][cset]; + if (arr.length) { + // protect against errant empty string values + if (arr.length == 1 && arr[0] == '') + continue; + found = true; + break; + } + } + } + // XXX If adt, etc should be validated separately from vxz, etc then move this up into the above for loop for (var j = 0; j < subfields.length; j++) { var sf = subfields[j]; - if (!matches.length) { + if (!found) { dojo.removeClass(sf.childNodes[2], 'marcValidated'); dojo.addClass(sf.childNodes[2], 'marcUnvalidated'); } else { @@ -1629,7 +1646,7 @@ function validateAuthority (button) { } } - if (matches.length) done = true; + if (found) done = true; }); } -- 2.11.0