Koha/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt
Bernardo Gonzalez Kriegel 2d9f5fc69e Bug 9457: [ENH] Ordering branches should be case independent (2)
This patch replace use of CGI::scroll_list() to show list of branches.

In two files, marc21_linking_section.pl and unimarc_field_4XX.pl,
the scrolling list is created but not used in the template file,
so the code is removed.

Also minor renaming/normalizing of variables.

To test:
1) Install with some branches, records and patrons

2.1) Select a record, click 'Place hold', select user,
     there is a library pull-down next to 'Pickup at:',
     list is ordered case sensitive
2.2) Go to Reports > Average loan time,
     next to Library is a pull-down,
     list without order
2.3) Go to Reports > Catalog by item type,
     next to 'Select a library' is a pull-down,
     list is ordered case sensitive
2.4) This is tricky, go to Reports home,
     change last part of URL 'reports-home.pl' with
     'manager.pl?report_name=issues_by_borrower_category'
     (can't find a direct link), next to 'Select a library'
     is a library pull-down,
     list without order
2.5) Edit/Add a patron, on section 'Library management'
     there is a library pull-down, case sensitive
2.6) OPAC, as logged user, make a suggestion or hold,
     there is library pull-down, correct order

3) Apply the patch

4.1) Repeat 2.1), correctly ordered list
4.2) Repeat 2.2), correctly ordered list
4.3) Repeat 2.3), correctly ordered list
4.4) Repeat 2.4), correctly ordered list
4.5) This is a bit more work
     There are 3 possible situations to test:
     A) No branches, must show a message that are no
        libraries defined
     B) New patron, must show a correctly ordered
        list of branches, current branch selected
     C) Edit patron, must show a correctly ordered
        list of branches, patron branch selected
4.6) Small changes on variable names, so retest 2.6)

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
2013-03-20 15:35:58 -04:00

519 lines
25 KiB
Text

