Bug 18076 - Error when placing a hold and holds per record is set to 999
Summary: Error when placing a hold and holds per record is set to 999
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Hold requests (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal (vote)
Assignee: Jonathan Druart
QA Contact: Testopia
URL:
Keywords:
Depends on: 14695
Blocks:
  Show dependency treegraph
 
Reported: 2017-02-07 22:17 UTC by Katrin Fischer
Modified: 2018-06-04 20:10 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 18076: Replace holds_to_place_count with an input type=text (2.56 KB, patch)
2017-02-08 15:54 UTC, Jonathan Druart
Details | Diff | Splinter Review
[SIGNED OFF] Bug 18076: Replace holds_to_place_count with an input type=text (2.63 KB, patch)
2017-02-08 21:49 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 18076: Replace holds_to_place_count with an input type=text (2.67 KB, patch)
2017-02-14 13:04 UTC, Nick Clemens
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Katrin Fischer 2017-02-07 22:17:14 UTC
Ran into something odd today: When you have a 'holds per record' setting of 999 in your circulation conditions and try to place a hold in the staff client, you will get an 'internal server error' under Plack after looking up the patron to place the hold for.

To test:
- Set circulation conditions - holds per record = 999
- Search for record with items
- Go to the holds tab
- Search for a patron
- Verify that when you send your search, the 'internal server error' is shown

The plack error logs show:
Template process failed: undef error - WHILE loop terminated (> 1000 iterations)

This has been verified on 2 different 16.11.x and on master.
Comment 1 Jonathan Druart 2017-02-08 15:47:03 UTC
From http://www.template-toolkit.org/docs/manual/Directives.html#section_WHILE

"""
The Template Toolkit uses a failsafe counter to prevent runaway WHILE loops which would otherwise never terminate. If the loop exceeds 1000 iterations then an undef exception will be thrown, reporting the error:

WHILE loop terminated (> 1000 iterations)

The $Template::Directive::WHILE_MAX variable controls this behaviour and can be set to a higher value if necessary. 
"""

I do not think we want to increase this value, and I do not think we want to display a dropdown list with 1000 entries.
I'd suggest to replace it with an input box (type=number).
Comment 2 Katrin Fischer 2017-02-08 15:48:33 UTC
+1 for the input box.
Comment 3 Jonathan Druart 2017-02-08 15:54:19 UTC
Created attachment 60021 [details] [review]
Bug 18076: Replace holds_to_place_count with an input type=text

From http://www.template-toolkit.org/docs/manual/Directives.html#section_WHILE

"""
The Template Toolkit uses a failsafe counter to prevent runaway WHILE loops which
 would otherwise never terminate. If the loop exceeds 1000 iterations then an undef
exception will be thrown, reporting the error:

WHILE loop terminated (> 1000 iterations)

The $Template::Directive::WHILE_MAX variable controls this behaviour and can be set
to a higher value if necessary.
"""

I do not think we want to increase this value, and I do not think we want to display a
dropdown list with 1000 entries.

This patch replaces the dropdown list with an input text.

Test plan:
- Set circulation conditions - holds per record = 999
- Search for record with items
- Go to the holds tab
- Search for a patron
- Verify that when you send your search, the 'internal server error' is not shown
and you see the input text.
You should be able to enter a value > than 999 and < 1
Comment 4 Katrin Fischer 2017-02-08 21:49:12 UTC
Created attachment 60041 [details] [review]
[SIGNED OFF] Bug 18076: Replace holds_to_place_count with an input type=text

From http://www.template-toolkit.org/docs/manual/Directives.html#section_WHILE

"""
The Template Toolkit uses a failsafe counter to prevent runaway WHILE loops which
 would otherwise never terminate. If the loop exceeds 1000 iterations then an undef
exception will be thrown, reporting the error:

WHILE loop terminated (> 1000 iterations)

The $Template::Directive::WHILE_MAX variable controls this behaviour and can be set
to a higher value if necessary.
"""

I do not think we want to increase this value, and I do not think we want to display a
dropdown list with 1000 entries.

This patch replaces the dropdown list with an input text.

Test plan:
- Set circulation conditions - holds per record = 999
- Search for record with items
- Go to the holds tab
- Search for a patron
- Verify that when you send your search, the 'internal server error' is not shown
and you see the input text.
You should be able to enter a value > than 999 and < 1

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 5 Nick Clemens 2017-02-14 13:04:41 UTC
Created attachment 60201 [details] [review]
Bug 18076: Replace holds_to_place_count with an input type=text

From http://www.template-toolkit.org/docs/manual/Directives.html#section_WHILE

"""
The Template Toolkit uses a failsafe counter to prevent runaway WHILE loops which
 would otherwise never terminate. If the loop exceeds 1000 iterations then an undef
exception will be thrown, reporting the error:

WHILE loop terminated (> 1000 iterations)

The $Template::Directive::WHILE_MAX variable controls this behaviour and can be set
to a higher value if necessary.
"""

I do not think we want to increase this value, and I do not think we want to display a
dropdown list with 1000 entries.

This patch replaces the dropdown list with an input text.

Test plan:
- Set circulation conditions - holds per record = 999
- Search for record with items
- Go to the holds tab
- Search for a patron
- Verify that when you send your search, the 'internal server error' is not shown
and you see the input text.
You should be able to enter a value > than 999 and < 1

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 6 Kyle M Hall 2017-02-14 13:51:19 UTC
Pushed to master for 17.05, thanks Jonathan!
Comment 7 Katrin Fischer 2017-02-14 19:31:46 UTC
This patch has been pushed to 16.11.x and will be in 16.11.04.