Bugzilla – Attachment 29806 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.58 KB, created by
Kyle M Hall (khall)
on 2014-07-17 16:23:59 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 16:23:59 UTC
Size:
2.58 KB
patch
obsolete
>From dd547247500db5e3f8fa6026fc3026ffea036cbb 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. > >Test Plan: >1) Apply the unit test patch >2) prove t/db_dependent/Circulation.t >3) Note the failure >4) Apply the second patch >5) prove t/db_dependent/Circulation.t >6) Note there are no failures >--- > C4/Overdues.pm | 14 +++++++++----- > 1 files changed, 9 insertions(+), 5 deletions(-) > >diff --git a/C4/Overdues.pm b/C4/Overdues.pm >index 169b36c..b3ec066 100644 >--- a/C4/Overdues.pm >+++ b/C4/Overdues.pm >@@ -282,15 +282,19 @@ 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 ); >+ > 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 +304,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