--- /dev/null
+-- Deploy kcls-evergreen:ecard-notice-validator to pg
+-- requires: remove-gender
+
+BEGIN;
+
+DO $INSERT$
+BEGIN
+ IF evergreen.insert_on_deploy() THEN
+
+ INSERT INTO action_trigger.validator (module, description) VALUES (
+ 'PatronIsPendingEcard',
+ 'Confirm a patron is a valid candidate for a pending ecard print letter'
+ );
+
+ INSERT INTO action_trigger.event_params (event_def, param, value)
+ VALUES (
+ ( SELECT id FROM action_trigger.event_definition
+ WHERE hook = 'au.create.ecard'),
+ 'profile',
+ '951' -- Temporary Ecard
+ );
+
+ UPDATE action_trigger.event_definition
+ SET validator = 'PatronIsPendingEcard'
+ WHERE id = (
+ SELECT id FROM action_trigger.event_definition
+ WHERE hook = 'au.create.ecard'
+ );
+
+ END IF; -- insert_on_deploy
+END $INSERT$;
+
+COMMIT;
--- /dev/null
+-- Revert kcls-evergreen:ecard-notice-validator on pg
+
+BEGIN;
+
+UPDATE action_trigger.event_definition
+ SET validator = 'NOOP_True'
+ WHERE id = (
+ SELECT id FROM action_trigger.event_definition
+ WHERE hook = 'au.create.ecard'
+ );
+
+DELETE FROM action_trigger.validator WHERE module = 'PatronIsPendingEcard';
+
+DELETE FROM action_trigger.event_params WHERE
+ param = 'profile' AND
+ event_def = (
+ SELECT id FROM action_trigger.event_definition
+ WHERE hook = 'au.create.ecard'
+ );
+
+COMMIT;
acq-inv-close-fields [search-index-keep-periods] 2018-04-12T19:03:29Z Bill Erickson,,, <berick@kcls-dev-local> # Invoice export by/date fields
ecard-data [2.10-to-2.12-upgrade] 2018-01-03T21:55:03Z Bill Erickson,,, <berick@kcls-dev-local> # Ecard lib settings, policy data, etc.
remove-gender [ecard-data] 2018-06-06T14:44:36Z Bill Erickson,,, <berick@kcls-dev-local> # Remove gender field/data
+ecard-notice-validator [remove-gender] 2018-07-26T14:33:57Z Bill Erickson,,, <berick@kcls-dev-local> # eCard UMS notice validator
return 1;
}
+# eCard notifications are sent the day after an ecard registration.
+# Be sure the account was not verified or purged by staff in the meantime.
+sub PatronIsPendingEcard {
+ my ($self, $env) = @_;
+ my $user = $env->{target};
+ my $profile = $env->{params}->{profile} || 951;
+ return $user->deleted eq 'f' && $user->profile == $profile;
+}
+
+
1;