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 <jboyer@library.in.gov>
Signed-off-by: Bill Erickson <berickxx@gmail.com>
);
# 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';