Bug 14100: Fix 3 occurrences more
[koha_ffzg] / koha-tmpl / opac-tmpl / bootstrap / en / modules / opac-reserve.tt
index e82540c..a864dde 100644 (file)
@@ -1,12 +1,12 @@
 [% USE Koha %]
 [% USE KohaDates %]
 [% INCLUDE 'doc-head-open.inc' %]
-[% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog › Placing a hold
+<title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog &rsaquo; Placing a hold</title>
 [% INCLUDE 'doc-head-close.inc' %]
 [% BLOCK cssinclude %][% END %]
 </head>
 
-<body id="opac-holds">
+[% INCLUDE 'bodytag.inc' bodyid='opac-holds' %]
 [% INCLUDE 'masthead.inc' %]
 
 <div class="main">
                             </div>
                         [% END %]
 
+                        [% IF ( new_reserves_allowed ) %]
+                            <div id="new_reserves_allowed" class="alert">
+                                <strong>Sorry,</strong> you can only place [% new_reserves_allowed %] more holds. Please uncheck the checkboxes for the items you wish to not place holds on.
+                            </div>
+                        [% END %]
+
                         <form action="/cgi-bin/koha/opac-reserve.pl" method="post" id="hold-request-form">
                             <input type="hidden" name="place_reserve" value="1"/>
                             <!-- These values are set dynamically by js -->
                                         </p>
 
                                         [% UNLESS ( bibitemloo.holdable ) %]
+                                            [% IF ( bibitemloo.ageRestricted ) %]
+                                                <div class="alert">Sorry, you are too young to reserve this material.</div>
+                                            [% END %]
                                             [% IF ( bibitemloo.already_reserved ) %]
                                                 <div class="alert">You have already requested this title.</div>
                                             [% ELSE %]
                                                         <li class="itype">
                                                             <span class="label">Item type: </span>
                                                             [% IF ( bibitemloo.imageurl ) %]<img src="[% bibitemloo.imageurl %]" alt="" />[% END %]
-                                                            [% bibitemloo.description %]
+                                                            [% bibitemloo.translated_description %]
                                                         </li>
                                                     [% END %]
 
-                                                    [% IF showholds || showpriority %]
+                                                    [% SET OPACShowHoldQueueDetails = Koha.Preference('OPACShowHoldQueueDetails') %]
+                                                    [% IF OPACShowHoldQueueDetails == 'holds_priority' || OPACShowHoldQueueDetails == 'priority' %]
                                                         <li class="priority">
-                                                            <span class="label">Holds and priority: </span>
-                                                            [% IF showpriority %] [% bibitemloo.rank %] [% END %]
-                                                            [% IF showholds && showpriority %] out of [% END %]
-                                                            [% IF showholds %] [% bibitemloo.reservecount %] [% END %]
+                                                            <span class="label">Your priority: </span>
+                                                            [% bibitemloo.rank %]
+                                                        </li>
+                                                    [% END %]
+
+                                                    [% IF OPACShowHoldQueueDetails == 'holds_priority' || OPACShowHoldQueueDetails == 'holds' %]
+                                                        <li class="holds-count">
+                                                            <span class="label">Number of holds: </span>
+                                                            [% bibitemloo.reservecount %]
                                                         </li>
                                                     [% END %]
 
                                                             </li>
                                                         [% END # / IF OpacHoldNotes %]
 
-                                                        [% IF OPACItemHolds == '1' or OPACItemHolds == 'force' %]
+                                                        <li>
+                                                        </li>
+                                                        [% IF bibitemloo.itemholdable %]
                                                             <!-- ITEM HOLDS -->
                                                             <li class="lradio place_on_type" style="display:none;">
-                                                                <label class="radio inline" for="reqany_[% bibitemloo.biblionumber %]">Next available item</label>
-                                                                [% IF OPACItemHolds == "1" %]
+                                                                [% IF NOT bibitemloo.force_hold %]
+                                                                    <label class="radio inline" for="reqany_[% bibitemloo.biblionumber %]">Next available item</label>
                                                                     <input type="radio" name="reqtype_[% bibitemloo.biblionumber %]"
                                                                             id="reqany_[% bibitemloo.biblionumber %]"
                                                                             class="selectany"
                                                                             value="Any"
                                                                             checked="checked"
                                                                     />
-                                                                [% ELSE %]
-                                                                    <input type="radio" name="reqtype_[% bibitemloo.biblionumber %]"
-                                                                            id="reqany_[% bibitemloo.biblionumber %]"
-                                                                            class="selectany"
-                                                                            value="Any"
-                                                                     />
                                                                 [% END %]
                                                                 <label class="radio inline" for="reqspecific_[% bibitemloo.biblionumber %]">A specific item</label>
-                                                                [% IF OPACItemHolds == "force" %]
-                                                                    <input type="radio" name="reqtype_[% bibitemloo.biblionumber %]"
-                                                                           id="reqspecific_[% bibitemloo.biblionumber %]"
-                                                                           class="selectspecific"
-                                                                           value="Specific"
-                                                                           checked="checked"
-                                                                    />
-                                                                [% ELSE %]
-                                                                    <input type="radio" name="reqtype_[% bibitemloo.biblionumber %]"
-                                                                           id="reqspecific_[% bibitemloo.biblionumber %]"
-                                                                           class="selectspecific"
-                                                                           value="Specific"
-                                                                    />
-                                                                [% END %]
+                                                                <input type="radio" name="reqtype_[% bibitemloo.biblionumber %]"
+                                                                       id="reqspecific_[% bibitemloo.biblionumber %]"
+                                                                       class="selectspecific"
+                                                                       value="Specific"
+                                                                />
                                                             </li>
-                                                        [% END # / IF OPACItemHolds %]
+                                                        [% END # / IF bibitemloo.itemholdable %]
                                                     </ul>
 
-                                                    [% IF OPACItemHolds == '1' || OPACItemHolds == 'force' %]
+                                                    [% IF bibitemloo.itemholdable %]
                                                         <table class="copiesrow table table-bordered table-striped" id="copiesrow_[% bibitemloo.biblionumber %]">
                                                             <caption>Select a specific item:</caption>
                                                             <tr>
                                                                                     <img src="[% itemLoo.imageurl %]" alt="" />
                                                                                 [% END %]
                                                                             [% END %]
-                                                                            [% itemLoo.description %]
+                                                                            [% itemLoo.translated_description %]
                                                                         </td>
                                                                     [% END %]
 
                                                                 </tr>
                                                             [% END # / FOREACH itemLoo IN bibitemloo.itemLoop%]
                                                         </table> <!-- / #copiesrow_[% bibitemloo.biblionumber %] -->
-                                                    [% END # / IF ( OPACItemHolds )%]
+                                                    [% END # / IF ( bibitemloo.itemholdable )%]
                                                 </div> <!-- / #hold-options-[% bibitemloo.biblionumber %] -->
                                             </fieldset>
                                         [% END # / IF ( bibitemloo.holdable ) %]
         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() {
           }
         });
 
+        $(".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' %]
-              $("#copiesrow_[% bibitemloo.biblionumber %]").show();
-            [% END %]
+          [% IF bibitemloo.force_hold %]
+            $("#toggle-hold-options-[% bibitemloo.biblionumber %]").click();
+            $("#reqspecific_[% bibitemloo.biblionumber %]").click();
+            $("#copiesrow_[% bibitemloo.biblionumber %]").show();
           [% END %]
         [% END %]
 
             }
         });
 
-        $(".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"; }
 
         $("#place_on_hdr").show();
 
-        [% IF OPACItemHolds == '1' %]
-            $(".place_on_type").show();
-            // onload, selectany is checked
-            $(".selectany").attr("checked", "checked");
-        [% END %]
+        $(".place_on_type").show();
+        // onload, selectany is checked
+        $(".selectany").attr("checked", "checked");
 
-        // If we can choose a specific item, we preselect the first one
-        [% IF OPACItemHolds =="1" or OPACItemHolds == 'force' %]
-            $("table.copiesrow").each(function(){
-                var id = suffixOf($(this).attr("id"), "_");
-                select_first_available(id);
-            });
-        [% END %]
+        // If the user is *allowed* to choose a specific item
+        // The first one is preselected
+        $("table.copiesrow").each(function(){
+            var id = suffixOf($(this).attr("id"), "_");
+            select_first_available(id);
+        });
 
         // On confirmsjs change
         $(".confirmjs").change(function(){
             var biblionumbers = "";
             var selections = "";
 
+            [% IF new_reserves_allowed %]
+                if ($(".confirmjs:checked").size() > [% new_reserves_allowed %] ) {
+                    alert(MSG_MAX_HOLDS_EXCEEDED);
+                    return false;
+                }
+            [% END %]
+
             if ($(".confirmjs:checked").size() == 0) {
                 alert(MSG_NO_RECORD_SELECTED);
                 return false;
             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