From: James Fournie <jfournie@sitka.bclibraries.ca>
Date: Wed, 7 Dec 2011 19:27:45 +0000 (-0800)
Subject: Acq fix for LP#901378
X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=de40cb6bfbf2c41a1e287ec143c81576ed3edde8;p=evergreen%2Fmasslnc.git

Acq fix for LP#901378

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>
---

diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Invoice.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Invoice.pm
index 305bd077e3..9d59b6accc 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Invoice.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Invoice.pm
@@ -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;
                 }