Bug 7825: (follow-up) do not preselect item when OpacItemHolds is 'force'
authorJonathan Druart <jonathan.druart@biblibre.com>
Mon, 20 Jan 2014 10:36:33 +0000 (11:36 +0100)
committerGalen Charlton <gmc@esilibrary.com>
Mon, 26 May 2014 01:01:12 +0000 (01:01 +0000)
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 <Katrin.Fischer.83@web.de>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt

index 80d0458..d846355 100644 (file)
@@ -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' %]
                             <script type="text/javascript">
                                 $(document).ready(function() {
+                                    $("#toggle-hold-options-[% bibitemloo.biblionumber %]").click();
                                     $("#copiesrow_[% bibitemloo.biblionumber %]").show();
                                 });
                             </script>