Backporting MARC js fixes from trunk
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 12 Oct 2010 17:43:14 +0000 (17:43 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 12 Oct 2010 17:43:14 +0000 (17:43 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/branches/rel_2_0@18284 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/js/dojo/MARC/Field.js
Open-ILS/web/js/dojo/MARC/Record.js

index 7242a89..8783928 100644 (file)
@@ -40,7 +40,7 @@ if(!dojo._hasResource["MARC.Field"]) {
 
         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;
index d2f6b1d..2473798 100644 (file)
@@ -27,7 +27,7 @@ if(!dojo._hasResource["MARC.Record"]) {
 
         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 @@ if(!dojo._hasResource["MARC.Record"]) {
             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 @@ if(!dojo._hasResource["MARC.Record"]) {
 
         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 @@ if(!dojo._hasResource["MARC.Record"]) {
                     // 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({