From b30d84cbb28d05d5b6ed678b1c8aa053a6b75ab6 Mon Sep 17 00:00:00 2001 From: Jason Stephenson Date: Mon, 27 Jan 2014 12:38:31 -0500 Subject: [PATCH] LP 1198465: More fixes as a result of testing. Testing voiding of lost on claims returned turned up a problem with double voiding the same bill when/if the claims returned copy is later checked in. The fix is to modify CircCommon::void_bills_of_type so that it does not void already voided bills. Also, the BILL_ALREADY_VOIDED event was not getting propagated to the staff client, so we changed CircCommon::real_void_bills to add the event to the editor. Finally, there was a typo in the original event description in ils_events.xml, so we altered that language to be simpler English. Signed-off-by: Jason Stephenson Signed-off-by: Kathy Lussier --- Open-ILS/src/extras/ils_events.xml | 2 +- .../lib/OpenILS/Application/Circ/CircCommon.pm | 25 +++++++++++----------- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/Open-ILS/src/extras/ils_events.xml b/Open-ILS/src/extras/ils_events.xml index 21d59a737f..5f340474cb 100644 --- a/Open-ILS/src/extras/ils_events.xml +++ b/Open-ILS/src/extras/ils_events.xml @@ -78,7 +78,7 @@ The provided password is not correct - The selecte bill has already been voided + The bill is already voided The patron has too many overdue items 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 8acaf363cd..bf14556a8e 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/CircCommon.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/CircCommon.pm @@ -85,17 +85,16 @@ sub void_bills_of_type { # Make sure we have a session. return $e->die_event unless $e->checkauth; - my $bills = $e->search_money_billing( - { - xact => $circ->id, - btype => $btype - } - ); - - if ($bills && @$bills) { - my $result = $class->real_void_bills($e, $bills, $note); - if (ref($result)) { - return $result; + # Get a bill payment map. + my $bpmap = $class->bill_payment_map_for_xact($e, $circ); + if ($bpmap && @$bpmap) { + # Filter out the unvoided bills of the type we're looking for: + my @bills = map {$_->{bill}} grep { $_->{bill}->btype() == $btype && $_->{bill_amount} > $_->{void_amount} } @$bpmap; + if (@bills) { + my $result = $class->real_void_bills($e, \@bills, $note); + if (ref($result)) { + return $result; + } } } @@ -579,7 +578,9 @@ sub real_void_bills { # made it impossible to void an already voided bill, so # we're doing the same. if ($amount_to_void <= 0) { - return OpenILS::Event->new('BILL_ALREADY_VOIDED', payload => $bill); + my $event = OpenILS::Event->new('BILL_ALREADY_VOIDED', payload => $bill); + $e->event($event); + return $event; } # If we're voiding a circulation-related bill we have -- 2.11.0