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

svn at svn.open-ils.org svn at svn.open-ils.org
Thu Oct 8 11:41:46 EDT 2009


Author: miker
Date: 2009-10-08 11:41:44 -0400 (Thu, 08 Oct 2009)
New Revision: 14305

Modified:
   trunk/Open-ILS/xul/staff_client/server/cat/marcedit.js
Log:
Bug fix for the MARC editor:

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: trunk/Open-ILS/xul/staff_client/server/cat/marcedit.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/cat/marcedit.js	2009-10-07 21:32:17 UTC (rev 14304)
+++ trunk/Open-ILS/xul/staff_client/server/cat/marcedit.js	2009-10-08 15:41:44 UTC (rev 14305)
@@ -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