Bug 42013 - Confirmation dialog for "Remove all reserves" never shown on course details page
Summary: Confirmation dialog for "Remove all reserves" never shown on course details page
Status: Signed Off
Alias: None
Product: Koha
Classification: Unclassified
Component: Course reserves (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: Paul Derscheid
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2026-03-06 12:41 UTC by Paul Derscheid
Modified: 2026-03-06 20:54 UTC (History)
0 users

See Also:
GIT URL:
Initiative type: ---
Sponsorship status: ---
Comma delimited list of Sponsors:
Crowdfunding goal: 0
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 42013: Fix missing confirmation dialog for "Remove all reserves" (2.42 KB, patch)
2026-03-06 12:47 UTC, Paul Derscheid
Details | Diff | Splinter Review
Bug 42013: Fix missing confirmation dialog for "Remove all reserves" (2.47 KB, patch)
2026-03-06 20:54 UTC, Roman Dolny
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Derscheid 2026-03-06 12:41:42 UTC
On the course details page (course_reserves/course-details.tt), clicking "Remove all reserves" skips the confirmation dialog and immediately submits the form.

The "Remove all reserves" button (#rm_items_button) is an <a> tag separate from the #rm_items form. 

The click handler on the button calls $("#rm_items").submit() programmatically. A separate $("#rm_items").click(...) handler was intended to show a confirmDelete dialog, but it is bound as a click event on the form element, which is never clicked by the user.

jQuery's .submit() method also does not trigger click events, so the confirmation is never shown.
Comment 1 Paul Derscheid 2026-03-06 12:47:57 UTC
Created attachment 194699 [details] [review]
Bug 42013: Fix missing confirmation dialog for "Remove all reserves"

- The confirmDelete dialog for removing all reserves from a course
  was bound as a click handler on the #rm_items form element, which
  is never directly clicked by the user
- The #rm_items_button click handler called .submit() on the form
  without checking confirmDelete first, bypassing the confirmation
- Move the confirmDelete check into the #rm_items_button click
  handler and remove the dead #rm_items click handler

Test plan:
- Enable UseCourseReserves system preference (should be enabled in ktd)
- Create a course (or use the existing one) and add at least one reserve to it
- On the course details page, click "Remove all reserves"
- Observe the form submits immediately without confirmation
- Apply patch
- Repeat the steps above
- Verify a confirmation dialog now appears
- Click cancel and verify the reserves are not removed
- Click "Remove all reserves" again, confirm, and verify
  the reserves are removed
Comment 2 Roman Dolny 2026-03-06 20:54:05 UTC
Created attachment 194909 [details] [review]
Bug 42013: Fix missing confirmation dialog for "Remove all reserves"

- The confirmDelete dialog for removing all reserves from a course
  was bound as a click handler on the #rm_items form element, which
  is never directly clicked by the user
- The #rm_items_button click handler called .submit() on the form
  without checking confirmDelete first, bypassing the confirmation
- Move the confirmDelete check into the #rm_items_button click
  handler and remove the dead #rm_items click handler

Test plan:
- Enable UseCourseReserves system preference (should be enabled in ktd)
- Create a course (or use the existing one) and add at least one reserve to it
- On the course details page, click "Remove all reserves"
- Observe the form submits immediately without confirmation
- Apply patch
- Repeat the steps above
- Verify a confirmation dialog now appears
- Click cancel and verify the reserves are not removed
- Click "Remove all reserves" again, confirm, and verify
  the reserves are removed

Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>