Bugzilla – Attachment 185834 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 reamining JS to hold.js
Bug-31698-Move-reamining-JS-to-holdjs.patch (text/plain), 12.71 KB, created by
Lucas Gass (lukeg)
on 2025-08-27 15:55:21 UTC
(
hide
)
Description:
Bug 31698: Move reamining JS to hold.js
Filename:
MIME Type:
Creator:
Lucas Gass (lukeg)
Created:
2025-08-27 15:55:21 UTC
Size:
12.71 KB
patch
obsolete
>From 2d2c2d5a09785edf92665ab50c3d142c4f9a18bf Mon Sep 17 00:00:00 2001 >From: Lucas Gass <lucas@bywatersolutions.com> >Date: Wed, 27 Aug 2025 15:52:32 +0000 >Subject: [PATCH] Bug 31698: Move reamining JS to hold.js > >--- > .../prog/en/modules/reserve/request.tt | 52 --------- > koha-tmpl/intranet-tmpl/prog/js/holds.js | 100 ++++++++++++++++-- > 2 files changed, 94 insertions(+), 58 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt >index 9d6db932955..06e6ec13f42 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt >@@ -1955,58 +1955,6 @@ > }); > [% END %] > >- $('.move_hold_item').click(function(e) { >- e.preventDefault(); >- $('#move_hold_item_confirm').prop('disabled' , true ); >- if($('.holds_table .select_hold:checked').length) { >- $('#itemResultMessage').empty(); >- $('#move_hold_item_selection table tbody').empty(); >- $('#moveHoldItemModal').modal('show'); >- $('.select_hold:checked').each( function() { >- let reserve_id = $(this).data('id'); >- let reserve_biblionumber = $(this).data('biblionumber'); >- let reserve_itemnumber = $(this).data('itemnumber'); >- let item_level_hold = $(this).data('item_level_hold'); >- let item_waiting = $(this).data('waiting'); >- let item_intransit = $(this).data('intransit'); >- let error_message = $(this).data('item_level_hold') ? "" : _("Cannot move a waiting, in transit, or record level hold"); >- let found_status = $(this).data('found'); >- if ( item_level_hold && ( !item_waiting || !item_intransit ) ) { >- $('#move_hold_item_selection table').append(`<tr><td><input type="checkbox" name="move_hold_id" value="${reserve_id}" checked /></td><td>${reserve_id}</td><td>Biblionumber: <a target="_blank" href="/cgi-bin/koha/reserve/request.pl?biblionumber=${reserve_biblionumber}">${reserve_biblionumber}</a> Itemnumber: <a target="_blank" href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=${reserve_biblionumber}#item${reserve_itemnumber}">${reserve_itemnumber}</a></td><td>${error_message}</td></tr>`) >- } else { >- $('#move_hold_item_selection table').append(`<tr><td><input type="checkbox" name="move_hold_id" value="${reserve_id}" disabled /></td><td>${reserve_id}</td><td>Biblionumber: <a target="_blank" href="/cgi-bin/koha/reserve/request.pl?biblionumber=${reserve_biblionumber}">${reserve_biblionumber}</a> Itemnumber: <a target="_blank" href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=${reserve_biblionumber}#item${reserve_itemnumber}">${reserve_itemnumber}</a></td><td>${error_message}</td></tr>`) >- } >- }); >- } >- }); >- >- $('.move_hold_biblio').click(function(e) { >- e.preventDefault(); >- $('#move_hold_biblio_confirm').prop('disabled' , true ); >- if($('.holds_table .select_hold:checked').length) { >- $('#biblioResultMessage').empty(); >- $('#move_hold_biblio_selection table tbody').empty(); >- $('#moveHoldBiblioModal').modal('show'); >- $('.select_hold:checked').each( function() { >- let reserve_id = $(this).data('id'); >- let reserve_biblionumber = $(this).data('biblionumber'); >- let reserve_itemnumber = $(this).data('itemnumber'); >- let item_level_hold = $(this).data('item_level_hold'); >- let item_status = $(this).data('status'); >- let item_waiting = $(this).data('waiting'); >- let item_intransit = $(this).data('intransit'); >- let error_message = $(this).data('item_level_hold') ? _("Cannot move a waiting, in transit, or item level hold") : ""; >- let found_status = $(this).data('found'); >- if ( !item_level_hold && ( !item_waiting || !item_intransit ) ) { >- $('#move_hold_biblio_selection table').append(`<tr><td><input type="checkbox" name="move_hold_id" value="${reserve_id}" checked /><td>${reserve_id}</td><td>Biblionumber: <a target="_blank" href="/cgi-bin/koha/reserve/request.pl?biblionumber=${reserve_biblionumber}">${reserve_biblionumber}</a></td><td>${error_message}</td></tr>`) >- } else { >- $('#move_hold_biblio_selection table').append(`<tr><td><input type="checkbox" name="move_hold_id" value="${reserve_id}" disabled /><td>${reserve_id}</td><td>Biblionumber: <a target="_blank" href="/cgi-bin/koha/reserve/request.pl?biblionumber=${reserve_biblionumber}">${reserve_biblionumber}</a></td><td>${error_message}</td></tr>`) >- >- } >- }); >- } >- }); >- > $(".hold-arrow").click(function(e) { > e.preventDefault(); > let arrowForm = $("#hold-actions-form").attr({ >diff --git a/koha-tmpl/intranet-tmpl/prog/js/holds.js b/koha-tmpl/intranet-tmpl/prog/js/holds.js >index e5c08efa572..26a65ee0cbd 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/holds.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/holds.js >@@ -793,6 +793,23 @@ $(document).ready(function () { > ); > } > >+ function updateMoveButtons(table) { >+ var checked_holds = $(".select_hold:checked", table); >+ var checked_count = checked_holds.length; >+ >+ var item_level_count = checked_holds.filter(function () { >+ return $(this).attr("data-item_level_hold") !== ""; >+ }).length; >+ >+ var record_level_count = checked_holds.filter(function () { >+ return $(this).attr("data-item_level_hold") === ""; >+ }).length; >+ >+ $(".move_hold_item").toggleClass("disabled", item_level_count <= 0); >+ $(".move_hold_biblio").toggleClass("disabled", record_level_count <= 0); >+ $(".move_selected_holds").prop("disabled", !checked_count); >+ } >+ > updateSelectedHoldsButtonCounters(); > > $(".holds_table .select_hold_all").click(function () { >@@ -802,9 +819,13 @@ $(document).ready(function () { > } else { > table = $(".holds_table:not(.fixedHeader-floating)"); > } >- var count = $(".select_hold:checked", table).length; >- $(".select_hold", table).prop("checked", !count); >- $(this).prop("checked", !count); >+ >+ var checked_count = $(".select_hold:checked", table).length; >+ $(".select_hold", table).prop("checked", !checked_count); >+ $(this).prop("checked", !checked_count); >+ >+ updateMoveButtons(table); >+ > updateSelectedHoldsButtonCounters(); > $("#cancel_hold_alert").html( > MSG_CANCEL_ALERT.format( >@@ -825,14 +846,15 @@ $(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); >+ >+ updateMoveButtons(table); >+ > updateSelectedHoldsButtonCounters(); > $("#cancel_hold_alert").html( > MSG_CANCEL_ALERT.format( >@@ -853,7 +875,6 @@ $(document).ready(function () { > ) > .join(",") + > "]"; >- $(".move_selected_holds").prop("disabled", !checked_count); > }); > > $(".cancel_selected_holds").click(function (e) { >@@ -1005,6 +1026,73 @@ $(document).ready(function () { > } > }); > >+ $(".move_hold_item").click(function (e) { >+ e.preventDefault(); >+ $("#move_hold_item_confirm").prop("disabled", true); >+ if ($(".holds_table .select_hold:checked").length) { >+ $("#itemResultMessage").empty(); >+ $("#move_hold_item_selection table tbody").empty(); >+ $("#moveHoldItemModal").modal("show"); >+ $(".select_hold:checked").each(function () { >+ let reserve_id = $(this).data("id"); >+ let reserve_biblionumber = $(this).data("biblionumber"); >+ let reserve_itemnumber = $(this).data("itemnumber"); >+ let item_level_hold = $(this).data("item_level_hold"); >+ let item_waiting = $(this).data("waiting"); >+ let item_intransit = $(this).data("intransit"); >+ let error_message = $(this).data("item_level_hold") >+ ? "" >+ : __( >+ "Cannot move a waiting, in transit, or record level hold" >+ ); >+ let found_status = $(this).data("found"); >+ if (item_level_hold && (!item_waiting || !item_intransit)) { >+ $("#move_hold_item_selection table").append( >+ `<tr><td><input type="checkbox" name="move_hold_id" value="${reserve_id}" checked /></td><td>${reserve_id}</td><td>Biblionumber: <a target="_blank" href="/cgi-bin/koha/reserve/request.pl?biblionumber=${reserve_biblionumber}">${reserve_biblionumber}</a> Itemnumber: <a target="_blank" href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=${reserve_biblionumber}#item${reserve_itemnumber}">${reserve_itemnumber}</a></td><td>${error_message}</td></tr>` >+ ); >+ } else { >+ $("#move_hold_item_selection table").append( >+ `<tr><td><input type="checkbox" name="move_hold_id" value="${reserve_id}" disabled /></td><td>${reserve_id}</td><td>Biblionumber: <a target="_blank" href="/cgi-bin/koha/reserve/request.pl?biblionumber=${reserve_biblionumber}">${reserve_biblionumber}</a> Itemnumber: <a target="_blank" href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=${reserve_biblionumber}#item${reserve_itemnumber}">${reserve_itemnumber}</a></td><td>${error_message}</td></tr>` >+ ); >+ } >+ }); >+ } >+ }); >+ >+ $(".move_hold_biblio").click(function (e) { >+ e.preventDefault(); >+ $("#move_hold_biblio_confirm").prop("disabled", true); >+ if ($(".holds_table .select_hold:checked").length) { >+ $("#biblioResultMessage").empty(); >+ $("#move_hold_biblio_selection table tbody").empty(); >+ $("#moveHoldBiblioModal").modal("show"); >+ $(".select_hold:checked").each(function () { >+ let reserve_id = $(this).data("id"); >+ let reserve_biblionumber = $(this).data("biblionumber"); >+ let reserve_itemnumber = $(this).data("itemnumber"); >+ let item_level_hold = $(this).data("item_level_hold"); >+ let item_status = $(this).data("status"); >+ let item_waiting = $(this).data("waiting"); >+ let item_intransit = $(this).data("intransit"); >+ let error_message = $(this).data("item_level_hold") >+ ? __( >+ "Cannot move a waiting, in transit, or item level hold" >+ ) >+ : ""; >+ let found_status = $(this).data("found"); >+ if (!item_level_hold && (!item_waiting || !item_intransit)) { >+ $("#move_hold_biblio_selection table").append( >+ `<tr><td><input type="checkbox" name="move_hold_id" value="${reserve_id}" checked /><td>${reserve_id}</td><td>Biblionumber: <a target="_blank" href="/cgi-bin/koha/reserve/request.pl?biblionumber=${reserve_biblionumber}">${reserve_biblionumber}</a></td><td>${error_message}</td></tr>` >+ ); >+ } else { >+ $("#move_hold_biblio_selection table").append( >+ `<tr><td><input type="checkbox" name="move_hold_id" value="${reserve_id}" disabled /><td>${reserve_id}</td><td>Biblionumber: <a target="_blank" href="/cgi-bin/koha/reserve/request.pl?biblionumber=${reserve_biblionumber}">${reserve_biblionumber}</a></td><td>${error_message}</td></tr>` >+ ); >+ } >+ }); >+ } >+ }); >+ > 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