Heading normalization bug; Use CStoreEditor, not Editor; syntax-y bugs
authorMike Rylander <mrylander@gmail.com>
Sat, 28 May 2011 01:12:18 +0000 (21:12 -0400)
committerMike Rylander <mrylander@gmail.com>
Mon, 11 Jul 2011 17:48:28 +0000 (13:48 -0400)
Signed-off-by: Mike Rylander <mrylander@gmail.com>
Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Authority.pm
Open-ILS/src/sql/Pg/011.schema.authority.sql
Open-ILS/web/js/dojo/openils/AuthorityControlSet.js
Open-ILS/xul/staff_client/server/cat/marcedit.js

index a93dbb6..3dc14d8 100644 (file)
@@ -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;
index 4620c75..a06cce3 100644 (file)
@@ -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;
index 9f290f7..bbae912 100644 (file)
@@ -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);
index f05eba4..8f32593 100644 (file)
@@ -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);