Bug 18450 - Renew in header bypasses hold block and renewal limits
Summary: Renew in header bypasses hold block and renewal limits
Status: Failed QA
Alias: None
Product: Koha
Classification: Unclassified
Component: Circulation (show other bugs)
Version: master
Hardware: All All
: P5 - low major (vote)
Assignee: Alex Buckley
QA Contact: Testopia
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-04-18 18:35 UTC by Christopher Brannon
Modified: 2017-06-23 10:03 UTC (History)
8 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Bot Control: ---
When did the bot last check this:
Who signed the patch off:
Text to go in the release notes:


Attachments
Bug 18450 - Implemented a check to determine if the 'Override and renew' button is displayed based on the setting of the AllowRenewalLimitOverride and AllowRenewalIfOtherItemsAvaliable preferences. (4.06 KB, patch)
2017-04-18 22:50 UTC, Alex Buckley
Details | Diff | Splinter Review
Bug 18450 - Implemented a check to determine if the 'Override and renew' button is displayed based on the setting of the AllowRenewalLimitOverride and AllowRenewalIfOtherItemsAvaliable preferences. (4.23 KB, patch)
2017-04-20 08:12 UTC, Marc Véron
Details | Diff | Splinter Review
Bug 18450 - Implemented check if either AllowRenewLimitOverride or AllowRenewalIfOtherItemsAvaliable were set to allow, so the user is only blocked if both of these sysprefs are set to 'Dont allow' (3.99 KB, patch)
2017-04-28 08:56 UTC, Alex Buckley
Details | Diff | Splinter Review
Bug 18450 - Implemented check if either AllowRenewLimitOverride or AllowRenewalIfOtherItemsAvaliable were set to allow, so the user is only blocked if both of these sysprefs are set to 'Dont allow' (3.98 KB, patch)
2017-05-07 13:38 UTC, Alex Buckley
Details | Diff | Splinter Review
[SIGNED-OFF] Bug 18450 - Implemented a check to determine if the 'Override and renew' button is displayed based on the setting of the AllowRenewalLimitOverride and AllowRenewalIfOtherItemsAvaliable preferences. (4.30 KB, patch)
2017-05-09 15:03 UTC, Josef Moravec
Details | Diff | Splinter Review
[SIGNED-OFF] Bug 18450 - Implemented check if either AllowRenewLimitOverride or AllowRenewalIfOtherItemsAvaliable were set to allow, so the user is only blocked if both of these sysprefs are set to 'Dont allow' (4.05 KB, patch)
2017-05-09 15:04 UTC, Josef Moravec
Details | Diff | Splinter Review
Bug 18450 - Implemented check if either AllowRenewLimitOverride or AllowRenewalIfOtherItemsAvaliable were set to allow, so the user is only blocked if both of these sysprefs are set to 'Dont allow' (4.90 KB, patch)
2017-05-11 09:46 UTC, Alex Buckley
Details | Diff | Splinter Review
Bug 18450 - Implemented check in renew.tt for block and renewal limits (4.72 KB, patch)
2017-05-28 05:32 UTC, Alex Buckley
Details | Diff | Splinter Review
Bug 18450 - Implemented check in renew.tt for block and renewal limits (4.77 KB, patch)
2017-06-16 15:36 UTC, Lee Jamison
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Christopher Brannon 2017-04-18 18:35:59 UTC
When you renew an item on hold, it allows you to bypass the hold, even if you don't allow it elsewhere.  It also bypasses renewal limits set in Circulation Rules.

Does not honor AllowRenewalLimitOverride preference if set to Don't allow.

Does not honor AllowRenewalIfOtherItemsAvailable if set to Don't allow.
Comment 1 Alex Buckley 2017-04-18 22:50:07 UTC
Created attachment 62339 [details] [review]
Bug 18450 - Implemented a check to determine if the 'Override and renew' button is displayed based on the setting of the AllowRenewalLimitOverride and AllowRenewalIfOtherItemsAvaliable preferences.

This will display the 'Override and renew' button only if both
preferences are set to 'Allow'.

