]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/sql/Pg/upgrade/0279.data.telephony-basics.sql
LP#1759238: stamping upgrade script
[Evergreen.git] / Open-ILS / src / sql / Pg / upgrade / 0279.data.telephony-basics.sql
1 BEGIN;
2
3 INSERT INTO config.upgrade_log (version) VALUES ('0279'); -- atz / senator
4
5 INSERT INTO
6     config.org_unit_setting_type (name, label, description, datatype)
7     VALUES (
8         'notice.telephony.callfile_lines',
9         'Telephony: Arbitrary line(s) to include in each notice callfile',
10         $$
11         This overrides lines from opensrf.xml.
12         Line(s) must be valid for your target server and platform
13         (e.g. Asterisk 1.4).
14         $$,
15         'string'
16     );
17
18 INSERT INTO action_trigger.reactor (module, description) VALUES (
19     'AstCall', 'Possibly place a phone call with Asterisk'
20 );
21
22 INSERT INTO
23     action_trigger.event_definition (
24         id, active, owner, name, hook, validator, reactor,
25         cleanup_success, cleanup_failure, delay, delay_field, group_field,
26         max_delay, granularity, usr_field, opt_in_setting, template
27     ) VALUES (
28         24,
29         FALSE,
30         1,
31         'Telephone Overdue Notice',
32         'checkout.due', 'NOOP_True', 'AstCall',
33         DEFAULT, DEFAULT, '5 seconds', 'due_date', 'usr',
34         DEFAULT, DEFAULT, DEFAULT, DEFAULT,
35         $$
36 [% phone = target.0.usr.day_phone | replace('[\s\-\(\)]', '') -%]
37 [% IF phone.match('^[2-9]') %][% country = 1 %][% ELSE %][% country = '' %][% END -%]
38 Channel: [% channel_prefix %]/[% country %][% phone %]
39 Context: overdue-test
40 MaxRetries: 1
41 RetryTime: 60
42 WaitTime: 30
43 Extension: 10
44 Archive: 1
45 Set: eg_user_id=[% target.0.usr.id %]
46 Set: items=[% target.size %]
47 Set: titlestring=[% titles = [] %][% FOR circ IN target %][% titles.push(circ.target_copy.call_number.record.simple_record.title) %][% END %][% titles.join(". ") %]
48 $$
49     );
50
51 INSERT INTO
52     action_trigger.environment (id, event_def, path)
53     VALUES
54         (DEFAULT, 24, 'target_copy.call_number.record.simple_record'),
55         (DEFAULT, 24, 'usr')
56     ;
57
58 COMMIT;