From 3d3ddde8644cc9010524e4bdf553991605da7350 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Thu, 30 Nov 2017 12:14:46 -0500 Subject: [PATCH] JBAS-1932 New headings report SQL mattype field Adds a new 'mattype' field to the new headings report views and IDL definition. Signed-off-by: Bill Erickson --- KCLS/sql/schema/deploy/new-headings-mattype.sql | 33 +++++++++++++++++++++++++ KCLS/sql/schema/revert/new-headings-mattype.sql | 30 ++++++++++++++++++++++ KCLS/sql/schema/sqitch.plan | 1 + KCLS/sql/schema/verify/new-headings-mattype.sql | 7 ++++++ Open-ILS/examples/fm_IDL.xml | 1 + 5 files changed, 72 insertions(+) create mode 100644 KCLS/sql/schema/deploy/new-headings-mattype.sql create mode 100644 KCLS/sql/schema/revert/new-headings-mattype.sql create mode 100644 KCLS/sql/schema/verify/new-headings-mattype.sql diff --git a/KCLS/sql/schema/deploy/new-headings-mattype.sql b/KCLS/sql/schema/deploy/new-headings-mattype.sql new file mode 100644 index 0000000000..f073b052e0 --- /dev/null +++ b/KCLS/sql/schema/deploy/new-headings-mattype.sql @@ -0,0 +1,33 @@ +-- Deploy kcls-evergreen:new-headings-mattype to pg +-- requires: 2.9-to-2.10-upgrade + +BEGIN; + +DROP VIEW reporter.cataloged_browse_entry; + +CREATE OR REPLACE VIEW reporter.cataloged_browse_entry AS +SELECT entry.*, + cmf.label AS field_label, + usr.usrname AS bib_editor_usrname, + evergreen.marc_tag_to_string('1', bre.marc) AS bib_marc_1xx, + evergreen.marc_tag_to_string('245', bre.marc) AS bib_marc_245, + rec_attr.attrs -> 'mattype' AS mattype, + (reporter.metabib_browse_entry_window_prev( + entry.browse_axis, entry.entry_sort_value)).*, + (reporter.metabib_browse_entry_window_next( + entry.browse_axis, entry.entry_sort_value)).* +FROM reporter.cataloged_browse_entry_combined entry + JOIN config.metabib_field cmf ON (cmf.id = entry.field_def) + JOIN biblio.record_entry bre ON (bre.id = entry.bib_record) + JOIN metabib.record_attr rec_attr ON (rec_attr.id = bre.id) + JOIN actor.usr usr ON (usr.id = bre.editor) +ORDER BY + CASE entry.browse_axis + WHEN 'author' THEN 1 + WHEN 'subject' THEN 2 + ELSE 3 + END, + entry.entry_sort_value +; + +COMMIT; diff --git a/KCLS/sql/schema/revert/new-headings-mattype.sql b/KCLS/sql/schema/revert/new-headings-mattype.sql new file mode 100644 index 0000000000..90b44b0373 --- /dev/null +++ b/KCLS/sql/schema/revert/new-headings-mattype.sql @@ -0,0 +1,30 @@ +-- Revert kcls-evergreen:new-headings-mattype from pg + +BEGIN; + +DROP VIEW reporter.cataloged_browse_entry; + +CREATE OR REPLACE VIEW reporter.cataloged_browse_entry AS +SELECT entry.*, + cmf.label AS field_label, + usr.usrname AS bib_editor_usrname, + evergreen.marc_tag_to_string('1', bre.marc) AS bib_marc_1xx, + evergreen.marc_tag_to_string('245', bre.marc) AS bib_marc_245, + (reporter.metabib_browse_entry_window_prev( + entry.browse_axis, entry.entry_sort_value)).*, + (reporter.metabib_browse_entry_window_next( + entry.browse_axis, entry.entry_sort_value)).* +FROM reporter.cataloged_browse_entry_combined entry + JOIN config.metabib_field cmf ON (cmf.id = entry.field_def) + JOIN biblio.record_entry bre ON (bre.id = entry.bib_record) + JOIN actor.usr usr ON (usr.id = bre.editor) +ORDER BY + CASE entry.browse_axis + WHEN 'author' THEN 1 + WHEN 'subject' THEN 2 + ELSE 3 + END, + entry.entry_sort_value +; + +COMMIT; diff --git a/KCLS/sql/schema/sqitch.plan b/KCLS/sql/schema/sqitch.plan index 2cfc23002b..ab5a2be183 100644 --- a/KCLS/sql/schema/sqitch.plan +++ b/KCLS/sql/schema/sqitch.plan @@ -54,3 +54,4 @@ org-phones [2.9-to-2.10-upgrade] 2017-11-22T16:23:27Z Bill Erickson,,, # KCLS 2.9 to 2.10 SQL Data Ingests selfcheck-email-receipts [2.7-to-2.9-upgrade-part-2] 2017-04-21T19:02:22Z Victoria Lewis # Self Checkout email receipts checkout-ok-2.10-recovery [2.9-to-2.10-upgrade] 2017-12-20T20:32:10Z Bill Erickson,,, # Recover lost checkout_ok circ test check +new-headings-mattype [2.9-to-2.10-upgrade] 2017-11-30T15:41:38Z Bill Erickson,,, # Add mattype filter for new headings report diff --git a/KCLS/sql/schema/verify/new-headings-mattype.sql b/KCLS/sql/schema/verify/new-headings-mattype.sql new file mode 100644 index 0000000000..5cbdcf1081 --- /dev/null +++ b/KCLS/sql/schema/verify/new-headings-mattype.sql @@ -0,0 +1,7 @@ +-- Verify kcls-evergreen:new-headings-mattype on pg + +BEGIN; + +-- XXX Add verifications here. + +ROLLBACK; diff --git a/Open-ILS/examples/fm_IDL.xml b/Open-ILS/examples/fm_IDL.xml index 8471baccd4..31d3ef2ed5 100644 --- a/Open-ILS/examples/fm_IDL.xml +++ b/Open-ILS/examples/fm_IDL.xml @@ -4275,6 +4275,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + -- 2.11.0