From 804210a37030eea40906ca88d6de31f072440732 Mon Sep 17 00:00:00 2001 From: Jason Boyer Date: Mon, 2 Mar 2015 15:06:33 -0500 Subject: [PATCH] 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 --- .../lib/OpenILS/Application/Collections.pm | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) 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'; -- 2.43.2