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 7597a4a..c77a11e 100644 (file)
@@ -1,9 +1,12 @@
-[% INCLUDE 'doc-head-open.inc' %][% LibraryNameTitle or "Koha Online" %] Catalog ›  Placing a hold
+[% 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</th>
                   <th>Title</th>
                   [% UNLESS ( item_level_itypes ) %]
-                    <th>Item Type</th>
+                    <th>Item type</th>
                   [% END %]
-                  [% IF ( showpriority ) %]
+                  [% IF showholds && showpriority %]
+                  <th>Holds and priority</th>
+                  [% ELSIF showholds %]
+                  <th>Holds</th>
+                  [% ELSIF showpriority %]
                   <th>Priority</th>
                   [% END %]
                  [% IF ( reserve_in_future ) %]
-                 <th>Hold Starts on Date</th>
+        <th>Hold starts on date</th>
                  [% END %]
-                 <th>Hold Not Needed After</th>
+        <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>
+                    <th id="place_on_hdr" style="display:none">Place on</th>
                   [% END %]
                   [% UNLESS ( singleBranchMode ) %]
                    [% IF ( choose_branch ) %]
-                        <th>Pickup Location</th>
+                        <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>
                       [% IF ( bibitemloo.holdable ) %]
-                                         <td>
+                                    <td class="hold">
                       <input class="reserve_mode" name="reserve_mode" type="hidden" value="single"/>
                       <input class="single_bib" name="single_bib" type="hidden" value="[% bibitemloo.biblionumber %]"/>
                         <span class="confirmjs_hold" title="[% bibitemloo.biblionumber %]"></span>
                         </span>
                                        </td>
                       [% ELSE %]
-                                         [% UNLESS ( none_available ) %]<td>&nbsp;</td>[% END %]
+                                      [% UNLESS ( none_available ) %]<td class="hold">&nbsp;</td>[% END %]
                       [% END %]
-                    [% IF ( bibitemloo.holdable ) %]<td>[% ELSE %]<td 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 %]
 
                         [% END %]
 
                     </td>
-                    [% IF ( bibitemloo.holdable ) %][% UNLESS ( item_level_itypes ) %]
-                                          <td>
-                                            [% IF ( bibitemloo.imageurl ) %]<img src="[% bibitemloo.imageurl %]" alt="" />[% END %]
-                                [% bibitemloo.description %]
-                                          </td>
-                                        [% END %][% END %]
                     [% IF ( bibitemloo.holdable ) %]
-                    [% IF ( showpriority ) %]
-                    <td>
-                    [% bibitemloo.rank %] out of [% bibitemloo.reservecount %]
-                    </td>[% END %][% END %]
-                   [% IF ( reserve_in_future ) %]
-                   [% IF ( bibitemloo.holdable ) %]<td>
-              <input name="reserve_date_[% bibitemloo.biblionumber %]" id="reserve_date_[% bibitemloo.biblionumber %]" size="10">
-              <script language="JavaScript" type="text/javascript">
+            <!-- HOLDABLE -->
+                        [% UNLESS ( item_level_itypes ) %]
+                        <td class="itype">
+                            [% IF ( bibitemloo.imageurl ) %]<img src="[% bibitemloo.imageurl %]" alt="" />[% END %]
+                            [% bibitemloo.description %]
+                        </td>
+                        [% END %]
+                        [% IF showholds || showpriority %]
+                        <td class="priority">
+                        [% IF showpriority %] [% bibitemloo.rank %] [% END %]
+                        [% IF showholds && showpriority %] out of [% END %]
+                        [% IF showholds %] [% bibitemloo.reservecount %] [% END %]
+                        </td>
+                        [% END %]
+                [% IF ( reserve_in_future ) %]
+                        <td class="reserve_date">
+              <input name="reserve_date_[% bibitemloo.biblionumber %]" id="from" size="10" class="datepickerfrom"/>
+              <script type="text/javascript">
               //<![CDATA[
               $("#reserve_date_[% bibitemloo.biblionumber %]").attr( 'readonly', 'readonly' );
-
-              var cal_img = document.createElement('img');
-              cal_img.src = "[% themelang %]/lib/calendar/cal.gif";
-              cal_img.alt = "Show Calendar";
-              cal_img.border = "0";
-              cal_img.id = "CalendarReserveDate[% bibitemloo.biblionumber %]";
-              cal_img.style.cursor = "pointer";
-              document.getElementById("reserve_date_[% bibitemloo.biblionumber %]").parentNode.appendChild( cal_img );
-
-              function validate[% bibitemloo.biblionumber %](date) {
-                  var today = new Date();
-                        if ( (date > today) ||
-                                ( date.getDate() == today.getDate() &&
-                                  date.getMonth() == today.getMonth() &&
-                                  date.getFullYear() == today.getFullYear() ) ) {
-                            return false;
-                        } else {
-                            return true;
-                        }
-              };
-              Calendar.setup(
-              {
-                inputField : "reserve_date_[% bibitemloo.biblionumber %]",
-                ifFormat : "[% DHTMLcalendar_dateformat %]",
-                button : "CalendarReserveDate[% bibitemloo.biblionumber %]",
-                disableFunc : validate[% bibitemloo.biblionumber %],
-                dateStatusFunc : validate[% bibitemloo.biblionumber %],
-                firstDay : [% CalendarFirstDayOfWeek %]
-              }
-              );
               //]]>
               </script>
       <p style="margin:.3em 2em;">