Test plan:
1. In More->Administration->Global system preferences
ensure that both the AllowRenewalLimitOverride and
AllowRenewalIfOtherItemsAvaliable preferences are both set to 'Dont allow'.
2. Place a hold on an item from a patron
3. Checkout the item out to a different patron
4. Renew the item and notice the 'Cannot renew: The item is on hold for another patron'
5. Click the 'Override and renew' button and notice that although you
can bypass the hold
6. Apply patch
7. Renew the item again and notice that the message does not have a
'Override and renew' button it just has the 'Ignore and continue' button
8. Go back to More->Administration->Global system preferences and set
AllowRenewalLimitOverride to 'Allow'
9. Try renewing the same item again and notice that the 'Override and
renew' button is still not being displayed.
10. In systems preferences now set the
AllowRenewalIfOtherItemsAvailable to 'Allow'
11. Try renewing the item again and notice that now both of these
preferences are allowed the 'Override and renew' button is displayed
because you will not be violating these preferences.

Note: Checking if the renewal exceeds the renewal level, if auto renew
is set up, or if renewal is to soon is checked earlier in this conditional
if statement earlier and so the check in this patch does not need to
check the renewal level, auto renewal, if renewal is too soon.
Comment 2 Marc Véron 2017-04-20 08:12:44 UTC
Created attachment 62447 [details] [review]
Bug 18450 - Implemented a check to determine if the 'Override and renew' button is displayed based on the setting of the AllowRenewalLimitOverride and AllowRenewalIfOtherItemsAvaliable preferences.

This will display the 'Override and renew' button only if both
preferences are set to 'Allow'.

Test plan:
1. In More->Administration->Global system preferences
ensure that both the AllowRenewalLimitOverride and
AllowRenewalIfOtherItemsAvaliable preferences are both set to 'Dont allow'.
2. Place a hold on an item from a patron
3. Checkout the item out to a different patron
4. Renew the item and notice the 'Cannot renew: The item is on hold for another patron'
5. Click the 'Override and renew' button and notice that although you
can bypass the hold
6. Apply patch
7. Renew the item again and notice that the message does not have a
'Override and renew' button it just has the 'Ignore and continue' button
8. Go back to More->Administration->Global system preferences and set
AllowRenewalLimitOverride to 'Allow'
9. Try renewing the same item again and notice that the 'Override and
renew' button is still not being displayed.
10. In systems preferences now set the
AllowRenewalIfOtherItemsAvailable to 'Allow'
11. Try renewing the item again and notice that now both of these
preferences are allowed the 'Override and renew' button is displayed
because you will not be violating these preferences.

Note: Checking if the renewal exceeds the renewal level, if auto renew
is set up, or if renewal is to soon is checked earlier in this conditional
if statement earlier and so the check in this patch does not need to
check the renewal level, auto renewal, if renewal is too soon.

Folloed test plan, works as expected.
Signed-off-by: Marc Véron <veron@veron.ch>
Comment 3 Christopher Brannon 2017-04-21 23:02:31 UTC
Sorry, found a wrinkle.

With AllowRenewalLimitOverride set to Don't allow and AllowRenewalIfOtherItemsAvailable set to Allow and you haven't hit the renewal limit, you are still blocked with the hold in place.
Comment 4 Christopher Brannon 2017-04-21 23:03:31 UTC
Test needs to be updated to include all combinations of these two settings.
Comment 5 Alex Buckley 2017-04-28 08:56:49 UTC
Created attachment 62811 [details] [review]
Bug 18450 - Implemented check if either AllowRenewLimitOverride or AllowRenewalIfOtherItemsAvaliable were set to allow, so the user is only blocked if both of these sysprefs are set to 'Dont allow'

Test plan:
1. In More->Administration->Global system preferences
ensure that both the AllowRenewalLimitOverride and
AllowRenewalIfOtherItemsAvaliable preferences are both set to 'Dont
allow'.
2. Place a hold on an item from a patron
3. Checkout the item out to a different patron
4. Renew the item and notice the 'Cannot renew: The item is on hold for
another patron' warning
5. Click the 'Override and renew' button and notice that you
can bypass the hold
6. Apply patch
7. Renew the item again and notice that the message does not have a
'Override and renew' button it just has the 'Ignore and continue' button
8. Go back to More->Administration->Global system preferences and set
AllowRenewalLimitOverride to 'Allow'
9. Try renewing the same item again and notice that the 'Override and
renew' button is displayed
10. In systems preferences now set the
AllowRenewalIfOtherItemsAvailable syspref to 'Allow' and
AllowRenewalLimitOverride to 'Dont allow' and notice the 'Override and
renew' button is displayed
11. Now set both these sysprefs to 'Allow' and notice the 'Override and renew' button is displayed
because you will not be violating these preferences.

