Minor bug fixes (alignment of fm classes, etc); Do not check deletedness, just remove...
authorMike Rylander <mrylander@gmail.com>
Sat, 28 May 2011 15:27:04 +0000 (11:27 -0400)
committerMike Rylander <mrylander@gmail.com>
Mon, 11 Jul 2011 17:48:29 +0000 (13:48 -0400)
Signed-off-by: Mike Rylander <mrylander@gmail.com>

Open-ILS/src/perlmods/lib/OpenILS/Application/SuperCat.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 e04e5fb..ff3d558 100644 (file)
@@ -892,7 +892,7 @@ sub grab_authority_browse_axes {
     unless(scalar(keys(%authority_browse_axis_cache))) {
         my $axes = new_editor->search_authority_browse_axis([
             { code => { '<>' => undef } },
-            { flesh => 2, flesh_fields => { aba => ['fields'], acsafm => ['bib_fields','sub_entries'] } }
+            { flesh => 2, flesh_fields => { aba => ['fields'], acsaf => ['bib_fields','sub_entries'] } }
         ]);
         $authority_browse_axis_cache{$_->code} = $_ for (@$axes);
     }
@@ -1116,11 +1116,8 @@ sub authority_tag_sf_browse {
         my $before = $_storage->request(
             "open-ils.cstore.json_query.atomic",
             { select    => { afr => [qw/record value/] },
-              from      => { 'are', 'afr' },
-              where     => {
-                '+afr' => { tag => \@ref_tags, subfield => $subfield, value => { '<' => $value } },
-                '+are' => { 'deleted' => 'f' }
-              },
+              from      => 'afr',
+              where     => { tag => \@ref_tags, subfield => $subfield, value => { '<' => $value } },
               order_by  => { afr => { value => 'desc' } },
               limit     => $before_limit,
               offset    => abs($page) * $page_size - $before_offset,
@@ -1133,11 +1130,8 @@ sub authority_tag_sf_browse {
         my $after = $_storage->request(
             "open-ils.cstore.json_query.atomic",
             { select    => { afr => [qw/record value/] },
-              from      => { 'are', 'afr' },
-              where     => {
-                '+afr' => { tag => \@ref_tags, subfield => $subfield, value => { '>=' => $value } },
-                '+are' => { 'deleted' => 'f' }
-              },
+              from      => 'afr',
+              where     => { tag => \@ref_tags, subfield => $subfield, value => { '>=' => $value } },
               order_by  => { afr => { value => 'asc' } },
               limit     => $after_limit,
               offset    => abs($page) * $page_size - $after_offset,
index a06cce3..4493332 100644 (file)
@@ -83,7 +83,7 @@ CREATE INDEX authority_record_deleted_idx ON authority.record_entry(deleted) WHE
 CREATE TRIGGER a_marcxml_is_well_formed BEFORE INSERT OR UPDATE ON authority.record_entry FOR EACH ROW EXECUTE PROCEDURE biblio.check_marcxml_well_formed();
 CREATE TRIGGER b_maintain_901 BEFORE INSERT OR UPDATE ON authority.record_entry FOR EACH ROW EXECUTE PROCEDURE evergreen.maintain_901();
 CREATE TRIGGER c_maintain_control_numbers BEFORE INSERT OR UPDATE ON authority.record_entry FOR EACH ROW EXECUTE PROCEDURE maintain_control_numbers();
-CREATE RULE protect_authority_rec_delete AS ON DELETE TO authority.record_entry DO INSTEAD (UPDATE authority.record_entry SET deleted = TRUE WHERE OLD.id = authority.record_entry.id);
+CREATE RULE protect_authority_rec_delete AS ON DELETE TO authority.record_entry DO INSTEAD (UPDATE authority.record_entry SET deleted = TRUE WHERE OLD.id = authority.record_entry.id; DELETE FROM authority.full_rec WHERE record = OLD.id);
 
 CREATE TABLE authority.bib_linking (
     id          BIGSERIAL   PRIMARY KEY,
@@ -136,6 +136,8 @@ CREATE TRIGGER authority_full_rec_fti_trigger
 CREATE INDEX authority_full_rec_index_vector_idx ON authority.full_rec USING GIST (index_vector);
 /* Enable LIKE to use an index for database clusters with locales other than C or POSIX */
 CREATE INDEX authority_full_rec_value_tpo_index ON authority.full_rec (value text_pattern_ops);
+/* But we still need this (boooo) for paging using >, <, etc */
+CREATE INDEX authority_full_rec_value_index ON authority.full_rec (value);
 
 -- Intended to be used in a unique index on authority.record_entry like so:
 -- CREATE UNIQUE INDEX unique_by_heading_and_thesaurus
index bbae912..9993c72 100644 (file)
@@ -151,17 +151,6 @@ if(!dojo._hasResource["openils.AuthorityControlSet"]) {
 
                 });
 
-                openils.AuthorityControlSet._browse_axis_by_name = {};
-                dojo.forEach( openils.AuthorityControlSet._browse_axis_list, function (ba) {
-                    ba.maps(
-                        dojo.filter(
-                            openils.AuthorityControlSet._browse_field_map_list,
-                            function (m) { m.axis() == ba.code }
-                        )
-                    );
-                    openils.AuthorityControlSet._browse_axis_by_name[ba.code()] = ba;
-                });
-                
                 if (this.controlSetList().length > 0)
                     delete openils.AuthorityControlSet._controlsets['-1'];
 
@@ -203,8 +192,8 @@ if(!dojo._hasResource["openils.AuthorityControlSet"]) {
                     openils.AuthorityControlSet._browse_axis_by_name[bname].maps(),
                     function (m) {
                         if (dojo.filter(
-                                m.field().bib_fields,
-                                function (b) { return b.tag == t }
+                                m.field().bib_fields(),
+                                function (b) { return b.tag() == t }
                             ).length > 0
                         ) blist.push(bname);
                     }
index 8f32593..3925acb 100644 (file)
@@ -1513,7 +1513,7 @@ function getAuthorityContextMenu (target, sf) {
     }
 
     if (sf.toString().replace(/\s*/, '')) {
-        browseAuthority(sf_popup, menu_id, target, sf, 20, page);
+        return browseAuthority(sf_popup, menu_id, target, sf, 20, page);
     }
 
     return true;
@@ -1668,8 +1668,12 @@ function browseAuthority (sf_popup, menu_id, target, sf, limit, page) {
     // Sets will change that
 
     var axis_list = acs.bibFieldBrowseAxes( sf.parent().@tag.toString() );
+
     // No matching tag means no authorities to search - shortcut
-    if (axis_list.length == 0) return;
+    if (axis_list.length == 0) {
+        target.setAttribute('context', 'clipboard');
+        return false;
+    }
 
     var type = 'authority.' + axis_list[0]; // Just take the first for now
                                             // TODO support multiple axes ... loop?