[open-ils-commits] r18284 - branches/rel_2_0/Open-ILS/web/js/dojo/MARC (miker)

svn at svn.open-ils.org svn at svn.open-ils.org
Tue Oct 12 13:43:18 EDT 2010


Author: miker
Date: 2010-10-12 13:43:14 -0400 (Tue, 12 Oct 2010)
New Revision: 18284

Modified:
   branches/rel_2_0/Open-ILS/web/js/dojo/MARC/Field.js
   branches/rel_2_0/Open-ILS/web/js/dojo/MARC/Record.js
Log:
Backporting MARC js fixes from trunk

Modified: branches/rel_2_0/Open-ILS/web/js/dojo/MARC/Field.js
===================================================================
--- branches/rel_2_0/Open-ILS/web/js/dojo/MARC/Field.js	2010-10-12 17:02:35 UTC (rev 18283)
+++ branches/rel_2_0/Open-ILS/web/js/dojo/MARC/Field.js	2010-10-12 17:43:14 UTC (rev 18284)
@@ -40,7 +40,7 @@
 
         subfield : function (code) {
             var list = dojo.filter( this.subfields, function (s) {
-                if (s[0] == code) return true; return true;
+                if (s[0] == code) return true; return false;
             });
             if (list.length == 1) return list[0];
             return list;

Modified: branches/rel_2_0/Open-ILS/web/js/dojo/MARC/Record.js
===================================================================
--- branches/rel_2_0/Open-ILS/web/js/dojo/MARC/Record.js	2010-10-12 17:02:35 UTC (rev 18283)
+++ branches/rel_2_0/Open-ILS/web/js/dojo/MARC/Record.js	2010-10-12 17:43:14 UTC (rev 18284)
@@ -27,7 +27,7 @@
 
         constructor : function(kwargs) {
             this.fields = [];
-            this.leader = '';
+            this.leader = '00000cam a2200205Ka 4500';
 
             if (kwargs.delimiter) this.delimiter = kwargs.delimiter;
             if (kwargs.onLoad) this.onLoad = kwargs.onLoad;
@@ -57,7 +57,11 @@
             return list;
         },
 
-        subfield : function (spec, code) { return this.field(spec)[0].subfield(code) },
+        subfield : function (spec, code) {
+            var f = this.field(spec);
+            if (dojo.isArray(f)) f = f[0];
+            return f.subfield(code)
+        },
 
         appendFields : function () {
             var me = this;
@@ -151,7 +155,7 @@
 
         fromXmlDocument : function (mxml) {
             var me = this;
-            me.leader = dojox.xml.parser.textContent(dojo.query('leader', mxml)[0]) || '';
+            me.leader = dojox.xml.parser.textContent(dojo.query('leader', mxml)[0]) || '00000cam a2200205Ka 4500';
 
             dojo.forEach( dojo.query('controlfield', mxml), function (cf) {
                 me.fields.push(
@@ -240,7 +244,7 @@
                     // skip comment lines
                 } else if (isControlField(current_line)) {
                     if (line_tag(current_line) == 'LDR') {
-                        me.leader = cf_line_data(current_line) || '';
+                        me.leader = cf_line_data(current_line) || '00000cam a2200205Ka 4500';
                     } else {
                         me.fields.push(
                             new MARC.Field({



More information about the open-ils-commits mailing list