api: some sanity checks
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 9 Apr 2010 18:35:03 +0000 (18:35 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 9 Apr 2010 18:35:03 +0000 (18:35 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@16195 dcc99617-32d9-48b4-a31d-7c20da2025e4

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

index 458ce99..a653325 100644 (file)
@@ -214,7 +214,8 @@ sub find_entry_debits {
     $query->{where}->{'+acqfdeb'}->{amount} = $amount if $amount;
 
     my $debits = $e->json_query($query);
-    return $e->search_acq_fund_debit({id => [map { $_->{id} } @$debits]});
+    my $debit_ids = [map { $_->{id} } @$debits];
+    return (@$debit_ids) ? $e->search_acq_fund_debit({id => $debit_ids}) : [];
 }
 
 
@@ -264,7 +265,7 @@ sub fetch_invoice_impl {
         }
     ];
 
-    my $invoice = $e->retrieve_acq_invoice($args);
+    my $invoice = $e->retrieve_acq_invoice($args) or return $e->die_event;
     return $invoice if $options->{no_flesh_misc} or $options->{keep_li_marc};
 
     $_->lineitem->clear_marc for @{$invoice->entries};