Bug 9722: Allow users to add notes when placing a hold in opac
[koha.git] / koha-tmpl / opac-tmpl / prog / en / modules / opac-reserve.tt
index 8096baf..c77a11e 100644 (file)
@@ -1,8 +1,12 @@
 [% INCLUDE 'doc-head-open.inc' %][% LibraryNameTitle or "Koha online" %] catalog ›  Placing a hold
 [% INCLUDE 'doc-head-close.inc' %]
+[% INCLUDE 'calendar.inc' %]
 <script type="text/javascript">
 // <![CDATA[
  var MSG_NO_COPY_SELECTED = _("Expecting a specific copy selection.");
+ var ForceHoldNotesReasons=new Array(
+    _("This title consists of multiple volumes/parts. Please indicate which part you need. Clicking on specific copy information may be helpful."),
+    "*** Add a new reason above this line ***" ); // NOTE: Do not renumber reasons; this will affect use of existing ones.
 
  function prefixOf (s, tok) {
      var index = s.indexOf(tok);
        });
     // Hides all 'specific copy' table rows on load.
     $(".copiesrow").hide();
+    $(".notesrow").hide();
+
+    // Insert reasons for forced hold notes
+    $(".forcenotesreason").each(function(){
+        biblioNum = suffixOf($(this).attr("id"), "_");
+        var j=$("#notesmandatory_"+biblioNum).val();
+        if(j>0) {
+            $(this).html(ForceHoldNotesReasons[j-1]);
+        }
+    });
 
     $("#place_on_hdr").show();
     $(".place_on_type").show();
         $(".copiesrow").hide();
     });
 
