Acq fix for LP#901378
authorJames Fournie <jfournie@sitka.bclibraries.ca>
Wed, 7 Dec 2011 19:27:45 +0000 (11:27 -0800)
committerBill Erickson <berick@esilibrary.com>
Fri, 20 Jan 2012 20:56:20 +0000 (15:56 -0500)
Proratable invoice charges do not have a fund_debit, we need to check for
this before attempting to delete the charge.  If there's no fund_debit
we can generally assume that there's no corresponding debit to this charge
and skip trying to delete it.

Signed-off-by: James Fournie <jfournie@sitka.bclibraries.ca>
Signed-off-by: Bill Erickson <berick@esilibrary.com>

Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Invoice.pm

index 305bd07..9d59b6a 100644 (file)
@@ -133,7 +133,7 @@ sub build_invoice_api {
                     my $debit = $e->retrieve_acq_fund_debit($item->fund_debit);
                     $debit->encumbrance('t');
                     $e->update_acq_fund_debit($debit) or return $e->die_event;
-                } else {
+                } elsif($item->fund_debit) {
                     $e->delete_acq_fund_debit($e->retrieve_acq_fund_debit($item->fund_debit))
                         or return $e->die_event;
                 }