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> Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org> Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
This commit is contained in:
parent
cd3574bdda
commit
9e0b6c3914
|
|
@ -373,7 +373,9 @@
|
|||
$(document).ready(function () {
|
||||
$("#rm_items_button").on("click", function (e) {
|
||||
e.preventDefault();
|
||||
$("#rm_items").submit();
|
||||
if (confirmDelete(_("Are you sure you want to remove all items from the course?"))) {
|
||||
$("#rm_items").submit();
|
||||
}
|
||||
});
|
||||
|
||||
var rtable = $("#course_reserves_table").kohaTable(
|
||||
|
|
@ -392,10 +394,6 @@
|
|||
}
|
||||
});
|
||||
|
||||
$("#rm_items").click(function () {
|
||||
return confirmDelete(_("Are you sure you want to remove all items from the course?"));
|
||||
});
|
||||
|
||||
$("#delete_course").on("submit", function () {
|
||||
return confirmDelete(course_reserves_size > 0 ? i18n.are_you_sure_items : i18n.are_you_sure_no_item);
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue