6 [% USE AuthorisedValues %]
7 [% INCLUDE 'doc-head-open.inc' %]
8 <title>Placing a hold › [% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog</title>
9 [% INCLUDE 'doc-head-close.inc' %]
10 [% BLOCK cssinclude %][% END %]
13 [% INCLUDE 'bodytag.inc' bodyid='opac-holds' %]
14 [% INCLUDE 'masthead.inc' %]
17 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumbs">
18 <ol class="breadcrumb">
19 <li class="breadcrumb-item">
20 <a href="/cgi-bin/koha/opac-main.pl">Home</a>
22 <li class="breadcrumb-item active">
23 <a href="#" aria-current="page">Placing a hold</a>
26 </nav> <!-- /#breadcrumbs -->
28 <div class="container">
29 <div id="holds" class="maincontent">
30 <h1>Placing a hold</h1>
32 <div id="holdmessages" class="alert">
33 <p>Sorry, you cannot place holds.</p>
37 According to our records, we don't have up-to-date contact information. Please contact the library.
38 <a href="/cgi-bin/koha/opac-memberentry.pl">[% IF ( Koha.Preference('OPACPatronDetails') ) %]<span>Update your contact information</span>[% ELSE %]<span>Go to your contact information</span>[% END %]</a>
39 [% IF ( Koha.Preference('OPACPatronDetails') ) %]<em>(Please note: there may be a delay in restoring your account if you submit online.)</em>[% END %]
45 Your library card has been marked as lost or stolen.<br />
46 <em>If this is an error, please take your library card to the circulation desk at your local library and the error will be corrected.</em>
52 Your account has been frozen.
53 [% IF debarred_comment %]
55 <span id="userdebarred_comment">
57 [% IF debarred_comment.search('OVERDUES_PROCESS') %]
58 Restriction added by overdues process [% debarred_comment.remove('OVERDUES_PROCESS ') | html_line_break %]
60 [% debarred_comment | html_line_break %]
66 [% IF debarred_date && debarred_date != '9999-12-31' %]
68 <span id="userdebarred_date">[% debarred_date | $KohaDates %]</span>
70 <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>
74 [% IF ( too_much_oweing ) %]
75 <li id="too_much_oweing">
76 You have unpaid fines. Amount: [% too_much_oweing | $Price %].
80 [% IF ( too_many_reserves ) %]
81 <li id="too_many_reserves">
82 Sorry, you cannot place more than [% too_many_reserves | html %] holds.
86 [% IF ( bad_biblionumber ) %]
87 <li id="bad_biblionumber">
88 ERROR: No record found for record id [% bad_biblionumber | html %].
92 [% IF ( no_items_selected ) %]
93 <li id="no_items_selected">
94 You must select at least one item.
98 [% IF ( no_branch_selected ) %]
99 <li id="no_branch_selected">
100 You must select a library for pickup.
104 [% IF ( no_biblionumber ) %]
105 <li id="no_biblionumber">
106 ERROR: No record id specified.
110 [% IF ( bad_data ) %]
112 ERROR: Internal error: incomplete hold request.
116 [% IF ( expired_patron ) %]
117 <li id="expired_patron">
118 Your library card has expired. Please contact your librarian if you wish to renew your card.
122 [% IF ( no_pickup_locations ) %]
123 <li id="no_pickup_locations">
124 None of the libraries are available for pickup location.
128 </div> <!-- /.message -->
129 [% ELSE # /IF message %]
131 [% IF ( none_available && multi_hold ) %]
132 <div id="none_available" class="alert">
133 Sorry, none of these titles can be placed on hold.
137 [% END # / IF message %]
139 [% UNLESS ( message ) %]
140 [% UNLESS ( none_available ) %]
141 <h2>Confirm holds for:[% INCLUDE 'patron-title.inc' patron = logged_in_user %] ([% logged_in_user.cardnumber | html %])</h2>
142 [% END # / UNLESS none_available %]
144 [% IF (RESERVE_CHARGE) %]
145 <div class="alert" id="reserve_fee">
146 [% IF Koha.Preference('HoldFeeMode') == 'any_time_is_collected' %]
147 <span>You will be charged a hold fee of [% RESERVE_CHARGE | $Price %] when you collect this item</span>
149 <span>You will be charged a hold fee of [% RESERVE_CHARGE | $Price %] for placing this hold</span>
154 [% IF ( new_reserves_allowed ) %]
155 <div id="new_reserves_allowed" class="alert">
156 <strong>Sorry,</strong> you can only place [% new_reserves_allowed | html %] more holds. Please uncheck the checkboxes for the items you wish to not place holds on.
160 <form action="/cgi-bin/koha/opac-reserve.pl" method="post" id="hold-request-form">
161 <legend class="sr-only">Hold requests</legend>
162 <input type="hidden" name="place_reserve" value="1"/>
163 <!-- These values are set dynamically by js -->
164 <input type="hidden" name="biblionumbers" id="biblionumbers"/>
165 <input type="hidden" name="selecteditems" id="selections"/>
168 [% FOREACH bibitemloo IN bibitemloop %]
169 <div class="holdrow">
170 [% IF bibitemloo.forced_hold_level %]
171 <div class="alert alert-info forced_hold_level">
172 [% IF bibitemloo.forced_hold_level == 'item' %]
173 <span>You already have at least one item level hold on this title.
174 All further holds must be item level.</span>
176 <span>You already have at least one record level hold on this title.
177 All further holds must be record level.</span>
182 [% IF ( bibitemloo.holdable ) %]
183 <input class="reserve_mode" name="reserve_mode" type="hidden" value="single"/>
184 <input class="single_bib" name="single_bib" type="hidden" value="[% bibitemloo.biblionumber | html %]"/>
185 <span class="confirmjs_hold" title="[% bibitemloo.biblionumber | html %]" style="padding:.3em"></span>
186 <span class="confirm_nonjs">
187 <input type="radio" class="confirmbox checkitem [% bibitemloo.biblionumber | html %]" name="[% bibitemloo.biblionumber | html %]" checked="checked" id="single_[% bibitemloo.biblionumber | html %]" value="any" />
188 <label class="confirm_label" for="single_[% bibitemloo.biblionumber | html %]">Place a hold on </label>
190 [% END # / bibitemloo.holdable %]
192 [% INCLUDE 'biblio-title.inc' biblio=bibitemloo link=> 1%]
194 [% IF ( bibitemloo.author ) %], by [% bibitemloo.author | html %][% END %]
197 [% UNLESS ( bibitemloo.holdable ) %]
198 [% IF ( bibitemloo.ageRestricted ) %]
199 <div class="alert alert-warning">Sorry, you are too young to place a hold for this item.</div>
201 [% IF ( bibitemloo.already_reserved ) %]
202 <div class="alert alert-warning">You have already requested this title.</div>
203 [% ELSIF ( bibitemloo.recall ) %]
204 <div class="alert alert-warning">You have already placed a recall on this title.</div>
206 [% IF bibitemloo.alreadypossession %]
207 <div class="alert alert-warning">This title cannot be requested because it's already in your possession.</div>
208 [% ELSIF bibitemloo.tooManyReserves %]
209 <div class="alert alert-warning">This title cannot be requested because you reached the maximum number of holds.</div>
210 [% ELSIF bibitemloo.tooManyHoldsForThisRecord %]
211 <div class="alert alert-warning">This title cannot be requested because you exceeded max holds per record.</div>
212 [% ELSIF bibitemloo.tooManyReservesToday %]
213 <div class="alert alert-warning">This title cannot be requested because you reached the daily hold limit.</div>
214 [% ELSIF bibitemloo.itemAlreadyOnHold %]
215 <div class="alert alert-warning">This title cannot be requested because you already have hold for this item.</div>
217 [% UNLESS ( bibitemloo.bib_available ) %]
218 <div class="alert">There are no items that can be placed on hold.</div>
220 <div class="alert">This title cannot be requested.</div>
222 [% END # / UNLESS bibitemloo.already_patron_possession %]
223 [% END # / IF bibitemloo.already_reserved %]
224 [% END # / UNLESS bibitemloo.holdable %]
226 [% IF ( bibitemloo.holdable ) %]
227 <fieldset class="rows">
230 [% UNLESS ( item_level_itypes ) %]
232 <span class="label">Item type: </span>
233 [% IF ( bibitemloo.imageurl ) %]<img src="[% bibitemloo.imageurl | html %]" alt="" />[% END %]
234 [% bibitemloo.translated_description | html %]
238 [% SET OPACShowHoldQueueDetails = Koha.Preference('OPACShowHoldQueueDetails') %]
239 [% IF OPACShowHoldQueueDetails == 'holds_priority' || OPACShowHoldQueueDetails == 'priority' %]
240 <li class="priority">
241 <span class="label">Your priority: </span>
242 [% bibitemloo.rank | html %]
246 [% IF OPACShowHoldQueueDetails == 'holds_priority' || OPACShowHoldQueueDetails == 'holds' %]
247 <li class="holds-count">
248 <span class="label">Number of holds: </span>
249 [% bibitemloo.reservecount | html %]
253 [% UNLESS ( singleBranchMode ) %]
254 [% IF ( bibitemloo.holdable && Koha.Preference('OPACAllowUserToChooseBranch')) %]
256 <label for="branch_[% bibitemloo.biblionumber | html %]">Pick up location:</label>
257 [% UNLESS ( bibitemloo.holdable ) %]
258 <select name="branch" id="branch_[% bibitemloo.biblionumber | html %]" disabled="disabled">
259 [% PROCESS options_for_libraries libraries => Branches.pickup_locations({ search_params => { biblio => bibitemloo.biblionumber, patron => logged_in_user }, selected => branch }) %]
262 [% SET at_least_one_library_not_available_for_pickup = 0 %]
263 <select name="branch" id="branch_[% bibitemloo.biblionumber | html %]">
264 [% FOREACH library IN Branches.pickup_locations({ search_params => { biblio => bibitemloo.biblionumber, patron => logged_in_user }, selected => branch }) %]
265 [% SET pickup_available_at = bibitemloo.not_available_at.grep('^' _ library.branchcode _ '$').size ? 0 : 1 %]
266 [% IF library.selected AND pickup_available_at %]
267 <option value="[% library.branchcode | html %]" selected="selected" >[% library.branchname | html %]</option>
268 [% ELSIF pickup_available_at %]
269 <option value="[% library.branchcode | html %]">[% library.branchname | html %]</option>
271 [% SET at_least_one_library_not_available_for_pickup = 1 %]
272 <option value="[% library.branchcode | html %]" disabled="disabled" title="At least one item is available at this library">[% library.branchname | html %]</option>
276 [% IF at_least_one_library_not_available_for_pickup %]
277 <div class="at_least_one_library_not_available_note">Note: Library policy does not allow hold/pickup of an item available locally. Please come to the library to retrieve these items</div>
279 [% END # / UNLESS bibitemloo.holdable %]
281 [% END # / IF bibitemloo.holdable && Koha.Preference('OPACAllowUserToChooseBranch') %]
282 [% END # / UNLESS singleBranchMode %]
285 <a class="toggle-hold-options" id="toggle-hold-options-[% bibitemloo.biblionumber | html %]" style="display:none;" href="#">Show more options</a>
287 <div id="hold-options-[% bibitemloo.biblionumber | html %]" class="hold-options">
290 [% IF ( reserve_in_future ) %]
292 <label for="from[% bibitemloo.biblionumber | html %]">Hold starts on date:</label>
293 <input type="text" name="reserve_date_[% bibitemloo.biblionumber | html %]" id="from[% bibitemloo.biblionumber | html %]" data-start_for="to[% bibitemloo.biblionumber | html %]" size="10" class="flatpickr holddatefrom" />
294 <span class="date-format from" data-biblionumber="[% bibitemloo.biblionumber | html %]">[% INCLUDE 'date-format.inc' %]</span>
299 <label for="to[% bibitemloo.biblionumber | html %]">Hold not needed after:</label>
300 <input type="text" name="expiration_date_[% bibitemloo.biblionumber | html %]" id="to[% bibitemloo.biblionumber | html %]" size="10" class="flatpickr futuredate" />
301 <span class="date-format to" data-biblionumber="[% bibitemloo.biblionumber | html %]">[% INCLUDE 'date-format.inc' %]</span>
304 [% IF Koha.Preference('AllowHoldItemTypeSelection') %]
306 <label for="itemtype">Request specific item type:</label>
307 <select name="itemtype" id="itemtype">
308 <option value="">Any item type</option>
309 [% FOREACH i IN bibitemloo.allowed_item_types %]
310 <option value="[% i | html %]">[% ItemTypes.GetDescription( i ) | html %]</option>
316 [% IF ( OpacHoldNotes ) %]
318 <div class="notesrow" id="notesrow_[% bibitemloo.biblionumber | html %]">
319 <label for="holdnotes_[% bibitemloo.biblionumber | html %]">Hold notes:</label>
320 [% IF bibitemloo.reqholdnotes %]
321 <span id="reqholdnotes_[% bibitemloo.biblionumber | html %]">Please enter additional information about the requested item:</span>
323 <textarea id="holdnotes_[% bibitemloo.biblionumber | html %]" rows="2" cols="30" name="notes_[% bibitemloo.biblionumber | html %]" >[% bibitemloo.holdnotes | html %]</textarea>
326 [% END # / IF OpacHoldNotes %]
328 [% IF bibitemloo.itemholdable %]
330 <li class="lradio place_on_type" style="display:none;">
331 [% IF NOT bibitemloo.force_hold %]
332 <label class="radio inline" for="reqany_[% bibitemloo.biblionumber | html %]">Next available item</label>
333 <input type="radio" name="reqtype_[% bibitemloo.biblionumber | html %]"
334 id="reqany_[% bibitemloo.biblionumber | html %]"
340 <label class="radio inline" for="reqspecific_[% bibitemloo.biblionumber | html %]">A specific item</label>
341 <input type="radio" name="reqtype_[% bibitemloo.biblionumber | html %]"
342 id="reqspecific_[% bibitemloo.biblionumber | html %]"
343 class="selectspecific"
347 [% END # / IF bibitemloo.itemholdable %]
350 [% IF bibitemloo.itemholdable %]
351 <div id="copiesrow_[% bibitemloo.biblionumber | html %]" class="copiesrow">
352 <table class="table table-bordered table-striped itemstable">
353 <caption>Select a specific item:</caption>
357 [% IF ( item_level_itypes ) %]
361 [% UNLESS ( singleBranchMode ) %]
362 <th>Home library</th>
363 <th>Last location</th>
365 [% IF ( itemdata_ccode ) %]
369 [% IF ( itemdata_enumchron ) %]
378 [% SET unholdable_items = 0 %]
379 [% FOREACH itemLoo IN bibitemloo.itemLoop %]
380 [% IF ( itemLoo.available ) %]
381 [% IF ( itemLoo.checkout ) %]
382 <tr class="holdable onloan">
384 <tr class="holdable">
386 <td class="copynumber" data-order="[% itemLoo.copynumber | html %]">
387 <input type="radio" class="checkitem checkitem_[% bibitemloo.biblionumber | html %]" name="checkitem_[% bibitemloo.biblionumber | html %]" value="[% itemLoo.itemnumber | html %]" />
389 [% SET unholdable_items = 1 %]
390 [% IF ( itemLoo.checkout ) %]
391 <tr class="unholdable onloan" style="display:none;">
393 <tr class="unholdable" style="display:none;">
395 <td class="copynumber">
396 <input disabled="disabled" type="radio" aria-label="Cannot be put on hold" class="checkitem" name="checkitem" value="[% itemLoo.itemnumber | html %]"
397 style="display:none;" />
398 <i class="fa fa-remove danger" aria-hidden="true" title="Cannot be put on hold"></i>
400 [% IF ( itemLoo.copynumber ) %]
401 [% itemLoo.copynumber | html %]
403 </td> [%# copynumber %]
405 [% IF ( item_level_itypes ) %]
407 [% UNLESS ( Koha.Preference('OpacNoItemTypeImages') ) %]
408 [% IF ( itemLoo.imageurl ) %]
409 <img src="[% itemLoo.imageurl | html %]" alt="" />
412 [% itemLoo.itemtype.translated_description | html %]
416 <td class="barcode">[% itemLoo.barcode | html %]</td>
417 [% UNLESS ( singleBranchMode ) %]
418 <td class="homebranch">[% Branches.GetName( itemLoo.homebranch) | html %]</td>
419 <td class="holdingbranch">[% Branches.GetName( itemLoo.holdingbranch ) | html %]</td>
421 [% IF ( itemdata_ccode ) %]
422 <td class="ccode"> [% IF ( itemLoo.ccode ) %][% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.ccode', authorised_value => itemLoo.ccode, opac => 1 ) | html %][% END %]</td>
424 <td class="call_no">[% itemLoo.itemcallnumber | html %]</td>
425 [% IF ( itemdata_enumchron ) %]
426 <td class="vol_info">[% itemLoo.enumchron | html %]</td>
428 <td class="itemnotes">
429 [% itemLoo.itemnotes | html %]
431 <td class="information">
432 [% IF ( itemLoo.checkout.date_due) %]
433 <span class="checkedout">Due [% itemLoo.checkout.date_due| $KohaDates as_due_date => 1 %]</span>
434 [% ELSIF ( itemLoo.transfertwhen ) %]
435 <span class="intransit">In transit from [% Branches.GetName( itemLoo.transfertfrom ) | html %] to [% Branches.GetName( itemLoo.transfertto ) | html %] since [% itemLoo.transfertwhen | $KohaDates %]</span>
438 [% IF ( itemLoo.itemlost == 1 || itemLoo.itemlost == 2 ) %] [%# FIXME Why only for 1 or 2? Shouldn't we test for withdrawn as well? %]
439 <span class="lost">Unavailable (lost or missing)</span>
442 [% IF ( itemLoo.notforloan ) %]
443 <span class="notforloan">Not for loan ([% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.notforloan', authorised_value => itemLoo.notforloan ) %] %])</span>
446 [% IF ( itemLoo.first_hold ) %]
447 <span class="waiting">
448 [% IF ( itemLoo.waitingdate ) %]
449 <span>Waiting for patron at [% Branches.GetName( itemLoo.ExpectedAtLibrary ) | html %] since [% itemLoo.waitingdate | $KohaDates %]</span>
450 [% ELSIF ( itemLoo.reservedate ) %]
451 <span>On hold for patron expected at [% Branches.GetName( itemLoo.ExpectedAtLibrary ) | html %] since [% itemLoo.reservedate | $KohaDates %]</span>
453 <span>On hold for patron expected at [% Branches.GetName( itemLoo.ExpectedAtLibrary ) | html %]</span>
457 <span class="notonhold">Not on hold</span>
458 [% END # / IF ( itemLoo.first_hold )%]
461 [% END # / FOREACH itemLoo IN bibitemloo.itemLoop%]
463 </table> <!-- / #copiesrow_[% bibitemloo.biblionumber | html %] -->
464 [% IF unholdable_items %]
465 <button id="show_unholdable" class="btn btn-primary toggle_unholdable unholdable">Show unholdable items</button>
466 <button id="hide_unholdable" class="btn btn-primary toggle_unholdable unholdable" style="display:none;">Hide unholdable items</button>
469 [% END # / IF ( bibitemloo.itemholdable )%]
470 </div> <!-- / #hold-options-[% bibitemloo.biblionumber | html %] -->
472 [% END # / IF ( bibitemloo.holdable ) %]
473 </div> <!-- / .holdrow -->
474 [% END # / FOREACH bibitemloo IN bibitemloop %]
475 </div><!-- #bigloop -->
477 [% UNLESS ( none_available ) %]
478 <input type="submit" value="Confirm hold" class="btn btn-primary placehold" />
482 [% END # / UNLESS message %]
483 </div> <!-- / #holds -->
484 </div> <!-- / .container -->
485 </div> <!-- / .main -->
486 [% INCLUDE 'opac-bottom.inc' %]
487 [% BLOCK jsinclude %]
488 [% INCLUDE 'calendar.inc' %]
489 [% INCLUDE 'datatables.inc' %]
491 var MSG_NO_ITEM_SELECTED = _("Expecting a specific item selection.");
492 var MSG_EMPTY_START_DATE = _("Hold start date should be filled.");
493 var MSG_EMPTY_END_DATE = _("Hold expiration date should be filled.");
495 $(document).ready(function() {
497 $(".toggle_unholdable").click(function(e){
499 $(this).parent('div').find(".unholdable").toggle();
502 $("#hold-request-form").preventDoubleFormSubmit();
503 var copiesRowId = null;
504 var wasSpecific = false;
505 var lastCopiesRowId = null;
507 $(".toggle-hold-options").show();
508 $(".hold-options").hide();
509 var OPACMandatoryHoldDates = "[% Koha.Preference('OPACMandatoryHoldDates') | html %]";
510 var requiredDiv = "<div class=\"required_label required\">" + _("Required") + "</div>";
511 if( OPACMandatoryHoldDates ) {
512 if( OPACMandatoryHoldDates == "start" || OPACMandatoryHoldDates == "both" ) {
513 $(".holddatefrom").prop( 'required', true );
514 $(".holddatefrom").parent().append(requiredDiv);
516 if( OPACMandatoryHoldDates == "end" || OPACMandatoryHoldDates == "both" ) {
517 $(".futuredate").prop( 'required', true );
518 $(".futuredate").parent().append(requiredDiv);
521 $(".holddatefrom,.futuredate").prop("readOnly", true);
523 $(".checkitem").parent().click(function(e){
524 if(e.target.tagName.toLowerCase() == 'td'){
525 $(this).find("input.checkitem").each( function() {
526 $(this).attr('checked', 'checked');
531 // click on a first td check the confirmjs checkbox
532 $("td.hold").click(function(e){
533 if(e.target.tagName.toLowerCase() == 'td'){
534 $(this).find("input.confirmjs").each( function() {
535 $(this).attr('checked', !$(this).attr('checked'));
541 $(".toggle-hold-options").on("click",function(e){
543 toggleLink = $(this);
544 var optionsID = this.id.replace("toggle-hold-options-","");
545 $("#hold-options-"+optionsID).toggle(0, function() {
546 toggleLink.text($(this).is(':visible') ? _("Hide options") : _("Show more options"));
549 if( $(".holddatefrom").prop('required') || $(".futuredate").prop('required') ) $(".toggle-hold-options").click();
551 // Hides all 'specific copy' table rows on load.
552 $(".copiesrow").hide();
554 [% FOREACH bibitemloo IN bibitemloop %]
555 [% IF bibitemloo.force_hold %]
556 if( $("#to[% bibitemloo.biblionumber | html %]:hidden").length )
557 $("#toggle-hold-options-[% bibitemloo.biblionumber | html %]").click();
558 $("#reqspecific_[% bibitemloo.biblionumber | html %]").click();
559 $("#copiesrow_[% bibitemloo.biblionumber | html %]").show();
561 [% IF bibitemloo.reqholdnotes %]
562 $("#holdnotes_[% bibitemloo.biblionumber | html %]").attr( 'required', true );
566 // Replace non-JS single-selection with multi-selection capability.
567 $(".reserve_mode").val("multi");
568 $(".confirm_nonjs").remove();
569 $(".confirmjs_hold").each(function(){
570 var bib = $(this).attr("title");
571 var html = "<label><input type =\"checkbox\" class=\"confirmjs\" checked=\"checked\"";
572 html += "value=\"" + bib + "\" id=\"" + bib + "\" /> " + _("Place a hold on") + " </label> ";
575 $(".confirmjs_nohold").each(function(){
576 var bib = $(this).attr("title");
577 var html = "<label><input type =\"checkbox\" class=\"confirmjs\" disabled=\"disabled\"";
578 html += "value=\"" + bib + "\" id=\"" + bib + "\" />" + _("Place a hold on: ") + "</label>";
582 // expand or collapse the copiesrow tr
583 function toggle_copiesrow(biblioNum) {
584 var checkbox = $("input:checkbox[value='"+biblioNum+"']");
585 newCopiesRowId = "#copiesrow_" + biblioNum;
586 var select_specific = $("#reqspecific_"+biblioNum).is(":checked");
587 // If the checkbox is checked AND we want a specific item, we display the items block
588 if ( $(checkbox).is(":checked") && select_specific ) {
589 $(newCopiesRowId).show();
591 $(newCopiesRowId).hide();
595 $("#place_on_hdr").show();
597 $(".place_on_type").show();
598 // onload, selectany is checked
599 $(".selectany").attr("checked", "checked");
602 // On confirmsjs change
603 $(".confirmjs").change(function(){
604 var id = suffixOf($(this).attr("id"), "_");
605 // If I m checked, I enable radio buttons
606 if ( $(this).is(":checked") ) {
607 $("#reqspecific_" + id).attr("disabled", false);
608 $("#reqany_" + id).attr("disabled", false);
610 // Else its are disabled
612 $("#reqspecific_" + id).attr("disabled", "disabled");
613 $("#reqany_" + id).attr("disabled", "disabled");
615 // expand or collaspe the items block
616 toggle_copiesrow(id);
619 // When 'specific copy' or 'first available' radio button is clicked
620 $(".selectspecific, .selectany").click(function() {
621 var id = suffixOf($(this).attr("id"), "_");
622 toggle_copiesrow(id);
625 // Show or hide holds notes
626 $(".shownotes").click(function(){
627 biblioNum = suffixOf($(this).attr("id"), "_");
628 $("#notesrow_"+biblioNum).toggle();
631 // When 'Place Hold' button is clicked
632 $(".placehold").click(function(){
633 var biblionumbers = "";
636 [% IF new_reserves_allowed %]
637 if ($(".confirmjs:checked").size() > [% new_reserves_allowed | html %] ) {
638 alert(MSG_MAX_HOLDS_EXCEEDED);
643 if ($(".confirmjs:checked").size() == 0) {
644 alert( __("No item was selected") );
648 // Find the items with the 'Hold' box checked
650 $(".confirmjs:checked").each(function() {
651 var biblioNum = $(this).val();
652 biblionumbers += biblioNum + "/";
653 selections += biblioNum + "/";
655 // If required hold note is empty, make it visible
656 if( $("#holdnotes_"+biblioNum).attr( 'required' ) && $("#holdnotes_"+biblioNum).val() == '' ) {
657 if( !$("#hold-options-"+biblioNum).is(':visible')) {
658 $("#toggle-hold-options-"+biblioNum).click();
662 if( $(".holddatefrom").prop('required') && $("#from"+ biblioNum).val() == '' ) {
663 alert(MSG_EMPTY_START_DATE);
665 if( $("#from"+biblioNum+":hidden").length ) $("#toggle-hold-options-"+biblioNum).click();
666 $("#from"+ biblioNum).focus();
668 } else if( $(".futuredate").prop('required') && $("#to"+ biblioNum).val() == '' ) {
669 alert(MSG_EMPTY_END_DATE);
671 if( $("#to"+biblioNum+":hidden").length ) $("#toggle-hold-options-"+biblioNum).click();
672 $("#to"+ biblioNum).focus();
676 // If the 'specific copy' radio button is checked
677 if ($("#reqspecific_" + biblioNum + ":checked").size() > 0) {
678 // Find the selected copy
679 var item = $(".checkitem_" + biblioNum + ":checked");
680 if ($(item).size() == 0) {
681 alert(MSG_NO_ITEM_SELECTED);
685 selections += $(item).val();
690 // Add the pickup location
691 var branchSel = $("#branch_" + biblioNum);
692 if (branchSel.size() > 0) {
693 selections += $(branchSel).val();
699 if (badBib) { // alert has been raised already
703 $("#selections").val(selections);
704 $("#biblionumbers").val(biblionumbers);
708 $(".itemstable").each(function(){
711 initComplete: function() {
712 this.find("input:radio").first().prop("checked", true );