Merge remote-tracking branch 'origin/new/bug_8636'
[koha.git] / koha-tmpl / opac-tmpl / prog / en / modules / opac-reserve.tt
1 [% INCLUDE 'doc-head-open.inc' %][% LibraryNameTitle or "Koha online" %] catalog ›  Placing a hold
2 [% INCLUDE 'doc-head-close.inc' %]
3 <script type="text/javascript">
4 // <![CDATA[
5  var MSG_NO_COPY_SELECTED = _("Expecting a specific copy selection.");
6
7  function prefixOf (s, tok) {
8      var index = s.indexOf(tok);
9      return s.substring(0, index);
10  }
11  function suffixOf (s, tok) {
12      var index = s.indexOf(tok);
13      return s.substring(index + 1);
14  }
15
16  $(document).ready(function() {
17     $('#hold-request-form').preventDoubleFormSubmit();
18
19     var copiesRowId = null;
20     var wasSpecific = false;
21     var lastCopiesRowId = null;
22         $(".checkitem").parent().click(function(e){
23                 if(e.target.tagName.toLowerCase() == 'td'){
24            $(this).find("input.checkitem").each( function() {
25                $(this).attr('checked', !$(this).attr('checked'));
26                         });
27                 }
28         });
29     // Hides all 'specific copy' table rows on load.
30     $(".copiesrow").hide();
31
32     $("#place_on_hdr").show();
33     $(".place_on_type").show();
34
35     // Replace non-JS single-selection with multi-selection capability.
36     $(".reserve_mode").val("multi");
37     $(".confirm_nonjs").remove();
38     $(".confirmjs_hold").each(function(){
39         var bib = $(this).attr("title");
40         var html = "<input type =\"checkbox\" class=\"confirmjs\" checked=\"checked\"";
41         html += "value=\"" + bib + "\"/>";
42         $(this).html(html);
43     });
44     $(".confirmjs_nohold").each(function(){
45         var bib = $(this).attr("title");
46         var html = "<input type =\"checkbox\" class=\"confirmjs\" disabled=\"disabled\"";
47         html += "value=\"" + bib + "\"/>";
48         $(this).html(html);
49     });
50
51     // Make sure a specific item was selected where specified
52     // before moving on to a new item.
53     function changeSelection (newCopiesRowId, isSpecific) {
54         if (copiesRowId && ((copiesRowId != newCopiesRowId) || (wasSpecific != isSpecific))) {
55             var biblioNum = suffixOf(copiesRowId, "_");
56
57             // If the 'specific copy' radio button was checked
58               if (wasSpecific && (copiesRowId != newCopiesRowId)) {
59                 // Find the selected copy
60                 var item = $(".checkitem_" + biblioNum + ":checked");
61                 if ($(item).size() == 0) {
62                     alert(MSG_NO_COPY_SELECTED);
63                     return false;
64                 }
65             }
66         }
67         copiesRowId = newCopiesRowId;
68         wasSpecific = isSpecific;
69         return true;
70     }
71
72     // When 'specific copy' radio button is clicked
73     $(".selectspecific").click(function() {
74
75         // Make sure all other specific copy table rows are hidden
76         biblioNum = suffixOf($(this).attr("id"), "_");
77         newCopiesRowId = "#copiesrow_" + biblioNum;
78
79         if (!changeSelection(newCopiesRowId, true)) {
80             return false;
81         }
82         $(".copiesrow:not(" + newCopiesRowId + ")").hide();
83
84         // Show the specific copy table for this radio button.
85         $(newCopiesRowId).show();
86     });
87
88
89     // When 'first available' radion button is clicked
90     $(".selectany").click(function() {
91         // Make sure all other specific copy table rows are hidden
92         biblioNum = suffixOf($(this).attr("id"), "_");
93         newCopiesRowId = "#copiesrow_" + biblioNum;
94
95         if (!changeSelection(newCopiesRowId, false)) {
96             return false;
97         }
98
99         // Hide the copies table row
100         $(".copiesrow").hide();
101     });
102
103     // When 'Place Hold' button is clicked
104     $(".placehold").click(function(){
105         var biblionumbers = "";
106         var selections = "";
107
108         if ($(".confirmjs:checked").size() == 0) {
109             alert(MSG_NO_RECORD_SELECTED);
110             return false;
111         }
112
113         // Find the items with the 'Hold' box checked
114         var badBib = null;
115         $(".confirmjs:checked").each(function() {
116             var biblioNum = $(this).val();
117             biblionumbers += biblioNum + "/";
118             selections += biblioNum + "/";
119
120             // If the 'specific copy' radio button is checked
121             if ($("#reqspecific_" + biblioNum + ":checked").size() > 0) {
122                 // Find the selected copy
123                 var item = $(".checkitem_" + biblioNum + ":checked");
124                 if ($(item).size() == 0) {
125                     badBib = biblioNum;
126                     return false;
127                 } else {
128                   selections += $(item).val();
129                 }
130             }
131             selections += "/";
132
133             // Add the pickup location
134             var branchSel = $("#branch_" + biblioNum);
135             if (branchSel.size() > 0) {
136                 selections += $(branchSel).val();
137             }
138             selections += "/";
139             return true;
140         });
141
142         if (badBib) {
143             alert(MSG_NO_COPY_SELECTED);
144             return false;
145         }
146
147         $("#selections").val(selections);
148         $("#biblionumbers").val(biblionumbers);
149
150         return true;
151     });
152
153  });
154 // ]]>
155 </script>
156 <style type="text/css">td ul { padding : 0; } td li { white-space: nowrap; font-size: 90%; list-style-type:none; padding : .3em 0; }</style>
157 </head>
158
159 <body id="opac-holds">
160   <div id="doc3" class="yui-t7">
161     [% INCLUDE 'masthead.inc' %]
162     <div id="bd">
163           <div id="yui-g">
164         <div id="holds" class="container">
165         [% IF ( message ) %]
166             [% IF ( GNA ) %]
167               <div id="gna" class="dialog alert">
168                 <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>
169               <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>
170               </div>
171             [% END %]
172             [% IF ( lost ) %]
173               <div id="lost" class="dialog alert">
174                 <p><strong>Sorry</strong>, you cannot place holds because your library card has been marked as lost or stolen.</p>
175                 <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>
176               </div>
177             [% END %]
178             [% IF ( debarred ) %]
179               <div id="debarred" class="dialog alert">
180                 <p><strong>Sorry</strong>, you cannot place holds because your account has been frozen.</p>
181                 <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>
182               </div>
183             [% END %]
184             [% IF ( too_much_oweing ) %]
185               <div id="too_much_oweing" class="dialog alert">
186                 Sorry, you cannot place holds because you owe [% too_much_oweing %].
187               </div>
188             [% END %]
189             [% IF ( too_many_reserves ) %]
190               <div id="too_many_reserves" class="dialog alert">Sorry, you cannot place more than [% too_many_reserves %] holds.
191               </div>
192             [% END %]
193             [% IF ( bad_biblionumber ) %]
194               <div id="bad_biblionumber" class="dialog alert">ERROR: No biblio record found for biblionumber [% bad_biblionumber %].</div>
195             [% END %]
196             [% IF ( no_items_selected ) %]
197               <div id="no_items_selected" class="dialog alert">
198                 You must select at least one item.
199               </div>
200             [% END %]
201             [% IF ( no_branch_selected ) %]
202               <div id="no_branch_selected" class="dialog alert">
203                 You must select a library for pickup.
204               </div>
205             [% END %]
206             [% IF ( no_biblionumber ) %]
207               <div id="no_biblionumber" class="dialog alert">ERROR: No biblionumber received.</div>
208             [% END %]
209             [% IF ( bad_data ) %]
210               <div id="bad_data" class="dialog alert">ERROR: Internal error: incomplete hold request.</div>
211             [% END %]
212           [% ELSE %]
213             [% IF ( none_available ) %]
214                 <div id="none_available" class="dialog alert"><strong>Sorry</strong>, none of these items can be placed on hold.
215                 </div>
216               [% END %]
217           [% END %]<!-- NAME="message" -->
218
219       [% UNLESS ( message ) %][% UNLESS ( none_available ) %]<h3>Confirm holds for:
220                       [% FOREACH USER_INF IN USER_INFO %]
221                         [% USER_INF.firstname %] [% USER_INF.surname %] ([% USER_INF.cardnumber %])
222                       [% END %]
223                     </h3>[% END %]
224               [% IF (RESERVE_CHARGE) %]
225               <div class="dialog alert" id="reserve_fee">
226                 There is a charge of [% RESERVE_CHARGE %] for placing this hold
227               </div>
228               [% END %]
229
230             <form action="/cgi-bin/koha/opac-reserve.pl" method="post" id="hold-request-form">
231             <input type="hidden" name="place_reserve" value="1"/>
232
233             <!-- These values are set dynamically by js -->
234             <input type="hidden" name="biblionumbers" id="biblionumbers"/>
235             <input type="hidden" name="selecteditems" id="selections"/>
236             <div id="bigloop">
237               <table id="bibitemloop">
238                 [% UNLESS ( none_available ) %]<tr>
239                   <th>Hold</th>
240                   <th>Title</th>
241                   [% UNLESS ( item_level_itypes ) %]
242                     <th>Item type</th>
243                   [% END %]
244                   [% IF showholds && showpriority %]
245                   <th>Holds and priority</th>
246                   [% ELSIF showholds %]
247                   <th>Holds</th>
248                   [% ELSIF showpriority %]
249                   <th>Priority</th>
250                   [% END %]
251                   [% IF ( reserve_in_future ) %]
252         <th>Hold starts on date</th>
253                   [% END %]
254         <th>Hold not needed after</th>
255                   [% IF ( OPACItemHolds ) %]
256                     <th id="place_on_hdr" style="display:none">Place on</th>
257                   [% END %]
258                   [% UNLESS ( singleBranchMode ) %]
259                     [% IF ( choose_branch ) %]
260                         <th>Pickup location</th>
261                     [% END %]
262                   [% END %]
263                 </tr>[% ELSE %]<tr><th colspan="5">Title</th></tr>[% END %]
264
265                 [% FOREACH bibitemloo IN bibitemloop %]
266                   <tr>
267                       [% IF ( bibitemloo.holdable ) %]
268                                     <td class="hold">
269                       <input class="reserve_mode" name="reserve_mode" type="hidden" value="single"/>
270                       <input class="single_bib" name="single_bib" type="hidden" value="[% bibitemloo.biblionumber %]"/>
271                         <span class="confirmjs_hold" title="[% bibitemloo.biblionumber %]"></span>
272                         <span class="confirm_nonjs">
273                           <input type="radio" class="confirmbox checkitem [% bibitemloo.checkitem_bib %]"
274                                  name="[% bibitemloo.checkitem_bib %]" checked="checked"
275                                  id="[% bibitemloo.checkitem_bib %]"
276                                  value="any" />
277                           <label class="confirm_label" for="[% bibitemloo.checkitem_bib %]">Next available copy</label>
278                         </span>
279                                         </td>
280                       [% ELSE %]
281                                       [% UNLESS ( none_available ) %]<td class="hold">&nbsp;</td>[% END %]
282                       [% END %]
283                     [% IF ( bibitemloo.holdable ) %]<td class="title">[% ELSE %]<td class="title" colspan="5">[% END %]
284                       <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>
285                       [% IF ( bibitemloo.author ) %],  by [% bibitemloo.author %][% END %]
286
287                       [% UNLESS ( bibitemloo.holdable ) %]
288
289                         [% IF ( bibitemloo.already_reserved ) %]
290                           <div class="bibmessage">You have already requested this title.</div>
291                         [% ELSE %]
292                           [% UNLESS ( bibitemloo.bib_available ) %]
293                             <div class="bibmessage">No available items.</div>
294                           [% ELSE %]
295                             <div class="bibmessage">This title cannot be requested.</div>
296                           [% END %]
297                         [% END %]
298
299
300                         [% END %]
301
302                     </td>
303                     [% IF ( bibitemloo.holdable ) %]
304             <!-- HOLDABLE -->
305                         [% UNLESS ( item_level_itypes ) %]
306                         <td class="itype">
307                             [% IF ( bibitemloo.imageurl ) %]<img src="[% bibitemloo.imageurl %]" alt="" />[% END %]
308                             [% bibitemloo.description %]
309                         </td>
310                         [% END %]
311                         [% IF showholds || showpriority %]
312                         <td class="priority">
313                         [% IF showpriority %] [% bibitemloo.rank %] [% END %]
314                         [% IF showholds && showpriority %] out of [% END %]
315                         [% IF showholds %] [% bibitemloo.reservecount %] [% END %]
316                         </td>
317                         [% END %]
318                 [% IF ( reserve_in_future ) %]
319                         <td class="reserve_date">
320               <input name="reserve_date_[% bibitemloo.biblionumber %]" id="from" size="10" class="datepickerfrom"/>
321               <script language="JavaScript" type="text/javascript">
322               //<![CDATA[
323               $("#reserve_date_[% bibitemloo.biblionumber %]").attr( 'readonly', 'readonly' );
324               //]]>
325               </script>
326       <p style="margin:.3em 2em;">
327       <a href="#" style="font-size:85%;text-decoration:none;" onclick="document.getElementById('reserve_date_[% bibitemloo.biblionumber %]').value='';return false;">Clear date</a></p>
328                 </td>[% END %]
329
330                     [% END %]
331         [% IF ( bibitemloo.holdable ) %]<td class="expiration_date">
332         <input name="expiration_date_[% bibitemloo.biblionumber %]" id="to" size="10" readonly="readonly" class="datepickerto" />
333       <p style="margin:.3em 2em;">
334       <a href="#" style="font-size:85%;text-decoration:none;" onclick="document.getElementById('expiration_date_[% bibitemloo.biblionumber %]').value='';return false;">Clear date</a></p>
335     </td>[% END %]
336
337                     [% IF ( bibitemloo.holdable ) %]
338                     <!-- HOLD ABLE -->
339                     [% IF ( OPACItemHolds ) %]
340                     <!-- ITEM HOLDS -->
341                                           <td class="place_on_type" style="display:none">
342                                             <ul>
343                                                 <li>
344                                                   [% UNLESS ( bibitemloo.holdable ) %]
345                                                     <input type="radio" name="reqtype_[% bibitemloo.biblionumber %]"
346                                                            id="reqany_[% bibitemloo.biblionumber %]"
347                                                            class="selectany"
348                                                            value="Any"
349                                                            disabled="disabled"
350                                                     />
351                                                   [% ELSE %]
352                                                     <input type="radio" name="reqtype_[% bibitemloo.biblionumber %]"
353                                                            id="reqany_[% bibitemloo.biblionumber %]"
354                                                            class="selectany"
355                                                            value="Any"
356                                                            checked="checked"
357                                                     />
358                                                   [% END %]
359                                                   <label for="reqany_[% bibitemloo.biblionumber %]">Next available copy</label>
360                                                 </li>
361                                                 <li>
362                                                   [% UNLESS ( bibitemloo.holdable ) %]
363                                                     <input type="radio" name="reqtype_[% bibitemloo.biblionumber %]"
364                                                            id="reqspecific_[% bibitemloo.biblionumber %]"
365                                                            class="selectspecific"
366                                                            disabled="disabled"
367                                                            value="Specific"
368                                                     />
369                                                   [% ELSE %]
370                                                     <input type="radio" name="reqtype_[% bibitemloo.biblionumber %]"
371                                                            id="reqspecific_[% bibitemloo.biblionumber %]"
372                                                            class="selectspecific"
373                                                            value="Specific"
374                                                     />
375                                                   [% END %]
376                                                   <label for="reqspecific_[% bibitemloo.biblionumber %]">A specific copy</label>
377                                                 </li>
378                                             </ul>
379                                           </td>
380                                         [% END %][% END %]
381
382                     [% UNLESS ( singleBranchMode ) %]
383                         [% IF ( bibitemloo.holdable ) %]
384                             [% IF ( choose_branch ) %]
385                                           <td class="branch">
386                          [% UNLESS ( bibitemloo.holdable ) %]
387                             <select name="branch" id="branch_[% bibitemloo.biblionumber %]" disabled="disabled">
388                               [% FOREACH branchChoicesLoo IN bibitemloo.branchChoicesLoop %]
389                                 [% IF ( branchChoicesLoo.selected ) %]
390                                   <option value="[% branchChoicesLoo.value %]" selected="selected">[% branchChoicesLoo.branchname %]</option>
391                                 [% ELSE %]
392                                   <option value="[% branchChoicesLoo.value %]">[% branchChoicesLoo.branchname %]</option>
393                                 [% END %]
394                               [% END %]
395                           </select>
396                           [% ELSE %]
397                             <select name="branch" id="branch_[% bibitemloo.biblionumber %]">
398                               [% FOREACH branchChoicesLoo IN bibitemloo.branchChoicesLoop %]
399                                 [% IF ( branchChoicesLoo.selected ) %]
400                                   <option value="[% branchChoicesLoo.value %]" selected="selected">[% branchChoicesLoo.branchname %]</option>
401                                 [% ELSE %]
402                                   <option value="[% branchChoicesLoo.value %]">[% branchChoicesLoo.branchname %]</option>
403                                 [% END %]
404                               [% END %]
405                             </select>
406                           [% END %]
407                        </td>
408                             [% END %]
409                         [% END %]
410                     [% END %]
411                   </tr>
412
413                   [% IF ( OPACItemHolds ) %]
414                   [% IF ( bibitemloo.holdable ) %]
415                     <tr class="copiesrow" id="copiesrow_[% bibitemloo.biblionumber %]">
416                       <td>&nbsp;</td>
417                       <td colspan="[% itemtable_colspan %]">
418                         <table>
419                           <caption>Select a specific copy:</caption>
420                           <tr>
421                             <th>Copy</th>
422                             [% IF ( item_level_itypes ) %]
423                               <th>Item type</th>
424                             [% END %]
425                             <th>Barcode</th>
426                             [% UNLESS ( singleBranchMode ) %]
427                               <th>Home library</th>
428                               <th>Last location</th>
429                             [% END %]
430                             <th>Call number</th>
431                             [% IF ( bibitemloo.itemdata_enumchron ) %]
432                               <th>Vol info</th>
433                             [% END %]
434                             <th>Information</th>
435                           </tr>
436
437                           [% FOREACH itemLoo IN bibitemloo.itemLoop %]
438                             <tr class="[% itemLoo.backgroundcolor %]">
439                               <td class="copy">
440                                 [% IF ( itemLoo.available ) %]
441                                   <input type="radio" class="checkitem checkitem_[% bibitemloo.biblionumber %]" name="checkitem_[% bibitemloo.biblionumber %]"
442                                          value="[% itemLoo.itemnumber %]" />
443                                 [% ELSE %]
444                                   <input disabled="disabled" type="radio" class="checkitem" name="checkitem" value="[% itemLoo.itemnumber %]" />
445                                   <img src="/opac-tmpl/lib/famfamfam/silk/cross.png" alt="Cannot be put on hold" title="Cannot be put on hold" />
446                                 [% END %] [% IF ( itemLoo.copynumber ) %][% itemLoo.copynumber %][% END %]
447                               </td>
448                               [% IF ( item_level_itypes ) %]
449                                 <td class="itype">
450                                   [% UNLESS ( noItemTypeImages ) %]
451                                   [% IF ( itemLoo.imageurl ) %]<img src="[% itemLoo.imageurl %]" alt="" />[% END %]
452                                   [% END %]
453                                                                 [% itemLoo.description %]
454                                 </td>
455                               [% END %]
456                               <td class="barcode">[% itemLoo.barcode %]</td>
457                               [% UNLESS ( singleBranchMode ) %]
458                                 <td class="homebranch">[% itemLoo.homeBranchName %]</td>
459                                 <td class="holdingbranch">[% itemLoo.holdingBranchName %]</td>
460                               [% END %]
461                               <td class="call_no">[% itemLoo.callNumber %]</td>
462                               [% IF ( itemLoo.itemdata_enumchron ) %]<!-- test -->
463                                 <td class="vol_info">[% itemLoo.enumchron %]</td>
464                               [% END %]
465                               <td class="information">
466                                 [% IF ( itemLoo.dateDue ) %]
467                                   <span class="checkedout">Due [% itemLoo.dateDue %]</span>
468                                 [% ELSIF ( itemLoo.transfertwhen ) %]
469                                   <span class="intransit">In transit from [% itemLoo.transfertfrom %],
470                                     to [% itemLoo.transfertto %], since [% itemLoo.transfertwhen %]</span>
471                                 [% END %]
472                                 [% IF ( itemLoo.message ) %]
473                                   <span class="lost">Unavailable (lost or missing)</span>
474                                 [% END %]
475                                 [% IF ( itemLoo.notforloan ) %]
476                                   <span class="notforloan">Not for loan ([% itemLoo.notforloanvalue %])</span>
477                                 [% END %]
478                                 [% IF ( itemLoo.reservedate ) %]
479                                   <span class="waiting">[% IF ( itemLoo.waitingdate ) %]Waiting[% ELSE %]On hold[% END %] for patron
480                                     [% IF ( itemLoo.waitingdate ) %]at[% ELSE %]expected at[% END %] [% itemLoo.ExpectedAtLibrary %]
481                                     since
482                                     [% IF ( itemLoo.waitingdate ) %][% itemLoo.waitingdate %][% ELSE %][% IF ( itemLoo.reservedate ) %][% itemLoo.reservedate %][% END %][% END %].
483                                   </span>
484                                 [% ELSE %]
485                                   <span class="notonhold">Not on hold</span>
486                                 [% END %]&nbsp;
487                               </td>
488                             </tr>
489                           [% END %]
490                         </table>
491                       </td>
492                     </tr>
493                   [% END %]<!-- bib_available -->
494                   [% END %]<!-- OPACItemHolds -->
495                 [% END %]
496               </table><!-- bibitemloop -->
497               [% END %] <!-- if message -->
498             </div><!-- bigloop -->
499
500             [% UNLESS ( message ) %]
501             [% UNLESS ( none_available ) %]
502             <input type="submit" value="Place Hold" class="placehold" />
503             [% END %]
504             [% END %]
505
506             </form>
507
508         </div><!-- holds -->
509       </div><!-- yui-g -->
510     </div><!-- bd    -->
511   </div><!-- doc3  -->
512
513 <div><!-- The following include seems to have an extra "/div" in it... -->
514 [% INCLUDE 'opac-bottom.inc' %]