From 83ae8927495135d189448272efb46568268b7543 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 20 Jan 2014 11:36:33 +0100 Subject: [PATCH] Bug 7825: (follow-up) do not preselect item when OpacItemHolds is 'force' This patch changes the default behavior for the 'force' value. If the pref is set to force, no item is preselected and the item list is shown. Signed-off-by: Katrin Fischer Signed-off-by: Galen Charlton --- .../opac-tmpl/prog/en/modules/opac-reserve.tt | 35 ++++++++++--------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt index 80d04582c1..d8463555c2 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt @@ -32,6 +32,11 @@ function select_first_available(id){ var copiesRowId = null; var wasSpecific = false; var lastCopiesRowId = null; + + $(".toggle-hold-options").show(); + $(".hold-options").hide(); + $(".holddatefrom,.holddateto").prop("readOnly", true); + $(".checkitem").parent().click(function(e){ if(e.target.tagName.toLowerCase() == 'td'){ $(this).find("input.checkitem").each( function() { @@ -50,6 +55,15 @@ function select_first_available(id){ } }); + $(".toggle-hold-options").on("click",function(e){ + e.preventDefault(); + toggleLink = $(this); + var optionsID = this.id.replace("toggle-hold-options-",""); + $("#hold-options-"+optionsID).toggle(0, function() { + toggleLink.text($(this).is(':visible') ? _("Hide options") : _("Show more options")); + }); + }); + // Hides all 'specific copy' table rows on load. $(".copiesrow").hide(); @@ -62,10 +76,6 @@ function select_first_available(id){ } }); - $(".toggle-hold-options").show(); - $(".hold-options").hide(); - $(".holddatefrom,.holddateto").prop("readOnly", true); - $(".date-format").each(function(){ if($(this).hasClass("to")){ var op = "to"; } if($(this).hasClass("from")){ var op = "from"; } @@ -118,8 +128,9 @@ function select_first_available(id){ $(".selectany").attr("checked", "checked"); [% END %] - // If we can choose a specific item, we preselect the first one - [% IF OPACItemHolds =="1" or OPACItemHolds == 'force' %] + // If the user is *allowed* to choose a specific item + // The first one is preselected + [% IF OPACItemHolds =="1" %] $("table.copiesrow").each(function(){ var id = suffixOf($(this).attr("id"), "_"); select_first_available(id); @@ -203,17 +214,6 @@ function select_first_available(id){ $("#biblionumbers").val(biblionumbers); return true; }); - $(".toggle-hold-options").on("click",function(e){ - e.preventDefault(); - toggleLink = $(this); - var optionsID = this.id.replace("toggle-hold-options-",""); - $("#hold-options-"+optionsID).toggle(0, function() { - toggleLink.text($(this).is(':visible') ? _("Hide options") : _("Show more options")); - }); - }); - - - [% FOREACH bibitemloo IN bibitemloop %] @@ -489,6 +489,7 @@ function select_first_available(id){ [% IF OPACItemHolds == 'force' %] -- 2.39.2