-      <a href="#" style="font-size:85%;text-decoration:none;" onclick="document.getElementById('reserve_date_[% bibitemloo.biblionumber %]').value='';return false;">Clear Date</a></p>
+      <a href="#" style="font-size:85%;text-decoration:none;" onclick="document.getElementById('reserve_date_[% bibitemloo.biblionumber %]').value='';return false;">Clear date</a></p>
                 </td>[% END %]
 
                    [% END %]
-       [% IF ( bibitemloo.holdable ) %]<td>
-        <input name="expiration_date_[% bibitemloo.biblionumber %]" id="expiration_date_[% bibitemloo.biblionumber %]" size="10" readonly="readonly" />
-        <img src="[% themelang %]/lib/calendar/cal.gif" alt="Show Calendar" border="0" id="CalendarExpirationDate_[% bibitemloo.biblionumber %]" style="cursor: pointer;" />
-        <script language="JavaScript" type="text/javascript">
-      //<![CDATA[
-      function validate1(date) {
-        var today = new Date();
-        if ( (date > today) ||
-                      ( date.getDate() == today.getDate() &&
-                        date.getMonth() == today.getMonth() &&
-                        date.getFullYear() == today.getFullYear() ) ) {
-          return false;
-        } else {
-          return true;
-        }
-      };
-      Calendar.setup(
-        {
-          inputField : "expiration_date_[% bibitemloo.biblionumber %]",
-          ifFormat : "[% DHTMLcalendar_dateformat %]",
-          button : "CalendarExpirationDate_[% bibitemloo.biblionumber %]",
-          disableFunc : validate1,
-          dateStatusFunc : validate1,
-          firstDay : [% CalendarFirstDayOfWeek %]
-        }
-      );
-      //]]>
-        </script>
+        [% IF ( bibitemloo.holdable ) %]<td class="expiration_date">
+        <input name="expiration_date_[% bibitemloo.biblionumber %]" id="to" size="10" readonly="readonly" class="datepickerto" />
       <p style="margin:.3em 2em;">
-      <a href="#" style="font-size:85%;text-decoration:none;" onclick="document.getElementById('expiration_date_[% bibitemloo.biblionumber %]').value='';return false;">Clear Date</a></p>
+      <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 ) %]
                     [% UNLESS ( singleBranchMode ) %]
                         [% IF ( bibitemloo.holdable ) %]
                            [% IF ( choose_branch ) %]
-                                          <td>
+                                          <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 %]">
                           <tr>
                             <th>Copy</th>
                             [% IF ( item_level_itypes ) %]
-                              <th>Item Type</th>
+                              <th>Item type</th>
                             [% END %]
                             <th>Barcode</th>
                             [% UNLESS ( singleBranchMode ) %]
-                              <th>Home Library</th>
-                              <th>Last Location</th>
+                              <th>Home library</th>
+                              <th>Last location</th>
                             [% END %]
-                            <th>Call Number</th>
-                            [% IF ( bibitemloo.itemdata_enumchron ) %]
-                              <th>Vol Info</th>
+                            <th>Call number</th>
+                            [% IF ( itemdata_enumchron ) %]
+                              <th>Vol info</th>
                             [% END %]
                             <th>Information</th>
                           </tr>
 
                           [% FOREACH itemLoo IN bibitemloo.itemLoop %]
                             <tr class="[% itemLoo.backgroundcolor %]">
-                              <td>
+                              <td class="copy">
                                 [% IF ( itemLoo.available ) %]
                                   <input type="radio" class="checkitem checkitem_[% bibitemloo.biblionumber %]" name="checkitem_[% bibitemloo.biblionumber %]"
                                          value="[% itemLoo.itemnumber %]" />
                                 [% ELSE %]
                                   <input disabled="disabled" type="radio" class="checkitem" name="checkitem" value="[% itemLoo.itemnumber %]" />
-                                  <img src="/opac-tmpl/[% theme %]/famfamfam/silk/cross.png" alt="Cannot be put on hold" title="Cannot be put on hold" />
+                                  <img src="/opac-tmpl/lib/famfamfam/silk/cross.png" alt="Cannot be put on hold" title="Cannot be put on hold" />
                                 [% END %] [% IF ( itemLoo.copynumber ) %][% itemLoo.copynumber %][% END %]
                               </td>
                               [% IF ( item_level_itypes ) %]
-                                <td>
+                                <td class="itype">
                                   [% UNLESS ( noItemTypeImages ) %]
                                   [% IF ( itemLoo.imageurl ) %]<img src="[% itemLoo.imageurl %]" alt="" />[% END %]
                                   [% END %]
                                                                [% itemLoo.description %]
                                 </td>
                               [% END %]
-                              <td>[% itemLoo.barcode %]</td>
+                              <td class="barcode">[% itemLoo.barcode %]</td>
                               [% UNLESS ( singleBranchMode ) %]
-                                <td>[% itemLoo.homeBranchName %]</td>
-                                <td>[% itemLoo.holdingBranchName %]</td>
+                                <td class="homebranch">[% itemLoo.homeBranchName %]</td>
+                                <td class="holdingbranch">[% itemLoo.holdingBranchName %]</td>
                               [% END %]
-                              <td>[% itemLoo.callNumber %]</td>
-                              [% IF ( itemLoo.itemdata_enumchron ) %]<!-- test -->
-                                <td>[% itemLoo.enumchron %]</td>
+                              <td class="call_no">[% itemLoo.callNumber %]</td>
+                              [% IF ( itemdata_enumchron ) %]
+                                <td class="vol_info">[% itemLoo.enumchron %]</td>
                               [% END %]
-                              <td>
+                              <td class="information">
                                 [% IF ( itemLoo.dateDue ) %]
                                   <span class="checkedout">Due [% itemLoo.dateDue %]</span>
                                 [% ELSIF ( itemLoo.transfertwhen ) %]