Bug 19636 - Hold priority changes incorrectly via dropdown select
Summary: Hold priority changes incorrectly via dropdown select
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Staff interface (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low normal (vote)
Assignee: Lari Taskula
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks: 21608
  Show dependency treegraph
 
Reported: 2017-11-16 12:34 UTC by Lari Taskula
Modified: 2019-10-14 19:56 UTC (History)
2 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 19636: Hold priority changes incorrectly via dropdown select (2.55 KB, patch)
2017-11-16 12:41 UTC, Lari Taskula
Details | Diff | Splinter Review
Bug 19636: Hold priority changes incorrectly via dropdown select (2.60 KB, patch)
2017-11-17 13:31 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 19636: Hold priority changes incorrectly via dropdown select (2.68 KB, patch)
2017-12-19 16:02 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Lari Taskula 2017-11-16 12:34:20 UTC
To reproduce:

1. Place 3 holds on a record
2. See existing holds (cgi-bin/koha/reserve/request.pl?biblionumber=XXX)
3. By using the dropdown menu under "Priority" column, change the first hold's
   priority to last (3). Do not touch other priorities.
4. Click Update hold(s)
5. Observe the hold did not get your selected priority 3, but 2 instead.

I believe this happens when the form is posted and each row is individually processed one by one - and due to conflict in priority value, the latter row always gets the chosen value.

This could be solved by sorting the hold table by priority before updating the holds.
Comment 1 Lari Taskula 2017-11-16 12:41:37 UTC Comment hidden (obsolete)
Comment 2 Owen Leonard 2017-11-17 13:31:09 UTC
Created attachment 69195 [details] [review]
Bug 19636: Hold priority changes incorrectly via dropdown select

This patch sorts holds in UI after priority is changed via "Priority"
dropdown.

It fixes confusion where the form is posted and each row is individually
processed one by one - and due to conflict in priority value, the latter
row always gets the chosen value instead of what the user actually might
have wanted to change.

To reproduce:
1. Place 3 holds on a record
2. See existing holds (cgi-bin/koha/reserve/request.pl?biblionumber=XXX)
3. By using the dropdown menu under "Priority" column, change the first
   hold's priority to last (3). Do not touch other priorities.
4. Click Update hold(s)
5. Observe the hold did not get your selected priority 3, but 2 instead.

To test:
1. Apply patch
2. Place 3 holds on a record
3. See existing holds (cgi-bin/koha/reserve/request.pl?biblionumber=XXX)
4. By using the dropdown menu under "Priority" column, change the first
   hold's priority to last (3). Do not touch other priorities.
5. Observe this hold was automatically moved to the last row in the user
   interface.
6. Click Update hold(s)
7. Observe the hold has your selected priority 3.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 3 Jonathan Druart 2017-12-19 16:02:10 UTC
Created attachment 69917 [details] [review]
Bug 19636: Hold priority changes incorrectly via dropdown select

This patch sorts holds in UI after priority is changed via "Priority"
dropdown.

It fixes confusion where the form is posted and each row is individually
processed one by one - and due to conflict in priority value, the latter
row always gets the chosen value instead of what the user actually might
have wanted to change.

To reproduce:
1. Place 3 holds on a record
2. See existing holds (cgi-bin/koha/reserve/request.pl?biblionumber=XXX)
3. By using the dropdown menu under "Priority" column, change the first
   hold's priority to last (3). Do not touch other priorities.
4. Click Update hold(s)
5. Observe the hold did not get your selected priority 3, but 2 instead.

To test:
1. Apply patch
2. Place 3 holds on a record
3. See existing holds (cgi-bin/koha/reserve/request.pl?biblionumber=XXX)
4. By using the dropdown menu under "Priority" column, change the first
   hold's priority to last (3). Do not touch other priorities.
5. Observe this hold was automatically moved to the last row in the user
   interface.
6. Click Update hold(s)
7. Observe the hold has your selected priority 3.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 4 Jonathan Druart 2017-12-20 16:46:13 UTC
Pushed to master for 18.05, thanks to everybody involved!