Bug 23575 - Template error causes item search to be submitted multiple times
Summary: Template error causes item search to be submitted multiple times
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Templates (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: Owen Leonard
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks: 23543 23565
  Show dependency treegraph
 
Reported: 2019-09-09 16:55 UTC by Owen Leonard
Modified: 2020-06-04 20:34 UTC (History)
2 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
19.11.00,19.05.04
Circulation function:


Attachments
Bug 23575: Template error causes item search to be submitted multiple times (2.05 KB, patch)
2019-09-09 17:25 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 23575: Template error causes item search to be submitted multiple times (2.10 KB, patch)
2019-09-11 13:02 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 23575: Template error causes item search to be submitted multiple times (2.15 KB, patch)
2019-09-13 19:53 UTC, Bouzid Fergani
Details | Diff | Splinter Review
Bug 23575: Template error causes item search to be submitted multiple times (2.21 KB, patch)
2019-09-15 20:30 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Owen Leonard 2019-09-09 16:55:06 UTC
The submit handler for the item search form has been accidentally nested inside a function which loops through the <select> forms on the page. This means the submitForm() function fires 8 times.
Comment 1 Owen Leonard 2019-09-09 17:25:34 UTC
Created attachment 92672 [details] [review]
Bug 23575: Template error causes item search to be submitted multiple times

This patch corrects the item search template so that the submit handler
is not nested inside an unrelated loop. The change should have no
outward effect on the behavior of the item search other than making it
faster.

To observe the bug in action, open your browser's developer tools and
click the "Network" tab. Filter the output to only "XHR" and perform an
item search. You should see multiple requests.

To test, apply the patch and perform an item search. It should behave
normally.

Check the browser's "Network" monitor again to verify that only one
request is being sent.
Comment 2 Lucas Gass (lukeg) 2019-09-11 13:02:40 UTC
Created attachment 92709 [details] [review]
Bug 23575: Template error causes item search to be submitted multiple times

This patch corrects the item search template so that the submit handler
is not nested inside an unrelated loop. The change should have no
outward effect on the behavior of the item search other than making it
faster.

To observe the bug in action, open your browser's developer tools and
click the "Network" tab. Filter the output to only "XHR" and perform an
item search. You should see multiple requests.

To test, apply the patch and perform an item search. It should behave
normally.

Check the browser's "Network" monitor again to verify that only one
request is being sent.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 3 Bouzid Fergani 2019-09-13 19:53:07 UTC
Created attachment 92820 [details] [review]
Bug 23575: Template error causes item search to be submitted multiple times

This patch corrects the item search template so that the submit handler
is not nested inside an unrelated loop. The change should have no
outward effect on the behavior of the item search other than making it
faster.

To observe the bug in action, open your browser's developer tools and
click the "Network" tab. Filter the output to only "XHR" and perform an
item search. You should see multiple requests.

To test, apply the patch and perform an item search. It should behave
normally.

Check the browser's "Network" monitor again to verify that only one
request is being sent.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Bouzid Fergani <bouzid.fergani@inlibro.com>
Comment 4 Katrin Fischer 2019-09-15 20:30:24 UTC
Created attachment 92822 [details] [review]
Bug 23575: Template error causes item search to be submitted multiple times

This patch corrects the item search template so that the submit handler
is not nested inside an unrelated loop. The change should have no
outward effect on the behavior of the item search other than making it
faster.

To observe the bug in action, open your browser's developer tools and
click the "Network" tab. Filter the output to only "XHR" and perform an
item search. You should see multiple requests.

To test, apply the patch and perform an item search. It should behave
normally.

Check the browser's "Network" monitor again to verify that only one
request is being sent.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Bouzid Fergani <bouzid.fergani@inlibro.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 5 Katrin Fischer 2019-09-15 20:30:38 UTC
Excellent catch, Owen!
Comment 6 Martin Renvoize (ashimema) 2019-09-17 11:40:49 UTC
Nice work!

Pushed to master for 19.11.00
Comment 7 Fridolin Somers 2019-09-19 15:58:39 UTC
Pushed to 19.05.x for 19.05.04

Great job, what a dirty bug ;)
Comment 8 Lucas Gass (lukeg) 2019-10-17 19:24:04 UTC
backported to 18.11.x for 18.11.11