From: Dan Wells Date: Thu, 28 May 2015 17:54:26 +0000 (-0400) Subject: LP 1198465: Set restored overdue timestamp to time of last overdue X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=75b8b2b0a5690e6362fb51970ae3b0f0e8910b8f;p=evergreen%2Fmasslnc.git 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 Signed-off-by: Ben Shum --- 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) ); } }