From: dbs Date: Tue, 8 Feb 2011 06:12:24 +0000 (+0000) Subject: Create authorities that only contain controlled subfields (LP 712496) X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=1ae6aedcb9af2c58928b6ad41242fdd0d478cf11;p=contrib%2FConifer.git Create authorities that only contain controlled subfields (LP 712496) Selecting "Create authority" on a field containing uncontrolled subfields would generate an authority record that contained those uncontrolled subfields. This would, in turn, prevent the "Validate" button from operating correctly - if you added a 700 with $a and $c subfields, clicked "Create authority", and then immediately clicked "Validate", the field would show up as red. Now we filter out the uncontrolled subfields before they get sent to the "Create authority" function, avoiding this validation problem. git-svn-id: svn://svn.open-ils.org/ILS/trunk@19404 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/xul/staff_client/server/cat/marcedit.js b/Open-ILS/xul/staff_client/server/cat/marcedit.js index eeb76fbc27..9dc0137d79 100644 --- a/Open-ILS/xul/staff_client/server/cat/marcedit.js +++ b/Open-ILS/xul/staff_client/server/cat/marcedit.js @@ -2610,16 +2610,25 @@ function summarizeField(sf) { "ind2": '', "subfields": [] }; - for (var i = 0; i < sf.parent().subfield.length(); i++) { - source_f.subfields.push([sf.parent().subfield[i].@code.toString(), sf.parent().subfield[i].toString()]); - } + source_f.tag = sf.parent().@tag.toString(); source_f.ind1 = sf.parent().@ind1.toString(); source_f.ind1 = sf.parent().@ind2.toString(); + + for (var i = 0; i < sf.parent().subfield.length(); i++) { + var sf_iter = sf.parent().subfield[i]; + + /* Filter out subfields that are not controlled for this tag */ + if (!control_map[source_f.tag][sf_iter.@code.toString()]) { + continue; + } + + source_f.subfields.push([sf_iter.@code.toString(), sf_iter.toString()]); + } + return source_f; } - function buildBibSourceList (authtoken, recId) { /* TODO: Work out how to set the bib source of the bre that does not yet * exist - this is specifically in the case of Z39.50 imports. Right now