[open-ils-commits] r14312 - tags/rel_1_6_0_0/Open-ILS/xul/staff_client/server/cat (miker)

svn at svn.open-ils.org svn at svn.open-ils.org
Thu Oct 8 13:48:39 EDT 2009


Author: miker
Date: 2009-10-08 13:48:35 -0400 (Thu, 08 Oct 2009)
New Revision: 14312

Modified:
   tags/rel_1_6_0_0/Open-ILS/xul/staff_client/server/cat/marcedit.js
Log:
Backporting r14305 to fix <controlfield> creation and use (when missing) bug:

When we add a <controlfield> element we need to set it to be 40 characters
long, and full of spaces, otherwise the Fixed Field editor cannot properly
set the positions.

Additionally, when a Fixed Field is edited but there is no backing
<controlfield> element (say, trying to set the Audn when there is no 008)
then we will add the needed <controlfield>.




Modified: tags/rel_1_6_0_0/Open-ILS/xul/staff_client/server/cat/marcedit.js
===================================================================
--- tags/rel_1_6_0_0/Open-ILS/xul/staff_client/server/cat/marcedit.js	2009-10-08 17:47:56 UTC (rev 14311)
+++ tags/rel_1_6_0_0/Open-ILS/xul/staff_client/server/cat/marcedit.js	2009-10-08 17:48:35 UTC (rev 14312)
@@ -525,13 +525,13 @@
 					return false;
 				}
 			} else if (event.keyCode == 64 && event.ctrlKey) { // ctrl + F6
-				createControlField('006','');
+				createControlField('006','                                        ');
 				loadRecord(xml_record);
 			} else if (event.keyCode == 65 && event.ctrlKey) { // ctrl + F7
-				createControlField('007','');
+				createControlField('007','                                        ');
 				loadRecord(xml_record);
 			} else if (event.keyCode == 66 && event.ctrlKey) { // ctrl + F8
-				createControlField('008','');
+				createControlField('008','                                        ');
 				loadRecord(xml_record);
 			}
 			return true;
@@ -1168,8 +1168,19 @@
 	for (var i in ff_pos[name]) {
 
 		if (!ff_pos[name][i][rtype]) continue;
-		if (!parts[i]) continue;
+		if (!parts[i]) {
+			// we're missing the required field.  Add it now.
 
+			var newfield;
+			if (i == '_6') newfield = '006';
+			else if (i == '_7') newfield = '007';
+			else if (i == '_8') newfield = '008';
+			else continue;
+
+			createControlField(newfield,'                                        ');
+			parts[i] = _record.controlfield.(@tag==newfield);
+		}
+
 		var before = parts[i].substr(0, ff_pos[name][i][rtype].start);
 		var after = parts[i].substr(ff_pos[name][i][rtype].start + ff_pos[name][i][rtype].len);
 



More information about the open-ils-commits mailing list