From cbfb886fb079e679fc3084b1b97ded4d3bc3704a Mon Sep 17 00:00:00 2001 From: "geraudmj2@gmail.com" Date: Thu, 22 Sep 2022 15:04:14 -0400 Subject: [PATCH] =?UTF-8?q?Bug=2031579:=20Improve=20reserve/request.pl=20t?= =?UTF-8?q?o=20avoid=20mistakes=20with=20pick=20up=20locations=20Reported-?= =?UTF-8?q?by:=20G=C3=A9raud=20Frappier=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In the place hold page reserve/request.pl, there are two sections. One is the "Hold details" section which allow for record hold. The other is "Place a hold on a specific item" which speaks for itself. The pick-up location by default is the signed-in user (the employee). But it is different from the "Allowed pick-up location" for the item which defaults to the homebranch. The wording should be "Pick-up location", btw, the "Allowed" states there's a list, not that the user should select it. This patch will resolve this problem. To test: 1) Go in System preferences and find the "UseBranchTransfertLimits". 2) Change the value of "Don't enforce" to "Enforce". 3) Come back on the menu and search a catalog. 4) Click on "Place a hold" and enter the name of a patron. 5) In the sections Hold details change the value of "pickup at" by choosing an other library. 6) Observe that the web page is refreshed, but in the second section the list of "allowed pickup locations" didn't changed. 7) Apply the patch. 8) Redo 3-4-5-6. 9) See that the values of the list of "Allowed pickup locations" has changed to the library you have chosen. --- .../prog/en/modules/reserve/request.tt | 33 ++++++++++++------- 1 file changed, 22 insertions(+), 11 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 0ed253f766..ed1fe9223a 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt @@ -743,12 +743,16 @@ [% IF (itemloo.pickup_locations_count > 0) %] + [% UNLESS ( multi_hold ) %] [% END %] @@ -1269,7 +1273,6 @@ var MSG_CANCEL_SELECTED = _("Cancel selected (%s)"); $.fn.select2.defaults.set("width", "100%" ); $.fn.select2.defaults.set("dropdownAutoWidth", true ); - $(document).ready(function() { $('#cancellation-reason-fieldset').hide(); $('.rank-request').on('change', function() { @@ -1293,7 +1296,6 @@ }); } - function ToggleHoldsToPlace() { if ( $("#requestany").prop('checked') ) { $("#holds_to_place_count").prop('disabled', false); @@ -1307,13 +1309,14 @@ }); [% IF Koha.Preference('UseBranchTransferLimits') %] - $("#pickup").on('change', function(){ - var pickup = $("#pickup").val(); - var url = "?pickup=" + pickup; - url += "&borrowernumber=" + borrowernumber; - url += "&biblionumber=" + biblionumbers[0]; - window.location.replace(url); - }); + $("#pickup").on('change', function(){ + $(".pickup_locations option:selected").text('Le nouveau texte à afficher'); + var pickup = $("#pickup").val(); + var url = "?pickup=" + pickup; + url += "&borrowernumber=" + borrowernumber; + url += "&biblionumber=" + biblionumbers[0]; + window.location.replace(url); + }); [% END %] var my_table = $("#requestspecific").dataTable($.extend(true, {}, dataTablesDefaults, { @@ -1424,6 +1427,14 @@ $(".pickup_locations").each(function () { $(this).pickup_locations_dropdown(); }); + + const pickup_location_code = window.location.search.substring(1).split('&').filter(tableau => tableau.split('=')[0] == 'pickup'); + + if(pickup_location_code.length > 0 ){ + $(".pickup_locations").val(pickup_location_code[0].split('=')[1]); + } + + }); function check( table ) { -- 2.34.1