[open-ils-commits] r13625 - in branches/rel_1_6/Open-ILS/src: perlmods/OpenILS/Application/Trigger sql/Pg (erickson)
svn at svn.open-ils.org
svn at svn.open-ils.org
Sun Jul 19 11:36:14 EDT 2009
Author: erickson
Date: 2009-07-19 11:36:12 -0400 (Sun, 19 Jul 2009)
New Revision: 13625
Modified:
branches/rel_1_6/Open-ILS/src/perlmods/OpenILS/Application/Trigger/Validator.pm
branches/rel_1_6/Open-ILS/src/sql/Pg/950.data.seed-values.sql
Log:
added seed data for hold-available notifications. update holdisavail validator to use same basic logic as hold status method
Modified: branches/rel_1_6/Open-ILS/src/perlmods/OpenILS/Application/Trigger/Validator.pm
===================================================================
--- branches/rel_1_6/Open-ILS/src/perlmods/OpenILS/Application/Trigger/Validator.pm 2009-07-19 15:35:54 UTC (rev 13624)
+++ branches/rel_1_6/Open-ILS/src/perlmods/OpenILS/Application/Trigger/Validator.pm 2009-07-19 15:36:12 UTC (rev 13625)
@@ -4,6 +4,7 @@
use DateTime::Format::ISO8601;
use OpenSRF::Utils qw/:datetime/;
use OpenSRF::Utils::Logger qw/:logger/;
+use OpenILS::Const qw/:const/;
sub fourty_two { return 42 }
sub NOOP_True { return 1 }
sub NOOP_False { return 0 }
@@ -33,16 +34,15 @@
my $self = shift;
my $env = shift;
- my $t = $env->{target}->transit;
+ my $hold = $env->{target};
- die "Transit object exists, but is not fleshed. Add 'transit' to the environment in order to use this Validator."
- if ($t && !ref($t));
+ return 1 if
+ !$hold->cancel_time and
+ $hold->capture_time and
+ $hold->current_copy and
+ $hold->current_copy->status == OILS_COPY_STATUS_ON_HOLDS_SHELF;
- if ($t) {
- return (defined($env->{target}->capture_time) && defined($t->dest_recv_time)) ? 1 : 0;
- }
-
- return defined($env->{target}->capture_time) ? 1 : 0;
+ return 0;
}
1;
Modified: branches/rel_1_6/Open-ILS/src/sql/Pg/950.data.seed-values.sql
===================================================================
--- branches/rel_1_6/Open-ILS/src/sql/Pg/950.data.seed-values.sql 2009-07-19 15:35:54 UTC (rev 13624)
+++ branches/rel_1_6/Open-ILS/src/sql/Pg/950.data.seed-values.sql 2009-07-19 15:36:12 UTC (rev 13625)
@@ -1855,5 +1855,34 @@
(4, 'provider.addresses'),
(4, 'lineitems.attributes');
+
+INSERT INTO action_trigger.event_definition (id, active, owner, name, hook, validator, reactor, delay, delay_field, group_field, template)
+ VALUES (5, 'f', 1, 'Hold Ready for Pickup Email Notification', 'hold.available', 'HoldIsAvailable', 'SendEmail', '30 minutes', 'capture_time', 'usr',
+$$
+[%- USE date -%]
+[%- user = target.0.usr -%]
+To: [%- params.recipient_email || user.email %]
+From: [%- params.sender_email || default_sender %]
+Subject: Hold Available Notification
+
+Dear [% user.family_name %], [% user.first_given_name %]
+The item(s) you requested are available for pickup from the Library.
+
+[% FOR hold IN target %]
+ Title: [% hold.current_copy.call_number.record.simple_record.title %]
+ Author: [% hold.current_copy.call_number.record.simple_record.author %]
+ Call Number: [% hold.current_copy.call_number.label %]
+ Barcode: [% hold.current_copy.barcode %]
+ Library: [% hold.pickup_lib.name %]
+[% END %]
+
+$$);
+
+INSERT INTO action_trigger.environment (event_def, path) VALUES
+ (5, 'current_copy.call_number.record.simple_record'),
+ (5, 'usr'),
+ (5, 'pickup_lib.billing_address');
+
+
SELECT SETVAL('action_trigger.event_definition_id_seq'::TEXT, 100);
More information about the open-ils-commits
mailing list