Bugzilla – Attachment 95727 Details for
Bug 24075
Backdating a return to the exact due date and time results in the fine not being refunded
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24075: Backdating a return to the exact due date and time results in the fine not being refunded
Bug-24075-Backdating-a-return-to-the-exact-due-dat.patch (text/plain), 3.29 KB, created by
Tomás Cohen Arazi (tcohen)
on 2019-11-22 14:34:17 UTC
(
hide
)
Description:
Bug 24075: Backdating a return to the exact due date and time results in the fine not being refunded
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2019-11-22 14:34:17 UTC
Size:
3.29 KB
patch
obsolete
>From 03bd9178204f9908634e7b790ccd8b091b328044 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Fri, 22 Nov 2019 12:31:09 +0000 >Subject: [PATCH] Bug 24075: Backdating a return to the exact due date and time > results in the fine not being refunded > >When you use the date picker or book drop mode and check in an item that is due on that date, a fine is assessed and not refunded. > >For example: item 12345 is due on 11/19/2109 23:59. On 11/20/2019 I check the item in using date picker/book drop setting the check in date to 11/19/2019 23:59, the patron is charged a fine, and the fine is not cleared as would be expected, since the item is being checked in before it is overdue. > >Test Plan: >1) Back date a checkout so it is overdue >2) Run fines.pl to generate the fine >3) Return the item, backdating to the same date/time is was due >4) Note the fine was not removed >5) Apply this patch >6) Repeat steps 1-3 >7) Fine should be zeroed out now! > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > C4/Circulation.pm | 6 ++---- > C4/Overdues.pm | 4 ++++ > 2 files changed, 6 insertions(+), 4 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index ad617c846e..74011cafc3 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -1953,17 +1953,15 @@ sub AddReturn { > > # case of a return of document (deal with issues and holdingbranch) > if ($doreturn) { >- my $is_overdue; > die "The item is not issed and cannot be returned" unless $issue; # Just in case... > $patron or warn "AddReturn without current borrower"; >- $is_overdue = $issue->is_overdue( $return_date ); > > if ($patron) { > eval { > MarkIssueReturned( $borrowernumber, $item->itemnumber, $return_date, $patron->privacy ); > }; > unless ( $@ ) { >- if ( C4::Context->preference('CalculateFinesOnReturn') && $is_overdue && !$item->itemlost ) { >+ if ( C4::Context->preference('CalculateFinesOnReturn') && !$item->itemlost ) { > _CalculateAndUpdateFine( { issue => $issue, item => $item_unblessed, borrower => $patron_unblessed, return_date => $return_date } ); > } > } else { >@@ -2890,7 +2888,7 @@ sub AddRenewal { > my $schema = Koha::Database->schema; > $schema->txn_do(sub{ > >- if ( C4::Context->preference('CalculateFinesOnReturn') && $issue->is_overdue ) { >+ if ( C4::Context->preference('CalculateFinesOnReturn') ) { > _CalculateAndUpdateFine( { issue => $issue, item => $item_unblessed, borrower => $patron_unblessed } ); > } > _FixOverduesOnReturn( $borrowernumber, $itemnumber, undef, 'RENEWED' ); >diff --git a/C4/Overdues.pm b/C4/Overdues.pm >index 78e16230bb..485f4dd598 100644 >--- a/C4/Overdues.pm >+++ b/C4/Overdues.pm >@@ -232,6 +232,10 @@ or "Final Notice". But CalcFine never defined any value. > > sub CalcFine { > my ( $item, $bortype, $branchcode, $due_dt, $end_date ) = @_; >+ >+ # Skip calculations if item is not overdue >+ return ( 0, 0, 0 ) unless (DateTime->compare( $due_dt, $end_date ) == -1); >+ > my $start_date = $due_dt->clone(); > # get issuingrules (fines part will be used) > my $itemtype = $item->{itemtype} || $item->{itype}; >-- >2.24.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 24075
:
95625
|
95626
|
95654
|
95655
|
95656
|
95706
|
95707
|
95719
|
95720
|
95723
|
95724
| 95727 |
95728