From cf5a35ed963692a7e265224f65adadba9ee2ce58 Mon Sep 17 00:00:00 2001 From: Mike Rylander Date: Fri, 27 May 2011 21:12:18 -0400 Subject: [PATCH] Heading normalization bug; Use CStoreEditor, not Editor; syntax-y bugs Signed-off-by: Mike Rylander --- .../perlmods/lib/OpenILS/Application/Search/Authority.pm | 2 +- Open-ILS/src/sql/Pg/011.schema.authority.sql | 2 +- Open-ILS/web/js/dojo/openils/AuthorityControlSet.js | 16 ++++++++-------- Open-ILS/xul/staff_client/server/cat/marcedit.js | 12 +++++++----- 4 files changed, 17 insertions(+), 15 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Authority.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Authority.pm index a93dbb619c..3dc14d8137 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Authority.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Authority.pm @@ -6,7 +6,7 @@ use OpenILS::Utils::Fieldmapper; use OpenILS::Application::AppUtils; use XML::LibXML; use XML::LibXSLT; -use OpenILS::Utils::Editor q/:funcs/; +use OpenILS::Utils::CStoreEditor q/:funcs/; use OpenSRF::Utils::Logger qw/$logger/; use OpenSRF::Utils::JSON; diff --git a/Open-ILS/src/sql/Pg/011.schema.authority.sql b/Open-ILS/src/sql/Pg/011.schema.authority.sql index 4620c75d33..a06cce324b 100644 --- a/Open-ILS/src/sql/Pg/011.schema.authority.sql +++ b/Open-ILS/src/sql/Pg/011.schema.authority.sql @@ -166,7 +166,7 @@ BEGIN tag_used := acsaf.tag; FOR sf IN SELECT * FROM regexp_split_to_table(acsaf.sf_list,'') LOOP tmp_text := oils_xpath_string('//*[@tag="'||tag_used||'"]/*[@code="'||sf||'"]', marcxml); - IF tmp_text IS NOT NULL THEN + IF tmp_text IS NOT NULL AND tmp_text <> '' THEN heading_text := heading_text || E'\u2021' || sf || ' ' || tmp_text; END IF; END LOOP; diff --git a/Open-ILS/web/js/dojo/openils/AuthorityControlSet.js b/Open-ILS/web/js/dojo/openils/AuthorityControlSet.js index 9f290f7ab4..bbae91281d 100644 --- a/Open-ILS/web/js/dojo/openils/AuthorityControlSet.js +++ b/Open-ILS/web/js/dojo/openils/AuthorityControlSet.js @@ -187,13 +187,13 @@ if(!dojo._hasResource["openils.AuthorityControlSet"]) { bibFieldByTag: function (x) { var me = this; return dojo.filter( - me.controlSet().bib_fields(), + me.controlSet().bib_fields, function (bf) { if (bf.tag() == x) return true } )[0]; }, bibFields: function (x) { - return this.controlSet(x).bib_fields(); + return this.controlSet(x).bib_fields; }, bibFieldBrowseAxes : function (t) { @@ -203,7 +203,7 @@ if(!dojo._hasResource["openils.AuthorityControlSet"]) { openils.AuthorityControlSet._browse_axis_by_name[bname].maps(), function (m) { if (dojo.filter( - m.field().bib_fields(), + m.field().bib_fields, function (b) { return b.tag == t } ).length > 0 ) blist.push(bname); @@ -241,20 +241,20 @@ if(!dojo._hasResource["openils.AuthorityControlSet"]) { }, bibToAuthority : function (field) { - var b_field = this.bibFieldByTag(field.tag()); + var b_field = this.bibFieldByTag(field.tag); if (b_field) { // construct an marc authority record af = b_field.authority_field(); var m = new MARC.Record ({rtype:'AUT'}); - m.appendField( + m.appendFields( new MARC.Field ({ tag : af.tag(), ind1: field.ind1, ind2: field.ind2, - subfields: dojo.filter( + subfields: [dojo.filter( field.subfields, function (sf) { return (af.sf_list().indexOf(sf[0]) > -1) } - ) + )] }) ); @@ -274,7 +274,7 @@ if(!dojo._hasResource["openils.AuthorityControlSet"]) { function (acs_id) { var acs = me.controlSet(acs_id); var x = me.bibToAuthority(field); - if (x) auth_list.push({acs_id : m.toXmlString()}); + if (x) { var foo = {}; foo[acs_id] = x; auth_list.push(foo); } } ); this.controlSetId(old_acs); diff --git a/Open-ILS/xul/staff_client/server/cat/marcedit.js b/Open-ILS/xul/staff_client/server/cat/marcedit.js index f05eba47af..8f32593f0a 100644 --- a/Open-ILS/xul/staff_client/server/cat/marcedit.js +++ b/Open-ILS/xul/staff_client/server/cat/marcedit.js @@ -1503,7 +1503,7 @@ function getAuthorityContextMenu (target, sf) { var found_acs = []; dojo.forEach( acs.controlSetList(), function (acs_id) { - if (ac.controlSet(acs_id).control_map[sf.parent().@tag]) found_acs.push(acs_id); + if (acs.controlSet(acs_id).control_map[sf.parent().@tag]) found_acs.push(acs_id); }); if (!found_acs.length) { @@ -1578,10 +1578,12 @@ function validateAuthority (button) { var row = rows[i]; var tag = row.firstChild; - for (var acs_id in acs.controlSetList()) { + var done = false; + dojo.forEach(acs.controlSetList(), function (acs_id) { + if (done) return; var control_map = acs.controlSet(acs_id).control_map; - if (!control_map[tag.value]) continue + if (!control_map[tag.value]) return; button.setAttribute('label', label + ' - ' + tag.value); var ind1 = tag.nextSibling; @@ -1614,8 +1616,8 @@ function validateAuthority (button) { } } - if (matches.length) break; - } + if (matches.length) done = true; + }); } button.setAttribute('label', label); -- 2.11.0