From 4ca89b6bc3cbca1da8e3bfce1f56e07ca5c5973c Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 20 Jan 2014 11:36:48 +0100 Subject: [PATCH] Bug 7825: (follow-up) do not preselect item when OpacItemHolds is 'force' - bootstrap Signed-off-by: Katrin Fischer Passes all tests and QA script. Retested with all 3 themes, works as expected. Signed-off-by: Galen Charlton --- .../bootstrap/en/modules/opac-reserve.tt | 39 ++++++++++--------- 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt index e82540c9ad..0ed677b35c 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt @@ -416,6 +416,11 @@ 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() { @@ -434,12 +439,22 @@ } }); + $(".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(); - [% FOREACH bibitemloo IN bibitemloop %] - [% IF bibitemloo.holdable %] - [% IF OPACItemHolds == 'force' %] + [% IF OPACItemHolds == 'force' %] + [% FOREACH bibitemloo IN bibitemloop %] + [% IF bibitemloo.holdable %] + $("#toggle-hold-options-[% bibitemloo.biblionumber %]").click(); $("#copiesrow_[% bibitemloo.biblionumber %]").show(); [% END %] [% END %] @@ -454,10 +469,6 @@ } }); - $(".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"; } @@ -509,8 +520,9 @@ $(".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); @@ -596,15 +608,6 @@ 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 %] [% IF ( bibitemloo.holdable ) %] // http://jqueryui.com/demos/datepicker/#date-range -- 2.39.5