+    // Show or hide holds notes
+    $(".shownotes").click(function(){
+        biblioNum = suffixOf($(this).attr("id"), "_");
+        $(".notesrow").hide();
+        $("#notesrow_"+biblioNum).show();
+    });
+
     // When 'Place Hold' button is clicked
     $(".placehold").click(function(){
         var biblionumbers = "";
 
 <body id="opac-holds">
   <div id="doc3" class="yui-t7">
-    [% INCLUDE 'masthead.inc' %]
     <div id="bd">
+    [% INCLUDE 'masthead.inc' %]
          <div id="yui-g">
         <div id="holds" class="container">
         [% IF ( message ) %]
             [% IF ( GNA ) %]
               <div id="gna" class="dialog alert">
-                <p><strong>Sorry</strong>, you cannot place holds because the library doesn't have up-to-date <a href="/cgi-bin/koha/opac-userupdate.pl">contact information</a> on file.</p>
-              <p>Please contact your librarian, or use the <a href="/cgi-bin/koha/opac-userupdate.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>
+                <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>
             [% END %]
             [% IF ( lost ) %]
         <th>Hold starts on date</th>
                  [% END %]
         <th>Hold not needed after</th>
+        [% IF ( OPACShowHoldNotes ) %]<th>Notes</th>[% END %]
                   [% IF ( OPACItemHolds ) %]
                     <th id="place_on_hdr" style="display:none">Place on</th>
                   [% END %]
                         <th>Pickup location</th>
                    [% END %]
                   [% END %]
-                </tr>[% ELSE %]<tr><th colspan="5">Title</th></tr>[% END %]
+                </tr>[% ELSE %]<tr><th colspan="[% itemtable_colspan + 1 %]">Title</th></tr>[% END %]
 
                 [% FOREACH bibitemloo IN bibitemloop %]
                   <tr>
                       [% ELSE %]
                                       [% UNLESS ( none_available ) %]<td class="hold">&nbsp;</td>[% END %]
                       [% END %]
-                    [% IF ( bibitemloo.holdable ) %]<td class="title">[% ELSE %]<td class="title" colspan="5">[% END %]
+                    [% IF ( bibitemloo.holdable ) %]<td class="title">[% ELSE %]<td class="title" colspan="[% itemtable_colspan + 1 %]">[% END %]
                       <a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% bibitemloo.biblionumber %]">[% bibitemloo.title |html %][% IF ( bibitemloo.subtitle ) %] [% FOREACH subtitl IN bibitemloo.subtitle %][% subtitl.subfield %][% END %][% END %]</a>
                       [% IF ( bibitemloo.author ) %],  by [% bibitemloo.author %][% END %]
 
                           [% UNLESS ( bibitemloo.bib_available ) %]
                             <div class="bibmessage">No available items.</div>
                           [% ELSE %]
-                            <div class="bibmessage">This title cannot be requested.</div>
+                            [% IF ( bibitemloo.already_patron_possession ) %]
+                                <div class="bibmessage">This title cannot be requested because it's already in your possession.</div>
+                            [% ELSE %]
+                                <div class="bibmessage">This title cannot be requested.</div>
+                            [% END %]
                           [% END %]
                         [% END %]
 
                 [% IF ( reserve_in_future ) %]
                         <td class="reserve_date">
               <input name="reserve_date_[% bibitemloo.biblionumber %]" id="from" size="10" class="datepickerfrom"/>
-              <script language="JavaScript" type="text/javascript">
+              <script type="text/javascript">
               //<![CDATA[
               $("#reserve_date_[% bibitemloo.biblionumber %]").attr( 'readonly', 'readonly' );
               //]]>
       <a href="#" style="font-size:85%;text-decoration:none;" onclick="document.getElementById('expiration_date_[% bibitemloo.biblionumber %]').value='';return false;">Clear date</a></p>
     </td>[% END %]
 
+    [% IF ( OPACShowHoldNotes ) %][% IF ( bibitemloo.holdable ) %]<td><input type="button" id="shownotes_[% bibitemloo.biblionumber %]" class="shownotes" value="Show notes"/></td>[% END %][% END %]
+
                     [% IF ( bibitemloo.holdable ) %]
                    <!-- HOLD ABLE -->
                    [% IF ( OPACItemHolds ) %]
                                           <td class="branch">
                          [% UNLESS ( bibitemloo.holdable ) %]
                             <select name="branch" id="branch_[% bibitemloo.biblionumber %]" disabled="disabled">
-                              [% FOREACH branchChoicesLoo IN bibitemloo.branchChoicesLoop %]
-                                [% IF ( branchChoicesLoo.selected ) %]
-                                  <option value="[% branchChoicesLoo.value %]" selected="selected">[% branchChoicesLoo.branchname %]</option>
+                              [% FOREACH branchloo IN bibitemloo.branchloop %]
+                                [% IF ( branchloo.selected ) %]
+                                  <option value="[% branchloo.branchcode %]" selected="selected">[% branchloo.branchname %]</option>
                                 [% ELSE %]
-                                  <option value="[% branchChoicesLoo.value %]">[% branchChoicesLoo.branchname %]</option>
+                                  <option value="[% branchloo.branchcode %]">[% branchloo.branchname %]</option>
                                 [% END %]
                               [% END %]
                           </select>
                           [% ELSE %]
                             <select name="branch" id="branch_[% bibitemloo.biblionumber %]">
-                              [% FOREACH branchChoicesLoo IN bibitemloo.branchChoicesLoop %]
-                                [% IF ( branchChoicesLoo.selected ) %]
-                                  <option value="[% branchChoicesLoo.value %]" selected="selected">[% branchChoicesLoo.branchname %]</option>
+                              [% FOREACH branchloo IN bibitemloo.branchloop %]
+                                [% IF ( branchloo.selected ) %]
+                                  <option value="[% branchloo.branchcode %]" selected="selected">[% branchloo.branchname %]</option>
                                 [% ELSE %]
-                                  <option value="[% branchChoicesLoo.value %]">[% branchChoicesLoo.branchname %]</option>
+                                  <option value="[% branchloo.branchcode %]">[% branchloo.branchname %]</option>
                                 [% END %]
                               [% END %]
                             </select>
                     [% END %]
                   </tr>
 
+                  [% IF ( OPACShowHoldNotes ) %]
+                  [% IF ( bibitemloo.holdable ) %]
+                  <tr class="notesrow" id="notesrow_[% bibitemloo.biblionumber %]">
+                      <td>&nbsp;</td>
+                      <td colspan="[% itemtable_colspan %]">
+                          <label for="holdnotes">Hold notes:</label>&nbsp;
+                          <span id="forcenotesreason_[% bibitemloo.biblionumber %]" class="forcenotesreason"></span>
+                          <textarea name="notes_[% bibitemloo.biblionumber %]">[% bibitemloo.holdnotes %]</textarea>
+                          <input type="hidden" id="notesmandatory_[% bibitemloo.biblionumber %]" value="[% bibitemloo.mandatorynotes %]"/>
+                      </td>
+                  </tr>
+                  [% END %]
+                  [% END %]
+
                   [% IF ( OPACItemHolds ) %]
                   [% IF ( bibitemloo.holdable ) %]
                     <tr class="copiesrow" id="copiesrow_[% bibitemloo.biblionumber %]">
                               <th>Last location</th>
                             [% END %]
                             <th>Call number</th>
-                            [% IF ( bibitemloo.itemdata_enumchron ) %]
+                            [% IF ( itemdata_enumchron ) %]
                               <th>Vol info</th>
                             [% END %]
                             <th>Information</th>
                                 <td class="holdingbranch">[% itemLoo.holdingBranchName %]</td>
                               [% END %]
                               <td class="call_no">[% itemLoo.callNumber %]</td>
-                              [% IF ( itemLoo.itemdata_enumchron ) %]<!-- test -->
+                              [% IF ( itemdata_enumchron ) %]
                                 <td class="vol_info">[% itemLoo.enumchron %]</td>
                               [% END %]
                               <td class="information">