From: Galen Charlton Date: Thu, 3 Mar 2016 01:28:33 +0000 (-0500) Subject: LP#1392396: stamp DB update X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=b3ebb9c9264c595e70cfb7daa74917b14de06d60;p=evergreen%2Ftadl.git LP#1392396: stamp DB 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 71ff514cb2..1ec157b2e3 100644 --- a/Open-ILS/src/sql/Pg/002.schema.config.sql +++ b/Open-ILS/src/sql/Pg/002.schema.config.sql @@ -91,7 +91,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 ('0967', :eg_version); -- jboyer/gmcharlt +INSERT INTO config.upgrade_log (version, applied_to) VALUES ('0968', :eg_version); -- jstompro/gmcharlt CREATE TABLE config.bib_source ( id SERIAL PRIMARY KEY, diff --git a/Open-ILS/src/sql/Pg/upgrade/0968.data.new_user_created_notice.sql b/Open-ILS/src/sql/Pg/upgrade/0968.data.new_user_created_notice.sql new file mode 100644 index 0000000000..6bff0068f9 --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/0968.data.new_user_created_notice.sql @@ -0,0 +1,61 @@ +BEGIN; + +INSERT INTO config.upgrade_log (version, applied_to) VALUES ('0968', :eg_version); -- jstompro/gmcharlt + +--create hook for actor.usr.create_date +INSERT INTO action_trigger.hook (key, core_type, description, passive) + VALUES ('au.created', 'au', 'A user was created', 't'); + +--SQL to create event definition for new account creation notice +--Inactive, owned by top of org tree by default. Modify to suit needs. + +INSERT INTO action_trigger.event_definition ( + active, owner, name, hook, + validator, reactor, delay, delay_field, + max_delay, template +) VALUES ( + 'f', '1', 'New User Created Welcome Notice', 'au.created', + 'NOOP_True', 'SendEmail', '10 seconds', 'create_date', + '1 day', +$$ +[%- USE date -%] +[%- user = target -%] +[%- lib = target.home_ou -%] +To: [%- params.recipient_email || user.email %] +From: [%- helpers.get_org_setting(target.home_ou.id, 'org.bounced_emails') || lib.email || params.sender_email || default_sender %] +Reply-To: [%- helpers.get_org_setting(target.home_ou.id, 'org.bounced_emails') || lib.email || params.sender_email || default_sender %] +Subject: New Library Account Sign-up - Welcome! +Auto-Submitted: auto-generated + +Dear [% user.first_given_name %] [% user.family_name %], + +Thank you for signing up for an account with the [% lib.name %] on [% user.create_date.substr(0, 10) %]. + +This email is your confirmation that your account is set up and ready as well as testing to see that we have your correct email address. + +If you did not sign up for an account at the library and have received this email in error, please reply and let us know. + +You can access your account online at http://catalog/eg/opac/login. From that site you can search the catalog, request materials, renew materials, leave comments, leave suggestions for titles you would like the library to purchase and update your account information. + +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 %] +[% lib.email %] + +$$); + +--insert environment values +INSERT INTO action_trigger.environment (event_def, path) VALUES + (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.new_user_created_notice.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.new_user_created_notice.sql deleted file mode 100644 index 3b5f13c99e..0000000000 --- a/Open-ILS/src/sql/Pg/upgrade/XXXX.new_user_created_notice.sql +++ /dev/null @@ -1,59 +0,0 @@ -BEGIN; - ---create hook for actor.usr.create_date -INSERT INTO action_trigger.hook (key, core_type, description, passive) - VALUES ('au.created', 'au', 'A user was created', 't'); - ---SQL to create event definition for new account creation notice ---Inactive, owned by top of org tree by default. Modify to suit needs. - -INSERT INTO action_trigger.event_definition ( - active, owner, name, hook, - validator, reactor, delay, delay_field, - max_delay, template -) VALUES ( - 'f', '1', 'New User Created Welcome Notice', 'au.created', - 'NOOP_True', 'SendEmail', '10 seconds', 'create_date', - '1 day', -$$ -[%- USE date -%] -[%- user = target -%] -[%- lib = target.home_ou -%] -To: [%- params.recipient_email || user.email %] -From: [%- helpers.get_org_setting(target.home_ou.id, 'org.bounced_emails') || lib.email || params.sender_email || default_sender %] -Reply-To: [%- helpers.get_org_setting(target.home_ou.id, 'org.bounced_emails') || lib.email || params.sender_email || default_sender %] -Subject: New Library Account Sign-up - Welcome! -Auto-Submitted: auto-generated - -Dear [% user.first_given_name %] [% user.family_name %], - -Thank you for signing up for an account with the [% lib.name %] on [% user.create_date.substr(0, 10) %]. - -This email is your confirmation that your account is set up and ready as well as testing to see that we have your correct email address. - -If you did not sign up for an account at the library and have received this email in error, please reply and let us know. - -You can access your account online at http://catalog/eg/opac/login. From that site you can search the catalog, request materials, renew materials, leave comments, leave suggestions for titles you would like the library to purchase and update your account information. - -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 %] -[% lib.email %] - -$$); - ---insert environment values -INSERT INTO action_trigger.environment (event_def, path) VALUES - (CURRVAL('action_trigger.event_definition_id_seq'), 'home_ou.mailing_address'), - (CURRVAL('action_trigger.event_definition_id_seq'), 'home_ou.billing_address'); - -COMMIT;