From: Bill Erickson Date: Thu, 16 May 2013 13:11:50 +0000 (-0400) Subject: Repair faulty MARC editor authority validation X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=f32375f6d719048329e631c621138db1335f3537;p=working%2FEvergreen.git 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 Signed-off-by: Lebbeous Fogle-Weekley --- diff --git a/Open-ILS/xul/staff_client/server/cat/marcedit.js b/Open-ILS/xul/staff_client/server/cat/marcedit.js index 0df3507e58..245037d9f1 100644 --- a/Open-ILS/xul/staff_client/server/cat/marcedit.js +++ b/Open-ILS/xul/staff_client/server/cat/marcedit.js @@ -1618,11 +1618,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 { @@ -1631,7 +1648,7 @@ function validateAuthority (button) { } } - if (matches.length) done = true; + if (found) done = true; }); }