]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/src/sql/Pg/upgrade/0921.data.conditional_negative_balance.sql
LP#1733695: Stamping upgrade scripts for multilingual search
[working/Evergreen.git] / Open-ILS / src / sql / Pg / upgrade / 0921.data.conditional_negative_balance.sql
1 BEGIN;
2
3 SELECT evergreen.upgrade_deps_block_check('0921', :eg_version);
4
5 CREATE TABLE money.account_adjustment (
6     billing BIGINT REFERENCES money.billing (id) ON DELETE SET NULL
7 ) INHERITS (money.bnm_payment);
8 ALTER TABLE money.account_adjustment ADD PRIMARY KEY (id);
9 CREATE INDEX money_adjustment_id_idx ON money.account_adjustment (id);
10 CREATE INDEX money_account_adjustment_xact_idx ON money.account_adjustment (xact);
11 CREATE INDEX money_account_adjustment_bill_idx ON money.account_adjustment (billing);
12 CREATE INDEX money_account_adjustment_payment_ts_idx ON money.account_adjustment (payment_ts);
13 CREATE INDEX money_account_adjustment_accepting_usr_idx ON money.account_adjustment (accepting_usr);
14
15 CREATE TRIGGER mat_summary_add_tgr AFTER INSERT ON money.account_adjustment FOR EACH ROW EXECUTE PROCEDURE money.materialized_summary_payment_add ('account_adjustment');
16 CREATE TRIGGER mat_summary_upd_tgr AFTER UPDATE ON money.account_adjustment FOR EACH ROW EXECUTE PROCEDURE money.materialized_summary_payment_update ('account_adjustment');
17 CREATE TRIGGER mat_summary_del_tgr BEFORE DELETE ON money.account_adjustment FOR EACH ROW EXECUTE PROCEDURE money.materialized_summary_payment_del ('account_adjustment');
18
19 -- Insert new org. unit settings.
20 INSERT INTO config.org_unit_setting_type 
21        (name, grp, datatype, label, description)
22 VALUES
23        ('bill.prohibit_negative_balance_default',
24         'finance', 'bool',
25         oils_i18n_gettext(
26             'bill.prohibit_negative_balance_default',
27             'Prohibit negative balance on bills (DEFAULT)',
28             'coust', 'label'),
29         oils_i18n_gettext(
30             'bill.prohibit_negative_balance_default',
31             'Default setting to prevent negative balances (refunds) on circulation related bills',
32             'coust', 'description')
33        ),
34        ('bill.prohibit_negative_balance_on_overdues',
35         'finance', 'bool',
36         oils_i18n_gettext(
37             'bill.prohibit_negative_balance_on_overdues',
38             'Prohibit negative balance on bills for overdue materials',
39             'coust', 'label'),
40         oils_i18n_gettext(
41             'bill.prohibit_negative_balance_on_overdues',
42             'Prevent negative balances (refunds) on bills for overdue materials',
43             'coust', 'description')
44        ),
45        ('bill.prohibit_negative_balance_on_lost',
46         'finance', 'bool',
47         oils_i18n_gettext(
48             'bill.prohibit_negative_balance_on_lost',
49             'Prohibit negative balance on bills for lost materials',
50             'coust', 'label'),
51         oils_i18n_gettext(
52             'bill.prohibit_negative_balance_on_lost',
53             'Prevent negative balances (refunds) on bills for lost/long-overdue materials',
54             'coust', 'description')
55        ),
56        ('bill.negative_balance_interval_default',
57         'finance', 'interval',
58         oils_i18n_gettext(
59             'bill.negative_balance_interval_default',
60             'Negative Balance Interval (DEFAULT)',
61             'coust', 'label'),
62         oils_i18n_gettext(
63             'bill.negative_balance_interval_default',
64             'Amount of time after which no negative balances (refunds) are allowed on circulation bills',
65             'coust', 'description')
66        ),
67        ('bill.negative_balance_interval_on_overdues',
68         'finance', 'interval',
69         oils_i18n_gettext(
70             'bill.negative_balance_interval_on_overdues',
71             'Negative Balance Interval for Overdues',
72             'coust', 'label'),
73         oils_i18n_gettext(
74             'bill.negative_balance_interval_on_overdues',
75             'Amount of time after which no negative balances (refunds) are allowed on bills for overdue materials',
76             'coust', 'description')
77        ),
78        ('bill.negative_balance_interval_on_lost',
79         'finance', 'interval',
80         oils_i18n_gettext(
81             'bill.negative_balance_interval_on_lost',
82             'Negative Balance Interval for Lost',
83             'coust', 'label'),
84         oils_i18n_gettext(
85             'bill.negative_balance_interval_on_lost',
86             'Amount of time after which no negative balances (refunds) are allowed on bills for lost/long overdue materials',
87             'coust', 'description')
88        );
89
90 COMMIT;