Bug 9722: Allow users to add notes when placing a hold in opac
authorMarcel de Rooy <m.de.rooy@rijksmuseum.nl>
Mon, 25 Feb 2013 14:21:57 +0000 (15:21 +0100)
committerGalen Charlton <gmc@esilibrary.com>
Thu, 23 May 2013 15:12:49 +0000 (08:12 -0700)
The option of adding a note is controlled by new pref OpacShowHoldNotes.
This development is part of a larger one (see umbrella report 9721).

Test plan:
1 Verify if new pref is disabled by default. Place a hold. You can't add a note.
2 Enable the pref. Place a hold and add a note. Check in staff if you can see
the note in Catalogue Detail/Holds tab.
3 Toggle SingleBranchmode, AllowHoldDateInFuture/OPACAllowHoldDateInFuture,
OPACShowHoldQueueDetails, or OPACItemHolds.
Check the display of columns when placing a hold from opac.
4 Place a few holds with notes from opac search results in one run (enable
DisplayMultiPlaceHold). Check results in staff again.

Remark: A few lines already refer to mandatory note reasons. This is handled
in a subsequent report. No reason to worry.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref
koha-tmpl/opac-tmpl/prog/en/css/opac.css
koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt
opac/opac-reserve.pl

index d1225b4..81824e4 100644 (file)
@@ -417,6 +417,14 @@ OPAC:
                 yes: Display
                 no: Don't display
             - the list of authors/subjects in a popup for a combined search on OPAC detail pages.
+        -
+            - pref: OpacShowHoldNotes
+              default: 0
+              choices:
+                  yes: Allow
+                  no: Do not allow
+            - users to add a note when placing a hold.
+
     Policy:
         -
             - pref: singleBranchMode
index 24a62a1..5e5d2f4 100644 (file)
@@ -2795,6 +2795,7 @@ div.authorizedheading {
     width: 75%;
 }
 
+
 .contentblock {
     position: relative;
     margin-left: 2em;
@@ -2950,3 +2951,12 @@ a.reviewlink,a.reviewlink:visited {
 float:left;
 padding: 0.1em 0;
 }
+.notesrow label {
+    font-weight: bold;
+}
+.notesrow span {
+    display: block;
+}
+.notesrow textarea {
+    width: 100%;
+}
index 85f1c30..c77a11e 100644 (file)
@@ -4,6 +4,9 @@
 <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 = "";
         <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 %]
 
       <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 ) %]
                     [% 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 %]">
index d0da2c5..d1c3360 100755 (executable)
@@ -170,7 +170,6 @@ foreach my $biblioNumber (@biblionumbers) {
 #
 #
 if ( $query->param('place_reserve') ) {
-    my $notes = $query->param('notes');
     my $reserve_cnt = 0;
     if ($MAXIMUM_NUMBER_OF_RESERVES) {
         $reserve_cnt = GetReservesFromBorrowernumber( $borrowernumber );
@@ -254,6 +253,7 @@ if ( $query->param('place_reserve') ) {
             # Inserts a null into the 'itemnumber' field of 'reserves' table.
             $itemNum = undef;
         }
+        my $notes = $query->param('notes_'.$biblioNum)||'';
 
         if (   $MAXIMUM_NUMBER_OF_RESERVES
             && $reserve_cnt >= $MAXIMUM_NUMBER_OF_RESERVES )
@@ -373,6 +373,7 @@ foreach my $biblioNum (@biblionumbers) {
     $biblioLoopIter{rank} = $biblioData->{rank};
     $biblioLoopIter{reservecount} = $biblioData->{reservecount};
     $biblioLoopIter{already_reserved} = $biblioData->{already_reserved};
+    $biblioLoopIter{mandatorynotes}=0; #FIXME: For future use
 
     if (!$itemLevelTypes && $biblioData->{itemtype}) {
         $biblioLoopIter{description} = $itemTypes->{$biblioData->{itemtype}}{description};
@@ -547,13 +548,16 @@ if ( $numBibsAvailable == 0 || $anyholdable == 0) {
     $template->param( none_available => 1 );
 }
 
-my $itemTableColspan = 7;
+my $itemTableColspan = 8;
 if (! $template->{VARS}->{'OPACItemHolds'}) {
     $itemTableColspan--;
 }
 if (! $template->{VARS}->{'singleBranchMode'}) {
     $itemTableColspan--;
 }
+my $show_notes=C4::Context->preference('OPACShowHoldNotes');
+$template->param(OPACShowHoldNotes=>$show_notes);
+$itemTableColspan-- if !$show_notes;
 $template->param(itemtable_colspan => $itemTableColspan);
 
 # display infos