From d784b1777f63a3997654b5ed67b12e7bebc44e9b Mon Sep 17 00:00:00 2001 From: Remington Steed Date: Wed, 18 Jun 2014 09:34:13 -0400 Subject: [PATCH] LP 1198465: Account for overdues voided the old way The code for the particular case of "void"-overdues-for-lost is incomplete. This is the one case in the new code where it now always adjusts rather than voids, but the new restore code still needs to recognize cases where the voiding happened under the old code. Signed-off-by: Remington Steed --- .../src/perlmods/lib/OpenILS/Application/Circ/CircCommon.pm | 2 +- .../src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/CircCommon.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/CircCommon.pm index 637650d80b..c13d808d59 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/CircCommon.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/CircCommon.pm @@ -370,7 +370,7 @@ sub bill_payment_map_for_xact { # find all bills in order my $bill_search = [ - {xact => $xact->id()}, + { xact => $xact->id(), voided => 'f' }, { order_by => { mb => { billing_ts => { direction => 'asc' } } } }, ]; diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm index 9a0b3d7ae8..1f59e4c501 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm @@ -4013,13 +4013,23 @@ sub checkin_handle_lost_or_lo_now_found_restore_od { if ($ods && @$ods) { my $void_amount = 0; my $void_max = $self->circ->max_fine(); + # search for overdues voided the new way (aka "adjusted") my @billings = map {$_->id()} @$ods; my $voids = $self->editor->search_money_adjustment_payment( { billing => \@billings } ); - map {$void_amount += $_->amount()} @$voids; + if (@$voids) { + map {$void_amount += $_->amount()} @$voids; + } else { + # if no adjustments found, assume they were voided the old way (aka "voided") + for my $bill (@$ods) { + if( $U->is_true($bill->voided) ) { + $void_amount += $bill->amount(); + } + } + } $CC->create_bill( $self->editor, ($void_amount < $void_max ? $void_amount : $void_max), -- 2.11.0