[Bug 38251] New: "Remove selected items" button not removing items in OPAC lists
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38251 Bug ID: 38251 Summary: "Remove selected items" button not removing items in OPAC lists Change sponsored?: --- Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: normal Priority: P5 - low Component: Lists Assignee: koha-bugs@lists.koha-community.org Reporter: dcook@prosentient.com.au QA Contact: testopia@bugs.koha-community.org CC: m.de.rooy@rijksmuseum.nl For some reason you can't remove items from lists in the OPAC using the "Remove selected items" button. You can individually remove items from lists using the "Remove from this list" link though. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38251 Phil Ringnalda <phil@chetcolibrary.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |phil@chetcolibrary.org --- Comment #1 from Phil Ringnalda <phil@chetcolibrary.org> --- You can remove items, what you can't do is remove an item: one fails, two or more works. https://git.koha-community.org/Koha-community/Koha/src/commit/e74f10042d78a9... thinks that if selected_titles.size() == 1 that means you clicked the Remove from this list and it can just stuff the biblionumber in its hidden form and submit that, but biblionumber isn't defined if you checked one checkbox and used Remove selected items. Bonus, in #L967 single_bib is always undefined, it's a Reference error, so no matter what you do and whether it works or not you get a nice JS error in the console. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38251 --- Comment #2 from David Cook <dcook@prosentient.com.au> --- You're a legend, Phil. Thanks for troubleshooting that further. I love finding bugs when testing bug fixes for other things... 😭 -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38251 Phil Ringnalda <phil@chetcolibrary.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |37150 Summary|"Remove selected items" |"Remove selected items" |button not removing items |button not removing single |in OPAC lists |item in OPAC lists Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37150 [Bug 37150] Can't delete single title from a list using the "Remove from list" link -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38251 Phil Ringnalda <phil@chetcolibrary.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |phil@chetcolibrary.org |ity.org | --- Comment #3 from Phil Ringnalda <phil@chetcolibrary.org> --- Ah, git archaeology failed me for the origin of the single_bib thing because it actually came from the obsoleted attachment 167965 for bug 37150, though it landed in a followup to bug 36557, because working on two patches to the same bit of code at the same time is hard. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38251 --- Comment #4 from Phil Ringnalda <phil@chetcolibrary.org> --- (In reply to David Cook from comment #2)
I love finding bugs when testing bug fixes for other things... 😭
Oh, like bug 38268? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38251 Phil Ringnalda <phil@chetcolibrary.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38251 --- Comment #5 from Phil Ringnalda <phil@chetcolibrary.org> --- Created attachment 173308 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=173308&action=edit Bug 38251: Make 'Remove selected items' button work when there is one item There are two ways to remove items from a list: you can remove a single item by clicking a 'Remove from this list' button below the item, or you can remove one or more items by checking the checkboxes for them and clicking the 'Remove selected items' button. Bug 37150 needed to fix 'Remove from this list' for CSRF, because in the wild old days it just triggered a GET to delete, and instead it needed to POST. The first patch to do that defined the JS var single_bib, checked the checkbox for that bib and submitted the form, as though you had used the checkbox yourself. But if you cancelled the confirmation prompt, it would need to uncheck the checkbox it checked, so it added a function to do that if (single_bib). That patch didn't land. What landed instead was a patch with a separate hidden form that could be populated with the single biblionumber from 'Remove from this list', but without single_bib to define that state, it used selected_titles.size() == 1 as the condition to use the hidden form, forgetting that when the user checks a single checkbox, selected_titles.size() is also 1. The right condition is the same one used to tell where to get the titles for the confirmation dialog: if the click event passed along a biblionumber, it's 'Remove from this list.' Since checking that sets var biblionumber, we can just use that being truthy as the condition. Test plan: 1. Without the patch, open the OPAC and log in 2. Add any two biblios to a new list 3. Lists - {your list name} 4. Click the checkbox for one of the items, click 'Remove selected items' and click 'Yes, remove from list' in the confirmation dialog 5. Note that it wasn't removed 6. Click the checkboxes for both items, click 'Remove selected items' and click 'Yes, remove from list' in the confirmation dialog 7. Note that both were removed 8. Apply patch, restart_all 9. Add any four items to your list 10. Lists - {your list name} 11. For the first item, click the 'Remove from this list' button below the details for the item, confirm, make sure it was deleted 12. Click the checkbox for what's now the first item, click 'Remove from this list,' confirm, make sure it was deleted 13. Click the checkboxes for what are now the first two items, click 'Remove from this list,' confirm, make sure both were deleted Sponsored-by: Chetco Community Public Library -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38251 Roman Dolny <roman.dolny@jezuici.pl> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38251 Roman Dolny <roman.dolny@jezuici.pl> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #173308|0 |1 is obsolete| | --- Comment #6 from Roman Dolny <roman.dolny@jezuici.pl> --- Created attachment 173411 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=173411&action=edit Bug 38251: Make 'Remove selected items' button work when there is one item There are two ways to remove items from a list: you can remove a single item by clicking a 'Remove from this list' button below the item, or you can remove one or more items by checking the checkboxes for them and clicking the 'Remove selected items' button. Bug 37150 needed to fix 'Remove from this list' for CSRF, because in the wild old days it just triggered a GET to delete, and instead it needed to POST. The first patch to do that defined the JS var single_bib, checked the checkbox for that bib and submitted the form, as though you had used the checkbox yourself. But if you cancelled the confirmation prompt, it would need to uncheck the checkbox it checked, so it added a function to do that if (single_bib). That patch didn't land. What landed instead was a patch with a separate hidden form that could be populated with the single biblionumber from 'Remove from this list', but without single_bib to define that state, it used selected_titles.size() == 1 as the condition to use the hidden form, forgetting that when the user checks a single checkbox, selected_titles.size() is also 1. The right condition is the same one used to tell where to get the titles for the confirmation dialog: if the click event passed along a biblionumber, it's 'Remove from this list.' Since checking that sets var biblionumber, we can just use that being truthy as the condition. Test plan: 1. Without the patch, open the OPAC and log in 2. Add any two biblios to a new list 3. Lists - {your list name} 4. Click the checkbox for one of the items, click 'Remove selected items' and click 'Yes, remove from list' in the confirmation dialog 5. Note that it wasn't removed 6. Click the checkboxes for both items, click 'Remove selected items' and click 'Yes, remove from list' in the confirmation dialog 7. Note that both were removed 8. Apply patch, restart_all 9. Add any four items to your list 10. Lists - {your list name} 11. For the first item, click the 'Remove from this list' button below the details for the item, confirm, make sure it was deleted 12. Click the checkbox for what's now the first item, click 'Remove from this list,' confirm, make sure it was deleted 13. Click the checkboxes for what are now the first two items, click 'Remove from this list,' confirm, make sure both were deleted Sponsored-by: Chetco Community Public Library Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38251 Martin Renvoize (ashimema) <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #173411|0 |1 is obsolete| | --- Comment #7 from Martin Renvoize (ashimema) <martin.renvoize@ptfs-europe.com> --- Created attachment 173435 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=173435&action=edit Bug 38251: Make 'Remove selected items' button work when there is one item There are two ways to remove items from a list: you can remove a single item by clicking a 'Remove from this list' button below the item, or you can remove one or more items by checking the checkboxes for them and clicking the 'Remove selected items' button. Bug 37150 needed to fix 'Remove from this list' for CSRF, because in the wild old days it just triggered a GET to delete, and instead it needed to POST. The first patch to do that defined the JS var single_bib, checked the checkbox for that bib and submitted the form, as though you had used the checkbox yourself. But if you cancelled the confirmation prompt, it would need to uncheck the checkbox it checked, so it added a function to do that if (single_bib). That patch didn't land. What landed instead was a patch with a separate hidden form that could be populated with the single biblionumber from 'Remove from this list', but without single_bib to define that state, it used selected_titles.size() == 1 as the condition to use the hidden form, forgetting that when the user checks a single checkbox, selected_titles.size() is also 1. The right condition is the same one used to tell where to get the titles for the confirmation dialog: if the click event passed along a biblionumber, it's 'Remove from this list.' Since checking that sets var biblionumber, we can just use that being truthy as the condition. Test plan: 1. Without the patch, open the OPAC and log in 2. Add any two biblios to a new list 3. Lists - {your list name} 4. Click the checkbox for one of the items, click 'Remove selected items' and click 'Yes, remove from list' in the confirmation dialog 5. Note that it wasn't removed 6. Click the checkboxes for both items, click 'Remove selected items' and click 'Yes, remove from list' in the confirmation dialog 7. Note that both were removed 8. Apply patch, restart_all 9. Add any four items to your list 10. Lists - {your list name} 11. For the first item, click the 'Remove from this list' button below the details for the item, confirm, make sure it was deleted 12. Click the checkbox for what's now the first item, click 'Remove from this list,' confirm, make sure it was deleted 13. Click the checkboxes for what are now the first two items, click 'Remove from this list,' confirm, make sure both were deleted Sponsored-by: Chetco Community Public Library Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38251 Martin Renvoize (ashimema) <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact|testopia@bugs.koha-communit |martin.renvoize@ptfs-europe |y.org |.com Status|Signed Off |Passed QA CC| |martin.renvoize@ptfs-europe | |.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38251 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)| |24.11.00 released in| | Status|Passed QA |Pushed to main -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38251 --- Comment #8 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Pushed for 24.11! Well done everyone, thank you! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38251 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |lucas@bywatersolutions.com Version(s)|24.11.00 |24.11.00,24.05.06 released in| | Status|Pushed to main |Pushed to stable --- Comment #9 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Backported to 24.05.x for upcoming 24.05.06 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38251 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to stable |Pushed to oldstable -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38251 Fridolin Somers <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |fridolin.somers@biblibre.co | |m Status|Pushed to oldstable |Needs documenting --- Comment #10 from Fridolin Somers <fridolin.somers@biblibre.com> --- Depends on Bug 37150 not in 23.11.x -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38251 Phil Ringnalda <phil@chetcolibrary.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |FIXED Status|Needs documenting |RESOLVED --- Comment #11 from Phil Ringnalda <phil@chetcolibrary.org> --- Since there's no documentation of the temporary bug, no need to document it being gone. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38251 Bug 38251 depends on bug 37150, which changed state. Bug 37150 Summary: Can't delete single title from a list using the "Remove from list" link https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37150 What |Removed |Added ---------------------------------------------------------------------------- Status|Needs documenting |RESOLVED Resolution|--- |FIXED -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org