[open-ils-commits] [GIT] Evergreen ILS branch master updated. 68ed88e897ff22b3afe7796dcbfc119c9b398cc1

Evergreen Git git at git.evergreen-ils.org
Wed Aug 12 20:11:28 EDT 2020


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".

The branch, master has been updated
       via  68ed88e897ff22b3afe7796dcbfc119c9b398cc1 (commit)
      from  f1730c77ff92cc62229321690af4328352652cd9 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 68ed88e897ff22b3afe7796dcbfc119c9b398cc1
Author: Jason Stephenson <jason at sigio.com>
Date:   Fri Sep 6 10:38:25 2019 -0400

    Lp 1843079: Add renewals remaining to AutoRenew reactor's user data
    
    Add auto_renewal_remaining and total_renewal_remaining fields to the
    autorenew event's user data so that we can report the number of
    renewals remaining to the patron without doing (possibly erroneous)
    math in the template.  When the circulation is renewed, we use the
    renewal remaining counts from the new circulation.  When the renewal
    fails, we use the counts from the original circulation.
    
    The current template is not modified to add these fields.  That is left
    as an exercise for sites that want to add this information for the
    convenience of their patrons.
    
    Signed-off-by: Jason Stephenson <jason at sigio.com>
    Signed-off-by: Jason Boyer <JBoyer at equinoxinitiative.org>

diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger/Reactor/Circ/AutoRenew.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger/Reactor/Circ/AutoRenew.pm
index a64d19cb6d..7274c408e0 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger/Reactor/Circ/AutoRenew.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger/Reactor/Circ/AutoRenew.pm
@@ -66,6 +66,11 @@ sub handler {
         my $is_renewed = $evt->{textcode} eq 'SUCCESS' ? 1 : 0;
 
         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(),
@@ -74,6 +79,8 @@ sub handler {
             new_due_date => $is_renewed ? $evt->{payload}->{circ}->due_date : '',
             old_due_date => !$is_renewed ? $_->due_date() : '',
             textcode => $evt->{textcode},
+            total_renewal_remaining => $total_remaining,
+            auto_renewal_remaining => ($auto_remaining < $total_remaining) ? $auto_remaining : $total_remaining,
         );
 
         # Create the event from the source circ instead of the
diff --git a/docs/RELEASE_NOTES_NEXT/Circulation/autorenewnotify-renewal-field.adoc b/docs/RELEASE_NOTES_NEXT/Circulation/autorenewnotify-renewal-field.adoc
new file mode 100644
index 0000000000..df3431ee9b
--- /dev/null
+++ b/docs/RELEASE_NOTES_NEXT/Circulation/autorenewnotify-renewal-field.adoc
@@ -0,0 +1,16 @@
+New Fields for AutorenewNotify Event Template
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+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
+if not renewed.  This is provided as a convenience to avoid possibly
+inaccurate math in the template.  You may access them in the template via
+the `udata`:
+
+.................................................
+Automatic Renewals Remaining: [% udata.auto_renewal_remaining %]
+Total Renewals Remaining: [% udata.total_renewal_remaining %]
+.................................................
+

-----------------------------------------------------------------------

Summary of changes:
 .../Application/Trigger/Reactor/Circ/AutoRenew.pm        |  7 +++++++
 .../Circulation/autorenewnotify-renewal-field.adoc       | 16 ++++++++++++++++
 2 files changed, 23 insertions(+)
 create mode 100644 docs/RELEASE_NOTES_NEXT/Circulation/autorenewnotify-renewal-field.adoc


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list