Note: Checking if the renewal exceeds the renewal level, if auto renew
is set up, or if renewal is to soon is checked earlier in this
conditional
if statement earlier and so the check in this patch does not need to
check the renewal level, auto renewal, if renewal is too soon.
Comment 6 Josef Moravec 2017-05-04 06:45:49 UTC
Comment on attachment 62811 [details] [review]
Bug 18450 - Implemented check if either AllowRenewLimitOverride or AllowRenewalIfOtherItemsAvaliable were set to allow, so the user is only blocked if both of these sysprefs are set to 'Dont allow'

Review of attachment 62811 [details] [review]:
-----------------------------------------------------------------

::: koha-tmpl/intranet-tmpl/prog/en/modules/circ/renew.tt
@@ +119,5 @@
> +                                       <input type="hidden" name="override_limit" value="1" />
> +                                       <input type="hidden" name="override_holds" value="1" />
> +                                       <button type="submit" class="approve"><i class="fa fa-check"></i> Override and renew</button>
> +                                     </form>
> +                                [% ELSIF ((Koha.Preference('AllowRenewalLimitOverride')) && !(Koha.Preference('AllowRenewalIfOtherItemsAvai    lable'))) %]

wrong copy paste in AllowRenewalIfOtherItemsAvailable preference name
Comment 7 Alex Buckley 2017-05-07 13:38:32 UTC
Created attachment 63226 [details] [review]
Bug 18450 - Implemented check if either AllowRenewLimitOverride or AllowRenewalIfOtherItemsAvaliable were set to allow, so the user is only blocked if both of these sysprefs are set to 'Dont allow'

Test plan:
1. In More->Administration->Global system preferences
ensure that both the AllowRenewalLimitOverride and
AllowRenewalIfOtherItemsAvaliable preferences are both set to 'Dont
allow'.
2. Place a hold on an item from a patron
3. Checkout the item out to a different patron
4. Renew the item and notice the 'Cannot renew: The item is on hold for
another patron' warning
5. Click the 'Override and renew' button and notice that you
can bypass the hold
6. Apply patch
7. Renew the item again and notice that the message does not have a
'Override and renew' button it just has the 'Ignore and continue' button
8. Go back to More->Administration->Global system preferences and set
AllowRenewalLimitOverride to 'Allow'
9. Try renewing the same item again and notice that the 'Override and
renew' button is displayed
10. In systems preferences now set the
AllowRenewalIfOtherItemsAvailable syspref to 'Allow' and
AllowRenewalLimitOverride to 'Dont allow' and notice the 'Override and
renew' button is displayed
11. Now set both these sysprefs to 'Allow' and notice the 'Override and renew' button is displayed
because you will not be violating these preferences.

Note: Checking if the renewal exceeds the renewal level, if auto renew
is set up, or if renewal is to soon is checked earlier in this
conditional
if statement earlier and so the check in this patch does not need to
check the renewal level, auto renewal, if renewal is too soon.
Comment 8 Alex Buckley 2017-05-07 13:40:45 UTC
(In reply to  Josef Moravec  in comment 6)

Thanks Josef.

I have fixed up that issue now
Comment 9 Josef Moravec 2017-05-09 15:03:27 UTC
Created attachment 63292 [details] [review]
[SIGNED-OFF] Bug 18450 - Implemented a check to determine if the 'Override and renew' button is displayed based on the setting of the AllowRenewalLimitOverride and AllowRenewalIfOtherItemsAvaliable preferences.

This will display the 'Override and renew' button only if both
preferences are set to 'Allow'.

Test plan:
1. In More->Administration->Global system preferences
ensure that both the AllowRenewalLimitOverride and
AllowRenewalIfOtherItemsAvaliable preferences are both set to 'Dont allow'.
2. Place a hold on an item from a patron
3. Checkout the item out to a different patron
4. Renew the item and notice the 'Cannot renew: The item is on hold for another patron'
5. Click the 'Override and renew' button and notice that although you
can bypass the hold
6. Apply patch
7. Renew the item again and notice that the message does not have a
'Override and renew' button it just has the 'Ignore and continue' button
8. Go back to More->Administration->Global system preferences and set
AllowRenewalLimitOverride to 'Allow'
9. Try renewing the same item again and notice that the 'Override and
renew' button is still not being displayed.
10. In systems preferences now set the
AllowRenewalIfOtherItemsAvailable to 'Allow'
11. Try renewing the item again and notice that now both of these
preferences are allowed the 'Override and renew' button is displayed
because you will not be violating these preferences.

