[open-ils-commits] [GIT] Evergreen ILS branch rel_2_8 updated. d415ce7dc6e6303083f32fbd07598a25a8536da3
Evergreen Git
git at git.evergreen-ils.org
Tue Dec 15 14:33:03 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, rel_2_8 has been updated
via d415ce7dc6e6303083f32fbd07598a25a8536da3 (commit)
via 5ce52cca2b450fa620695ac277cca55726212347 (commit)
from e82f8347e2cddef566e5035b5f560147d5d8e570 (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 d415ce7dc6e6303083f32fbd07598a25a8536da3
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 ca4950d..a218921 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 5ce52cca2b450fa620695ac277cca55726212347
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 fc0cfe3..f614da8 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