my $env = shift;
return 0 if (defined($env->{target}->checkin_time));
- return 0 if ($env->{params}->{max_delay_age} && !$self->MaxPassiveDelayAge($env));
if ($env->{params}->{min_target_age}) {
$env->{params}->{target_age_field} = 'xact_start';
return 1;
}
-sub MaxPassiveDelayAge {
- my $self = shift;
- my $env = shift;
- my $target = $env->{target};
- my $delay_field = $env->{event}->event_def->delay_field;
-
- my $delay_field_ts = DateTime::Format::ISO8601->new->parse_datetime(clense_ISO8601($target->$delay_field()));
-
- # the cutoff date is the target timestamp + the delay + the max_delay_age
- # This is also true for negative delays. For example:
- # due_date + "-3 days" + "1 day" == -2 days old.
- $delay_field_ts
- ->add( seconds => interval_to_seconds( $env->{event}->event_def->delay ) )
- ->add( seconds => interval_to_seconds( $env->{params}->{max_delay_age} ) );
-
- return 1 if $delay_field_ts > DateTime->now;
- return 0;
-}
-
sub MinPassiveTargetAge {
my $self = shift;
my $env = shift;
return 0 if $circ->checkin_time;
return 0 if $circ->stop_fines and not $circ->stop_fines =~ /MAXFINES|LONGOVERDUE/;
- return 0 if ($env->{params}->{max_delay_age} && !$self->MaxPassiveDelayAge($env));
if ($env->{params}->{min_target_age}) {
$env->{params}->{target_age_field} = 'xact_start';
-- Sample Overdue Notice --
-INSERT INTO action_trigger.event_definition (id, active, owner, name, hook, validator, reactor, delay, delay_field, group_field, template)
- VALUES (1, 'f', 1, '7 Day Overdue Email Notification', 'checkout.due', 'CircIsOverdue', 'SendEmail', '7 days', 'due_date', 'usr',
+INSERT INTO action_trigger.event_definition (id, active, owner, name, hook, validator, reactor, delay, delay_field, group_field, max_delay, template)
+ VALUES (1, 'f', 1, '7 Day Overdue Email Notification', 'checkout.due', 'CircIsOverdue', 'SendEmail', '7 days', '8 days', 'due_date', 'usr',
$$
[%- USE date -%]
[%- user = target.0.usr -%]
(1, 'billable_transaction.summary'),
(1, 'circ_lib.billing_address');
-INSERT INTO action_trigger.event_params (event_def, param, value) VALUES
- (1, 'max_delay_age', '"1 day"');
-
-- Sample Mark Long-Overdue Item Lost --
INSERT INTO action_trigger.event_definition (id, active, owner, name, hook, validator, reactor, delay, delay_field)
-- Sample Pre-due Notice --
-INSERT INTO action_trigger.event_definition (id, active, owner, name, hook, validator, reactor, delay, delay_field, group_field, template)
- VALUES (6, 'f', 1, '3 Day Courtesy Notice', 'checkout.due', 'MaxPassiveDelayAge', 'SendEmail', '-3 days', 'due_date', 'usr',
+INSERT INTO action_trigger.event_definition (id, active, owner, name, hook, validator, reactor, delay, delay_field, group_field, max_delay, template)
+ VALUES (6, 'f', 1, '3 Day Courtesy Notice', 'checkout.due', 'MaxPassiveDelayAge', 'SendEmail', '-3 days', 'due_date', 'usr', '-2 days',
$$
[%- USE date -%]
[%- user = target.0.usr -%]
(6, 'usr'),
(6, 'circ_lib.billing_address');
-INSERT INTO action_trigger.event_params (event_def, param, value) VALUES
- (6, 'max_delay_age', '"1 day"');
-
-
-- ApplyPatronPenalty A/T Reactor
INSERT INTO action_trigger.reactor (module,description) VALUES ('ApplyPatronPenalty','Applies the conifigured penalty to a patron. Required named environment variables are "user", which refers to the user object, and "context_org", which refers to the org_unit object that acts as the focus for the penalty.');