From 36113fa8c960a8972ed75a97a5b03ace86d18dae Mon Sep 17 00:00:00 2001 From: Lebbeous Fogle-Weekley Date: Wed, 8 May 2013 15:09:06 -0400 Subject: [PATCH] Two bugfixes to OPAC Browse: non-filing indicators, leading-article warning The second upgrade script in this branch now changes your metabib field definitions so that browse headings respect non-filing indicators (it does not perform the re-ingest for you). There is also a fix to the mod_perl layer driving OPAC display, so that now the config.global_flag value for warning about leading articles can actually be inert as intended when enabled=f. Signed-off-by: Lebbeous Fogle-Weekley --- .../perlmods/lib/OpenILS/WWW/EGCatLoader/Browse.pm | 2 +- Open-ILS/src/sql/Pg/030.schema.metabib.sql | 1 + Open-ILS/src/sql/Pg/950.data.seed-values.sql | 7 +++++-- .../sql/Pg/upgrade/YYYY.schema.bib-auth-browse.sql | 22 +++++++++++++++++++++- 4 files changed, 28 insertions(+), 4 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Browse.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Browse.pm index 059bad1f7f..df3f86c71f 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Browse.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Browse.pm @@ -262,7 +262,7 @@ sub leading_article_test { my $flag_name = "opac.browse.warnable_regexp_per_class"; my $flag = $self->ctx->{get_cgf}->($flag_name); - return unless $flag->enabled; + return unless $flag->enabled eq 't'; my $map; diff --git a/Open-ILS/src/sql/Pg/030.schema.metabib.sql b/Open-ILS/src/sql/Pg/030.schema.metabib.sql index fd32f3de35..e6caa0a999 100644 --- a/Open-ILS/src/sql/Pg/030.schema.metabib.sql +++ b/Open-ILS/src/sql/Pg/030.schema.metabib.sql @@ -554,6 +554,7 @@ BEGIN output_row.search_field = TRUE; RETURN NEXT output_row; + output_row.search_field = FALSE; END IF; END LOOP; diff --git a/Open-ILS/src/sql/Pg/950.data.seed-values.sql b/Open-ILS/src/sql/Pg/950.data.seed-values.sql index d96528fe1a..119d76c52f 100644 --- a/Open-ILS/src/sql/Pg/950.data.seed-values.sql +++ b/Open-ILS/src/sql/Pg/950.data.seed-values.sql @@ -119,8 +119,8 @@ INSERT INTO config.metabib_field ( id, field_class, name, label, format, xpath, (4, 'title', 'alternative', oils_i18n_gettext(4, 'Alternate Title', 'cmf', 'label'), 'mods32', $$//mods32:mods/mods32:titleInfo[mods32:title and (@type='alternative')]$$, '//@xlink:href' ); INSERT INTO config.metabib_field ( id, field_class, name, label, format, xpath, authority_xpath ) VALUES (5, 'title', 'uniform', oils_i18n_gettext(5, 'Uniform Title', 'cmf', 'label'), 'mods32', $$//mods32:mods/mods32:titleInfo[mods32:title and (@type='uniform')]$$, '//@xlink:href' ); -INSERT INTO config.metabib_field ( id, field_class, name, label, format, xpath, authority_xpath ) VALUES - (6, 'title', 'proper', oils_i18n_gettext(6, 'Title Proper', 'cmf', 'label'), 'mods32', $$//mods32:mods/mods32:titleNonfiling[mods32:title and not (@type)]$$, '//@xlink:href' ); +INSERT INTO config.metabib_field ( id, field_class, name, label, format, xpath, authority_xpath, browse_field ) VALUES + (6, 'title', 'proper', oils_i18n_gettext(6, 'Title Proper', 'cmf', 'label'), 'mods32', $$//mods32:mods/mods32:titleNonfiling[mods32:title and not (@type)]$$, '//@xlink:href', FALSE ); INSERT INTO config.metabib_field ( id, field_class, name, label, format, xpath, facet_xpath, facet_field , authority_xpath) VALUES (7, 'author', 'corporate', oils_i18n_gettext(7, 'Corporate Author', 'cmf', 'label'), 'mods32', $$//mods32:mods/mods32:name[@type='corporate' and (mods32:role/mods32:roleTerm[text()='creator'] or mods32:role/mods32:roleTerm[text()='aut'] or mods32:role/mods32:roleTerm[text()='cre'])]$$, $$//*[local-name()='namePart']$$, TRUE, '//@xlink:href' ); -- /* to fool vim */; @@ -174,6 +174,9 @@ INSERT INTO config.metabib_field ( id, field_class, name, label, format, xpath, (29, 'identifier', 'scn', oils_i18n_gettext(29, 'System Control Number', 'cmf', 'label'), 'marcxml', $$//marc:datafield[@tag='035']/marc:subfield[@code="a"]$$, FALSE); INSERT INTO config.metabib_field ( id, field_class, name, label, format, xpath, browse_field) VALUES (30, 'identifier', 'lccn', oils_i18n_gettext(30, 'LC Control Number', 'cmf', 'label'), 'marcxml', $$//marc:datafield[@tag='010']/marc:subfield[@code="a" or @code='z']$$, FALSE); +INSERT INTO config.metabib_field ( id, field_class, name, label, xpath, format, search_field, facet_field, browse_field) VALUES + (31, 'title', 'browse', oils_i18n_gettext(31, 'Title Proper (Browse)', 'cmf', 'label'), $$//mods32:mods/mods32:titleInfo[not (@type)]/mods32:title$$, 'mods32', FALSE, FALSE, TRUE); + SELECT SETVAL('config.metabib_field_id_seq'::TEXT, (SELECT MAX(id) FROM config.metabib_field), TRUE); diff --git a/Open-ILS/src/sql/Pg/upgrade/YYYY.schema.bib-auth-browse.sql b/Open-ILS/src/sql/Pg/upgrade/YYYY.schema.bib-auth-browse.sql index 7669d93ff6..ad4a4a5058 100644 --- a/Open-ILS/src/sql/Pg/upgrade/YYYY.schema.bib-auth-browse.sql +++ b/Open-ILS/src/sql/Pg/upgrade/YYYY.schema.bib-auth-browse.sql @@ -7,6 +7,15 @@ ALTER TABLE metabib.browse_entry_def_map ADD COLUMN authority BIGINT REFERENCES ALTER TABLE config.metabib_field ADD COLUMN authority_xpath TEXT; +-- The following UPDATE also affects AutoSuggest, but not in a way users +-- are likely to find objectionable. The selection of suggestions based +-- on user input shouldn't change, but the displayed heading will no longer +-- show leading articles or similar that can be rubbed out by non-filing +-- indicators. +change +UPDATE config.metabib_field SET browse_field = FALSE + WHERE field_class = 'title' and name = 'proper'; + UPDATE config.metabib_field SET authority_xpath = '//@xlink:href' WHERE @@ -14,6 +23,16 @@ UPDATE config.metabib_field field_class IN ('subject','series','title','author') AND browse_field IS TRUE; +INSERT INTO config.metabib_field ( + id, field_class, name, label, xpath, format, + search_field, facet_field, browse_field +) VALUES ( + 31, 'title', 'browse', + oils_i18n_gettext(31, 'Title Proper (Browse)', 'cmf', 'label'), + $$//mods32:mods/mods32:titleInfo[not (@type)]/mods32:title$$, + 'mods32', FALSE, FALSE, TRUE +); + ALTER TYPE metabib.field_entry_template ADD ATTRIBUTE authority BIGINT; @@ -240,6 +259,7 @@ BEGIN output_row.search_field = TRUE; RETURN NEXT output_row; + output_row.search_field = FALSE; END IF; END LOOP; @@ -6882,7 +6902,7 @@ Revision 1.2 - Added Log Comment 2003/03/24 19:37:42 ckeith $$ WHERE name = 'mods33'; -INSERT INTO config.global_flag (name, value, enabled, label) +INSERT INTO config.global_flag (name, value, enabled, label) VALUES ( 'opac.browse.warnable_regexp_per_class', '{"title": "^(a|the|an)\\s"}', -- 2.11.0