Bug 35771 - Unselecting titles when making multi-hold does not have any effect
Summary: Unselecting titles when making multi-hold does not have any effect
Status: Signed Off
Alias: None
Product: Koha
Classification: Unclassified
Component: Hold requests (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal (vote)
Assignee: Katariina Pohto
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-01-11 08:29 UTC by Anneli Österman
Modified: 2024-06-26 00:56 UTC (History)
5 users (show)

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


Attachments
One title unselected (30.11 KB, image/png)
2024-01-11 08:29 UTC, Anneli Österman
Details
Hold is made for all the titles even when one was unselected (55.28 KB, image/png)
2024-01-11 08:30 UTC, Anneli Österman
Details
Bug 35771: Unselecting titles when making multi-hold does not have any effect (3.41 KB, patch)
2024-05-15 14:06 UTC, Katariina Pohto
Details | Diff | Splinter Review
Bug 35771: Unselecting titles when making multi-hold (3.43 KB, patch)
2024-05-21 14:36 UTC, Katariina Pohto
Details | Diff | Splinter Review
Bug 35771: Unselecting titles when making multi-hold (3.47 KB, patch)
2024-05-23 05:11 UTC, David Nind
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Anneli Österman 2024-01-11 08:29:19 UTC
Created attachment 160810 [details]
One title unselected

When you make multi-hold and unselect one or some of the titles shown in the multi-hold page and then save the holds assuming that hold is made only for the selected titles. However, holds are made for all the titles regardless of the selection.
Comment 1 Anneli Österman 2024-01-11 08:30:34 UTC
Created attachment 160811 [details]
Hold is made for all the titles even when one was unselected

Hold is made for all the titles even when one title was unselected.
Comment 2 Katariina Pohto 2024-05-14 14:57:42 UTC
The process can be repeated like this:
1. Select several biblios and choose Place hold
2. Choose a patron
3. Select a pickup location for all biblios and deselect one of the checkmarks
4. Place holds and note that even the deselected holds was placed.

I looked into the code and noticed that the biblionumbers passed on to placerequest.pl come from hidden input fields that have no connection to the checkmark fields. This also means that the form validation will not care about invalid information on the unchecked biblios, which results in errors at least when unchecked biblio doesn't have a pickup location set:
1. Select several biblios and click Place hold
2. Choose a patron
3. Deselect one of the biblio checkmarks and leave the pickup location empty for that biblio.
4. Place holds and end up on an error page.
Comment 3 Katariina Pohto 2024-05-15 14:06:01 UTC
Created attachment 166780 [details] [review]
Bug 35771: Unselecting titles when making multi-hold does not have any effect

This patch moves the holdable_bibs id and value to the checkmark input. It doesn't do the same for the club multihold (which probably should be added), and doesn't change the <input name="biblionumber"> field which lists the biblios that end up on the URL query.

It might also be beneficial to change the placerequest.pl's redirect to request.pl to use the holdable_bibs list instead of the biblionumber list, so the unselected biblio wouldn't appear on request.pl page after the holds are placed

Test plan:
1. Select several biblios and choose Place hold
2. Choose a patron
3. Select a pickup location for all biblios and unselect one of the checkmarks
4. Place holds and note that even the deselected holds was placed.
5. Repeat steps 1-2.
6. Leave pickup locations empty and try to place the holds.
7. Note alert: "Please make sure all selected titles have a pickup location set"
8. Uncheck one of the biblios and add pickup locations to the checked biblios.
9. Try to place the holds and note that there is no alert, and you get an error 500.
10. Apply patch.
11. Repeat steps 1,2,8 and place holds.
12. Note that there is no error 500, and while all the biblios are shown on page, only the checked biblios have a new hold placed on them.
Comment 4 Lucas Gass 2024-05-15 14:34:55 UTC
With this patch applied I cannot place multi-hold's at all. 

I think we should also fix the problem of multiple ID's ( #holdable_bibs ) on the same page.
Comment 5 Katariina Pohto 2024-05-16 06:55:43 UTC
(In reply to Lucas Gass from comment #4)
> With this patch applied I cannot place multi-hold's at all. 
> 
> I think we should also fix the problem of multiple ID's ( #holdable_bibs )
> on the same page.

The changes worked on my test version but I don't have a completely working community version, so couldn't test there, I just did the same changes to the community file. It wouldn't be a complete fix anyway.

And I did wonder about those multiple IDs myself. There's the three different input fields for each biblionumber one the page, and the checkbox one doesn't effect the others at all. Currently we've just hidden the checkboxes so people don't try to unselect them.
Comment 6 Katariina Pohto 2024-05-21 14:36:10 UTC
Created attachment 166977 [details] [review]
Bug 35771: Unselecting titles when making multi-hold

I had dropped out the name attribute, which might be the reason for the patch failing.

New patch with the same steps as previously.

Someone else should pick up on this and check the club multi-hold too, and get rid of the multiple IDs, I wont be able to work on this further.
Comment 7 David Nind 2024-05-23 05:11:46 UTC
Created attachment 167060 [details] [review]
Bug 35771: Unselecting titles when making multi-hold

When placing a hold on multiple biblios Place Holds page (request.pl) has checkboxes for unselecting some of the listed biblios.
Removing the checkmark does not actually unselect the biblio. Clicking the Place holds button will place a hold for all the biblios on page that can be reserved.
If unchecked biblio does not have a pickup location, it will get past form validation and cause an error.

Test plan:
1. Select several biblios and choose Place hold
2. Choose a patron
3. Select a pickup location for all biblios and unselect one of the checkmarks
4. Place holds and note that even the deselected holds was placed.
5. Repeat steps 1-2.
6. Leave pickup locations empty and try to place the holds.
7. Note alert: "Please make sure all selected titles have a pickup location set"
8. Uncheck one of the biblios and add pickup locations to the checked biblios.
9. Try to place the holds and note that there is no alert, and you get an error 500.
10. Apply patch.
11. Repeat steps 1,2,8 and place holds.
12. Note that there is no error 500, and while all the biblios are shown on page, only the checked biblios have a new hold placed on them.

Signed-off-by: David Nind <david@davidnind.com>
Comment 8 David Nind 2024-05-23 05:20:07 UTC
I've signed off as everything now seems to work as per the test plan.

For items that are listed, but where the holds are not placed (where an item was unselected), the message shown is "There are no holds on this title.".

Ideally, this should say something "No hold placed for this title", or something similar.