Bugzilla – Attachment 158100 Details for
Bug 31579
Improve reserve/request.pl to avoid mistakes with pick up locations
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 31579: Improve reserve/request.pl to avoid mistakes with pick up locations
Bug-31579-Improve-reserverequestpl-to-avoid-mistak.patch (text/plain), 6.51 KB, created by
Emily-Rose Francoeur
on 2023-10-30 18:50:17 UTC
(
hide
)
Description:
Bug 31579: Improve reserve/request.pl to avoid mistakes with pick up locations
Filename:
MIME Type:
Creator:
Emily-Rose Francoeur
Created:
2023-10-30 18:50:17 UTC
Size:
6.51 KB
patch
obsolete
>From 42b9e83d81c3b3771c921269a6652d28f0ca40c8 Mon Sep 17 00:00:00 2001 >From: Emily-Rose Francoeur <emily-rose.francoeur@inLibro.com> >Date: Mon, 30 Oct 2023 14:39:21 -0400 >Subject: [PATCH] Bug 31579: Improve reserve/request.pl to avoid mistakes with > pick up locations >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >The patch has been updated to ensure it does not break the existing behavior. The test plan have also been updated. > >This patch improve the behavior of the intranet reservation page cgi-bin/koha/reserve/request.pl >It ensures that when you change the "pickup at" value in the "Hold details" section, the "Allowed pickup locations" values of each item are also changed (in the table) > >System preferences > > ensure that "UseBranchTransferLimits" is set to âDonât enforceâ > >Prerequisites > > have 4 different branches (libraries): > library A - logged in library, the one used to log into the intranet by the employee > library B - item's home library > library C - item's holding library found in the file of the user who will have the reservation > library D â another library > > have 2 library groups (each of them is set as âIs local hold groupâ): > group A â contains âlibrary Aâ and âlibrary Bâ > group B â contains âlibrary Câ and âlibrary Dâ > > have a record with multiple copies > create an item for each library A, B, C, D with homebranch = holdingbranch (with barcode) > >Circulation rules > > in the âCirculation and fine rulesâ, under âDefault holds policy by item typeâ: > select the same item type you use for the items you created before > set âHold pickup library matchâ to âitem's hold groupâ > click on â+ Addâ > >Test plan > > 1- Find a user record > 2- Change the user library (set it to library C) and save > 3- Click on âSearch to holdâ > 4- Find the notice you created > 5- Click on âPlace a hold > Place hold for [User]â > 6- Check the âpickup atâ field in the top section and those in the column âAllowed pickup locationsâ > 7- Change the library of the top âpickup atâ field > 8- Check the âAllowed pickup locationsâ of each item > 9- Notice that the âAllowed pickup locationsâ columns are not adjusted > 10- Apply the patch > 11- Refresh the page > 12- Repeat steps 6,7 and 8 > 13- Notice that the pickup locations change only if they are in the same library group > 14- Go to âCirculation and fine ruleâ (in Koha administration) and delete the the rule you created under âDefault holds policy by item typeâ > 15- Repeat step 1,3,4,5,6,7 and 8 > 16- Notice that all the âAllowed pickup locationsâ columns are adjusted >--- > .../prog/en/modules/reserve/request.tt | 55 +++++++++++++++++-- > 1 file changed, 50 insertions(+), 5 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 3f0a1973b4..56f0a9f062 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt >@@ -1330,6 +1330,8 @@ > $.fn.select2.defaults.set("width", "100%" ); > $.fn.select2.defaults.set("dropdownAutoWidth", true ); > >+ var pickup_locations_by_item = {}; >+ > $(document).ready(function() { > $('#cancellation-reason-fieldset').hide(); > $('.rank-request').on('change', function() { >@@ -1366,15 +1368,57 @@ > ToggleHoldsToPlace(); > }); > >- [% IF Koha.Preference('UseBranchTransferLimits') %] >- $("#pickup").on('change', function(){ >- var pickup = $("#pickup").val(); >+ function setPickupLocation (select) { >+ var item_id = select.data('item-id'); >+ var url = '/api/v1/items/' + encodeURIComponent(item_id) + '/pickup_locations'; >+ >+ $.ajax({ >+ dataType: 'json', >+ url: url, >+ data: { >+ "q": JSON.stringify({ >+ "name": { >+ "-like":'%'+(($.param().term === undefined) ? '' : $.param().term)+'%' >+ } >+ }), >+ "_order_by": "name", >+ "_page": $.param().page, >+ "patron_id": select.data('patron-id') >+ }, >+ success: function(data) { >+ pickup_locations_by_item[`${item_id}`] = []; >+ data.forEach(function (pickup_location) { >+ pickup_locations_by_item[`${item_id}`].push({ >+ "id": pickup_location.library_id, >+ "name": pickup_location.name >+ }); >+ }); >+ } >+ }); >+ } >+ >+ $("#pickup").on('change', function() { >+ var pickup = $("#pickup").val(); >+ [% IF Koha.Preference('UseBranchTransferLimits') %] > var url = "?pickup=" + pickup; > url += "&borrowernumber=" + borrowernumber; > url += "&biblionumber=" + biblionumbers[0]; > window.location.replace(url); >- }); >- [% END %] >+ [% ELSE %] >+ $(".pickup_locations").each(function () { >+ const pickup_locations = pickup_locations_by_item[$(this).data('item-id')]; >+ if (pickup_locations) { >+ const location = pickup_locations.find((pickup_location) => pickup_location.id === pickup); >+ if (location) { >+ var option = $("<option>").val(location.id).text(location.name).attr("selected", "selected"); >+ $(this).append(option).trigger('change'); >+ $(this).val(location.id); >+ $(this).pickup_locations_dropdown(); >+ } >+ } >+ }); >+ [% END %] >+ }); > > var my_table = $("#requestspecific").dataTable($.extend(true, {}, dataTablesDefaults, { > 'bPaginate': false, >@@ -1485,6 +1529,7 @@ > > $(".pickup_locations").each(function () { > $(this).pickup_locations_dropdown(); >+ setPickupLocation($(this)); > }); > }); > >-- >2.34.1
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 31579
:
140907
|
140917
|
140997
|
141007
|
141033
|
144634
|
154550
|
158100
|
158104