Bugzilla – Attachment 181230 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: Template and javascript changes to request.tt
Bug-31698-Template-and-javascript-changes-to-reque.patch (text/plain), 9.77 KB, created by
Lucas Gass (lukeg)
on 2025-04-21 19:24:00 UTC
(
hide
)
Description:
Bug 31698: Template and javascript changes to request.tt
Filename:
MIME Type:
Creator:
Lucas Gass (lukeg)
Created:
2025-04-21 19:24:00 UTC
Size:
9.77 KB
patch
obsolete
>From 85fc7c714f46a998fbf2a89687b4316ae5bc722a Mon Sep 17 00:00:00 2001 >From: Lucas Gass <lucas@bywatersolutions.com> >Date: Thu, 13 Mar 2025 19:10:53 +0000 >Subject: [PATCH] Bug 31698: Template and javascript changes to request.tt > >--- > .../prog/en/modules/reserve/request.tt | 117 ++++++++++++++++++ > 1 file changed, 117 insertions(+) > >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 558b5e0d9f0..03e0b966edb 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt >@@ -105,6 +105,9 @@ > :disabled { > opacity: 0.5; > } >+ #toolbar { >+ align-items: center; >+ } > </style> > [% END %] > </head> >@@ -1235,6 +1238,15 @@ > </select> > [% END %] > </fieldset> >+ [% IF ( CAN_user_reserveforothers_alter_hold_targets ) %] >+ <div class="btn-group"> >+ <a class="btn btn-default btn-xs dropdown-toggle move_selected_holds" id="item_record_choice" role="button" data-bs-toggle="dropdown" href="#" aria-expanded="false"></a> >+ <ul class="dropdown-menu" role="menu" aria-labelledby="item_record_choice" style=""> >+ <li><a class="dropdown-item move_hold_item" href="#">Item level holds to a different item</a></li> >+ <li><a class="dropdown-item move_hold_record" href="#">Record level holds to a different record</a></li> >+ </ul> >+ </div> >+ [% END %] > </div> > <div class="page-section"> > [% FOREACH biblioloo IN biblioloop %] >@@ -1416,6 +1428,51 @@ > </div> > </div> > </div> >+<div id="moveHoldItemModal" class="modal modal-lg" tabindex="-1" role="dialog" aria-hidden="true"> >+ <div class="modal-dialog"> >+ <div class="modal-content"> >+ <div class="modal-header"> >+ <h1 class="modal-title">Move hold(s) to a different item</h1> >+ <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> >+ </div> >+ <div class="modal-body"> >+ <div id="move_hold_item_selection"> >+ <h3>Selected holds to move</h3> >+ <table> >+ <thead> >+ <tr> >+ <th>Hold ID</th> >+ <th>Item barcode ( current hold )</th> >+ </tr> >+ </thead> >+ <tbody> </tbody> >+ </table> >+ </div> >+ <hr /> >+ <div id="move_hold_item_search" class="alert alert-danger" style="display:none;"></div> >+ <form id="searchForm"> >+ <div id="move_hold_item_searchform"> >+ <fieldset class="action"> >+ <h3><label for="external_id">Enter the item barcode of new hold target: </label></h3> >+ <input type="text" class="form-control" name="external_id" id="external_id" required /> >+ </fieldset> >+ <button type="submit" class="btn btn-success mt-3">Search</button> >+ </div> >+ </form> >+ <hr /> >+ <form id="move_hold_item_form" method="post" action="request.pl"> >+ [% INCLUDE 'csrf-token.inc' %] >+ <input type="hidden" name="op" value="cud-move_hold_item" /> >+ <div id="resultMessage" class="mt-3"> </div> >+ <button type="submit" class="btn btn-primary mt-3">Move selected holds</button> >+ </form> >+ </div> >+ <div class="modal-footer"> >+ <button type="button" class="btn btn-default" data-bs-dismiss="modal">Cancel</button> >+ </div> >+ </div> >+ </div> >+</div> > <div id="hold-actions"> > <form id="hold-actions-form"> [% INCLUDE 'csrf-token.inc' %] </form> > </div> >@@ -1467,6 +1524,7 @@ > } > > 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'>%s</span> hold(s)."); > $.fn.select2.defaults.set("width", "100%" ); > $.fn.select2.defaults.set("dropdownAutoWidth", true ); >@@ -1731,6 +1789,44 @@ > } > > $(document).ready(function() { >+ $("#searchForm").on("submit", function (event) { >+ event.preventDefault(); >+ >+ let externalID = $("#external_id").val(); >+ let apiUrl = `/api/v1/items?external_id=${encodeURIComponent(externalID)}`; >+ >+ $.ajax({ >+ url: apiUrl, >+ method: "GET", >+ dataType: "json", >+ success: function (data) { >+ if (data.length > 0) { >+ let resultHtml = ""; >+ $.each(data, 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 /> >+ `; >+ }); >+ $("#resultMessage").html(resultHtml); >+ } else { >+ $("#resultMessage").html(` >+ <div class="alert alert-warning">No item found with barcode: ${externalID}.</div> >+ `); >+ } >+ }, >+ }); >+ }); >+ >+ $(document).on("change", 'input[name="new_itemnumber"]', function() { >+ $('input[name="new_itemnumber"]').not(this).prop("checked", false); >+ }); > > $("#always_show_holds").change(function(){ > if( $(this).prop('checked') ){ >@@ -1834,6 +1930,7 @@ > }); > > $('.cancel_selected_holds').html(MSG_CANCEL_SELECTED.format($('.holds_table .select_hold:checked').length)); >+ $('.move_selected_holds').html(MSG_MOVE_SELECTED.format($('.holds_table .select_hold:checked').length)); > > $('.holds_table .select_hold_all').click(function() { > var table = $(this).parents('.holds_table'); >@@ -1841,6 +1938,7 @@ > $('.select_hold', table).prop('checked', !count); > $(this).prop('checked', !count); > $('.cancel_selected_holds').html(MSG_CANCEL_SELECTED.format($('.holds_table .select_hold:checked').length)); >+ $('.move_selected_holds').html(MSG_MOVE_SELECTED.format($('.holds_table .select_hold:checked').length)); > $('#cancel_hold_alert').html( MSG_CANCEL_ALERT.format($('.holds_table .select_hold:checked').length)); > $('#cancel_hold_alert').show(); > localStorage.selectedHolds = $('.holds_table .select_hold:checked').toArray().map(el => $(el).data('id')); >@@ -1851,11 +1949,30 @@ > var count = $('.select_hold:not(:checked)', table).length; > $('.select_hold_all', table).prop('checked', !count); > $('.cancel_selected_holds').html(MSG_CANCEL_SELECTED.format($('.holds_table .select_hold:checked').length)); >+ $('.move_selected_holds').html(MSG_MOVE_SELECTED.format($('.holds_table .select_hold:checked').length)); > $('#cancel_hold_alert').html( MSG_CANCEL_ALERT.format($('.holds_table .select_hold:checked').length)); > $('#cancel_hold_alert').show(); > localStorage.selectedHolds = $('.holds_table .select_hold:checked').toArray().map(el => $(el).data('id')); > }); > >+ $('.move_hold_item').click(function(e) { >+ e.preventDefault(); >+ if($('.holds_table .select_hold:checked').length) { >+ $('#moveHoldItemModal #resultMessage').empty(); >+ $('#move_hold_item_selection table tbody').empty(); >+ $('#moveHoldItemModal').modal('show'); >+ $('.select_hold:checked').each( function() { >+ let reserve_id = $(this).data('id'); >+ let item_level_hold = $(this).data('item_level_hold'); >+ let found_status = $(this).data('found'); >+ $('#move_hold_item_selection table').append(`<tr><td>${reserve_id}</td><td></td></tr>`) >+ if ( item_level_hold ) { >+ $('#move_hold_item_form').append(`<input type="hidden" name="hold_id" value="${reserve_id}">`); >+ } >+ }); >+ } >+ }); >+ > $('.cancel_selected_holds').click(function(e) { > e.preventDefault(); > if($('.holds_table .select_hold:checked').length) { >-- >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