From: miker Date: Tue, 12 Oct 2010 17:43:14 +0000 (+0000) Subject: Backporting MARC js fixes from trunk X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=c49c35e680d1fc099e0928837f53070f563a9607;p=working%2FEvergreen.git Backporting MARC js fixes from trunk git-svn-id: svn://svn.open-ils.org/ILS/branches/rel_2_0@18284 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/web/js/dojo/MARC/Field.js b/Open-ILS/web/js/dojo/MARC/Field.js index 7242a8945b..878392867a 100644 --- a/Open-ILS/web/js/dojo/MARC/Field.js +++ b/Open-ILS/web/js/dojo/MARC/Field.js @@ -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; diff --git a/Open-ILS/web/js/dojo/MARC/Record.js b/Open-ILS/web/js/dojo/MARC/Record.js index d2f6b1d2be..247379844f 100644 --- a/Open-ILS/web/js/dojo/MARC/Record.js +++ b/Open-ILS/web/js/dojo/MARC/Record.js @@ -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({