|
Lines 134-153
Link Here
|
| 134 |
<form action="/cgi-bin/koha/opac-reserve.pl" method="post" id="hold-request-form"> |
134 |
<form action="/cgi-bin/koha/opac-reserve.pl" method="post" id="hold-request-form"> |
| 135 |
<input type="hidden" name="place_reserve" value="1"/> |
135 |
<input type="hidden" name="place_reserve" value="1"/> |
| 136 |
<!-- These values are set dynamically by js --> |
136 |
<!-- These values are set dynamically by js --> |
| 137 |
<input type="hidden" name="biblionumbers" id="biblionumbers"/> |
|
|
| 138 |
<input type="hidden" name="selecteditems" id="selections"/> |
| 139 |
<div id="bigloop"> |
137 |
<div id="bigloop"> |
| 140 |
|
138 |
|
| 141 |
[% FOREACH bibitemloo IN bibitemloop %] |
139 |
[% FOREACH bibitemloo IN bibitemloop %] |
| 142 |
<div class="holdrow"> |
140 |
<div class="holdrow"> |
|
|
141 |
<input id="remaining_holds_[% bibitemloo.biblionumber %]" type="hidden" value="[% bibitemloo.remaining_holds_for_record %]"/> |
| 143 |
<p> |
142 |
<p> |
| 144 |
[% IF ( bibitemloo.holdable ) %] |
143 |
[% IF ( bibitemloo.holdable ) %] |
| 145 |
<input class="reserve_mode" name="reserve_mode" type="hidden" value="single"/> |
144 |
<span title="[% bibitemloo.biblionumber %]" style="padding:.3em"> |
| 146 |
<input class="single_bib" name="single_bib" type="hidden" value="[% bibitemloo.biblionumber %]"/> |
145 |
<label> |
| 147 |
<span class="confirmjs_hold" title="[% bibitemloo.biblionumber %]" style="padding:.3em"></span> |
146 |
<input class="biblionumbers" name="biblionumbers" type="checkbox" value="[% bibitemloo.biblionumber %]" checked="checked"> |
| 148 |
<span class="confirm_nonjs"> |
147 |
Place a hold on |
| 149 |
<input type="radio" class="confirmbox checkitem [% bibitemloo.biblionumber %]" name="[% bibitemloo.biblionumber %]" checked="checked" id="single_[% bibitemloo.biblionumber %]" value="any" /> |
148 |
</label> |
| 150 |
<label class="confirm_label" for="single_[% bibitemloo.biblionumber %]">Place a hold on </label> |
|
|
| 151 |
</span> |
149 |
</span> |
| 152 |
[% END # / bibitemloo.holdable %] |
150 |
[% END # / bibitemloo.holdable %] |
| 153 |
|
151 |
|
|
Lines 214-224
Link Here
|
| 214 |
<li class="branch"> |
212 |
<li class="branch"> |
| 215 |
<label for="branch_[% bibitemloo.biblionumber %]">Pick up location:</label> |
213 |
<label for="branch_[% bibitemloo.biblionumber %]">Pick up location:</label> |
| 216 |
[% UNLESS ( bibitemloo.holdable ) %] |
214 |
[% UNLESS ( bibitemloo.holdable ) %] |
| 217 |
<select name="branch" id="branch_[% bibitemloo.biblionumber %]" disabled="disabled"> |
215 |
<select name="branch_[% bibitemloo.biblionumber %]" id="branch_[% bibitemloo.biblionumber %]" disabled="disabled"> |
| 218 |
[% PROCESS options_for_libraries libraries => Branches.all( selected => branch ) %] |
216 |
[% PROCESS options_for_libraries libraries => Branches.all( selected => branch ) %] |
| 219 |
</select> |
217 |
</select> |
| 220 |
[% ELSE %] |
218 |
[% ELSE %] |
| 221 |
<select name="branch" id="branch_[% bibitemloo.biblionumber %]"> |
219 |
<select name="branch_[% bibitemloo.biblionumber %]" id="branch_[% bibitemloo.biblionumber %]"> |
| 222 |
[% PROCESS options_for_libraries libraries => Branches.all( selected => branch ) %] |
220 |
[% PROCESS options_for_libraries libraries => Branches.all( selected => branch ) %] |
| 223 |
</select> |
221 |
</select> |
| 224 |
[% END # / UNLESS bibitemloo.holdable %] |
222 |
[% END # / UNLESS bibitemloo.holdable %] |
|
Lines 273-301
Link Here
|
| 273 |
</li> |
271 |
</li> |
| 274 |
[% END # / IF OpacHoldNotes %] |
272 |
[% END # / IF OpacHoldNotes %] |
| 275 |
|
273 |
|
| 276 |
[% IF bibitemloo.itemholdable %] |
274 |
<!-- ITEM HOLDS --> |
| 277 |
<!-- ITEM HOLDS --> |
275 |
<li class="lradio place_on_type" style="display:none;"> |
| 278 |
<li class="lradio place_on_type" style="display:none;"> |
276 |
<label class="radio inline" for="reqany_[% bibitemloo.biblionumber %]">Next available item</label> |
| 279 |
[% IF NOT bibitemloo.force_hold %] |
|
|
| 280 |
<label class="radio inline" for="reqany_[% bibitemloo.biblionumber %]">Next available item</label> |
| 281 |
<input type="radio" name="reqtype_[% bibitemloo.biblionumber %]" |
| 282 |
id="reqany_[% bibitemloo.biblionumber %]" |
| 283 |
class="selectany" |
| 284 |
value="Any" |
| 285 |
checked="checked" |
| 286 |
/> |
| 287 |
[% END %] |
| 288 |
<label class="radio inline" for="reqspecific_[% bibitemloo.biblionumber %]">A specific item</label> |
| 289 |
<input type="radio" name="reqtype_[% bibitemloo.biblionumber %]" |
277 |
<input type="radio" name="reqtype_[% bibitemloo.biblionumber %]" |
| 290 |
id="reqspecific_[% bibitemloo.biblionumber %]" |
278 |
id="reqany_[% bibitemloo.biblionumber %]" |
| 291 |
class="selectspecific" |
279 |
class="selectany" |
| 292 |
value="Specific" |
280 |
value="Any" |
|
|
281 |
checked="checked" |
| 293 |
/> |
282 |
/> |
| 294 |
</li> |
283 |
<label class="radio inline" for="reqspecific_[% bibitemloo.biblionumber %]">A specific item</label> |
| 295 |
[% END # / IF bibitemloo.itemholdable %] |
284 |
<input type="radio" name="reqtype_[% bibitemloo.biblionumber %]" |
|
|
285 |
id="reqspecific_[% bibitemloo.biblionumber %]" |
| 286 |
class="selectspecific" |
| 287 |
value="Specific" |
| 288 |
/> |
| 289 |
</li> |
| 296 |
</ul> |
290 |
</ul> |
| 297 |
|
291 |
|
| 298 |
[% IF bibitemloo.itemholdable %] |
292 |
[% IF bibitemloo.remaining_holds_for_record > 1 %] |
|
|
293 |
[% SET count = 1 %] |
| 294 |
<div id="holds_to_place_[% bibitemloo.biblionumber %]" class="hold-options holds-to-place"> |
| 295 |
<label>Holds to place (count)</label> |
| 296 |
<select name="holds_to_place_count_[% bibitemloo.biblionumber %]"> |
| 297 |
[% WHILE count <= bibitemloo.remaining_holds_for_record %] |
| 298 |
<option value="[% count %]">[% count %]</option> |
| 299 |
[% SET count = count + 1 %] |
| 300 |
[% END %] |
| 301 |
</select> |
| 302 |
</div> |
| 303 |
[% ELSE %] |
| 304 |
<input type="hidden" name="holds_to_place_count_[% bibitemloo.biblionumber %]" value="1" /> |
| 305 |
[% END %] |
| 306 |
|
| 299 |
<table class="copiesrow table table-bordered table-striped" id="copiesrow_[% bibitemloo.biblionumber %]"> |
307 |
<table class="copiesrow table table-bordered table-striped" id="copiesrow_[% bibitemloo.biblionumber %]"> |
| 300 |
<caption>Select a specific item:</caption> |
308 |
<caption>Select a specific item:</caption> |
| 301 |
<tr> |
309 |
<tr> |
|
Lines 319-327
Link Here
|
| 319 |
<tr class="[% itemLoo.backgroundcolor %]"> |
327 |
<tr class="[% itemLoo.backgroundcolor %]"> |
| 320 |
<td class="copynumber"> |
328 |
<td class="copynumber"> |
| 321 |
[% IF ( itemLoo.available ) %] |
329 |
[% IF ( itemLoo.available ) %] |
| 322 |
<input type="radio" class="checkitem checkitem_[% bibitemloo.biblionumber %]" name="checkitem_[% bibitemloo.biblionumber %]" value="[% itemLoo.itemnumber %]" /> |
330 |
<input type="checkbox" class="checkitem checkitem_[% bibitemloo.biblionumber %]" name="checkitem_[% bibitemloo.biblionumber %]" value="[% itemLoo.itemnumber %]" /> |
| 323 |
[% ELSE %] |
331 |
[% ELSE %] |
| 324 |
<input disabled="disabled" type="radio" class="checkitem" name="checkitem" value="[% itemLoo.itemnumber %]" |
332 |
<input disabled="disabled" type="checkbox" class="checkitem" name="checkitem" value="[% itemLoo.itemnumber %]" |
| 325 |
style="display:none;" /> |
333 |
style="display:none;" /> |
| 326 |
<img src="[% interface %]/lib/famfamfam/silk/cross.png" alt="Cannot be put on hold" title="Cannot be put on hold" /> |
334 |
<img src="[% interface %]/lib/famfamfam/silk/cross.png" alt="Cannot be put on hold" title="Cannot be put on hold" /> |
| 327 |
[% END %] |
335 |
[% END %] |
|
Lines 395-401
Link Here
|
| 395 |
</tr> |
403 |
</tr> |
| 396 |
[% END # / FOREACH itemLoo IN bibitemloo.itemLoop%] |
404 |
[% END # / FOREACH itemLoo IN bibitemloo.itemLoop%] |
| 397 |
</table> <!-- / #copiesrow_[% bibitemloo.biblionumber %] --> |
405 |
</table> <!-- / #copiesrow_[% bibitemloo.biblionumber %] --> |
| 398 |
[% END # / IF ( bibitemloo.itemholdable )%] |
|
|
| 399 |
</div> <!-- / #hold-options-[% bibitemloo.biblionumber %] --> |
406 |
</div> <!-- / #hold-options-[% bibitemloo.biblionumber %] --> |
| 400 |
</fieldset> |
407 |
</fieldset> |
| 401 |
[% END # / IF ( bibitemloo.holdable ) %] |
408 |
[% END # / IF ( bibitemloo.holdable ) %] |
|
Lines 418-423
Link Here
|
| 418 |
<script type="text/javascript"> |
425 |
<script type="text/javascript"> |
| 419 |
// <![CDATA[ |
426 |
// <![CDATA[ |
| 420 |
var MSG_NO_ITEM_SELECTED = _("Expecting a specific item selection."); |
427 |
var MSG_NO_ITEM_SELECTED = _("Expecting a specific item selection."); |
|
|
428 |
var MSG_MAX_HOLDS_EXCEEDED = _("Maximum number of reserve exceded."); |
| 421 |
var ForceHoldNotesReasons=new Array( |
429 |
var ForceHoldNotesReasons=new Array( |
| 422 |
_("This title consists of multiple volumes/parts. Please indicate which part you need. Clicking on specific item information may be helpful."), |
430 |
_("This title consists of multiple volumes/parts. Please indicate which part you need. Clicking on specific item information may be helpful."), |
| 423 |
"*** Add a new reason above this line ***" ); |
431 |
"*** Add a new reason above this line ***" ); |
|
Lines 431-438
Link Here
|
| 431 |
|
439 |
|
| 432 |
// Select the first item available |
440 |
// Select the first item available |
| 433 |
function select_first_available(id){ |
441 |
function select_first_available(id){ |
| 434 |
var radios = $("input:radio[name='checkitem_" + id + "']"); |
442 |
var checkboxes = $("input:checkbox[name='checkitem_" + id + "']"); |
| 435 |
$(radios).first().attr("checked", "checked"); |
443 |
$(checkboxes).first().attr("checked", "checked"); |
| 436 |
} |
444 |
} |
| 437 |
|
445 |
|
| 438 |
$(document).ready(function() { |
446 |
$(document).ready(function() { |
|
Lines 453-466
Link Here
|
| 453 |
} |
461 |
} |
| 454 |
}); |
462 |
}); |
| 455 |
|
463 |
|
| 456 |
// click on a first td check the confirmjs checkbox |
464 |
$('.checkitem').click(function(e) { |
| 457 |
$("td.hold").click(function(e){ |
465 |
var bibNum = suffixOf($(this).attr("name"), "_"); |
| 458 |
if(e.target.tagName.toLowerCase() == 'td'){ |
466 |
var nbCheked = $("input[name='checkitem_"+bibNum+"']:checked").length; |
| 459 |
$(this).find("input.confirmjs").each( function() { |
467 |
var remaining = $("input[id='remaining_holds_"+bibNum+"']").val(); |
| 460 |
$(this).attr('checked', !$(this).attr('checked')); |
468 |
if (nbCheked >= remaining) { |
| 461 |
$(this).change(); |
469 |
$("input[name='checkitem_"+bibNum+"']:not(:checked)").attr('disabled', 'disabled'); |
| 462 |
}); |
470 |
} |
| 463 |
} |
471 |
else { |
|
|
472 |
$('.checkitem_'+bibNum).attr('disabled', false); |
| 473 |
} |
| 464 |
}); |
474 |
}); |
| 465 |
|
475 |
|
| 466 |
$(".toggle-hold-options").on("click",function(e){ |
476 |
$(".toggle-hold-options").on("click",function(e){ |
|
Lines 475-486
Link Here
|
| 475 |
// Hides all 'specific copy' table rows on load. |
485 |
// Hides all 'specific copy' table rows on load. |
| 476 |
$(".copiesrow").hide(); |
486 |
$(".copiesrow").hide(); |
| 477 |
|
487 |
|
|
|
488 |
$(".holds-to-place").show(); |
| 478 |
[% FOREACH bibitemloo IN bibitemloop %] |
489 |
[% FOREACH bibitemloo IN bibitemloop %] |
| 479 |
[% IF bibitemloo.force_hold %] |
490 |
[% IF bibitemloo.force_hold %] |
| 480 |
$("#toggle-hold-options-[% bibitemloo.biblionumber %]").click(); |
491 |
[% IF bibitemloo.force_hold == 'item' %] |
| 481 |
$("#reqspecific_[% bibitemloo.biblionumber %]").click(); |
492 |
$("#toggle-hold-options-[% bibitemloo.biblionumber %]").click(); |
| 482 |
$("#copiesrow_[% bibitemloo.biblionumber %]").show(); |
493 |
$("#reqspecific_[% bibitemloo.biblionumber %]").attr('checked', true); |
| 483 |
[% END %] |
494 |
$("#holds_to_place_[% bibitemloo.biblionumber %]").hide(); |
|
|
495 |
$("#copiesrow_[% bibitemloo.biblionumber %]").show(); |
| 496 |
[% ELSIF bibitemloo.force_hold == 'record' %] |
| 497 |
$("#toggle-hold-options-[% bibitemloo.biblionumber %]").click(); |
| 498 |
$("#reqany_[% bibitemloo.biblionumber %]").attr('checked', true); |
| 499 |
[% END %] |
| 500 |
$("#reqany_[% bibitemloo.biblionumber %]").attr('disabled', 'disabled'); |
| 501 |
$("#reqspecific_[% bibitemloo.biblionumber %]").attr('disabled', 'disabled'); |
| 502 |
[% END %] |
| 484 |
[% END %] |
503 |
[% END %] |
| 485 |
|
504 |
|
| 486 |
// Insert reasons for forced hold notes |
505 |
// Insert reasons for forced hold notes |
|
Lines 506-545
Link Here
|
| 506 |
$("#" + op + fieldID).val(""); |
525 |
$("#" + op + fieldID).val(""); |
| 507 |
}); |
526 |
}); |
| 508 |
|
527 |
|
| 509 |
// Replace non-JS single-selection with multi-selection capability. |
|
|
| 510 |
$(".reserve_mode").val("multi"); |
| 511 |
$(".confirm_nonjs").remove(); |
| 512 |
$(".confirmjs_hold").each(function(){ |
| 513 |
var bib = $(this).attr("title"); |
| 514 |
var html = "<label><input type =\"checkbox\" class=\"confirmjs\" checked=\"checked\""; |
| 515 |
html += "value=\"" + bib + "\" id=\"" + bib + "\" /> " + _("Place a hold on") + " </label> "; |
| 516 |
$(this).html(html); |
| 517 |
}); |
| 518 |
$(".confirmjs_nohold").each(function(){ |
| 519 |
var bib = $(this).attr("title"); |
| 520 |
var html = "<label><input type =\"checkbox\" class=\"confirmjs\" disabled=\"disabled\""; |
| 521 |
html += "value=\"" + bib + "\" id=\"" + bib + "\" />" + _("Place a hold on: ") + "</label>"; |
| 522 |
$(this).html(html); |
| 523 |
}); |
| 524 |
|
| 525 |
// expand or collapse the copiesrow tr |
528 |
// expand or collapse the copiesrow tr |
| 526 |
function toggle_copiesrow(biblioNum) { |
529 |
function toggle_copiesrow(biblioNum) { |
| 527 |
var checkbox = $("input:checkbox[value='"+biblioNum+"']"); |
530 |
var checkbox = $("input:checkbox[value='"+biblioNum+"']"); |
| 528 |
newCopiesRowId = "#copiesrow_" + biblioNum; |
531 |
newCopiesRowId = "#copiesrow_" + biblioNum; |
|
|
532 |
holdsToPlaceCountId = "#holds_to_place_" + biblioNum; |
| 529 |
var select_specific = $("#reqspecific_"+biblioNum).is(":checked"); |
533 |
var select_specific = $("#reqspecific_"+biblioNum).is(":checked"); |
| 530 |
// If the checkbox is checked AND we want a specific item, we display the items block |
534 |
// If the checkbox is checked AND we want a specific item, we display the items block |
| 531 |
if ( $(checkbox).is(":checked") && select_specific ) { |
535 |
if ( $(checkbox).is(":checked") && select_specific ) { |
| 532 |
$(newCopiesRowId).show(); |
536 |
$(newCopiesRowId).show(); |
|
|
537 |
$(holdsToPlaceCountId).hide(); |
| 533 |
} else { |
538 |
} else { |
| 534 |
$(newCopiesRowId).hide(); |
539 |
$(newCopiesRowId).hide(); |
|
|
540 |
$(holdsToPlaceCountId).show(); |
| 535 |
} |
541 |
} |
| 536 |
}; |
542 |
}; |
| 537 |
|
543 |
|
| 538 |
$("#place_on_hdr").show(); |
544 |
function total_requested() { |
|
|
545 |
var total = 0; |
| 546 |
$("input[name='biblionumbers']:checked").each(function() { |
| 547 |
var biblioNum = $(this).val(); |
| 548 |
if ($("#reqspecific_" + biblioNum + ":checked").size() > 0) { |
| 549 |
total += parseInt($("input[name='checkitem_'"+biblioNum+"]:checked").length); |
| 550 |
} else { |
| 551 |
total += parseInt($("select[name='holds_to_place_count_"+biblioNum+"']").val()); |
| 552 |
} |
| 553 |
}); |
| 554 |
return total; |
| 555 |
} |
| 539 |
|
556 |
|
| 540 |
$(".place_on_type").show(); |
557 |
$(".place_on_type").show(); |
| 541 |
// onload, selectany is checked |
558 |
// onload, selectany is checked |
| 542 |
$(".selectany").attr("checked", "checked"); |
|
|
| 543 |
|
559 |
|
| 544 |
// If the user is *allowed* to choose a specific item |
560 |
// If the user is *allowed* to choose a specific item |
| 545 |
// The first one is preselected |
561 |
// The first one is preselected |
|
Lines 548-555
Link Here
|
| 548 |
select_first_available(id); |
564 |
select_first_available(id); |
| 549 |
}); |
565 |
}); |
| 550 |
|
566 |
|
| 551 |
// On confirmsjs change |
567 |
// On biblionumbers change |
| 552 |
$(".confirmjs").change(function(){ |
568 |
$(".biblionumbers").change(function(){ |
| 553 |
var id = suffixOf($(this).attr("id"), "_"); |
569 |
var id = suffixOf($(this).attr("id"), "_"); |
| 554 |
// If I m checked, I enable radio buttons |
570 |
// If I m checked, I enable radio buttons |
| 555 |
if ( $(this).is(":checked") ) { |
571 |
if ( $(this).is(":checked") ) { |
|
Lines 571-605
Link Here
|
| 571 |
toggle_copiesrow(id); |
587 |
toggle_copiesrow(id); |
| 572 |
}); |
588 |
}); |
| 573 |
|
589 |
|
| 574 |
// Show or hide holds notes |
|
|
| 575 |
$(".shownotes").click(function(){ |
| 576 |
biblioNum = suffixOf($(this).attr("id"), "_"); |
| 577 |
$("#notesrow_"+biblioNum).toggle(); |
| 578 |
}); |
| 579 |
|
| 580 |
// When 'Place Hold' button is clicked |
590 |
// When 'Place Hold' button is clicked |
| 581 |
$(".placehold").click(function(){ |
591 |
$(".placehold").click(function(){ |
| 582 |
var biblionumbers = ""; |
592 |
if (total_requested() + [% reserves_count %] > [% maxreserves %]) { |
| 583 |
var selections = ""; |
593 |
alert(MSG_MAX_HOLDS_EXCEEDED); |
| 584 |
|
594 |
return false; |
| 585 |
[% IF new_reserves_allowed %] |
595 |
} |
| 586 |
if ($(".confirmjs:checked").size() > [% new_reserves_allowed %] ) { |
|
|
| 587 |
alert(MSG_MAX_HOLDS_EXCEEDED); |
| 588 |
return false; |
| 589 |
} |
| 590 |
[% END %] |
| 591 |
|
596 |
|
| 592 |
if ($(".confirmjs:checked").size() == 0) { |
597 |
if ($("input[name='biblionumbers']:checked").size() == 0) { |
| 593 |
alert(MSG_NO_RECORD_SELECTED); |
598 |
alert(MSG_NO_RECORD_SELECTED); |
| 594 |
return false; |
599 |
return false; |
| 595 |
} |
600 |
} |
| 596 |
|
601 |
|
| 597 |
// Find the items with the 'Hold' box checked |
602 |
// Find the items with the 'Hold' box checked |
| 598 |
var badBib = null; |
603 |
var badBib = null; |
| 599 |
$(".confirmjs:checked").each(function() { |
604 |
$("input[name='biblionumbers']:checked").each(function() { |
| 600 |
var biblioNum = $(this).val(); |
605 |
var biblioNum = $(this).val(); |
| 601 |
biblionumbers += biblioNum + "/"; |
|
|
| 602 |
selections += biblioNum + "/"; |
| 603 |
|
606 |
|
| 604 |
// If the 'specific copy' radio button is checked |
607 |
// If the 'specific copy' radio button is checked |
| 605 |
if ($("#reqspecific_" + biblioNum + ":checked").size() > 0) { |
608 |
if ($("#reqspecific_" + biblioNum + ":checked").size() > 0) { |
|
Lines 608-625
Link Here
|
| 608 |
if ($(item).size() == 0) { |
611 |
if ($(item).size() == 0) { |
| 609 |
badBib = biblioNum; |
612 |
badBib = biblioNum; |
| 610 |
return false; |
613 |
return false; |
| 611 |
} else { |
|
|
| 612 |
selections += $(item).val(); |
| 613 |
} |
614 |
} |
| 614 |
} |
615 |
} |
| 615 |
selections += "/"; |
|
|
| 616 |
|
| 617 |
// Add the pickup location |
| 618 |
var branchSel = $("#branch_" + biblioNum); |
| 619 |
if (branchSel.size() > 0) { |
| 620 |
selections += $(branchSel).val(); |
| 621 |
} |
| 622 |
selections += "/"; |
| 623 |
return true; |
616 |
return true; |
| 624 |
}); |
617 |
}); |
| 625 |
|
618 |
|
|
Lines 628-636
Link Here
|
| 628 |
return false; |
621 |
return false; |
| 629 |
} |
622 |
} |
| 630 |
|
623 |
|
| 631 |
$("#selections").val(selections); |
|
|
| 632 |
$("#biblionumbers").val(biblionumbers); |
| 633 |
|
| 634 |
return true; |
624 |
return true; |
| 635 |
}); |
625 |
}); |
| 636 |
|
626 |
|