From 50b49245a9f9549ae8c9f59b4218806f9468c46e Mon Sep 17 00:00:00 2001 From: Hammat Wele Date: Thu, 15 Dec 2022 18:35:10 +0000 Subject: [PATCH] Bug 31579: Improve reserve/request.pl to avoid mistakes with pick up locations 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) Prerequisites have 3 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 have a record with multiple copies create one item for each library A, B, C with homebranch = holdingbranch (with barcode) Test plan 1- Find a user record 2- Change the user library (put library C) and Save 3- Find the notice 4- Click on 'Place Hold' 5- Enter user name 6- Check the 'pickup at' field of the top section and those in the coluumn '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 path 11- Repeat step 3,4,5,6,7,8 12- Notice that all the 'Allowed pickup locations' columns are now adjusted and are the same that the selected 'pickup at' field --- .../prog/en/modules/reserve/request.tt | 18 +++++++++++++----- 1 file changed, 13 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 e2d33c5415..7d637349c2 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt @@ -1375,15 +1375,23 @@ ToggleHoldsToPlace(); }); - [% IF Koha.Preference('UseBranchTransferLimits') %] - $("#pickup").on('change', function(){ - var pickup = $("#pickup").val(); + $("#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 () { + if ($(this).find("option[value='"+pickup+"']").length == 0){ + $(this).append(""); + } + $(this).val(pickup); + $(this).pickup_locations_dropdown(); + }); + [% END %] + }); var my_table = $("#requestspecific").dataTable($.extend(true, {}, dataTablesDefaults, { 'bPaginate': false, -- 2.34.1