LP 1170794: Skip Deposit Fee on Renewal user/dyrcona/lp1170794-skip-deposit-fee-on-renewal
authorJason Stephenson <jason@sigio.com>
Thu, 9 Feb 2017 20:27:58 +0000 (15:27 -0500)
committerJason Stephenson <jason@sigio.com>
Thu, 9 Feb 2017 21:49:56 +0000 (16:49 -0500)
Skip charging the deposit fee if the circulation is a renewal.

This commit sets the Circulator object's skip_deposit_fee to true in
mk_env if the current action is renew.  This causes the deposit fee to
not be charged.

It also adds a check to the Circulator object's check_item_deposits
method so that the ITEM_DEPOSIT_REQUIRED event is not thrown if
skip_deposit_fee is true.  Something similar should be done for the
ITEM_RENTAL_FEE_REQUIRED event, but that is beyond the scope of this
bug.

We also add a rudimentary, but hopefully sufficient, release note.

Signed-off-by: Jason Stephenson <jason@sigio.com>
Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm
docs/RELEASE_NOTES_NEXT/Circulation/skip_deposit_fee_on_renewal.adoc [new file with mode: 0644]

index 8daab0c..de73ae6 100644 (file)
@@ -752,6 +752,11 @@ sub mk_env {
         $self->bail_on_events(OpenILS::Event->new('PATRON_ACCOUNT_EXPIRED'))
             if( CORE::time > $expire->epoch ) ;
     }
+
+    if ($self->is_renewal) {
+        # Skip the deposit fee if this is a renewal.
+        $self->skip_deposit_fee(1);
+    }
 }
 
 
@@ -792,7 +797,7 @@ sub do_permit {
 sub check_item_deposit_events {
     my $self = shift;
     $self->push_events(OpenILS::Event->new('ITEM_DEPOSIT_REQUIRED', payload => $self->copy)) 
-        if $self->is_deposit and not $self->is_deposit_exempt;
+        if $self->is_deposit and not $self->is_deposit_exempt and not $self->skip_deposit_fee;
     $self->push_events(OpenILS::Event->new('ITEM_RENTAL_FEE_REQUIRED', payload => $self->copy)) 
         if $self->is_rental and not $self->is_rental_exempt;
 }
diff --git a/docs/RELEASE_NOTES_NEXT/Circulation/skip_deposit_fee_on_renewal.adoc b/docs/RELEASE_NOTES_NEXT/Circulation/skip_deposit_fee_on_renewal.adoc
new file mode 100644 (file)
index 0000000..9f84b55
--- /dev/null
@@ -0,0 +1,5 @@
+Skip Deposit Fee On Renewal
+^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Fix Launchpad bug 1170794 and do not charge the deposit fee on copy
+renewals.
+