From: Jason Boyer Date: Mon, 2 Mar 2015 20:06:33 +0000 (-0500) Subject: LP#1427309 Fix Crash in Collections User Balance Summary X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=804210a37030eea40906ca88d6de31f072440732;p=evergreen%2Fmasslnc.git LP#1427309 Fix Crash in Collections User Balance Summary Previously a patron in collections that paid off all transactions would cause a crash and stop processing any balance summary file that they are supposed to appear in. Now user balance summaries can be created in full even if some users have a 0 balance. Signed-off-by: Jason Boyer Signed-off-by: Bill Erickson --- diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Collections.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Collections.pm index 750468c22e..e3fb51156f 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Collections.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Collections.pm @@ -862,16 +862,19 @@ sub user_balance_summary { ); # get the sum owed an all transactions - my $balance = $e->json_query({ - select => {mbts => [ - { column => 'balance_owed', - transform => 'sum', - aggregate => 1 - } - ]}, - from => 'mbts', - where => {id => [@$circ_ids, @$groc_ids, @$res_ids]} - })->[0]; + my $balance = undef; + if (@{[@$circ_ids, @$groc_ids, @$res_ids]}) { + $balance = $e->json_query({ + select => {mbts => [ + { column => 'balance_owed', + transform => 'sum', + aggregate => 1 + } + ]}, + from => 'mbts', + where => {id => [@$circ_ids, @$groc_ids, @$res_ids]} + })->[0]; + } $balance = $balance ? $balance->{balance_owed} : '0';