my $is_renewed = $evt->{textcode} eq 'SUCCESS' ? 1 : 0;
my $new_circ_due = $is_renewed ? $evt->{payload}->{circ}->due_date : '';
+ my $renewal_remaining = $is_renewed ? $evt->{payload}->{circ}->renewal_remaining : $_->renewal_remaining;
my %user_data = (
copy => $_->target_copy(),
new_due_date => $is_renewed ? $evt->{payload}->{circ}->due_date : '',
old_due_date => !$is_renewed ? $_->due_date() : '',
textcode => $evt->{textcode},
+ renewal_remaining => $renewal_remaining,
);
# Create the event from the source circ instead of the
--- /dev/null
+New Field for AutorenewNotify Eevent Template
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+A new field, `renewal_remaining`, has been added to the
+AutorenewNotify action/trigger event code. It will report the number
+of renewals remaining on the new circulation, if renewed, or on the
+old circulation, if not renewed. This is provided as a convenience to
+avoid possibly inaccurate math in the template. You may access it in
+the template via the `udata`:
+
+.................................................
+Renewals Remaining: [% udata.renewal_remaining %]
+.................................................
+