LP#1269574 - Exclude backordered copies from deletion.
authorChris Sharp <csharp@georgialibraries.org>
Tue, 7 Nov 2017 21:49:37 +0000 (16:49 -0500)
committerJason Stephenson <jason@sigio.com>
Wed, 12 Sep 2018 18:46:55 +0000 (14:46 -0400)
When canceling a lineitem with a cancel reason that
keep debits = true, make sure we don't delete those copies.

Signed-off-by: Chris Sharp <csharp@georgialibraries.org>
Signed-off-by: John Amundson <jamundson@cwmars.org>
Signed-off-by: Jason Stephenson <jason@sigio.com>
Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Order.pm

index feacb2f..331baf2 100644 (file)
@@ -3167,7 +3167,9 @@ sub cancel_lineitem {
             or return 0;
 
         # gathering any real copies for deletion
-        if ($lid->eg_copy_id) {
+        # if there is a copy ID and the cancel reason keeps debits,
+        # do not delete. 
+        if ($lid->eg_copy_id && ! $U->is_true($cancel_reason->keep_debits)) {
             $lid->eg_copy_id->isdeleted('t');
             push @$copies, $lid->eg_copy_id;
         }