Bugzilla – Attachment 110763 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-patrons.patch (text/plain), 4.14 KB, created by
Kyle M Hall (khall)
on 2020-09-25 14:39:46 UTC
(
hide
)
Description:
Bug 14784: Fix checkin message for debarred patrons
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2020-09-25 14:39:46 UTC
Size:
4.14 KB
patch
obsolete
>From eddfe42ea33e8a7b63aec9dda63adf2cfa52f91b 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 (manual restriction works) >2) Make sure finesday=0 for the user category. See [1] >3) Checkout and return an item (not overdue) > A previous restriction reminder will appear >4) Checkout and return an overdue item (change the date at cehckout) > 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. > >[1] The "finesday" setting is called "Suspension in days" in the web interface, if you're searching >for it like I did... > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >Signed-off-by: Victor Grousset <victor.grousset@biblibre.com> > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > C4/Circulation.pm | 29 ++++++++++++----------------- > 1 file changed, 12 insertions(+), 17 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index 3571051e84..fd59a15d19 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -2051,14 +2051,14 @@ sub AddReturn { > > if ( $issue and $issue->is_overdue($return_date) ) { > # fix fine days >- my ($debardate,$reminder) = _debar_user_on_return( $patron_unblessed, $item->unblessed, dt_from_string($issue->date_due), $return_date ); >- if ($reminder){ >- $messages->{'PrevDebarred'} = $debardate; >- } else { >- $messages->{'Debarred'} = $debardate if $debardate; >+ my $newdebardate = _debar_user_on_return( $patron_unblessed, $item->unblessed, dt_from_string($issue->date_due), $return_date ); >+ >+ 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 { >@@ -2360,7 +2360,7 @@ sub _calculate_new_debar_dt { > else { > $new_debar_dt = $return_date->clone()->add_duration($suspension_days); > } >- return $new_debar_dt; >+ return ($new_debar_dt, $has_been_extended); > } > return; > } >@@ -2370,7 +2370,7 @@ sub _debar_user_on_return { > > $return_date //= dt_from_string(); > >- my $new_debar_dt = _calculate_new_debar_dt ($borrower, $item, $dt_due, $return_date); >+ my ($new_debar_dt, $has_been_extended) = _calculate_new_debar_dt ($borrower, $item, $dt_due, $return_date); > > return unless $new_debar_dt; > >@@ -2379,17 +2379,12 @@ 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, $is_a_reminder); >- if ( $borrower->{debarred} && $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} && $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; > } > > =head2 _FixOverduesOnReturn >-- >2.24.1 (Apple Git-126)
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