From 6b0ff566c5bf8608ae3dc668979592fe4362cc48 Mon Sep 17 00:00:00 2001 From: Dan Wells Date: Thu, 28 May 2015 13:54:26 -0400 Subject: [PATCH] LP 1198465: Set restored overdue timestamp to time of last overdue When we have our settings configured to generate new overdues on lost item return, we start generation after the most recent overdue fine. Because of this, we need the restored fine to be dated in the past, which in turn allows the fine generator to apply catch-up fines as expected. Signed-off-by: Dan Wells Signed-off-by: Kathy Lussier --- .../src/perlmods/lib/OpenILS/Application/Circ/CircCommon.pm | 3 ++- .../src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm | 10 +++++++--- 2 files changed, 9 insertions(+), 4 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 4dac75ec86..541a5a8cf2 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/CircCommon.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/CircCommon.pm @@ -198,7 +198,7 @@ sub reopen_xact { sub create_bill { - my($class, $e, $amount, $btype, $type, $xactid, $note) = @_; + my($class, $e, $amount, $btype, $type, $xactid, $note, $billing_ts) = @_; $logger->info("The system is charging $amount [$type] on xact $xactid"); $note ||= 'SYSTEM GENERATED'; @@ -208,6 +208,7 @@ sub create_bill { my $bill = Fieldmapper::money::billing->new; $bill->xact($xactid); $bill->amount($amount); + $bill->billing_ts($billing_ts); $bill->billing_type($type); $bill->btype($btype); $bill->note($note); 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 44719ef0ba..9b20a97760 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm @@ -3813,12 +3813,15 @@ sub checkin_handle_lost_or_lo_now_found_restore_od { # restore those overdue charges voided when item was set to lost # ------------------------------------------------------------------ - my $ods = $self->editor->search_money_billing( + my $ods = $self->editor->search_money_billing([ { xact => $self->circ->id, btype => 1 + }, + { + order_by => {mb => 'billing_ts desc'} } - ); + ]); $logger->debug("returning ".scalar(@$ods)." overdue charges pre-$tag"); # Because actual users get up to all kinds of unexpectedness, we @@ -3852,7 +3855,8 @@ sub checkin_handle_lost_or_lo_now_found_restore_od { $ods->[0]->btype(), $ods->[0]->billing_type(), $self->circ->id(), - "System: $tag RETURNED - OVERDUES REINSTATED" + "System: $tag RETURNED - OVERDUES REINSTATED", + $ods->[0]->billing_ts() # date this restoration the same as the last overdue (for possible subsequent fine generation) ); } } -- 2.11.0