From: Galen Charlton Date: Fri, 11 Sep 2020 19:54:58 +0000 (-0400) Subject: LP#1777677: stamp schema update X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=ab774e44eb803d106a62f551209ac2b1257e12b0;p=evergreen%2Fmasslnc.git LP#1777677: stamp schema update Signed-off-by: Galen Charlton --- diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql index 17ac9d837b..062edd23a2 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 ('1228', :eg_version); -- miker/rhamby/gmcharlt +INSERT INTO config.upgrade_log (version, applied_to) VALUES ('1229', :eg_version); -- khuckins/csharp/gmcharlt CREATE TABLE config.bib_source ( id SERIAL PRIMARY KEY, diff --git a/Open-ILS/src/sql/Pg/upgrade/1229.data.lp1777677-action-triggers-test-notification.sql b/Open-ILS/src/sql/Pg/upgrade/1229.data.lp1777677-action-triggers-test-notification.sql new file mode 100644 index 0000000000..c6f56c45c8 --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/1229.data.lp1777677-action-triggers-test-notification.sql @@ -0,0 +1,85 @@ +BEGIN; + +SELECT evergreen.upgrade_deps_block_check('1229', :eg_version); + + +INSERT into action_trigger.hook (key, core_type, description) VALUES ( + 'au.email.test', 'au', 'A test email has been requested for this user' +), +( + 'au.sms_text.test', 'au', 'A test SMS has been requested for this user' +); + +INSERT INTO action_trigger.event_definition (active, owner, name, hook, validator, reactor, delay, template) +VALUES ( + 't', 1, 'Send Test Email', 'au.email.test', 'NOOP_True', 'SendEmail', '00:01:00', +$$ +[%- USE date -%] +[%- user = target -%] +[%- lib = target.home_ou -%] +To: [%- user.email %] +From: [%- helpers.get_org_setting(target.home_ou.id, 'org.bounced_emails') || lib.email || params.sender_email || default_sender %] +Date: [%- date.format(date.now, '%a, %d %b %Y %T -0000', gmt => 1) %] +Reply-To: [%- lib.email || params.sender_email || default_sender %] +Subject: Email Test Notification +Auto-Submitted: auto-generated + +Dear [% user.first_given_name %] [% user.family_name %], + +This is a test of the email associated with your account at [%- lib.name -%]. If you are receiving this message, your email information is correct. + +Sincerely, +[% lib.name %] + +Contact your library for more information: + +[% lib.name %] +[%- SET addr = lib.mailing_address -%] +[%- IF !addr -%] [%- SET addr = lib.billing_address -%] [%- END %] +[% addr.street1 %] [% addr.street2 %] +[% addr.city %], [% addr.state %] +[% addr.post_code %] +[% lib.phone %] +$$); + +INSERT INTO action_trigger.environment (event_def, path) +VALUES (currval('action_trigger.event_definition_id_seq'), 'home_ou'), + (currval('action_trigger.event_definition_id_seq'), 'home_ou.mailing_address'), + (currval('action_trigger.event_definition_id_seq'), 'home_ou.billing_address'); + +INSERT INTO action_trigger.event_definition (active, owner, name, hook, validator, reactor, delay, template) +VALUES ( + 't', 1, 'Send Test SMS', 'au.sms_text.test', 'NOOP_True', 'SendSMS', '00:01:00', +$$ +[%- USE date -%] +[%- user = target -%] +[%- lib = user.home_ou -%] +[%- sms_number = helpers.get_user_setting(target.id, 'opac.default_sms_notify') -%] +[%- sms_carrier = helpers.get_user_setting(target.id, 'opac.default_sms_carrier') -%] +From: [%- helpers.get_org_setting(target.home_ou.id, 'org.bounced_emails') || lib.email || params.sender_email || default_sender %] +To: [%- helpers.get_sms_gateway_email(sms_carrier,sms_number) %] +Subject: Test Text Message + +This is a test confirming your mobile number for [% lib.name %] is correct. + +Sincerely, +[% lib.name %] + +Contact your library for more information: + +[% lib.name %] +[%- SET addr = lib.mailing_address -%] +[%- IF !addr -%] [%- SET addr = lib.billing_address -%] [%- END %] +[% addr.street1 %] [% addr.street2 %] +[% addr.city %], [% addr.state %] +[% addr.post_code %] +[% lib.phone %] +$$); + +INSERT INTO action_trigger.environment (event_def, path) +VALUES (currval('action_trigger.event_definition_id_seq'), 'home_ou'), + (currval('action_trigger.event_definition_id_seq'), 'home_ou.mailing_address'), + (currval('action_trigger.event_definition_id_seq'), 'home_ou.billing_address'); + + +COMMIT; diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.data.lp1777677-action-triggers-test-notification.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.data.lp1777677-action-triggers-test-notification.sql deleted file mode 100644 index 4c22110dad..0000000000 --- a/Open-ILS/src/sql/Pg/upgrade/XXXX.data.lp1777677-action-triggers-test-notification.sql +++ /dev/null @@ -1,85 +0,0 @@ -BEGIN; - -SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version); - - -INSERT into action_trigger.hook (key, core_type, description) VALUES ( - 'au.email.test', 'au', 'A test email has been requested for this user' -), -( - 'au.sms_text.test', 'au', 'A test SMS has been requested for this user' -); - -INSERT INTO action_trigger.event_definition (active, owner, name, hook, validator, reactor, delay, template) -VALUES ( - 't', 1, 'Send Test Email', 'au.email.test', 'NOOP_True', 'SendEmail', '00:01:00', -$$ -[%- USE date -%] -[%- user = target -%] -[%- lib = target.home_ou -%] -To: [%- user.email %] -From: [%- helpers.get_org_setting(target.home_ou.id, 'org.bounced_emails') || lib.email || params.sender_email || default_sender %] -Date: [%- date.format(date.now, '%a, %d %b %Y %T -0000', gmt => 1) %] -Reply-To: [%- lib.email || params.sender_email || default_sender %] -Subject: Email Test Notification -Auto-Submitted: auto-generated - -Dear [% user.first_given_name %] [% user.family_name %], - -This is a test of the email associated with your account at [%- lib.name -%]. If you are receiving this message, your email information is correct. - -Sincerely, -[% lib.name %] - -Contact your library for more information: - -[% lib.name %] -[%- SET addr = lib.mailing_address -%] -[%- IF !addr -%] [%- SET addr = lib.billing_address -%] [%- END %] -[% addr.street1 %] [% addr.street2 %] -[% addr.city %], [% addr.state %] -[% addr.post_code %] -[% lib.phone %] -$$); - -INSERT INTO action_trigger.environment (event_def, path) -VALUES (currval('action_trigger.event_definition_id_seq'), 'home_ou'), - (currval('action_trigger.event_definition_id_seq'), 'home_ou.mailing_address'), - (currval('action_trigger.event_definition_id_seq'), 'home_ou.billing_address'); - -INSERT INTO action_trigger.event_definition (active, owner, name, hook, validator, reactor, delay, template) -VALUES ( - 't', 1, 'Send Test SMS', 'au.sms_text.test', 'NOOP_True', 'SendSMS', '00:01:00', -$$ -[%- USE date -%] -[%- user = target -%] -[%- lib = user.home_ou -%] -[%- sms_number = helpers.get_user_setting(target.id, 'opac.default_sms_notify') -%] -[%- sms_carrier = helpers.get_user_setting(target.id, 'opac.default_sms_carrier') -%] -From: [%- helpers.get_org_setting(target.home_ou.id, 'org.bounced_emails') || lib.email || params.sender_email || default_sender %] -To: [%- helpers.get_sms_gateway_email(sms_carrier,sms_number) %] -Subject: Test Text Message - -This is a test confirming your mobile number for [% lib.name %] is correct. - -Sincerely, -[% lib.name %] - -Contact your library for more information: - -[% lib.name %] -[%- SET addr = lib.mailing_address -%] -[%- IF !addr -%] [%- SET addr = lib.billing_address -%] [%- END %] -[% addr.street1 %] [% addr.street2 %] -[% addr.city %], [% addr.state %] -[% addr.post_code %] -[% lib.phone %] -$$); - -INSERT INTO action_trigger.environment (event_def, path) -VALUES (currval('action_trigger.event_definition_id_seq'), 'home_ou'), - (currval('action_trigger.event_definition_id_seq'), 'home_ou.mailing_address'), - (currval('action_trigger.event_definition_id_seq'), 'home_ou.billing_address'); - - -COMMIT; \ No newline at end of file