From 2b2ea4ce459803554748dac813d5b9ae7603e407 Mon Sep 17 00:00:00 2001 From: miker Date: Tue, 29 Dec 2009 16:06:10 +0000 Subject: [PATCH] add mbts variant view which includes billing location git-svn-id: svn://svn.open-ils.org/ILS/trunk@15238 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/examples/fm_IDL.xml | 23 ++++++++++++++++++++++ Open-ILS/src/sql/Pg/500.view.cross-schema.sql | 6 ++++++ .../0126.schema.mbts-with-location-view.sql | 14 +++++++++++++ 3 files changed, 43 insertions(+) create mode 100644 Open-ILS/src/sql/Pg/upgrade/0126.schema.mbts-with-location-view.sql diff --git a/Open-ILS/examples/fm_IDL.xml b/Open-ILS/examples/fm_IDL.xml index 014144b374..efe055c6ba 100644 --- a/Open-ILS/examples/fm_IDL.xml +++ b/Open-ILS/examples/fm_IDL.xml @@ -1107,6 +1107,29 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Open-ILS/src/sql/Pg/500.view.cross-schema.sql b/Open-ILS/src/sql/Pg/500.view.cross-schema.sql index 4909e8219b..b6df81eb23 100644 --- a/Open-ILS/src/sql/Pg/500.view.cross-schema.sql +++ b/Open-ILS/src/sql/Pg/500.view.cross-schema.sql @@ -64,6 +64,12 @@ CREATE OR REPLACE VIEW money.open_billable_xact_summary AS GROUP BY 1,2,3,4,5,15 ORDER BY MAX(debit.billing_ts), MAX(credit.payment_ts); +CREATE OR REPLACE VIEW money.billable_xact_summary_location_view AS + SELECT m.*, COALESCE(c.circ_lib, g.billing_location, r.pickup_lib) AS billing_location + FROM money.materialized_billable_xact_summary m + LEFT JOIN action.circulation c ON (c.id = m.id) + LEFT JOIN money.grocery g ON (g.id = m.id) + LEFT JOIN booking.reservation r ON (r.id = m.id); CREATE OR REPLACE VIEW money.open_usr_summary AS SELECT usr, diff --git a/Open-ILS/src/sql/Pg/upgrade/0126.schema.mbts-with-location-view.sql b/Open-ILS/src/sql/Pg/upgrade/0126.schema.mbts-with-location-view.sql new file mode 100644 index 0000000000..9856e943d7 --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/0126.schema.mbts-with-location-view.sql @@ -0,0 +1,14 @@ + +BEGIN; + +INSERT INTO config.upgrade_log (version) VALUES ('0126'); -- miker + +CREATE OR REPLACE VIEW money.billable_xact_summary_location_view AS + SELECT m.*, COALESCE(c.circ_lib, g.billing_location, r.pickup_lib) AS billing_location + FROM money.materialized_billable_xact_summary m + LEFT JOIN action.circulation c ON (c.id = m.id) + LEFT JOIN money.grocery g ON (g.id = m.id) + LEFT JOIN booking.reservation r ON (r.id = m.id); + +COMMIT; + -- 2.11.0