more xact protections collections-balance-summary-repair
authorBill Erickson <berick@esilibrary.com>
Wed, 7 Aug 2013 13:41:56 +0000 (09:41 -0400)
committerBill Erickson <berick@esilibrary.com>
Wed, 7 Aug 2013 13:41:56 +0000 (09:41 -0400)
Signed-off-by: Bill Erickson <berick@esilibrary.com>
Open-ILS/src/perlmods/lib/OpenILS/Application/Collections.pm

index 550c75d..23eccf5 100644 (file)
@@ -937,8 +937,9 @@ sub user_balance_summary {
         );
 
         my $balance = '0';
+        my @xact_ids = (@$circ_ids, @$groc_ids, @$res_ids);
 
-        if (@$circ_ids or @$groc_ids or @$res_ids) {
+        if (@xact_ids) {
 
             # get the sum owed an all transactions
             my $balance_obj = $e->json_query({
@@ -949,7 +950,7 @@ sub user_balance_summary {
                     }
                 ]},
                 from => 'mbts',
-                where => {id => [@$circ_ids, @$groc_ids, @$res_ids]}
+                where => {id => \@xact_ids}
             })->[0];
     
             $balance = $balance_obj ? $balance_obj->{balance_owed} : '0';
@@ -961,9 +962,9 @@ sub user_balance_summary {
         $xacts_node->appendChild($balance_node);
         $root->appendChild($xacts_node);
 
-        if ($$args{include_xacts}) {
+        if ($$args{include_xacts} and @xact_ids) {
             my $xacts = $e->search_money_billable_transaction_summary(
-                {id => [@$circ_ids, @$groc_ids, @$res_ids]},
+                {id => \@xact_ids},
                 {substream => 1}
             );