LP#1152235: Editing MARC Fixed Fields - fix blank field behavior user/simonmai/marc_editor_blank_field
authorSimon Hieu Mai <hieu.mai@mnsu.edu>
Thu, 7 Mar 2013 16:21:21 +0000 (10:21 -0600)
committerSimon Hieu Mai <hieu.mai@mnsu.edu>
Thu, 7 Mar 2013 16:21:21 +0000 (10:21 -0600)
When editing a field that had data in it to be blank, libs staff must
fill in spaces to take up that space. Otherwise, it retains the
old data (after saving record).
This patch will do that job (adding those spaces).

Signed-off-by: Simon Hieu Mai <hieu.mai@mnsu.edu>
Open-ILS/xul/staff_client/server/cat/marcedit.js

index 1fbf544..f494bf9 100644 (file)
@@ -819,8 +819,11 @@ function updateFixedFields (element) {
     var new_value = element.value;
     // Don't take focus away/adjust the record on partial changes
     var length = element.getAttribute('maxlength');
-    if(new_value.length < length) return true;
+    if ((new_value.length < length) & (new_value.length > 0)) return true;
 
+    if (new_value.length == 0){
+        for (var i = 0;i < length;i++){ new_value = new_value + ' ';}
+    }
     var marc_rec = new MARC.Record ({ delimiter : '$', marcxml : xml_record.toXMLString() });
     marc_rec.setFixedField(element.getAttribute('name'), new_value);