<desc xml:lang="en-US">The provided password is not correct</desc>
</event>
<event code='1211' textcode='BILL_ALREADY_VOIDED'>
- <desc xml:lang="en-US">The selecte bill has already been voided</desc>
+ <desc xml:lang="en-US">The bill is already voided</desc>
</event>
<event code='1212' textcode='PATRON_EXCEEDS_OVERDUE_COUNT'>
<desc xml:lang="en-US">The patron has too many overdue items</desc>
# 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;
+ }
}
}
# 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