[open-ils-commits] [GIT] Evergreen ILS branch master updated. 3e831ace67580c93369c2160761b308f242cc006
Evergreen Git
git at git.evergreen-ils.org
Tue Dec 15 14:27:17 EST 2015
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".
The branch, master has been updated
via 3e831ace67580c93369c2160761b308f242cc006 (commit)
via 574cab2d98b6ea6e58a57edd8824cc516c45ade3 (commit)
from 2038e93aa68baaabe20a8b4218cfb0ed6fc5903c (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 3e831ace67580c93369c2160761b308f242cc006
Author: Kathy Lussier <klussier at masslnc.org>
Date: Tue Dec 15 14:21:12 2015 -0500
LP#1319998 Stamping upgrade script
Signed-off-by: Kathy Lussier <klussier at masslnc.org>
diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql
index 31f73c4..5381cfd 100644
--- a/Open-ILS/src/sql/Pg/002.schema.config.sql
+++ b/Open-ILS/src/sql/Pg/002.schema.config.sql
@@ -91,7 +91,7 @@ CREATE TRIGGER no_overlapping_deps
BEFORE INSERT OR UPDATE ON config.db_patch_dependencies
FOR EACH ROW EXECUTE PROCEDURE evergreen.array_overlap_check ('deprecates');
-INSERT INTO config.upgrade_log (version, applied_to) VALUES ('0949', :eg_version); -- csharp/kmlussier/dyrcona
+INSERT INTO config.upgrade_log (version, applied_to) VALUES ('0950', :eg_version); -- bmagic/kmlussier
CREATE TABLE config.bib_source (
id SERIAL PRIMARY KEY,
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.materialized_billing_summmary_delete_trigger.sql b/Open-ILS/src/sql/Pg/upgrade/0950.schema.materialized_billing_summary_delete_trigger.sql
similarity index 95%
rename from Open-ILS/src/sql/Pg/upgrade/XXXX.schema.materialized_billing_summmary_delete_trigger.sql
rename to Open-ILS/src/sql/Pg/upgrade/0950.schema.materialized_billing_summary_delete_trigger.sql
index 3d1d621..8ade4bc 100644
--- a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.materialized_billing_summmary_delete_trigger.sql
+++ b/Open-ILS/src/sql/Pg/upgrade/0950.schema.materialized_billing_summary_delete_trigger.sql
@@ -1,6 +1,6 @@
BEGIN;
-INSERT INTO config.upgrade_log (version) VALUES ('XXXX');
+INSERT INTO config.upgrade_log (version) VALUES ('0950');
CREATE OR REPLACE FUNCTION money.materialized_summary_billing_del () RETURNS TRIGGER AS $$
DECLARE
commit 574cab2d98b6ea6e58a57edd8824cc516c45ade3
Author: blake <blake at mobiusconsortium.org>
Date: Thu Nov 19 16:14:37 2015 -0600
LP1319998_materialized_summary_billing_del_ADDS_to_balance_owed
Switched the plus sign to a minus sign. This will keep the
materialized view correct when deleting rows from money.billing.
Signed-off-by: blake <blake at mobiusconsortium.org>
Signed-off-by: Kathy Lussier <klussier at masslnc.org>
diff --git a/Open-ILS/src/sql/Pg/080.schema.money.sql b/Open-ILS/src/sql/Pg/080.schema.money.sql
index 41c7c86..3bba2ed 100644
--- a/Open-ILS/src/sql/Pg/080.schema.money.sql
+++ b/Open-ILS/src/sql/Pg/080.schema.money.sql
@@ -387,7 +387,7 @@ BEGIN
IF NOT OLD.voided THEN
UPDATE money.materialized_billable_xact_summary
SET total_owed = total_owed - OLD.amount,
- balance_owed = balance_owed + OLD.amount
+ balance_owed = balance_owed - OLD.amount
WHERE id = OLD.xact;
END IF;
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.materialized_billing_summmary_delete_trigger.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.materialized_billing_summmary_delete_trigger.sql
new file mode 100644
index 0000000..3d1d621
--- /dev/null
+++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.materialized_billing_summmary_delete_trigger.sql
@@ -0,0 +1,32 @@
+BEGIN;
+
+INSERT INTO config.upgrade_log (version) VALUES ('XXXX');
+
+CREATE OR REPLACE FUNCTION money.materialized_summary_billing_del () RETURNS TRIGGER AS $$
+DECLARE
+ prev_billing money.billing%ROWTYPE;
+ old_billing money.billing%ROWTYPE;
+BEGIN
+ SELECT * INTO prev_billing FROM money.billing WHERE xact = OLD.xact AND NOT voided ORDER BY billing_ts DESC LIMIT 1 OFFSET 1;
+ SELECT * INTO old_billing FROM money.billing WHERE xact = OLD.xact AND NOT voided ORDER BY billing_ts DESC LIMIT 1;
+
+ IF OLD.id = old_billing.id THEN
+ UPDATE money.materialized_billable_xact_summary
+ SET last_billing_ts = prev_billing.billing_ts,
+ last_billing_note = prev_billing.note,
+ last_billing_type = prev_billing.billing_type
+ WHERE id = OLD.xact;
+ END IF;
+
+ IF NOT OLD.voided THEN
+ UPDATE money.materialized_billable_xact_summary
+ SET total_owed = total_owed - OLD.amount,
+ balance_owed = balance_owed - OLD.amount
+ WHERE id = OLD.xact;
+ END IF;
+
+ RETURN OLD;
+END;
+$$ LANGUAGE PLPGSQL;
+
+COMMIT;
-----------------------------------------------------------------------
Summary of changes:
Open-ILS/src/sql/Pg/002.schema.config.sql | 2 +-
Open-ILS/src/sql/Pg/080.schema.money.sql | 2 +-
...aterialized_billing_summary_delete_trigger.sql} | 4 ++--
3 files changed, 4 insertions(+), 4 deletions(-)
copy Open-ILS/src/sql/Pg/upgrade/{0031.schema.materialized_billing_summmary_delete_trigger.sql => 0950.schema.materialized_billing_summary_delete_trigger.sql} (89%)
hooks/post-receive
--
Evergreen ILS
More information about the open-ils-commits
mailing list