]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/sql/Pg/upgrade/XXXX.data.overdue-email-opt-in-setting.sql
ddae2ef5f56281b7e5c7dca35f5e37ef8adff4e0
[Evergreen.git] / Open-ILS / src / sql / Pg / upgrade / XXXX.data.overdue-email-opt-in-setting.sql
1 BEGIN;
2
3 SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
4
5 INSERT INTO config.usr_setting_type (
6     name,
7     opac_visible,
8     label,
9     description,
10     grp,
11     datatype,
12     reg_default
13 ) VALUES (
14     'circ.default_overdue_notices_enabled',
15     TRUE,
16     oils_i18n_gettext(
17         'circ.default_overdue_notices_enabled',
18         'Receive Overdue and Courtesy Emails',
19         'cust',
20         'label'
21     ),
22     oils_i18n_gettext(
23         'circ.default_overdue_notices_enabled',
24         'Receive overdue and predue email notifications',
25         'cust',
26         'description'
27     ),
28     'circ',
29     'bool',
30     'true'
31 );
32
33 COMMIT;
34
35 \qecho
36 \qecho The following query will set the circ.default_overdue_notices_enabled
37 \qecho user setting to true (the default value) for all existing users,
38 \qecho ensuring they continue to receive overdue/predue emails.
39 \qecho
40 \qecho     INSERT INTO actor.usr_setting (usr, name, value)
41 \qecho     SELECT
42 \qecho         id,
43 \qecho         'circ.default_overdue_notices_enabled',
44 \qecho         'true'
45 \qecho     FROM actor.usr;
46 \qecho
47 \qecho The following query will add the circ.default_overdue_notices_enabled
48 \qecho user setting as an opt-in setting for all action triggers that send
49 \qecho emails based on a circ being due (unless another opt-in setting is
50 \qecho already in use).
51 \qecho
52 \qecho     UPDATE action_trigger.event_definition
53 \qecho     SET opt_in_setting = 'circ.default_overdue_notices_enabled',
54 \qecho         usr_field = 'usr'
55 \qecho     WHERE opt_in_setting IS NULL
56 \qecho         AND hook = 'checkout.due'
57 \qecho         AND reactor = 'SendEmail';
58 \qecho
59 \qecho Evergreen admins who wish to use the new setting should run both of
60 \qecho the above queries.  Admins who do not wish to use it, or who are
61 \qecho already using a custom opt-in setting of their own, do not need to
62 \qecho do anything.
63 \qecho
64