Bugzilla – Attachment 185763 Details for
Bug 31698
Add ability to move a hold to a new bibliographic record/item
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 31698: Move request.tt JS to hold.js
Bug-31698-Move-requesttt-JS-to-holdjs.patch (text/plain), 8.46 KB, created by
Lucas Gass (lukeg)
on 2025-08-25 20:56:21 UTC
(
hide
)
Description:
Bug 31698: Move request.tt JS to hold.js
Filename:
MIME Type:
Creator:
Lucas Gass (lukeg)
Created:
2025-08-25 20:56:21 UTC
Size:
8.46 KB
patch
obsolete
>From 440ba5e8cf85a65d4a6d308486421ebd794ad931 Mon Sep 17 00:00:00 2001 >From: Lucas Gass <lucas@bywatersolutions.com> >Date: Mon, 25 Aug 2025 20:51:54 +0000 >Subject: [PATCH] Bug 31698: Move request.tt JS to hold.js > >--- > .../prog/en/includes/holds_table.inc | 12 +- > koha-tmpl/intranet-tmpl/prog/js/holds.js | 108 ++++++++++++++++++ > 2 files changed, 119 insertions(+), 1 deletion(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc >index 0e0ae915821..ba64eda6e73 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc >@@ -46,7 +46,17 @@ > [%- END -%] > [% SET tr_class = hold.suspend ? 'suspend' : '' %] > <tr class="[% tr_class | html %]"> >- <td><input type="checkbox" class="select_hold" data-id="[% hold.reserve_id | html %]" data-item_level_hold="[% hold.item_level_hold | html %]" data-itemnumber="[% hold.itemnumber | html %]" data-biblionumber="[% hold.biblionumber | html %]" data-waiting="[% hold.atdestination | html %]" data-intransit="[% hold.intransit | html %]"/></td> >+ <td >+ ><input >+ type="checkbox" >+ class="select_hold" >+ data-id="[% hold.reserve_id | html %]" >+ data-item_level_hold="[% hold.item_level_hold | html %]" >+ data-itemnumber="[% hold.itemnumber | html %]" >+ data-biblionumber="[% hold.biblionumber | html %]" >+ data-waiting="[% hold.atdestination | html %]" >+ data-intransit="[% hold.intransit | html %]" >+ /></td> > <td style="min-width:185px;" data-order="[% priority | html %]"> > <div> > <input type="hidden" name="reserve_id" value="[% hold.reserve_id | html %]" /> >diff --git a/koha-tmpl/intranet-tmpl/prog/js/holds.js b/koha-tmpl/intranet-tmpl/prog/js/holds.js >index 6f746a8e109..e5c08efa572 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/holds.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/holds.js >@@ -715,6 +715,7 @@ $(document).ready(function () { > }); > > var MSG_CANCEL_SELECTED = __("Cancel selected (%s)"); >+ var MSG_MOVE_SELECTED = __("Move selected (%s)"); > var MSG_CANCEL_ALERT = __( > "This action will cancel <span class='badge bg-danger'>%s</span> hold(s)." > ); >@@ -780,6 +781,11 @@ $(document).ready(function () { > $(".holds_table .select_hold:checked").length > ) > ); >+ $(".move_selected_holds").html( >+ MSG_MOVE_SELECTED.format( >+ $(".holds_table .select_hold:checked").length >+ ) >+ ); > $(".suspend_selected_holds").html( > MSG_SUSPEND_SELECTED.format( > $(".holds_table .select_hold:checked").length >@@ -819,11 +825,13 @@ $(document).ready(function () { > ) > .join(",") + > "]"; >+ $(".move_selected_holds").prop("disabled", count); > }); > > $(".holds_table").on("click", ".select_hold", function () { > var table = $(this).parents(".holds_table"); > var count = $(".select_hold:not(:checked)", table).length; >+ var checked_count = $(".select_hold:checked", table).length; > $(".select_hold_all", table).prop("checked", !count); > updateSelectedHoldsButtonCounters(); > $("#cancel_hold_alert").html( >@@ -845,6 +853,7 @@ $(document).ready(function () { > ) > .join(",") + > "]"; >+ $(".move_selected_holds").prop("disabled", !checked_count); > }); > > $(".cancel_selected_holds").click(function (e) { >@@ -897,6 +906,105 @@ $(document).ready(function () { > return false; > }); > >+ $("#itemSearchForm").on("submit", function (event) { >+ event.preventDefault(); >+ $("#move_hold_item_confirm").prop("disabled", true); >+ >+ let externalID = $("#external_id").val(); >+ let apiUrl = `/api/v1/items?external_id=${encodeURIComponent(externalID)}`; >+ >+ $.ajax({ >+ url: apiUrl, >+ method: "GET", >+ dataType: "json", >+ success: function (data) { >+ // Filter for exact matches only >+ let exactMatches = data.filter( >+ item => item.external_id === externalID >+ ); >+ if (exactMatches.length > 0) { >+ let resultHtml = ""; >+ $.each(exactMatches, function (index, item) { >+ resultHtml += ` >+ <div class="alert alert-success"> >+ <strong>Biblionumber:</strong> ${item.biblio_id} <br> >+ <strong>Item:</strong> ${item.external_id} <br> >+ <input id="new_itemnumber_${item.item_id}" name="new_itemnumber" type="checkbox" value="${item.item_id}"> >+ <label for="new_itemnumber_${item.item_id}">Move all selected item level holds to this item</label> >+ <input id="new_biblionumber_${item.item_id}" name="new_biblionumber" type="hidden" value="${item.biblio_id}"> >+ </div> >+ <hr /> >+ `; >+ }); >+ $("#itemResultMessage").html(resultHtml); >+ } else { >+ $("#itemResultMessage").html(` >+ <div class="alert alert-warning">No item found with barcode: ${externalID}.</div> >+ `); >+ } >+ }, >+ }); >+ }); >+ >+ $("#biblioSearchForm").on("submit", function (event) { >+ event.preventDefault(); >+ $("#move_hold_biblio_confirm").prop("disabled", true); >+ >+ let biblioID = parseInt($("#biblio_id").val()); >+ let apiUrl = `/api/v1/biblios?q={"biblio_id":"${encodeURIComponent(biblioID)}"}`; >+ $.ajax({ >+ url: apiUrl, >+ method: "GET", >+ dataType: "json", >+ headers: { >+ Accept: "application/json", >+ }, >+ success: function (data) { >+ // Filter for exact matches only >+ let exactMatches = data.filter( >+ item => item.biblio_id === biblioID >+ ); >+ >+ if (exactMatches.length > 0) { >+ let resultHtml = ""; >+ $.each(exactMatches, function (index, item) { >+ resultHtml += ` >+ <div class="alert alert-success"> >+ <strong>Biblionumber:</strong> ${item.biblio_id} <br> >+ <input id="new_biblionumber_${item.biblio_id}" name="new_biblionumber" type="checkbox" value="${item.biblio_id}"> >+ <label for="new_biblionumber_${item.biblio_id}">Move all selected record level holds to this record</label> >+ </div> >+ <hr /> >+ `; >+ }); >+ $("#biblioResultMessage").html(resultHtml); >+ } else { >+ $("#biblioResultMessage").html(` >+ <div class="alert alert-warning">No record found with biblionumber: ${biblioID}.</div> >+ `); >+ } >+ }, >+ }); >+ }); >+ >+ $(document).on("change", 'input[name="new_itemnumber"]', function () { >+ $('input[name="new_itemnumber"]').not(this).prop("checked", false); >+ if ($('input[name="new_itemnumber"]:checked').length) { >+ $("#move_hold_item_confirm").prop("disabled", false); >+ } else { >+ $("#move_hold_item_confirm").prop("disabled", true); >+ } >+ }); >+ >+ $(document).on("change", 'input[name="new_biblionumber"]', function () { >+ $('input[name="new_biblionumber"]').not(this).prop("checked", false); >+ if ($('input[name="new_biblionumber"]:checked').length) { >+ $("#move_hold_biblio_confirm").prop("disabled", false); >+ } else { >+ $("#move_hold_biblio_confirm").prop("disabled", true); >+ } >+ }); >+ > function _append_patron_page_cancel_hold_modal_data(hold) { > $("#cancel_modal_form #inputs").append( > '<input type="hidden" name="rank-request" value="del">' >-- >2.39.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 31698
:
179226
|
179235
|
179236
|
179279
|
179287
|
179290
|
179291
|
179292
|
179295
|
179704
|
179711
|
179713
|
181222
|
181223
|
181224
|
181225
|
181226
|
181228
|
181229
|
181230
|
181231
|
181232
|
181233
|
181234
|
181929
|
181930
|
181944
|
181945
|
181946
|
181947
|
181948
|
181951
|
181952
|
181953
|
181954
|
181955
|
181956
|
181957
|
181958
|
181959
|
181960
|
181961
|
181962
|
182639
|
182640
|
182641
|
184750
|
185050
|
185064
|
185065
|
185066
|
185067
|
185068
|
185069
|
185070
|
185121
|
185379
|
185380
|
185607
|
185608
|
185609
|
185610
|
185611
|
185612
|
185613
|
185614
|
185615
|
185616
|
185753
|
185754
|
185755
|
185756
|
185757
|
185758
|
185759
|
185760
|
185761
|
185762
|
185763
|
185764
|
185765
|
185766
|
185767
|
185768
|
185769
|
185770
|
185771
|
185772
|
185773
|
185774
|
185775
|
185776
|
185834