[open-ils-commits] r19404 - trunk/Open-ILS/xul/staff_client/server/cat (dbs)

svn at svn.open-ils.org svn at svn.open-ils.org
Tue Feb 8 01:12:27 EST 2011


Author: dbs
Date: 2011-02-08 01:12:24 -0500 (Tue, 08 Feb 2011)
New Revision: 19404

Modified:
   trunk/Open-ILS/xul/staff_client/server/cat/marcedit.js
Log:
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.


Modified: trunk/Open-ILS/xul/staff_client/server/cat/marcedit.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/cat/marcedit.js	2011-02-08 05:12:28 UTC (rev 19403)
+++ trunk/Open-ILS/xul/staff_client/server/cat/marcedit.js	2011-02-08 06:12:24 UTC (rev 19404)
@@ -2610,16 +2610,25 @@
         "ind2": '',
         "subfields": []
     };
-    for (var i = 0; i < sf.parent().subfield.length(); i++) {
-        source_f.subfields.push([sf.parent().subfield[i]. at code.toString(), sf.parent().subfield[i].toString()]);
-    }
+
     source_f.tag = sf.parent(). at tag.toString();
     source_f.ind1 = sf.parent(). at ind1.toString();
     source_f.ind1 = sf.parent(). at 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. at code.toString()]) {
+            continue;
+        }
+
+        source_f.subfields.push([sf_iter. at 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



More information about the open-ils-commits mailing list