Bugzilla – Attachment 77683 Details for
Bug 14784
Missing checkin message for debarred patrons when issuing rules 'fine days = 0'
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14784 - Fix checkin message for debarred patrons
Bug-14784---Fix-checkin-message-for-debarred-patro.patch (text/plain), 4.52 KB, created by
Charles Farmer
on 2018-08-10 14:38:50 UTC
(
hide
)
Description:
Bug 14784 - Fix checkin message for debarred patrons
Filename:
MIME Type:
Creator:
Charles Farmer
Created:
2018-08-10 14:38:50 UTC
Size:
4.52 KB
patch
obsolete
>From d5f154d5b525b9b172135fdb0cec00bfec6d97d9 Mon Sep 17 00:00:00 2001 >From: David Bourgault <david.bourgault@inlibro.com> >Date: Wed, 22 Nov 2017 16:04:03 -0500 >Subject: [PATCH] Bug 14784 - Fix checkin message for debarred patrons > >After thinking about it I changed the code's behavior to always display a reminder if the patron was previously debarred. >This makes sense to me (it's only a reminder) and it correctly stacks with other messages. > >-- > >Test plan: >Before > >1) Select a user with active restrictions >2) Make sure finesday=0 for the user category >3) Checkout and return an item (not overdue) : a previous restriction reminder will appear >4) Checkout and return an overdue item : no previous restriction reminder will appear > >After applying patch: >Same steps, but a reminder should appear for step 4) > >I've also tested with finesday=1 with "no overdue", "grace period overdue" and "long overdue" test >cases. The appropriate nessage appeared for each test. > >P.S.: The "finesday" setting is called "Suspension days" in the web interface, if you're searching >for it like I did... > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > C4/Circulation.pm | 33 ++++++++++++++++----------------- > 1 file changed, 16 insertions(+), 17 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index b772a7a..2a54e36 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -1986,18 +1986,19 @@ sub AddReturn { > my $fix = _FixOverduesOnReturn($borrowernumber, $item->{itemnumber}, $exemptfine, $dropbox); > defined($fix) or warn "_FixOverduesOnReturn($borrowernumber, $item->{itemnumber}...) failed!"; # zero is OK, check defined > >+ my $newdebardate; > if ( $issue and $issue->is_overdue ) { >- # fix fine days >+ # fix fine days > $today = dt_from_string($return_date) if $return_date; > $today = $dropboxdate if $dropbox; >- my ($debardate,$reminder) = _debar_user_on_return( $patron_unblessed, $item, dt_from_string($issue->date_due), $today ); >- if ($reminder){ >- $messages->{'PrevDebarred'} = $debardate; >- } else { >- $messages->{'Debarred'} = $debardate if $debardate; >+ $newdebardate = _debar_user_on_return( $patron_unblessed, $item, dt_from_string($issue->date_due), $today ); >+ >+ if ( $newdebardate ) { >+ $messages->{'Debarred'} = $newdebardate; > } >+ } > # there's no overdue on the item but borrower had been previously debarred >- } elsif ( $issue->date_due and $patron->debarred ) { >+ if ( $patron->debarred ) { > if ( $patron->debarred eq "9999-12-31") { > $messages->{'ForeverDebarred'} = $patron->debarred; > } else { >@@ -2191,6 +2192,8 @@ Internal function, called only by AddReturn that calculates and updates > > Should only be called for overdue returns > >+Only returns a valid date if there is a new (or extended) debarment. >+ > =cut > > sub _debar_user_on_return { >@@ -2234,7 +2237,7 @@ sub _debar_user_on_return { > if DateTime::Duration->compare( $max_sd, $suspension_days ) < 0; > } > >- my ( $has_been_extended, $is_a_reminder ); >+ my ( $has_been_extended ); > if ( C4::Context->preference('CumulativeRestrictionPeriods') and $borrower->{debarred} ) { > my $debarment = @{ GetDebarments( { borrowernumber => $borrower->{borrowernumber}, type => 'SUSPENSION' } ) }[0]; > if ( $debarment ) { >@@ -2268,17 +2271,13 @@ sub _debar_user_on_return { > expiration => $new_debar_dt->ymd(), > type => 'SUSPENSION', > }); >- # if borrower was already debarred but does not get an extra debarment >+ >+ # Only return a valid date if there is a new (or extented) debarment > my $patron = Koha::Patrons->find( $borrower->{borrowernumber} ); >- my $new_debarment_str; >- if ( $borrower->{debarred} eq $patron->is_debarred ) { >- $is_a_reminder = 1; >- $new_debarment_str = $borrower->{debarred}; >- } else { >- $new_debarment_str = $new_debar_dt->ymd(); >+ if ( $borrower->{debarred} ne $patron->is_debarred or $has_been_extended ) { >+ # FIXME Should return a DateTime object >+ return $new_debar_dt->ymd(); > } >- # FIXME Should return a DateTime object >- return $new_debarment_str, $is_a_reminder; > } > } > return; >-- >2.7.4
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 14784
:
42354
|
49282
|
49283
|
49377
|
58227
|
67102
|
68132
|
69295
|
69296
|
77683
|
79826
|
106808
|
106809
|
107487
|
110485
|
110514
|
110763
|
110764
|
112724
|
112725
|
136040
|
136327
|
137727
|
137728
|
145320
|
145321