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