Bug 21796

Summary: Patron Restriction do not restrict checkouts if patron also has a fee/fine on their account
Product: Koha Reporter: Kelly McElligott <kelly>
Component: CirculationAssignee: Katrin Fischer <katrin.fischer>
Status: CLOSED FIXED QA Contact: Marcel de Rooy <m.de.rooy>
Severity: major    
Priority: P5 - low CC: andrewfh, fridolin.somers, george, gmcharlt, jonathan.druart, katrin.fischer, kyle.m.hall, m.de.rooy, martin.renvoize, nick, pierre-marc.thibault
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on: 19933    
Bug Blocks:    
Attachments: with both restriction and fine, checkout box is visible.
Bug 21796: Don't unlock checkouts if restriction exists but fines are below limit
Bug 21796: Don't unlock checkouts if restriction exists but fines are below limit
Bug 21796: Don't unlock checkouts if restriction exists but fines are below limit

Description Kelly McElligott 2018-11-08 18:48:08 UTC
Created attachment 82109 [details]
with both restriction and fine, checkout box is visible.

Prior behavior: when a patron has a restriction added to their account, the ability of checking out has been removed.  The checkout box is replaced by a "View restriction" box and an "Override Restriction Temporarily" box option.  If Override is chosen, then the patron's checkout box will reappear for that session. 

Currently in Koha 18.05.05, when a patron has a restriction, this behavior described above happens correctly.  However, if a patron also has a fine of a dollar amount in addition to the restriction, the checkout box is now visible allowing checkouts to occur.  The fine/fee amount can be any amount- this does not seem to correlate with the noissuecharge system preference.  For an example, system preference Noissuecharge set at 20.00, the value of $2.00 fine was attached to the patron and a restriction, the checkout box still appeared. If a fine/fee was above the noissuecharge, this same behavior occurred- the checkout box appears. 
See screenshot of bug.
Comment 1 Katrin Fischer 2018-11-08 21:05:31 UTC
Confirmed on master, having a look.
Comment 2 Katrin Fischer 2018-11-08 21:18:19 UTC
Did git bisect for the fun of it... lead me here:

commit bddfed75913a2302c19c00b00a6fe86538af6f9f
Author: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Date:   Sun Jan 7 14:57:23 2018 -0300

    Bug 19933: Remove patronflags - tricky ones
Comment 3 Katrin Fischer 2018-11-08 21:26:14 UTC
I think the problem is here:

$noissues = ( not C4::Context->preference("AllowFineOverride") and ( $owing > $noissuescharge ) );

It can reset noissues, even if it has already been set to 1 before.
Comment 4 Katrin Fischer 2018-11-08 21:47:15 UTC
Created attachment 82121 [details] [review]
Bug 21796: Don't unlock checkouts if restriction exists but fines are below limit

The checkout form will be removed if various conditions are
met: Restrictions, a fine above noissuescharge etc.

Bug 19933 changed the conditions, so a restriction will no longer
block checkouts, if the fines are below the set limit.

To test:

- Add a restriction
- Confirm the checkouts form is replaced by a message
- Add a fine below the noissuescharge limit
- Confirm that the form reappears
- Apply the patch
- Check that the checkout form is gone now
- Remove restriction - form should reappear
- Add to the fine, so it's above the limit
- Form should disappear
Comment 5 Pierre-Marc Thibault 2018-11-09 19:51:48 UTC
It works, but I saw the form at the final step because AllowFineOverride was set at "Allow". That's just a remainder for future reviewers.
Comment 6 Pierre-Marc Thibault 2018-11-09 19:53:25 UTC
Created attachment 82201 [details] [review]
Bug 21796: Don't unlock checkouts if restriction exists but fines are below limit

The checkout form will be removed if various conditions are
met: Restrictions, a fine above noissuescharge etc.

Bug 19933 changed the conditions, so a restriction will no longer
block checkouts, if the fines are below the set limit.

To test:

- Add a restriction
- Confirm the checkouts form is replaced by a message
- Add a fine below the noissuescharge limit
- Confirm that the form reappears
- Apply the patch
- Check that the checkout form is gone now
- Remove restriction - form should reappear
- Add to the fine, so it's above the limit
- Form should disappear

Signed-off-by: Pierre-Marc Thibault <pierre-marc.thibault@inLibro.com>
Comment 7 Katrin Fischer 2018-11-10 10:00:24 UTC
(In reply to Pierre-Marc Thibault from comment #5)
> It works, but I saw the form at the final step because AllowFineOverride was
> set at "Allow". That's just a remainder for future reviewers.

Thx for pointing this out!
Comment 8 Marcel de Rooy 2018-11-16 06:54:19 UTC
Created attachment 82377 [details] [review]
Bug 21796: Don't unlock checkouts if restriction exists but fines are below limit

The checkout form will be removed if various conditions are
met: Restrictions, a fine above noissuescharge etc.

Bug 19933 changed the conditions, so a restriction will no longer
block checkouts, if the fines are below the set limit.

To test:

- Add a restriction
- Confirm the checkouts form is replaced by a message
- Add a fine below the noissuescharge limit
- Confirm that the form reappears
- Apply the patch
- Check that the checkout form is gone now
- Remove restriction - form should reappear
- Add to the fine, so it's above the limit
- Form should disappear

Signed-off-by: Pierre-Marc Thibault <pierre-marc.thibault@inLibro.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 9 Nick Clemens 2018-11-16 13:09:54 UTC
Awesome work all!

Pushed to master for 18.11
Comment 10 Martin Renvoize 2018-11-30 14:14:33 UTC
Pushed to 18.05.x for 18.05.07
Comment 11 Fridolin Somers 2018-12-05 07:53:51 UTC
Depends on Bug 19933 not in 17.11.x
Comment 12 Andrew Fuerste-Henry 2019-01-11 14:26:38 UTC
This is sort of moot, since this is already resolved, but it looks like this bug isn't/wasn't actually allowing checkout. Koha gives you a checkout box, but when you actually try to check something out it blocks it, tells you the patron has a restriction, and doesn't give an override option.