Bugzilla – Attachment 29803 Details for
Bug 12596
Backdating returns with SpecifiyReturnDate causes fines for items not overdue!
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 12596 - Backdating returns with SpecifiyReturnDate causes fines for items not overdue!
Bug-12596---Backdating-returns-with-SpecifiyReturn.patch (text/plain), 2.42 KB, created by
Kyle M Hall (khall)
on 2014-07-17 15:10:52 UTC
(
hide
)
Description:
Bug 12596 - Backdating returns with SpecifiyReturnDate causes fines for items not overdue!
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2014-07-17 15:10:52 UTC
Size:
2.42 KB
patch
obsolete
>From 8d961af7ad7b9ba26b6ba2f0e3ffcfa6039d22dd Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Thu, 17 Jul 2014 10:57:06 -0400 >Subject: [PATCH] Bug 12596 - Backdating returns with SpecifiyReturnDate causes fines for items not overdue! > >When using the backdating of returns feature, an item that is not >overdue is treated as being as many days overdue as it is *not* overdue. >This is due to the fact that _get_chargeable_units appears to return the >difference between the return date and the due date without >consideration the return date being earlier than the due date. >--- > C4/Overdues.pm | 15 ++++++++++----- > 1 files changed, 10 insertions(+), 5 deletions(-) > >diff --git a/C4/Overdues.pm b/C4/Overdues.pm >index 169b36c..8e5a76f 100644 >--- a/C4/Overdues.pm >+++ b/C4/Overdues.pm >@@ -282,15 +282,20 @@ C<$branchcode> is the branch whose calendar to use for finding holidays. > =cut > > sub _get_chargeable_units { >- my ($unit, $dt1, $dt2, $branchcode) = @_; >+ my ($unit, $date_due, $date_returned, $branchcode) = @_; >+ >+ # If the due date is later than the return date >+ return 0 unless ( $date_returned > $date_due ); >+ ## FIXME: Add unit test >+ > my $charge_units = 0; > my $charge_duration; > if ($unit eq 'hours') { > if(C4::Context->preference('finesCalendar') eq 'noFinesWhenClosed') { > my $calendar = Koha::Calendar->new( branchcode => $branchcode ); >- $charge_duration = $calendar->hours_between( $dt1, $dt2 ); >+ $charge_duration = $calendar->hours_between( $date_due, $date_returned ); > } else { >- $charge_duration = $dt2->delta_ms( $dt1 ); >+ $charge_duration = $date_returned->delta_ms( $date_due ); > } > if($charge_duration->in_units('hours') == 0 && $charge_duration->in_units('seconds') > 0){ > return 1; >@@ -300,9 +305,9 @@ sub _get_chargeable_units { > else { # days > if(C4::Context->preference('finesCalendar') eq 'noFinesWhenClosed') { > my $calendar = Koha::Calendar->new( branchcode => $branchcode ); >- $charge_duration = $calendar->days_between( $dt1, $dt2 ); >+ $charge_duration = $calendar->days_between( $date_due, $date_returned ); > } else { >- $charge_duration = $dt2->delta_days( $dt1 ); >+ $charge_duration = $date_returned->delta_days( $date_due ); > } > return $charge_duration->in_units('days'); > } >-- >1.7.2.5
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 12596
:
29802
|
29803
|
29804
|
29805
|
29806
|
29940
|
29941
|
30049
|
30050