From 3f8c866509587b066109a1051f82df0aef9d2b79 Mon Sep 17 00:00:00 2001 From: Mike Rylander Date: Sat, 28 May 2011 11:27:04 -0400 Subject: [PATCH] Minor bug fixes (alignment of fm classes, etc); Do not check deletedness, just remove the afr data upon "delete" of an authority; We still need the non-tpo index on afr.value Signed-off-by: Mike Rylander --- .../perlmods/lib/OpenILS/Application/SuperCat.pm | 16 +++++----------- Open-ILS/src/sql/Pg/011.schema.authority.sql | 4 +++- .../web/js/dojo/openils/AuthorityControlSet.js | 15 ++------------- Open-ILS/xul/staff_client/server/cat/marcedit.js | 8 ++++++-- 4 files changed, 16 insertions(+), 27 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/SuperCat.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/SuperCat.pm index e04e5fb912..ff3d5584e1 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/SuperCat.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/SuperCat.pm @@ -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, diff --git a/Open-ILS/src/sql/Pg/011.schema.authority.sql b/Open-ILS/src/sql/Pg/011.schema.authority.sql index a06cce324b..44933326bc 100644 --- a/Open-ILS/src/sql/Pg/011.schema.authority.sql +++ b/Open-ILS/src/sql/Pg/011.schema.authority.sql @@ -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 diff --git a/Open-ILS/web/js/dojo/openils/AuthorityControlSet.js b/Open-ILS/web/js/dojo/openils/AuthorityControlSet.js index bbae91281d..9993c728a8 100644 --- a/Open-ILS/web/js/dojo/openils/AuthorityControlSet.js +++ b/Open-ILS/web/js/dojo/openils/AuthorityControlSet.js @@ -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); } diff --git a/Open-ILS/xul/staff_client/server/cat/marcedit.js b/Open-ILS/xul/staff_client/server/cat/marcedit.js index 8f32593f0a..3925acb74d 100644 --- a/Open-ILS/xul/staff_client/server/cat/marcedit.js +++ b/Open-ILS/xul/staff_client/server/cat/marcedit.js @@ -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? -- 2.43.2