Bug 14257: Follow-up - Add documentation, fix typo, fix test
[koha.git] / koha-tmpl / opac-tmpl / bootstrap / en / modules / opac-reserve.tt
index 6558e6e..516ada5 100644 (file)
@@ -1,7 +1,8 @@
 [% USE Koha %]
 [% USE KohaDates %]
+[% USE Price %]
 [% 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>
     </ul>
 
     <div class="container">
-
-                <div id="holds">
-                    [% IF ( message ) %]
+        <div id="holds">
+            [% IF ( message ) %]
+                <div id="holdmessages" class="alert">
+                    <p><strong>Sorry</strong>, you cannot place holds.</strong></p>
+                    <ul>
                         [% IF ( GNA ) %]
-                            <div id="gna" class="alert">
-                                <p><strong>Sorry</strong>, you cannot place holds because the library doesn't have up-to-date <a href="/cgi-bin/koha/opac-memberentry.pl">contact information</a> on file.</p>
-                                <p>Please contact your librarian, or use the <a href="/cgi-bin/koha/opac-memberentry.pl">online update form</a> to submit current information (<em>Please note:</em> there may be a delay in restoring your account if you submit online)</p>
-                            </div>
+                            <li id="gna">
+                                According to our records, we don't have up-to-date contact information. Please contact the library.
+                                <a href="/cgi-bin/koha/opac-memberentry.pl">[% IF ( Koha.Preference('OPACPatronDetails') ) %]Update your contact information[% ELSE %]Go to your contact information[% END %]</a>
+                                [% IF ( Koha.Preference('OPACPatronDetails') ) %]<em>(Please note: there may be a delay in restoring your account if you submit online.)</em>[% END %]
+                            </li>
                         [% END %]
 
                         [% IF ( lost ) %]
-                            <div id="lost" class="alert">
-                                <p><strong>Sorry</strong>, you cannot place holds because your library card has been marked as lost or stolen.</p>
-                                <p>If this is an error, please take your card to the circulation desk at your local library and the error will be corrected.</p>
-                            </div>
+                            <li id="lost">
+                                Your library card has been marked as lost or stolen.<br />
+                                <em>If this is an error, please take your card to the circulation desk at your local library and the error will be corrected.</em>
+                            </li>
                         [% END %]
 
                         [% IF ( debarred ) %]
-                            <div id="debarred" class="alert">
-                                <p><strong>Sorry</strong>, you cannot place holds because your account has been frozen.</p>
-                                <p>Usually the reason for freezing an account is old overdues or damage fees.   If <a href="/cgi-bin/koha/opac-user.pl">your account page</a> shows your account to be clear, please consult a librarian.</p>
-                            </div>
+                            <li id="debarred">
+                                Your account has been frozen.
+                                [% IF debarred_comment %] Comment: <span id="userdebarred_comment">"[% debarred_comment %]"</span>[% END %]
+                                [% IF debarred_date && debarred_date != '9999-12-31' %] End date: <span id="userdebarred_date">[% debarred_date | $KohaDates %]</span>[% END %]
+                                <br /><em>Usually the reason for freezing an account is old overdues or damage fees. If shows your account to be clear, please contact the library.</em> <a href="/cgi-bin/koha/opac-account.pl">Go to your account page</a>
+                            </li>
                         [% END %]
 
                         [% IF ( too_much_oweing ) %]
-                            <div id="too_much_oweing" class="alert">
-                                Sorry, you cannot place holds because you owe [% too_much_oweing %].
-                            </div>
+                            <li id="too_much_oweing">
+                                You have unpaid fines. Amount: [% too_much_oweing | $Price %].
+                            </li>
                         [% END %]
 
                         [% IF ( too_many_reserves ) %]
-                            <div id="too_many_reserves" class="alert">
+                            <li id="too_many_reserves">
                                 Sorry, you cannot place more than [% too_many_reserves %] holds.
-                            </div>
+                            </li>
                         [% END %]
 
                         [% IF ( bad_biblionumber ) %]
-                            <div id="bad_biblionumber" class="alert">
-                                ERROR: No biblio record found for biblionumber [% bad_biblionumber %].</div>
+                            <li id="bad_biblionumber">
+                                ERROR: No record found for record id [% bad_biblionumber %].
+                            </li>
                         [% END %]
 
                         [% IF ( no_items_selected ) %]
-                            <div id="no_items_selected" class="alert">
+                            <li id="no_items_selected">
                                 You must select at least one item.
-                            </div>
+                            </li>
                         [% END %]
 
                         [% IF ( no_branch_selected ) %]
-                            <div id="no_branch_selected" class="alert">
+                            <li id="no_branch_selected">
                                 You must select a library for pickup.
-                            </div>
+                            </li>
                         [% END %]
 
                         [% IF ( no_biblionumber ) %]
-                            <div id="no_biblionumber" class="alert">ERROR: No biblionumber received.</div>
+                            <li id="no_biblionumber">
+                               ERROR: No record id specified.
+                           </li>
                         [% END %]
 
                         [% IF ( bad_data ) %]
-                            <div id="bad_data" class="alert">ERROR: Internal error: incomplete hold request.</div>
+                            <li id="bad_data">
+                                ERROR: Internal error: incomplete hold request.
+                            </li>
                         [% END %]
 
                         [% IF ( expired_patron ) %]
-                            <div id="expired_patron" class="alert"><strong>Sorry</strong>, you cannot place holds because your library card has expired.</p><p>Please contact your librarian if you wish to renew your card.</div>
+                            <li id="expired_patron">
+                                Your library card has expired. Please contact your librarian if you wish to renew your card.
+                            </li>
                         [% END %]
 
                     [% ELSE %]
 
                         [% IF ( none_available ) %]
-                            <div id="none_available" class="alert"><strong>Sorry</strong>, none of these items can be placed on hold.
+                            <div id="none_available" class="alert">
+                                <strong>Sorry</strong>, none of these items can be placed on hold.
                             </div>
                         [% END %]
-
-                    [% END # / IF message %]
+                </div>
+            [% END # / IF message %]
 
                     [% UNLESS ( message ) %]
                         [% UNLESS ( none_available ) %]
-                            <h3>Confirm holds for:
-                                [% FOREACH USER_INF IN USER_INFO %]
-                                    [% USER_INF.firstname %] [% USER_INF.surname %] ([% USER_INF.cardnumber %])
-                                [% END %]
-                            </h3>
+                            <h3>Confirm holds for:[% USER_INFO.firstname %] [% USER_INFO.surname %] ([% USER_INFO.cardnumber %])</h3>
                         [% END # / UNLESS none_available %]
 
                         [% IF (RESERVE_CHARGE) %]
                                                         <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 ) %]
         // Hides all 'specific copy' table rows on load.
         $(".copiesrow").hide();
 
-        [% IF OPACItemHolds == 'force' %]
-          [% FOREACH bibitemloo IN bibitemloop %]
-            [% IF bibitemloo.holdable %]
-              $("#toggle-hold-options-[% bibitemloo.biblionumber %]").click();
-              $("#copiesrow_[% bibitemloo.biblionumber %]").show();
-            [% END %]
+        [% FOREACH bibitemloo IN bibitemloop %]
+          [% IF bibitemloo.force_hold %]
+            $("#toggle-hold-options-[% bibitemloo.biblionumber %]").click();
+            $("#reqspecific_[% bibitemloo.biblionumber %]").click();
+            $("#copiesrow_[% bibitemloo.biblionumber %]").show();
           [% END %]
         [% END %]
 
 
         $("#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 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);
-            });
-        [% END %]
+        $("table.copiesrow").each(function(){
+            var id = suffixOf($(this).attr("id"), "_");
+            select_first_available(id);
+        });
 
         // On confirmsjs change
         $(".confirmjs").change(function(){
             [% IF ( bibitemloo.holdable ) %]
                 // http://jqueryui.com/demos/datepicker/#date-range
                 var dates[% bibitemloo.biblionumber %] = $( "#from[% bibitemloo.biblionumber %], #to[% bibitemloo.biblionumber %]" ).datepicker({
-                    minDate: 1,
+                    minDate: 0,
                     changeMonth: true,
                     numberOfMonths: 1,
                     onSelect: function( selectedDate ) {