Bugzilla – Attachment 58131 Details for
Bug 14146
Add option to add restriction period when checking-in several overdues for same patron
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14146: Clean a bit and make the code understandable
Bug-14146-Clean-a-bit-and-make-the-code-understand.patch (text/plain), 3.29 KB, created by
Jonathan Druart
on 2016-12-12 15:33:31 UTC
(
hide
)
Description:
Bug 14146: Clean a bit and make the code understandable
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2016-12-12 15:33:31 UTC
Size:
3.29 KB
patch
obsolete
>From 670dbb1111b220f7315602d574e80b59b6580b46 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 12 Dec 2016 16:04:07 +0100 >Subject: [PATCH] Bug 14146: Clean a bit and make the code understandable > >The code was a bit weird and this patch cleans it a bit by renaming >variables and adding a variable. > >Sponsored-by: Orex Digital >--- > C4/Circulation.pm | 19 +++++++++++++------ > 1 file changed, 13 insertions(+), 6 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index cc412d1..4b6abd8 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -2188,7 +2188,7 @@ C<$item> item hashref > > C<$datedue> date due DateTime object > >-C<$today> DateTime object representing the return time >+C<$return_date> DateTime object representing the return time > > Internal function, called only by AddReturn that calculates and updates > the user fine days, and debars him if necessary. >@@ -2198,7 +2198,7 @@ Should only be called for overdue returns > =cut > > sub _debar_user_on_return { >- my ( $borrower, $item, $dt_due, $dt_today ) = @_; >+ my ( $borrower, $item, $dt_due, $return_date ) = @_; > > my $branchcode = _GetCircControlBranch( $item, $borrower ); > >@@ -2211,7 +2211,7 @@ sub _debar_user_on_return { > ); > my $finedays = $issuing_rule ? $issuing_rule->finedays : undef; > my $unit = $issuing_rule ? $issuing_rule->lengthunit : undef; >- my $chargeable_units = C4::Overdues::get_chargeable_units($unit, $dt_due, $dt_today, $branchcode); >+ my $chargeable_units = C4::Overdues::get_chargeable_units($unit, $dt_due, $return_date, $branchcode); > > if ($finedays) { > >@@ -2238,15 +2238,17 @@ sub _debar_user_on_return { > if DateTime::Duration->compare( $max_sd, $suspension_days ) < 0; > } > >+ my ( $has_been_extended, $is_a_reminder ); > if ( C4::Context->preference('CumulativeRestrictionPeriods') and $borrower->{debarred} ) { > my $debarment = @{ GetDebarments( { borrowernumber => $borrower->{borrowernumber}, type => 'SUSPENSION' } ) }[0]; > if ( $debarment ) { > $return_date = dt_from_string( $debarment->{expiration}, 'sql' ); >+ $has_been_extended = 1; > } > } > > my $new_debar_dt = >- $dt_today->clone()->add_duration( $suspension_days ); >+ $return_date->clone()->add_duration( $suspension_days ); > > Koha::Patron::Debarments::AddUniqueDebarment({ > borrowernumber => $borrower->{borrowernumber}, >@@ -2255,10 +2257,15 @@ sub _debar_user_on_return { > }); > # if borrower was already debarred but does not get an extra debarment > my $patron = Koha::Patrons->find( $borrower->{borrowernumber} ); >+ my $new_debarment_str; > if ( $borrower->{debarred} eq $patron->is_debarred ) { >- return ($borrower->{debarred},1); >+ $is_a_reminder = 1; >+ $new_debarment_str = $borrower->{debarred}; >+ } else { >+ $new_debarment_str = $new_debar_dt->ymd(); > } >- return $new_debar_dt->ymd(); >+ # FIXME Should return a DateTime object >+ return $new_debarment_str, $is_a_reminder; > } > } > return; >-- >2.9.3
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 14146
:
58128
|
58129
|
58130
|
58131
|
58149
|
60406
|
60407
|
60408
|
60409
|
61535
|
61536
|
61537
|
61538