my $new_circ_due = $is_renewed ? $evt->{payload}->{circ}->due_date : '';
my $total_remaining = $is_renewed ? $evt->{payload}->{circ}->renewal_remaining : $_->renewal_remaining;
my $auto_remaining = $is_renewed ? $evt->{payload}->{circ}->auto_renewal_remaining : $_->auto_renewal_remaining;
+ # Check for negative renewal remaining. It can happen with an override renewal:
+ $total_remaining = ($total_remaining < 0) ? 0 : $total_remaining;
+ $auto_remaining = ($auto_remaining < 0) ? 0 : $auto_remaining; # Just making sure....
my %user_data = (
copy => $_->target_copy(),
old_due_date => !$is_renewed ? $_->due_date() : '',
textcode => $evt->{textcode},
total_renewal_remaining => $total_remaining,
- renewal_remaining => ($auto_remaining < $total_remaining) ? $auto_remaining : $total_remaining,
+ auto_renewal_remaining => ($auto_remaining < $total_remaining) ? $auto_remaining : $total_remaining,
);
# Create the event from the source circ instead of the
-New Field for AutorenewNotify Eevent Template
+New Fields for AutorenewNotify Event Template
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-Two new fields, `renewal_remaining`, and `total_renewal_remaining` have
+Two new fields, `auto_renewal_remaining`, and `total_renewal_remaining` have
been added to the AutorenewNotify action/trigger event code. They will
report the number of autorenewals and regular renewals, respectively,
remaining on the new circulation if renewed, or on the old circulation
the `udata`:
.................................................
-Automatic Renewals Remaining: [% udata.renewal_remaining %]
+Automatic Renewals Remaining: [% udata.auto_renewal_remaining %]
Total Renewals Remaining: [% udata.total_renewal_remaining %]
.................................................