Bail from fee payment if no bills are found.
authorJason Stephenson <jstephenson@mvlc.org>
Wed, 13 Jul 2011 22:28:26 +0000 (18:28 -0400)
committerBill Erickson <berick@esilibrary.com>
Fri, 12 Aug 2011 20:54:27 +0000 (16:54 -0400)
Signed-off-by: Jason Stephenson <jstephenson@mvlc.org>
Signed-off-by: Bill Erickson <berick@esilibrary.com>
Open-ILS/src/perlmods/lib/OpenILS/SIP/Transaction/FeePayment.pm

index ceab0db..3a8509f 100644 (file)
@@ -100,11 +100,18 @@ sub do_fee_payment {
         }
     } else {
         # We attempt to pay as many of the patron's bills as possible with the payment provided.
-
         my $results = $U->simplereq('open-ils.actor', 'open-ils.actor.user.transactions.history.have_balance', $self->{authtoken}, $self->patron->internal_id);
         if ($results && ref($results) eq 'ARRAY') {
             syslog('LOG_INFO', 'OILS: ' . scalar @$results . " bills found for " . $self->patron->internal_id);
 
+            # If we get an empty array, we report not bills found and
+            # quit.
+            unless (@$results) {
+                $self->ok(0);
+                $self->screen_msg(OILS_SIP_MSG_NO_BILL);
+                return $self->ok;
+            }
+
             # We fill an array with the payment information as
             # open-ils.circ.money.payment expects it, i.e. an arrayref
             # with the bill_id and payment amount of its members. To