JBAS-1932 New headings report SQL mattype field
authorBill Erickson <berickxx@gmail.com>
Thu, 30 Nov 2017 17:14:46 +0000 (12:14 -0500)
committerBill Erickson <berickxx@gmail.com>
Thu, 21 Mar 2019 19:46:23 +0000 (15:46 -0400)
Adds a new 'mattype' field to the new headings report views and IDL
definition.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
KCLS/sql/schema/deploy/new-headings-mattype.sql [new file with mode: 0644]
KCLS/sql/schema/revert/new-headings-mattype.sql [new file with mode: 0644]
KCLS/sql/schema/sqitch.plan
KCLS/sql/schema/verify/new-headings-mattype.sql [new file with mode: 0644]
Open-ILS/examples/fm_IDL.xml

diff --git a/KCLS/sql/schema/deploy/new-headings-mattype.sql b/KCLS/sql/schema/deploy/new-headings-mattype.sql
new file mode 100644 (file)
index 0000000..f073b05
--- /dev/null
@@ -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 (file)
index 0000000..90b44b0
--- /dev/null
@@ -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;
index 2cfc230..ab5a2be 100644 (file)
@@ -54,3 +54,4 @@ org-phones [2.9-to-2.10-upgrade] 2017-11-22T16:23:27Z Bill Erickson,,, <berick@k
 2.9-to-2.10-upgrade-reingest [org-phones] 2017-06-26T19:01:20Z Bill Erickson,,, <berick@kcls-dev-local> # 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 <vlewis@catalyte.io> # Self Checkout email receipts
 checkout-ok-2.10-recovery [2.9-to-2.10-upgrade] 2017-12-20T20:32:10Z Bill Erickson,,, <berick@kcls-dev-local> # Recover lost checkout_ok circ test check
+new-headings-mattype [2.9-to-2.10-upgrade] 2017-11-30T15:41:38Z Bill Erickson,,, <berick@kcls-dev-local> # 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 (file)
index 0000000..5cbdcf1
--- /dev/null
@@ -0,0 +1,7 @@
+-- Verify kcls-evergreen:new-headings-mattype on pg
+
+BEGIN;
+
+-- XXX Add verifications here.
+
+ROLLBACK;
index 8471bac..31d3ef2 100644 (file)
@@ -4275,6 +4275,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
         <field name="bib_cataloging_date" reporter:datatype="timestamp" reporter:label="Bib Record Cataloging Date"/>
         <field name="bib_marc_1xx" reporter:datatype="text" reporter:label="Bib Record MARC 1XX"/>
         <field name="bib_marc_245" reporter:datatype="text" reporter:label="Bib Record MARC 245"/>
+        <field name="mattype" reporter:datatype="text" reporter:label="Material Type"/>
         <field name="bib_editor" reporter:datatype="link" reporter:label="Bib Record Editor"/>
         <field name="bib_editor_usrname" reporter:datatype="text" reporter:label="Bib Record Editor Username"/>
         <field name="next_entry" reporter:datatype="link" reporter:label="Next Browse Entry"/>