[% INCLUDE 'doc-head-open.inc' %][% LibraryNameTitle or "Koha online" %] catalog &rsaquo; Placing a hold
[% INCLUDE 'doc-head-close.inc' %]
[% INCLUDE 'calendar.inc' %]
<script type="text/javascript">
// <![CDATA[
var MSG_NO_COPY_SELECTED = _("Expecting a specific copy selection.");
function prefixOf (s, tok) {
var index = s.indexOf(tok);
return s.substring(0, index);
}
function suffixOf (s, tok) {
var index = s.indexOf(tok);
return s.substring(index + 1);
}
$(document).ready(function() {
$('#hold-request-form').preventDoubleFormSubmit();
var copiesRowId = null;
var wasSpecific = false;
var lastCopiesRowId = null;
$(".checkitem").parent().click(function(e){
if(e.target.tagName.toLowerCase() == 'td'){
$(this).find("input.checkitem").each( function() {
$(this).attr('checked', !$(this).attr('checked'));
});
}
});
// Hides all 'specific copy' table rows on load.
$(".copiesrow").hide();
$("#place_on_hdr").show();
$(".place_on_type").show();
// Replace non-JS single-selection with multi-selection capability.
$(".reserve_mode").val("multi");
$(".confirm_nonjs").remove();
$(".confirmjs_hold").each(function(){
var bib = $(this).attr("title");
var html = "<input type =\"checkbox\" class=\"confirmjs\" checked=\"checked\"";
html += "value=\"" + bib + "\"/>";
$(this).html(html);
});
$(".confirmjs_nohold").each(function(){
var bib = $(this).attr("title");
var html = "<input type =\"checkbox\" class=\"confirmjs\" disabled=\"disabled\"";
html += "value=\"" + bib + "\"/>";
$(this).html(html);
});
// Make sure a specific item was selected where specified
// before moving on to a new item.
function changeSelection (newCopiesRowId, isSpecific) {
if (copiesRowId && ((copiesRowId != newCopiesRowId) || (wasSpecific != isSpecific))) {
var biblioNum = suffixOf(copiesRowId, "_");
// If the 'specific copy' radio button was checked
if (wasSpecific && (copiesRowId != newCopiesRowId)) {
// Find the selected copy
var item = $(".checkitem_" + biblioNum + ":checked");
if ($(item).size() == 0) {
alert(MSG_NO_COPY_SELECTED);
return false;
}
}
}
copiesRowId = newCopiesRowId;
wasSpecific = isSpecific;
return true;
}
// When 'specific copy' radio button is clicked
$(".selectspecific").click(function() {
// Make sure all other specific copy table rows are hidden
biblioNum = suffixOf($(this).attr("id"), "_");
newCopiesRowId = "#copiesrow_" + biblioNum;
if (!changeSelection(newCopiesRowId, true)) {
return false;
}
$(".copiesrow:not(" + newCopiesRowId + ")").hide();
// Show the specific copy table for this radio button.
$(newCopiesRowId).show();
});
// When 'first available' radion button is clicked
$(".selectany").click(function() {
// Make sure all other specific copy table rows are hidden
biblioNum = suffixOf($(this).attr("id"), "_");
newCopiesRowId = "#copiesrow_" + biblioNum;
if (!changeSelection(newCopiesRowId, false)) {
return false;
}
// Hide the copies table row
$(".copiesrow").hide();
});
// When 'Place Hold' button is clicked
$(".placehold").click(function(){
var biblionumbers = "";
var selections = "";
if ($(".confirmjs:checked").size() == 0) {
alert(MSG_NO_RECORD_SELECTED);
return false;
}
// Find the items with the 'Hold' box checked
var badBib = null;
$(".confirmjs:checked").each(function() {
var biblioNum = $(this).val();
biblionumbers += biblioNum + "/";
selections += biblioNum + "/";
// If the 'specific copy' radio button is checked
if ($("#reqspecific_" + biblioNum + ":checked").size() > 0) {
// Find the selected copy
var item = $(".checkitem_" + biblioNum + ":checked");
if ($(item).size() == 0) {
badBib = biblioNum;
return false;
} else {
selections += $(item).val();
}
}
selections += "/";
// Add the pickup location
var branchSel = $("#branch_" + biblioNum);
if (branchSel.size() > 0) {
selections += $(branchSel).val();
}
selections += "/";
return true;
});
if (badBib) {
alert(MSG_NO_COPY_SELECTED);
return false;
}
$("#selections").val(selections);
$("#biblionumbers").val(biblionumbers);
return true;
});
});
// ]]>
</script>
<style type="text/css">td ul { padding : 0; } td li { white-space: nowrap; font-size: 90%; list-style-type:none; padding : .3em 0; }</style>
</head>
<body id="opac-holds">
<div id="doc3" class="yui-t7">
[% INCLUDE 'masthead.inc' %]
<div id="bd">
<div id="yui-g">
<div id="holds" class="container">
[% IF ( message ) %]
[% IF ( GNA ) %]
<div id="gna" class="dialog alert">
<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>
<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>
</div>
[% END %]
[% IF ( lost ) %]
<div id="lost" class="dialog alert">
<p><strong>Sorry</strong>, you cannot place holds because your library card has been marked as lost or stolen.</p>
<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>
</div>
[% END %]
[% IF ( debarred ) %]
<div id="debarred" class="dialog alert">
<p><strong>Sorry</strong>, you cannot place holds because your account has been frozen.</p>
<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>
</div>
[% END %]
[% IF ( too_much_oweing ) %]
<div id="too_much_oweing" class="dialog alert">
Sorry, you cannot place holds because you owe [% too_much_oweing %].
</div>
[% END %]
[% IF ( too_many_reserves ) %]
<div id="too_many_reserves" class="dialog alert">Sorry, you cannot place more than [% too_many_reserves %] holds.
</div>
[% END %]
[% IF ( bad_biblionumber ) %]
<div id="bad_biblionumber" class="dialog alert">ERROR: No biblio record found for biblionumber [% bad_biblionumber %].</div>
[% END %]
[% IF ( no_items_selected ) %]
<div id="no_items_selected" class="dialog alert">
You must select at least one item.
</div>
[% END %]
[% IF ( no_branch_selected ) %]
<div id="no_branch_selected" class="dialog alert">
You must select a library for pickup.
</div>
[% END %]
[% IF ( no_biblionumber ) %]
<div id="no_biblionumber" class="dialog alert">ERROR: No biblionumber received.</div>
[% END %]
[% IF ( bad_data ) %]
<div id="bad_data" class="dialog alert">ERROR: Internal error: incomplete hold request.</div>
[% END %]
[% ELSE %]
[% IF ( none_available ) %]
<div id="none_available" class="dialog alert"><strong>Sorry</strong>, none of these items can be placed on hold.
</div>
[% END %]
[% END %]<!-- NAME="message" -->
[% UNLESS ( message ) %][% UNLESS ( none_available ) %]<h3>Confirm holds for:
[% FOREACH USER_INF IN USER_INFO %]
[% USER_INF.firstname %] [% USER_INF.surname %] ([% USER_INF.cardnumber %])
[% END %]
</h3>[% END %]
[% IF (RESERVE_CHARGE) %]
<div class="dialog alert" id="reserve_fee">
There is a charge of [% RESERVE_CHARGE %] for placing this hold
</div>
[% END %]
<form action="/cgi-bin/koha/opac-reserve.pl" method="post" id="hold-request-form">
<input type="hidden" name="place_reserve" value="1"/>
<!-- These values are set dynamically by js -->
<input type="hidden" name="biblionumbers" id="biblionumbers"/>
<input type="hidden" name="selecteditems" id="selections"/>
<div id="bigloop">
<table id="bibitemloop">
[% UNLESS ( none_available ) %]<tr>
<th>Hold</th>
<th>Title</th>
[% UNLESS ( item_level_itypes ) %]
<th>Item type</th>
[% END %]
[% IF showholds && showpriority %]
<th>Holds and priority</th>
[% ELSIF showholds %]
<th>Holds</th>
[% ELSIF showpriority %]
<th>Priority</th>
[% END %]
[% IF ( reserve_in_future ) %]
<th>Hold starts on date</th>
[% END %]
<th>Hold not needed after</th>
[% IF ( OPACItemHolds ) %]
<th id="place_on_hdr" style="display:none">Place on</th>
[% END %]
[% UNLESS ( singleBranchMode ) %]
[% IF ( choose_branch ) %]
<th>Pickup location</th>
[% END %]
[% END %]
</tr>[% ELSE %]<tr><th colspan="5">Title</th></tr>[% END %]
[% FOREACH bibitemloo IN bibitemloop %]
<tr>
[% IF ( bibitemloo.holdable ) %]
<td class="hold">
<input class="reserve_mode" name="reserve_mode" type="hidden" value="single"/>
<input class="single_bib" name="single_bib" type="hidden" value="[% bibitemloo.biblionumber %]"/>
<span class="confirmjs_hold" title="[% bibitemloo.biblionumber %]"></span>
<span class="confirm_nonjs">
<input type="radio" class="confirmbox checkitem [% bibitemloo.checkitem_bib %]"
name="[% bibitemloo.checkitem_bib %]" checked="checked"
id="[% bibitemloo.checkitem_bib %]"
value="any" />
<label class="confirm_label" for="[% bibitemloo.checkitem_bib %]">Next available copy</label>
</span>
</td>
[% ELSE %]
[% UNLESS ( none_available ) %]<td class="hold">&nbsp;</td>[% END %]
[% END %]
[% IF ( bibitemloo.holdable ) %]<td class="title">[% ELSE %]<td class="title" colspan="5">[% 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 %]
[% UNLESS ( bibitemloo.holdable ) %]
[% IF ( bibitemloo.already_reserved ) %]
<div class="bibmessage">You have already requested this title.</div>
[% ELSE %]
[% UNLESS ( bibitemloo.bib_available ) %]
<div class="bibmessage">No available items.</div>
[% ELSE %]
[% IF ( bibitemloo.already_patron_possession ) %]
<div class="bibmessage">This title cannot be requested because it's already in your possession.</div>
[% ELSE %]
<div class="bibmessage">This title cannot be requested.</div>
[% END %]
[% END %]
[% END %]
[% END %]
</td>
[% IF ( bibitemloo.holdable ) %]
<!-- HOLDABLE -->
[% UNLESS ( item_level_itypes ) %]
<td class="itype">
[% IF ( bibitemloo.imageurl ) %]<img src="[% bibitemloo.imageurl %]" alt="" />[% END %]
[% bibitemloo.description %]
</td>
[% END %]
[% IF showholds || showpriority %]
<td class="priority">
[% IF showpriority %] [% bibitemloo.rank %] [% END %]
[% IF showholds && showpriority %] out of [% END %]
[% IF showholds %] [% bibitemloo.reservecount %] [% END %]
</td>
[% END %]
[% IF ( reserve_in_future ) %]
<td class="reserve_date">
<input name="reserve_date_[% bibitemloo.biblionumber %]" id="from" size="10" class="datepickerfrom"/>
<script type="text/javascript">
//<![CDATA[
$("#reserve_date_[% bibitemloo.biblionumber %]").attr( 'readonly', 'readonly' );
//]]>
</script>
<p style="margin:.3em 2em;">
<a href="#" style="font-size:85%;text-decoration:none;" onclick="document.getElementById('reserve_date_[% bibitemloo.biblionumber %]').value='';return false;">Clear date</a></p>
</td>[% END %]
[% END %]
[% IF ( bibitemloo.holdable ) %]<td class="expiration_date">
<input name="expiration_date_[% bibitemloo.biblionumber %]" id="to" size="10" readonly="readonly" class="datepickerto" />
<p style="margin:.3em 2em;">
<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 ( bibitemloo.holdable ) %]
<!-- HOLD ABLE -->
[% IF ( OPACItemHolds ) %]
<!-- ITEM HOLDS -->
<td class="place_on_type" style="display:none">
<ul>
<li>
[% UNLESS ( bibitemloo.holdable ) %]
<input type="radio" name="reqtype_[% bibitemloo.biblionumber %]"
id="reqany_[% bibitemloo.biblionumber %]"
class="selectany"
value="Any"
disabled="disabled"
/>
[% ELSE %]
<input type="radio" name="reqtype_[% bibitemloo.biblionumber %]"
id="reqany_[% bibitemloo.biblionumber %]"
class="selectany"
value="Any"
checked="checked"
/>
[% END %]
<label for="reqany_[% bibitemloo.biblionumber %]">Next available copy</label>
</li>
<li>
[% UNLESS ( bibitemloo.holdable ) %]
<input type="radio" name="reqtype_[% bibitemloo.biblionumber %]"
id="reqspecific_[% bibitemloo.biblionumber %]"
class="selectspecific"
disabled="disabled"
value="Specific"
/>
[% ELSE %]
<input type="radio" name="reqtype_[% bibitemloo.biblionumber %]"
id="reqspecific_[% bibitemloo.biblionumber %]"
class="selectspecific"
value="Specific"
/>
[% END %]
<label for="reqspecific_[% bibitemloo.biblionumber %]">A specific copy</label>
</li>
</ul>
</td>
[% END %][% END %]
[% UNLESS ( singleBranchMode ) %]
[% IF ( bibitemloo.holdable ) %]
[% IF ( choose_branch ) %]
<td class="branch">
[% UNLESS ( bibitemloo.holdable ) %]
<select name="branch" id="branch_[% bibitemloo.biblionumber %]" disabled="disabled">
[% FOREACH branchloo IN bibitemloo.branchloop %]
[% IF ( branchloo.selected ) %]
<option value="[% branchloo.branchcode %]" selected="selected">[% branchloo.branchname %]</option>
[% ELSE %]
<option value="[% branchloo.branchcode %]">[% branchloo.branchname %]</option>
[% END %]
[% END %]
</select>
[% ELSE %]
<select name="branch" id="branch_[% bibitemloo.biblionumber %]">
[% FOREACH branchloo IN bibitemloo.branchloop %]
[% IF ( branchloo.selected ) %]
<option value="[% branchloo.branchcode %]" selected="selected">[% branchloo.branchname %]</option>
[% ELSE %]
<option value="[% branchloo.branchcode %]">[% branchloo.branchname %]</option>
[% END %]
[% END %]
</select>
[% END %]
</td>
[% END %]
[% END %]
[% END %]
</tr>
[% IF ( OPACItemHolds ) %]
[% IF ( bibitemloo.holdable ) %]
<tr class="copiesrow" id="copiesrow_[% bibitemloo.biblionumber %]">
<td>&nbsp;</td>
<td colspan="[% itemtable_colspan %]">
<table>
<caption>Select a specific copy:</caption>
<tr>
<th>Copy</th>
[% IF ( item_level_itypes ) %]
<th>Item type</th>
[% END %]
<th>Barcode</th>
[% UNLESS ( singleBranchMode ) %]
<th>Home library</th>
<th>Last location</th>
[% END %]
<th>Call number</th>
[% IF ( bibitemloo.itemdata_enumchron ) %]
<th>Vol info</th>
[% END %]
<th>Information</th>
</tr>
[% FOREACH itemLoo IN bibitemloo.itemLoop %]
<tr class="[% itemLoo.backgroundcolor %]">
<td class="copy">
[% IF ( itemLoo.available ) %]
<input type="radio" class="checkitem checkitem_[% bibitemloo.biblionumber %]" name="checkitem_[% bibitemloo.biblionumber %]"
value="[% itemLoo.itemnumber %]" />
[% ELSE %]
<input disabled="disabled" type="radio" class="checkitem" name="checkitem" value="[% itemLoo.itemnumber %]" />
<img src="/opac-tmpl/lib/famfamfam/silk/cross.png" alt="Cannot be put on hold" title="Cannot be put on hold" />
[% END %] [% IF ( itemLoo.copynumber ) %][% itemLoo.copynumber %][% END %]
</td>
[% IF ( item_level_itypes ) %]
<td class="itype">
[% UNLESS ( noItemTypeImages ) %]
[% IF ( itemLoo.imageurl ) %]<img src="[% itemLoo.imageurl %]" alt="" />[% END %]
[% END %]
[% itemLoo.description %]
</td>
[% END %]
<td class="barcode">[% itemLoo.barcode %]</td>
[% UNLESS ( singleBranchMode ) %]
<td class="homebranch">[% itemLoo.homeBranchName %]</td>
<td class="holdingbranch">[% itemLoo.holdingBranchName %]</td>
[% END %]
<td class="call_no">[% itemLoo.callNumber %]</td>
[% IF ( itemLoo.itemdata_enumchron ) %]<!-- test -->
<td class="vol_info">[% itemLoo.enumchron %]</td>
[% END %]
<td class="information">
[% IF ( itemLoo.dateDue ) %]
<span class="checkedout">Due [% itemLoo.dateDue %]</span>
[% ELSIF ( itemLoo.transfertwhen ) %]
<span class="intransit">In transit from [% itemLoo.transfertfrom %],
to [% itemLoo.transfertto %], since [% itemLoo.transfertwhen %]</span>
[% END %]
[% IF ( itemLoo.message ) %]
<span class="lost">Unavailable (lost or missing)</span>
[% END %]
[% IF ( itemLoo.notforloan ) %]
<span class="notforloan">Not for loan ([% itemLoo.notforloanvalue %])</span>
[% END %]
[% IF ( itemLoo.reservedate ) %]
<span class="waiting">[% IF ( itemLoo.waitingdate ) %]Waiting[% ELSE %]On hold[% END %] for patron
[% IF ( itemLoo.waitingdate ) %]at[% ELSE %]expected at[% END %] [% itemLoo.ExpectedAtLibrary %]
since
[% IF ( itemLoo.waitingdate ) %][% itemLoo.waitingdate %][% ELSE %][% IF ( itemLoo.reservedate ) %][% itemLoo.reservedate %][% END %][% END %].
</span>
[% ELSE %]
<span class="notonhold">Not on hold</span>
[% END %]&nbsp;
</td>
</tr>
[% END %]
</table>
</td>
</tr>
[% END %]<!-- bib_available -->
[% END %]<!-- OPACItemHolds -->
[% END %]
</table><!-- bibitemloop -->
[% END %] <!-- if message -->
</div><!-- bigloop -->
[% UNLESS ( message ) %]
[% UNLESS ( none_available ) %]
<input type="submit" value="Place Hold" class="placehold" />
[% END %]
[% END %]
</form>
</div><!-- holds -->
</div><!-- yui-g -->
</div><!-- bd -->
</div><!-- doc3 -->
<div><!-- The following include seems to have an extra "/div" in it... -->
[% INCLUDE 'opac-bottom.inc' %]