LP1905091 Supply environment for added print/email triggers
authorMichele Morgan <mmorgan@noblenet.org>
Mon, 30 Nov 2020 21:19:49 +0000 (16:19 -0500)
committerGalen Charlton <gmc@equinoxinitiative.org>
Fri, 2 Apr 2021 21:53:49 +0000 (17:53 -0400)
Ensures that OPAC print and email triggers added by upgrade script 1231
(lp 1749475) have appropriate environment.

Signed-off-by: Michele Morgan <mmorgan@noblenet.org>
Signed-off-by: Jason Boyer <JBoyer@equinoxinitiative.org>
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Open-ILS/src/sql/Pg/upgrade/XXXX.data.lp1905091.missing_print_email_trigger_environment.sql [new file with mode: 0644]

diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.data.lp1905091.missing_print_email_trigger_environment.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.data.lp1905091.missing_print_email_trigger_environment.sql
new file mode 100644 (file)
index 0000000..a014793
--- /dev/null
@@ -0,0 +1,23 @@
+BEGIN;
+
+SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
+
+INSERT INTO action_trigger.environment (event_def,path)
+SELECT id,'items' from action_trigger.event_definition WHERE name='biblio.record_entry.print.full'
+AND NOT EXISTS (SELECT 1 FROM action_trigger.environment WHERE
+event_def=(SELECT id FROM action_trigger.event_definition WHERE name ='biblio.record_entry.print.full' AND owner=1 LIMIT 1)
+AND path='items');
+
+INSERT INTO action_trigger.environment (event_def,path)
+SELECT id,'items' from action_trigger.event_definition WHERE name='biblio.record_entry.email.full'
+AND NOT EXISTS (SELECT 1 FROM action_trigger.environment WHERE
+event_def=(SELECT id FROM action_trigger.event_definition WHERE name ='biblio.record_entry.email.full' AND owner=1 LIMIT 1)
+AND path='items');
+
+INSERT INTO action_trigger.environment (event_def,path)
+SELECT id,'owner' from action_trigger.event_definition WHERE name='biblio.record_entry.email.full'
+AND NOT EXISTS (SELECT 1 FROM action_trigger.environment WHERE
+event_def=(SELECT id FROM action_trigger.event_definition WHERE name ='biblio.record_entry.email.full' AND owner=1 LIMIT 1)
+AND path='owner');
+
+COMMIT;