From 4172bed2b9c736a140730fc60873e0160f8a97ee Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Wed, 16 Mar 2016 16:46:38 -0400 Subject: [PATCH] Porting 2.8.6 -> 2.8.7 SQL upgrade Signed-off-by: Bill Erickson --- .../Pg/version-upgrade/2.8.6-2.8.7-upgrade-db.sql | 167 +++++++++++++++++++++ 1 file changed, 167 insertions(+) create mode 100644 Open-ILS/src/sql/Pg/version-upgrade/2.8.6-2.8.7-upgrade-db.sql diff --git a/Open-ILS/src/sql/Pg/version-upgrade/2.8.6-2.8.7-upgrade-db.sql b/Open-ILS/src/sql/Pg/version-upgrade/2.8.6-2.8.7-upgrade-db.sql new file mode 100644 index 0000000000..f81cf5433c --- /dev/null +++ b/Open-ILS/src/sql/Pg/version-upgrade/2.8.6-2.8.7-upgrade-db.sql @@ -0,0 +1,167 @@ +--Upgrade Script for 2.8.6 to 2.8.7 +\set eg_version '''2.8.7''' +BEGIN; +INSERT INTO config.upgrade_log (version, applied_to) VALUES ('2.8.7', :eg_version); + +SELECT evergreen.upgrade_deps_block_check('0959', :eg_version); + +CREATE OR REPLACE VIEW money.transaction_billing_summary AS + SELECT id as xact, + last_billing_type, + last_billing_note, + last_billing_ts, + total_owed + FROM money.materialized_billable_xact_summary; + + +SELECT evergreen.upgrade_deps_block_check('0972', :eg_version); -- jstompro/gmcharlt + +-- LP#1550495 - Add Baker&Taylor EDI Quantity Cancel Code +-- Insert EDI Cancel Reason 85 (1200 + 85 = 1285) if it doesn't already exist +INSERT INTO acq.cancel_reason + (org_unit, keep_debits, id, label, description) + SELECT + 1, 'f',( 85+1200), + oils_i18n_gettext(1285, 'Canceled: By Vendor', 'acqcr', 'label'), + oils_i18n_gettext(1285, 'Line item canceled by vendor', 'acqcr', 'description') + WHERE NOT EXISTS ( + SELECT 1 FROM acq.cancel_reason where id=(85+1200) + ); + + + +SELECT evergreen.upgrade_deps_block_check('0973', :eg_version); -- tmccanna/gmcharlt + +UPDATE action_trigger.event_definition SET template = +$$ +[%- USE date -%] +[%- SET user = target -%] +
+ +
[% date.format %]
+
+ Fines for:
+ [% user.family_name %], [% user.first_given_name %] +
    + [% FOR xact IN user.open_billable_transactions_summary %] + [% IF xact.balance_owed > 0 %] +
  1. +
    Details: + [% IF xact.xact_type == 'circulation' %] + [%- helpers.get_copy_bib_basics(xact.circulation.target_copy).title -%] + [% ELSE %] + [%- xact.last_billing_type -%] + [% END %] +
    +
    Total Billed: [% xact.total_owed %]
    +
    Total Paid: [% xact.total_paid %]
    +
    Balance Owed : [% xact.balance_owed %]
    +
  2. + [% END %] + [% END %] +
+
+$$ WHERE id=13 +AND template = +$$ +[%- USE date -%] +[%- SET user = target -%] +
+ +
[% date.format %]
+
+ + [% user.family_name %], [% user.first_given_name %] +
    + [% FOR xact IN user.open_billable_transactions_summary %] +
  1. +
    Details: + [% IF xact.xact_type == 'circulation' %] + [%- helpers.get_copy_bib_basics(xact.circulation.target_copy).title -%] + [% ELSE %] + [%- xact.last_billing_type -%] + [% END %] +
    +
    Total Billed: [% xact.total_owed %]
    +
    Total Paid: [% xact.total_paid %]
    +
    Balance Owed : [% xact.balance_owed %]
    +
  2. + [% END %] +
+
+$$ +; + + +SELECT evergreen.upgrade_deps_block_check('0974', :eg_version); -- tmccanna/gmcharlt + +UPDATE action_trigger.event_definition SET template = +$$ +[%- USE date -%] +[%- SET user = target.0.usr -%] +
+ +
[% date.format %]
+
+ Holds for:
+ [% user.family_name %], [% user.first_given_name %] + +
    + [% FOR hold IN target %] + [%- + SET idx = loop.count - 1; + SET udata = user_data.$idx; + -%] +
  1. +
    Title: [% udata.item_title %]
    +
    Author: [% udata.item_author %]
    +
    Pickup Location: [% udata.pickup_lib %]
    +
    Status: + [%- IF udata.ready -%] + Ready for pickup + [% ELSE %] + #[% udata.queue_position %] of + [% udata.potential_copies %] copies. + [% END %] +
    +
  2. + [% END %] +
+
+ +$$ WHERE id=12 +AND template = +$$ +[%- USE date -%] +[%- SET user = target.0.usr -%] +
+ +
[% date.format %]
+
+ + [% user.family_name %], [% user.first_given_name %] +
    + [% FOR hold IN target %] + [%- + SET idx = loop.count - 1; + SET udata = user_data.$idx + -%] +
  1. +
    Title: [% hold.bib_rec.bib_record.simple_record.title %]
    +
    Author: [% hold.bib_rec.bib_record.simple_record.author %]
    +
    Pickup Location: [% hold.pickup_lib.name %]
    +
    Status: + [%- IF udata.ready -%] + Ready for pickup + [% ELSE %] + #[% udata.queue_position %] of [% udata.potential_copies %] copies. + [% END %] +
    +
  2. + [% END %] +
+
+$$ +; + +COMMIT; -- 2.11.0