Note: Checking if the renewal exceeds the renewal level, if auto renew
is set up, or if renewal is to soon is checked earlier in this conditional
if statement earlier and so the check in this patch does not need to
check the renewal level, auto renewal, if renewal is too soon.

Folloed test plan, works as expected.
Signed-off-by: Marc Véron <veron@veron.ch>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 10 Josef Moravec 2017-05-09 15:04:14 UTC
Created attachment 63293 [details] [review]
[SIGNED-OFF] Bug 18450 - Implemented check if either AllowRenewLimitOverride or AllowRenewalIfOtherItemsAvaliable were set to allow, so the user is only blocked if both of these sysprefs are set to 'Dont allow'

Test plan:
1. In More->Administration->Global system preferences
ensure that both the AllowRenewalLimitOverride and
AllowRenewalIfOtherItemsAvaliable preferences are both set to 'Dont
allow'.
2. Place a hold on an item from a patron
3. Checkout the item out to a different patron
4. Renew the item and notice the 'Cannot renew: The item is on hold for
another patron' warning
5. Click the 'Override and renew' button and notice that you
can bypass the hold
6. Apply patch
7. Renew the item again and notice that the message does not have a
'Override and renew' button it just has the 'Ignore and continue' button
8. Go back to More->Administration->Global system preferences and set
AllowRenewalLimitOverride to 'Allow'
9. Try renewing the same item again and notice that the 'Override and
renew' button is displayed
10. In systems preferences now set the
AllowRenewalIfOtherItemsAvailable syspref to 'Allow' and
AllowRenewalLimitOverride to 'Dont allow' and notice the 'Override and
renew' button is displayed
11. Now set both these sysprefs to 'Allow' and notice the 'Override and renew' button is displayed
because you will not be violating these preferences.

Note: Checking if the renewal exceeds the renewal level, if auto renew
is set up, or if renewal is to soon is checked earlier in this
conditional
if statement earlier and so the check in this patch does not need to
check the renewal level, auto renewal, if renewal is too soon.

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 11 Jonathan Druart 2017-05-09 18:50:12 UTC
If I do not misread the second patch, we have:

IF NOT A AND  B:
  Do stuff
ELSIF A AND NOT B:
  Do the same stuff

If that the case, we can simplify with:

IT NOT A AND B
    OR A AND NOT B:
  Do the stuff
Comment 12 Alex Buckley 2017-05-11 09:46:58 UTC
Created attachment 63377 [details] [review]
Bug 18450 - Implemented check if either AllowRenewLimitOverride or AllowRenewalIfOtherItemsAvaliable were set to allow, so the user is only blocked if both of these sysprefs are set to 'Dont allow'

Test plan:
1. In More->Administration->Global system preferences
ensure that both the AllowRenewalLimitOverride and
AllowRenewalIfOtherItemsAvaliable preferences are both set to 'Dont
allow'.
2. Place a hold on an item from a patron
3. Checkout the item out to a different patron
4. Renew the item and notice the 'Cannot renew: The item is on hold for
another patron' warning
5. Click the 'Override and renew' button and notice that you
can bypass the hold
6. Apply patch
7. Renew the item again and notice that the message does not have a
'Override and renew' button it just has the 'Ignore and continue' button
8. Go back to More->Administration->Global system preferences and set
AllowRenewalLimitOverride to 'Allow'
9. Try renewing the same item again and notice that the 'Override and
renew' button is displayed
10. In systems preferences now set the
AllowRenewalIfOtherItemsAvailable syspref to 'Allow' and
AllowRenewalLimitOverride to 'Dont allow' and notice the 'Override and
renew' button is displayed
11. Now set both these sysprefs to 'Allow' and notice the 'Override and renew' button is displayed
because you will not be violating these preferences.

Note: Checking if the renewal exceeds the renewal level, if auto renew
is set up, or if renewal is to soon is checked earlier in this
conditional
if statement earlier and so the check in this patch does not need to
check the renewal level, auto renewal, if renewal is too soon.

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 13 Alex Buckley 2017-05-11 09:49:38 UTC
I have just squashed the two previous patches into 1 and attached it to this bug report, and as Jonathan suggested in comment 11 I have implemented the following logic in the renew.tt file:

