|
Lines 146-165
Link Here
|
| 146 |
<form action="/cgi-bin/koha/opac-reserve.pl" method="post" id="hold-request-form"> |
146 |
<form action="/cgi-bin/koha/opac-reserve.pl" method="post" id="hold-request-form"> |
| 147 |
<input type="hidden" name="place_reserve" value="1"/> |
147 |
<input type="hidden" name="place_reserve" value="1"/> |
| 148 |
<!-- These values are set dynamically by js --> |
148 |
<!-- These values are set dynamically by js --> |
| 149 |
<input type="hidden" name="biblionumbers" id="biblionumbers"/> |
|
|
| 150 |
<input type="hidden" name="selecteditems" id="selections"/> |
| 151 |
<div id="bigloop"> |
149 |
<div id="bigloop"> |
| 152 |
|
150 |
|
| 153 |
[% FOREACH bibitemloo IN bibitemloop %] |
151 |
[% FOREACH bibitemloo IN bibitemloop %] |
| 154 |
<div class="holdrow"> |
152 |
<div class="holdrow"> |
|
|
153 |
<input id="remaining_holds_[% bibitemloo.biblionumber %]" type="hidden" value="[% bibitemloo.remaining_holds_for_record %]"/> |
| 155 |
<p> |
154 |
<p> |
| 156 |
[% IF ( bibitemloo.holdable ) %] |
155 |
[% IF ( bibitemloo.holdable ) %] |
| 157 |
<input class="reserve_mode" name="reserve_mode" type="hidden" value="single"/> |
156 |
<span title="[% bibitemloo.biblionumber %]" style="padding:.3em"> |
| 158 |
<input class="single_bib" name="single_bib" type="hidden" value="[% bibitemloo.biblionumber | html %]"/> |
157 |
<label> |
| 159 |
<span class="confirmjs_hold" title="[% bibitemloo.biblionumber | html %]" style="padding:.3em"></span> |
158 |
<input class="biblionumbers" name="biblionumbers" type="checkbox" value="[% bibitemloo.biblionumber %]" checked="checked"> |
| 160 |
<span class="confirm_nonjs"> |
159 |
Place a hold on |
| 161 |
<input type="radio" class="confirmbox checkitem [% bibitemloo.biblionumber | html %]" name="[% bibitemloo.biblionumber | html %]" checked="checked" id="single_[% bibitemloo.biblionumber | html %]" value="any" /> |
160 |
</label> |
| 162 |
<label class="confirm_label" for="single_[% bibitemloo.biblionumber | html %]">Place a hold on </label> |
|
|
| 163 |
</span> |
161 |
</span> |
| 164 |
[% END # / bibitemloo.holdable %] |
162 |
[% END # / bibitemloo.holdable %] |
| 165 |
|
163 |
|
|
Lines 226-232
Link Here
|
| 226 |
<li class="branch"> |
224 |
<li class="branch"> |
| 227 |
<label for="branch_[% bibitemloo.biblionumber | html %]">Pick up location:</label> |
225 |
<label for="branch_[% bibitemloo.biblionumber | html %]">Pick up location:</label> |
| 228 |
[% UNLESS ( bibitemloo.holdable ) %] |
226 |
[% UNLESS ( bibitemloo.holdable ) %] |
| 229 |
<select name="branch" id="branch_[% bibitemloo.biblionumber | html %]" disabled="disabled"> |
227 |
<select name="branch_[% bibitemloo.biblionumber %]" id="branch_[% bibitemloo.biblionumber | html %]" disabled="disabled"> |
| 230 |
[% PROCESS options_for_libraries libraries => Branches.all({ search_params => { pickup_location => 1 }, selected => branch }) %] |
228 |
[% PROCESS options_for_libraries libraries => Branches.all({ search_params => { pickup_location => 1 }, selected => branch }) %] |
| 231 |
</select> |
229 |
</select> |
| 232 |
[% ELSE %] |
230 |
[% ELSE %] |
|
Lines 300-329
Link Here
|
| 300 |
</li> |
298 |
</li> |
| 301 |
[% END # / IF OpacHoldNotes %] |
299 |
[% END # / IF OpacHoldNotes %] |
| 302 |
|
300 |
|
| 303 |
[% IF bibitemloo.itemholdable %] |
301 |
<!-- ITEM HOLDS --> |
| 304 |
<!-- ITEM HOLDS --> |
302 |
<li class="lradio place_on_type" style="display:none;"> |
| 305 |
<li class="lradio place_on_type" style="display:none;"> |
303 |
<label class="radio inline" for="reqany_[% bibitemloo.biblionumber %]">Next available item</label> |
| 306 |
[% IF NOT bibitemloo.force_hold %] |
304 |
<input type="radio" name="reqtype_[% bibitemloo.biblionumber %]" |
| 307 |
<label class="radio inline" for="reqany_[% bibitemloo.biblionumber | html %]">Next available item</label> |
305 |
id="reqany_[% bibitemloo.biblionumber %]" |
| 308 |
<input type="radio" name="reqtype_[% bibitemloo.biblionumber | html %]" |
306 |
class="selectany" |
| 309 |
id="reqany_[% bibitemloo.biblionumber | html %]" |
307 |
value="Any" |
| 310 |
class="selectany" |
308 |
checked="checked" |
| 311 |
value="Any" |
|
|
| 312 |
checked="checked" |
| 313 |
/> |
| 314 |
[% END %] |
| 315 |
<label class="radio inline" for="reqspecific_[% bibitemloo.biblionumber | html %]">A specific item</label> |
| 316 |
<input type="radio" name="reqtype_[% bibitemloo.biblionumber | html %]" |
| 317 |
id="reqspecific_[% bibitemloo.biblionumber | html %]" |
| 318 |
class="selectspecific" |
| 319 |
value="Specific" |
| 320 |
/> |
309 |
/> |
| 321 |
</li> |
310 |
<label class="radio inline" for="reqspecific_[% bibitemloo.biblionumber %]">A specific item</label> |
| 322 |
[% END # / IF bibitemloo.itemholdable %] |
311 |
<input type="radio" name="reqtype_[% bibitemloo.biblionumber %]" |
|
|
312 |
id="reqspecific_[% bibitemloo.biblionumber %]" |
| 313 |
class="selectspecific" |
| 314 |
value="Specific" |
| 315 |
/> |
| 316 |
</li> |
| 323 |
</ul> |
317 |
</ul> |
| 324 |
|
318 |
|
| 325 |
[% IF bibitemloo.itemholdable %] |
319 |
[% IF bibitemloo.remaining_holds_for_record > 1 %] |
| 326 |
<table class="copiesrow table table-bordered table-striped" id="copiesrow_[% bibitemloo.biblionumber | html %]"> |
320 |
[% SET count = 1 %] |
|
|
321 |
<div id="holds_to_place_[% bibitemloo.biblionumber %]" class="hold-options holds-to-place"> |
| 322 |
<label>Holds to place (count)</label> |
| 323 |
<select name="holds_to_place_count_[% bibitemloo.biblionumber %]"> |
| 324 |
[% WHILE count <= bibitemloo.remaining_holds_for_record %] |
| 325 |
<option value="[% count %]">[% count %]</option> |
| 326 |
[% SET count = count + 1 %] |
| 327 |
[% END %] |
| 328 |
</select> |
| 329 |
</div> |
| 330 |
[% ELSE %] |
| 331 |
<input type="hidden" name="holds_to_place_count_[% bibitemloo.biblionumber %]" value="1" /> |
| 332 |
[% END %] |
| 333 |
|
| 334 |
<table class="copiesrow table table-bordered table-striped" id="copiesrow_[% bibitemloo.biblionumber %]"> |
| 327 |
<caption>Select a specific item:</caption> |
335 |
<caption>Select a specific item:</caption> |
| 328 |
<tr> |
336 |
<tr> |
| 329 |
<th>Copy number</th> |
337 |
<th>Copy number</th> |
|
Lines 349-357
Link Here
|
| 349 |
<tr class="[% itemLoo.backgroundcolor | html %]"> |
357 |
<tr class="[% itemLoo.backgroundcolor | html %]"> |
| 350 |
<td class="copynumber"> |
358 |
<td class="copynumber"> |
| 351 |
[% IF ( itemLoo.available ) %] |
359 |
[% IF ( itemLoo.available ) %] |
| 352 |
<input type="radio" class="checkitem checkitem_[% bibitemloo.biblionumber | html %]" name="checkitem_[% bibitemloo.biblionumber | html %]" value="[% itemLoo.itemnumber | html %]" /> |
360 |
<input type="checkbox" class="checkitem checkitem_[% bibitemloo.biblionumber %]" name="checkitem_[% bibitemloo.biblionumber %]" value="[% itemLoo.itemnumber %]" /> |
| 353 |
[% ELSE %] |
361 |
[% ELSE %] |
| 354 |
<input disabled="disabled" type="radio" class="checkitem" name="checkitem" value="[% itemLoo.itemnumber | html %]" |
362 |
<input disabled="disabled" type="checkbox" class="checkitem" name="checkitem" value="[% itemLoo.itemnumber %]" |
| 355 |
style="display:none;" /> |
363 |
style="display:none;" /> |
| 356 |
<img src="[% interface | html %]/lib/famfamfam/silk/cross.png" alt="Cannot be put on hold" title="Cannot be put on hold" /> |
364 |
<img src="[% interface | html %]/lib/famfamfam/silk/cross.png" alt="Cannot be put on hold" title="Cannot be put on hold" /> |
| 357 |
[% END %] |
365 |
[% END %] |
|
Lines 427-435
Link Here
|
| 427 |
</td> |
435 |
</td> |
| 428 |
</tr> |
436 |
</tr> |
| 429 |
[% END # / FOREACH itemLoo IN bibitemloo.itemLoop%] |
437 |
[% END # / FOREACH itemLoo IN bibitemloo.itemLoop%] |
| 430 |
</table> <!-- / #copiesrow_[% bibitemloo.biblionumber | html %] --> |
438 |
</table> <!-- / #copiesrow_[% bibitemloo.biblionumber %] --> |
| 431 |
[% END # / IF ( bibitemloo.itemholdable )%] |
439 |
</div> <!-- / #hold-options-[% bibitemloo.biblionumber %] --> |
| 432 |
</div> <!-- / #hold-options-[% bibitemloo.biblionumber | html %] --> |
|
|
| 433 |
</fieldset> |
440 |
</fieldset> |
| 434 |
[% END # / IF ( bibitemloo.holdable ) %] |
441 |
[% END # / IF ( bibitemloo.holdable ) %] |
| 435 |
</div> <!-- / .holdrow --> |
442 |
</div> <!-- / .holdrow --> |
|
Lines 451-456
Link Here
|
| 451 |
<script> |
458 |
<script> |
| 452 |
// <![CDATA[ |
459 |
// <![CDATA[ |
| 453 |
var MSG_NO_ITEM_SELECTED = _("Expecting a specific item selection."); |
460 |
var MSG_NO_ITEM_SELECTED = _("Expecting a specific item selection."); |
|
|
461 |
var MSG_MAX_HOLDS_EXCEEDED = _("Maximum number of reserve exceded."); |
| 454 |
|
462 |
|
| 455 |
// Clear the contents of an input field |
463 |
// Clear the contents of an input field |
| 456 |
$(".clearfield").on("click",function(e){ |
464 |
$(".clearfield").on("click",function(e){ |
|
Lines 460-467
Link Here
|
| 460 |
|
468 |
|
| 461 |
// Select the first item available |
469 |
// Select the first item available |
| 462 |
function select_first_available(id){ |
470 |
function select_first_available(id){ |
| 463 |
var radios = $("input:radio[name='checkitem_" + id + "']"); |
471 |
var checkboxes = $("input:checkbox[name='checkitem_" + id + "']"); |
| 464 |
$(radios).first().attr("checked", "checked"); |
472 |
$(checkboxes).first().attr("checked", "checked"); |
| 465 |
} |
473 |
} |
| 466 |
|
474 |
|
| 467 |
$(document).ready(function() { |
475 |
$(document).ready(function() { |
|
Lines 482-495
Link Here
|
| 482 |
} |
490 |
} |
| 483 |
}); |
491 |
}); |
| 484 |
|
492 |
|
| 485 |
// click on a first td check the confirmjs checkbox |
493 |
$('.checkitem').click(function(e) { |
| 486 |
$("td.hold").click(function(e){ |
494 |
var bibNum = suffixOf($(this).attr("name"), "_"); |
| 487 |
if(e.target.tagName.toLowerCase() == 'td'){ |
495 |
var nbCheked = $("input[name='checkitem_"+bibNum+"']:checked").length; |
| 488 |
$(this).find("input.confirmjs").each( function() { |
496 |
var remaining = $("input[id='remaining_holds_"+bibNum+"']").val(); |
| 489 |
$(this).attr('checked', !$(this).attr('checked')); |
497 |
if (nbCheked >= remaining) { |
| 490 |
$(this).change(); |
498 |
$("input[name='checkitem_"+bibNum+"']:not(:checked)").attr('disabled', 'disabled'); |
| 491 |
}); |
499 |
} |
| 492 |
} |
500 |
else { |
|
|
501 |
$('.checkitem_'+bibNum).attr('disabled', false); |
| 502 |
} |
| 493 |
}); |
503 |
}); |
| 494 |
|
504 |
|
| 495 |
$(".toggle-hold-options").on("click",function(e){ |
505 |
$(".toggle-hold-options").on("click",function(e){ |
|
Lines 504-518
Link Here
|
| 504 |
// Hides all 'specific copy' table rows on load. |
514 |
// Hides all 'specific copy' table rows on load. |
| 505 |
$(".copiesrow").hide(); |
515 |
$(".copiesrow").hide(); |
| 506 |
|
516 |
|
|
|
517 |
$(".holds-to-place").show(); |
| 507 |
[% FOREACH bibitemloo IN bibitemloop %] |
518 |
[% FOREACH bibitemloo IN bibitemloop %] |
| 508 |
[% IF bibitemloo.force_hold %] |
519 |
[% IF bibitemloo.force_hold %] |
| 509 |
$("#toggle-hold-options-[% bibitemloo.biblionumber | html %]").click(); |
520 |
[% IF bibitemloo.force_hold == 'item' %] |
| 510 |
$("#reqspecific_[% bibitemloo.biblionumber | html %]").click(); |
521 |
$("#toggle-hold-options-[% bibitemloo.biblionumber %]").click(); |
| 511 |
$("#copiesrow_[% bibitemloo.biblionumber | html %]").show(); |
522 |
$("#reqspecific_[% bibitemloo.biblionumber %]").attr('checked', true); |
| 512 |
[% END %] |
523 |
$("#holds_to_place_[% bibitemloo.biblionumber %]").hide(); |
| 513 |
[% IF bibitemloo.reqholdnotes %] |
524 |
$("#copiesrow_[% bibitemloo.biblionumber %]").show(); |
| 514 |
$("#holdnotes_[% bibitemloo.biblionumber | html %]").attr( 'required', true ); |
525 |
[% ELSIF bibitemloo.force_hold == 'record' %] |
| 515 |
[% END %] |
526 |
$("#toggle-hold-options-[% bibitemloo.biblionumber %]").click(); |
|
|
527 |
$("#reqany_[% bibitemloo.biblionumber %]").attr('checked', true); |
| 528 |
[% END %] |
| 529 |
$("#reqany_[% bibitemloo.biblionumber %]").attr('disabled', 'disabled'); |
| 530 |
$("#reqspecific_[% bibitemloo.biblionumber %]").attr('disabled', 'disabled'); |
| 531 |
[% END %] |
| 532 |
[% IF bibitemloo.reqholdnotes %] |
| 533 |
$("#holdnotes_[% bibitemloo.biblionumber %]").attr( 'required', true ); |
| 534 |
[% END %] |
| 516 |
[% END %] |
535 |
[% END %] |
| 517 |
|
536 |
|
| 518 |
$(".date-format").each(function(){ |
537 |
$(".date-format").each(function(){ |
|
Lines 529-568
Link Here
|
| 529 |
$("#" + op + fieldID).val(""); |
548 |
$("#" + op + fieldID).val(""); |
| 530 |
}); |
549 |
}); |
| 531 |
|
550 |
|
| 532 |
// Replace non-JS single-selection with multi-selection capability. |
|
|
| 533 |
$(".reserve_mode").val("multi"); |
| 534 |
$(".confirm_nonjs").remove(); |
| 535 |
$(".confirmjs_hold").each(function(){ |
| 536 |
var bib = $(this).attr("title"); |
| 537 |
var html = "<label><input type =\"checkbox\" class=\"confirmjs\" checked=\"checked\""; |
| 538 |
html += "value=\"" + bib + "\" id=\"" + bib + "\" /> " + _("Place a hold on") + " </label> "; |
| 539 |
$(this).html(html); |
| 540 |
}); |
| 541 |
$(".confirmjs_nohold").each(function(){ |
| 542 |
var bib = $(this).attr("title"); |
| 543 |
var html = "<label><input type =\"checkbox\" class=\"confirmjs\" disabled=\"disabled\""; |
| 544 |
html += "value=\"" + bib + "\" id=\"" + bib + "\" />" + _("Place a hold on: ") + "</label>"; |
| 545 |
$(this).html(html); |
| 546 |
}); |
| 547 |
|
| 548 |
// expand or collapse the copiesrow tr |
551 |
// expand or collapse the copiesrow tr |
| 549 |
function toggle_copiesrow(biblioNum) { |
552 |
function toggle_copiesrow(biblioNum) { |
| 550 |
var checkbox = $("input:checkbox[value='"+biblioNum+"']"); |
553 |
var checkbox = $("input:checkbox[value='"+biblioNum+"']"); |
| 551 |
newCopiesRowId = "#copiesrow_" + biblioNum; |
554 |
newCopiesRowId = "#copiesrow_" + biblioNum; |
|
|
555 |
holdsToPlaceCountId = "#holds_to_place_" + biblioNum; |
| 552 |
var select_specific = $("#reqspecific_"+biblioNum).is(":checked"); |
556 |
var select_specific = $("#reqspecific_"+biblioNum).is(":checked"); |
| 553 |
// If the checkbox is checked AND we want a specific item, we display the items block |
557 |
// If the checkbox is checked AND we want a specific item, we display the items block |
| 554 |
if ( $(checkbox).is(":checked") && select_specific ) { |
558 |
if ( $(checkbox).is(":checked") && select_specific ) { |
| 555 |
$(newCopiesRowId).show(); |
559 |
$(newCopiesRowId).show(); |
|
|
560 |
$(holdsToPlaceCountId).hide(); |
| 556 |
} else { |
561 |
} else { |
| 557 |
$(newCopiesRowId).hide(); |
562 |
$(newCopiesRowId).hide(); |
|
|
563 |
$(holdsToPlaceCountId).show(); |
| 558 |
} |
564 |
} |
| 559 |
}; |
565 |
}; |
| 560 |
|
566 |
|
| 561 |
$("#place_on_hdr").show(); |
567 |
function total_requested() { |
|
|
568 |
var total = 0; |
| 569 |
$("input[name='biblionumbers']:checked").each(function() { |
| 570 |
var biblioNum = $(this).val(); |
| 571 |
if ($("#reqspecific_" + biblioNum + ":checked").size() > 0) { |
| 572 |
total += parseInt($("input[name='checkitem_'"+biblioNum+"]:checked").length); |
| 573 |
} else { |
| 574 |
total += parseInt($("select[name='holds_to_place_count_"+biblioNum+"']").val()); |
| 575 |
} |
| 576 |
}); |
| 577 |
return total; |
| 578 |
} |
| 562 |
|
579 |
|
| 563 |
$(".place_on_type").show(); |
580 |
$(".place_on_type").show(); |
| 564 |
// onload, selectany is checked |
581 |
// onload, selectany is checked |
| 565 |
$(".selectany").attr("checked", "checked"); |
|
|
| 566 |
|
582 |
|
| 567 |
// If the user is *allowed* to choose a specific item |
583 |
// If the user is *allowed* to choose a specific item |
| 568 |
// The first one is preselected |
584 |
// The first one is preselected |
|
Lines 571-578
Link Here
|
| 571 |
select_first_available(id); |
587 |
select_first_available(id); |
| 572 |
}); |
588 |
}); |
| 573 |
|
589 |
|
| 574 |
// On confirmsjs change |
590 |
// On biblionumbers change |
| 575 |
$(".confirmjs").change(function(){ |
591 |
$(".biblionumbers").change(function(){ |
| 576 |
var id = suffixOf($(this).attr("id"), "_"); |
592 |
var id = suffixOf($(this).attr("id"), "_"); |
| 577 |
// If I m checked, I enable radio buttons |
593 |
// If I m checked, I enable radio buttons |
| 578 |
if ( $(this).is(":checked") ) { |
594 |
if ( $(this).is(":checked") ) { |
|
Lines 594-628
Link Here
|
| 594 |
toggle_copiesrow(id); |
610 |
toggle_copiesrow(id); |
| 595 |
}); |
611 |
}); |
| 596 |
|
612 |
|
| 597 |
// Show or hide holds notes |
|
|
| 598 |
$(".shownotes").click(function(){ |
| 599 |
biblioNum = suffixOf($(this).attr("id"), "_"); |
| 600 |
$("#notesrow_"+biblioNum).toggle(); |
| 601 |
}); |
| 602 |
|
| 603 |
// When 'Place Hold' button is clicked |
613 |
// When 'Place Hold' button is clicked |
| 604 |
$(".placehold").click(function(){ |
614 |
$(".placehold").click(function(){ |
| 605 |
var biblionumbers = ""; |
615 |
if (total_requested() + [% reserves_count %] > [% maxreserves %]) { |
| 606 |
var selections = ""; |
616 |
alert(MSG_MAX_HOLDS_EXCEEDED); |
| 607 |
|
617 |
return false; |
| 608 |
[% IF new_reserves_allowed %] |
618 |
} |
| 609 |
if ($(".confirmjs:checked").size() > [% new_reserves_allowed | html %] ) { |
|
|
| 610 |
alert(MSG_MAX_HOLDS_EXCEEDED); |
| 611 |
return false; |
| 612 |
} |
| 613 |
[% END %] |
| 614 |
|
619 |
|
| 615 |
if ($(".confirmjs:checked").size() == 0) { |
620 |
if ($("input[name='biblionumbers']:checked").size() == 0) { |
| 616 |
alert(MSG_NO_RECORD_SELECTED); |
621 |
alert(MSG_NO_RECORD_SELECTED); |
| 617 |
return false; |
622 |
return false; |
| 618 |
} |
623 |
} |
| 619 |
|
624 |
|
| 620 |
// Find the items with the 'Hold' box checked |
625 |
// Find the items with the 'Hold' box checked |
| 621 |
var badBib = null; |
626 |
var badBib = null; |
| 622 |
$(".confirmjs:checked").each(function() { |
627 |
$("input[name='biblionumbers']:checked").each(function() { |
| 623 |
var biblioNum = $(this).val(); |
628 |
var biblioNum = $(this).val(); |
| 624 |
biblionumbers += biblioNum + "/"; |
|
|
| 625 |
selections += biblioNum + "/"; |
| 626 |
|
629 |
|
| 627 |
// If required hold note is empty, make it visible |
630 |
// If required hold note is empty, make it visible |
| 628 |
if( $("#holdnotes_"+biblioNum).attr( 'required' ) && $("#holdnotes_"+biblioNum).val() == '' ) { |
631 |
if( $("#holdnotes_"+biblioNum).attr( 'required' ) && $("#holdnotes_"+biblioNum).val() == '' ) { |
|
Lines 639-656
Link Here
|
| 639 |
alert(MSG_NO_ITEM_SELECTED); |
642 |
alert(MSG_NO_ITEM_SELECTED); |
| 640 |
badBib = biblioNum; |
643 |
badBib = biblioNum; |
| 641 |
return false; |
644 |
return false; |
| 642 |
} else { |
|
|
| 643 |
selections += $(item).val(); |
| 644 |
} |
645 |
} |
| 645 |
} |
646 |
} |
| 646 |
selections += "/"; |
|
|
| 647 |
|
| 648 |
// Add the pickup location |
| 649 |
var branchSel = $("#branch_" + biblioNum); |
| 650 |
if (branchSel.size() > 0) { |
| 651 |
selections += $(branchSel).val(); |
| 652 |
} |
| 653 |
selections += "/"; |
| 654 |
return true; |
647 |
return true; |
| 655 |
}); |
648 |
}); |
| 656 |
|
649 |
|
|
Lines 658-666
Link Here
|
| 658 |
return false; |
651 |
return false; |
| 659 |
} |
652 |
} |
| 660 |
|
653 |
|
| 661 |
$("#selections").val(selections); |
|
|
| 662 |
$("#biblionumbers").val(biblionumbers); |
| 663 |
|
| 664 |
return true; |
654 |
return true; |
| 665 |
}); |
655 |
}); |
| 666 |
|
656 |
|