From 254ef81f24faac127abd9b2ab5fe1aa70c522145 Mon Sep 17 00:00:00 2001 From: Chris Sharp Date: Mon, 24 Feb 2020 11:02:28 -0500 Subject: [PATCH] LP#1849736: Stamping upgrade script Signed-off-by: Chris Sharp --- Open-ILS/src/sql/Pg/002.schema.config.sql | 2 +- .../1199.lp1849736_at_email_self_register.sql | 47 ++++++++++++++++++++++ 2 files changed, 48 insertions(+), 1 deletion(-) create mode 100755 Open-ILS/src/sql/Pg/upgrade/1199.lp1849736_at_email_self_register.sql diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql index 6715c8c6b8..86b2d68676 100644 --- a/Open-ILS/src/sql/Pg/002.schema.config.sql +++ b/Open-ILS/src/sql/Pg/002.schema.config.sql @@ -92,7 +92,7 @@ CREATE TRIGGER no_overlapping_deps BEFORE INSERT OR UPDATE ON config.db_patch_dependencies FOR EACH ROW EXECUTE PROCEDURE evergreen.array_overlap_check ('deprecates'); -INSERT INTO config.upgrade_log (version, applied_to) VALUES ('1198', :eg_version); -- berick/tmccanna +INSERT INTO config.upgrade_log (version, applied_to) VALUES ('1199', :eg_version); -- Bmagic/csharp CREATE TABLE config.bib_source ( id SERIAL PRIMARY KEY, diff --git a/Open-ILS/src/sql/Pg/upgrade/1199.lp1849736_at_email_self_register.sql b/Open-ILS/src/sql/Pg/upgrade/1199.lp1849736_at_email_self_register.sql new file mode 100755 index 0000000000..6b95c3f862 --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/1199.lp1849736_at_email_self_register.sql @@ -0,0 +1,47 @@ +BEGIN; + + +SELECT evergreen.upgrade_deps_block_check('1199', :eg_version); + +INSERT INTO action_trigger.hook +(key,core_type,description,passive) +VALUES +('stgu.created','stgu','Patron requested a card using self registration','t'); + + +INSERT INTO action_trigger.event_definition(active,owner,name,hook,validator,reactor,delay,max_delay,delay_field,group_field,template,retention_interval) +SELECT 'f',1,'Patron Registered for a card stgu.created','stgu.created','NOOP_True','SendEmail','00:01:00'::interval,'1 day'::interval,'row_date','home_ou', +$$[%- USE date -%] +[%- lib = target.0.home_ou -%] +To: [% lib.name %] <[% params.recipient_email || helpers.get_org_setting(target.0.home_ou.id, 'org.bounced_emails') || lib.email || default_sender %]> +From: [% lib.name %] <[% helpers.get_org_setting(target.0.home_ou.id, 'org.bounced_emails') || lib.email || params.recipient_email || default_sender %]> +Date: [% date.format(format => '%a, %d %b %Y %H:%M:%S %Z') %] +Subject: Patron card requested +Auto-Submitted: auto-generated + + +Dear Staff Admin, + +There are some pending patrons waiting for your attention. + +[% FOR patron IN target %] + [% patron.first_given_name %] + +[% END %] + +These requests can be tended via the staff interface. Located "Circulation" -> "Pending Patrons" + + +$$, +'1 year'::interval + +WHERE NOT EXISTS (SELECT 1 FROM action_trigger.event_definition WHERE name='Patron Registered for a card stgu.created'); + +INSERT INTO action_trigger.environment (event_def,path) +SELECT id,'home_ou' from action_trigger.event_definition WHERE name='Patron Registered for a card stgu.created' +AND NOT EXISTS (SELECT 1 FROM action_trigger.environment WHERE +event_def=(SELECT id FROM action_trigger.event_definition WHERE name='Patron Registered for a card stgu.created' AND owner=1 LIMIT 1) +AND path='home_ou'); + + +COMMIT; -- 2.11.0