IT NOT A AND B
    OR A AND NOT B:
  Do the stuff
Comment 14 Jonathan Druart 2017-05-18 19:04:56 UTC
Nope, the last patch does:
IF A AND B:
  Do the stuffs
ELSIF ( NOT A AND B ) OR ( A AND NOT B ):
  Do the same stuffs

Alex, could you submit another patch replacing this one, update the commit message with a shorter first line (ideally should be < 80chars), remove the signed-off by line and switch the status to "Needs Signoff" please?
Comment 15 Alex Buckley 2017-05-28 05:32:19 UTC
Created attachment 63764 [details] [review]
Bug 18450 - Implemented check in renew.tt for block and renewal limits

Test plan:
1. In More->Administration->Global system preferences
ensure that both the AllowRenewalLimitOverride and
AllowRenewalIfOtherItemsAvaliable preferences are both set to 'Dont
allow'.
2. Place a hold on an item from a patron
3. Checkout the item out to a different patron
4. Renew the item and notice the 'Cannot renew: The item is on hold for
another patron' warning
5. Click the 'Override and renew' button and notice that you
can bypass the hold
6. Apply patch
7. Renew the item again and notice that the message does not have a
'Override and renew' button it just has the 'Ignore and continue' button
8. Go back to More->Administration->Global system preferences and set
AllowRenewalLimitOverride to 'Allow'
9. Try renewing the same item again and notice that the 'Override and
renew' button is displayed
10. In systems preferences now set the
AllowRenewalIfOtherItemsAvailable syspref to 'Allow' and
AllowRenewalLimitOverride to 'Dont allow' and notice the 'Override and
renew' button is displayed
11. Now set both these sysprefs to 'Allow' and notice the 'Override and renew' button is displayed
because you will not be violating these preferences.

Note: Checking if the renewal exceeds the renewal level, if auto renew
is set up, or if renewal is to soon is checked earlier in this
conditional
if statement earlier and so the check in this patch does not need to
check the renewal level, auto renewal, if renewal is too soon.
Comment 16 Alex Buckley 2017-05-28 05:34:10 UTC
Hi Jonathan 

I have done what you asked in comment 14. Were you happy with the if statement logic in the renew.tt file being this:

IF A AND B:
  Do the stuffs
ELSIF ( NOT A AND B ) OR ( A AND NOT B ):
  Do the same stuffs
Comment 17 Lee Jamison 2017-06-16 15:36:41 UTC
Created attachment 64402 [details] [review]
Bug 18450 - Implemented check in renew.tt for block and renewal limits

Test plan:
1. In More->Administration->Global system preferences
ensure that both the AllowRenewalLimitOverride and
AllowRenewalIfOtherItemsAvaliable preferences are both set to 'Dont
allow'.
2. Place a hold on an item from a patron
3. Checkout the item out to a different patron
4. Renew the item and notice the 'Cannot renew: The item is on hold for
another patron' warning
5. Click the 'Override and renew' button and notice that you
can bypass the hold
6. Apply patch
7. Renew the item again and notice that the message does not have a
'Override and renew' button it just has the 'Ignore and continue' button
8. Go back to More->Administration->Global system preferences and set
AllowRenewalLimitOverride to 'Allow'
9. Try renewing the same item again and notice that the 'Override and
renew' button is displayed
10. In systems preferences now set the
AllowRenewalIfOtherItemsAvailable syspref to 'Allow' and
AllowRenewalLimitOverride to 'Dont allow' and notice the 'Override and
renew' button is displayed
11. Now set both these sysprefs to 'Allow' and notice the 'Override and renew' button is displayed
because you will not be violating these preferences.

Note: Checking if the renewal exceeds the renewal level, if auto renew
is set up, or if renewal is to soon is checked earlier in this
conditional
if statement earlier and so the check in this patch does not need to
check the renewal level, auto renewal, if renewal is too soon.

Signed-off-by: Lee Jamison <ldjamison@marywood.edu>
Comment 18 Nick Clemens 2017-06-23 10:03:51 UTC
Two things here:
1 - 'AllowRenewalIfOtherItemsAvailable' - we need to check if other items are available - a record with 1 item with a hold and checked out should not be renewable (it is currently)
2 - As Jonathan mentioned in comment #11 - if we are doing the same stuff we can do "IF A OR B OR C { stuff }" - no need for if/elsif