From f3e627115961101358962dc1c636c2477f2e2261 Mon Sep 17 00:00:00 2001 From: Pedro Amorim Date: Wed, 30 Jul 2025 11:32:58 +0000 Subject: [PATCH] Bug 40552: Allow selecting all holds from a group Test plan, k-t-d, patches applied: 1) Search for 'music': http://localhost:8081/cgi-bin/koha/catalogue/search.pl?q=music 2) Click the 'Select all' link on the left of the search toolbar 3) Click the 'Place hold' button on the same toolbar 4) On the patron input, add 'koha' 5) You need to pick the 'Pickup location' specifically for each hold. Click 'Place holds' 6) Now visit the patron details page: http://localhost:8081/cgi-bin/koha/members/moremember.pl?borrowernumber=51 7) Click the 'Holds' tab. 8) Test that selecting the hold group number opens the hold group modal and a new 'select group holds' buttons exist. 9) Click that button, ensure it selects the group holds. Test with more holds, more groups, unselecting all beforehand, selecting all beforehand, etc. --- .../prog/en/modules/reserve/hold-group.tt | 2 +- koha-tmpl/intranet-tmpl/prog/js/hold-group.js | 32 +++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/hold-group.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/hold-group.tt index 09d7b4a32d3..d0739a9b7ae 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/hold-group.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/hold-group.tt @@ -20,7 +20,7 @@ [% biblio = hold.biblio %] - [% biblio.title | html %] + [% biblio.title | html %] [% IF (hold.is_hold_group_target) %]
(target of hold group) [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/js/hold-group.js b/koha-tmpl/intranet-tmpl/prog/js/hold-group.js index cae322324ad..60320ae22ab 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/hold-group.js +++ b/koha-tmpl/intranet-tmpl/prog/js/hold-group.js @@ -3,6 +3,38 @@ $(document).ready(function () { var href = $(this).attr("href"); $("#hold-group-modal .modal-body").load(href + " #main"); $("#hold-group-modal").modal("show"); + if (holds_table_patron_page()) { + append_select_group_holds_button(); + } return false; }); + $("body").on("click", "button#select-group-holds", function () { + let group_hold_ids = $(".hold-group-entry") + .map(function () { + return $(this).data("hold-id"); + }) + .get(); + + $(".select_hold").each(function () { + var $this = $(this); + if ( + group_hold_ids.includes($this.data("id")) !== + $this.prop("checked") + ) { + $this.click(); + } + }); + }); + + function append_select_group_holds_button() { + var button = document.createElement("button"); + button.type = "button"; + button.className = "btn btn-primary"; + button.id = "select-group-holds"; + button.dataset.bsDismiss = "modal"; + button.innerHTML = _("Select group holds"); + if (!$("#select-group-holds").length) { + $("#hold-group-modal .modal-footer").prepend(button); + } + } }); -- 2.39.5