Koha/koha-tmpl/intranet-tmpl/prog/en/modules/basket/basket.tt
Kyle M Hall 430f0ea6ba Bug 7940 - Placing a hold on a single item from the staff cart causes errors
This is caused by the javascript function placeHold() in basket.pl
The cause of this error is thus: when a staff member uses the cart
to place holds on multiple items at once, the cart redirects to
reserver/request.pl with the params 'biblionumbers' ( a string of
biblionumbers separated by slashes ( e.g. '5/4/3/' ) and the param
multi_hold with a value of 1.

When multi_hold is enabled, request.pl splits the string 'biblionumbers'
on those slashes and works on that list.

In placeHold(), when only one item is checked, the system passes
the param biblionumbers with a single biblionumber ( e.g. '5/' )
and does *not* pass the multi_hold param. This causes request.pl
to not parse the biblionumbers param, and thus reserve.pl has
no biblionumber to work on ( hence our error here ).

There are two options to resolve this:
A) Add the multi_hold param even for a single hold from the cart.
B) In the event of a single hold being placed from the cart,
   switch to the standard single hold url ( i.e. request.pl?biblionumber=234 )

This commit resolves the situation using option B, as it seems more
logical than using the multi-holds system for a single hold.

Signed-off-by: Liz Rea <wizzyrea@gmail.com>
passes tests, works as advertised. Good catch!

Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
2012-04-12 17:58:49 +02:00

364 lines
14 KiB
Text

[% INCLUDE 'doc-head-open.inc' %]
<title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] Catalog &rsaquo; Your cart</title>
[% IF ( print_basket ) %]
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="shortcut icon" href="[% IF ( IntranetFavicon ) %][% IntranetFavicon %][% ELSE %][% themelang %]/includes/favicon.ico[% END %]" type="image/x-icon" />
<meta http-equiv="Content-Language" content="en-us" />
<style type="text/css">
@import url([% themelang %]/css/print.css);
</style>
[% ELSE %][% INCLUDE 'doc-head-close.inc' %]
<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.tablesorter.min.js"></script>
<script type="text/javascript">
//<![CDATA[
$(document).ready(function()
{
$("#itemst").tablesorter({
headers: { 0: { sorter: false }}
});
}
);
function placeHold () {
var checkedItems = $("input:checkbox:checked");
if ($(checkedItems).size() == 0) {
alert(MSG_NO_RECORD_SELECTED);
return false;
}
var newloc;
if ($(checkedItems).size() > 1) {
var bibs = "";
$(checkedItems).each(function() {
var bib = $(this).val();
bibs += bib + "/";
});
newloc = "/cgi-bin/koha/reserve/request.pl?biblionumbers=" + bibs + "&multi_hold=1";
} else {
var bib = checkedItems[0].value;
newloc = "/cgi-bin/koha/reserve/request.pl?biblionumber=" + bib;
}
window.opener.location = newloc;
window.close();
}
$(document).ready(function(){
$("#CheckAll").click(function(){
var checked = [];
$("#bookbag_form").checkCheckboxes("*", true).each(
function() {
selRecord(this.value,true);
}
);
return false;
});
$("#CheckNone").click(function(){
var checked = [];
$("#bookbag_form").unCheckCheckboxes("*",true).each(
function() {
selRecord(this.value,false);
}
);
return false;
});
$(".holdsep").text("| ");
$(".hold").text(_("Place Hold"));
});
//]]>
</script>
[% END %]
</head>
[% IF ( print_basket ) %]<body id="cart_basket" class="cart" onload="print();history.back();">[% ELSE %]<body id="cart_basket" class="cart">[% END %]
<div id="doc" class="yui-t7">
<div class="container">
[% UNLESS ( print_basket ) %]
<h1>Your cart</h1>
<div id="toolbar">
<ul class="toolbar">
<li>
<span id="addchild" class="yui-button yui-link-button"><span class="first-child">
[% IF ( verbose ) %]<a href="basket.pl" class="brief" onclick="showLess(); return false;">Brief display</a>[% ELSE %]<a href="basket.pl" class="detail" onclick="showMore(); return false;">More details</a>[% END %]
</span></span>
</li>
<li>
<span id="receive" class="yui-button yui-link-button"><span class="first-child">
<a class="send" href="basket.pl" onclick="sendBasket(); return false;">Send</a>
</span></span>
</li>
<li>
<span id="savemenuc" class="yui-button yui-link-button"><span class="first-child">
<a class="download" href="basket.pl" onclick="downloadBasket(); return false;">Download</a>
</span></span>
</li>
<li>
<span id="printmenuc" class="yui-button yui-link-button"><span class="first-child">
<a class="print" href="basket.pl" onclick="printBasket(); return false;">Print</a>
</span></span>
</li>
<li>
<span id="delete" class="yui-button yui-link-button"><span class="first-child">
<a class="empty" href="basket.pl" onclick="delBasket('popup'); return false;">Empty and close</a>
</span></span>
</li>
<li>
<span id="hide" class="yui-button yui-link-button"><span class="first-child">
<a class="hide close" href="basket.pl">Hide window</a>
</span></span>
</li>
</ul>
</div>
[% END %]
[% IF ( verbose ) %]
[% UNLESS ( print_basket ) %]<p style="padding: 7px 0; border-top : 1px solid #E8E8E8;"><a id="CheckAll" href="#">Select all</a> <a id="CheckNone" href="#">Clear all</a> | <b>Selected items :</b>
<a href="#" onclick="delSelRecords(); return false;">Remove</a>
[% IF ( loggedinusername ) %]
| <a href="#" onclick="addSelToShelf(); return false;">Add to a list</a>
[% END %]
[% IF ( CAN_user_reserveforothers ) %]
| <a href="#" onclick="placeHold(); return false;">Place hold</a>
[% END %]
</p>[% END %]
<form action="basket.pl" method="get" name="bookbag_form" id="bookbag_form">
[% FOREACH BIBLIO_RESULT IN BIBLIO_RESULTS %]
<h3>
[% IF ( print_basket ) %]
[% BIBLIO_RESULT.title |html %]
[% IF ( BIBLIO_RESULT.subtitle ) %] [% BIBLIO_RESULT.subtitle %][% END %]
[% IF ( BIBLIO_RESULT.author ) %] [% BIBLIO_RESULT.author %][% END %]
[% ELSE %]
<input type="checkbox" value="[% BIBLIO_RESULT.biblionumber %]" name="bib[% BIBLIO_RESULT.biblionumber %]" id="bib[% BIBLIO_RESULT.biblionumber %]" onclick="selRecord(value,checked)" />
[% BIBLIO_RESULT.title |html %]
[% IF ( BIBLIO_RESULT.subtitle ) %] [% BIBLIO_RESULT.subtitle %][% END %]
[% IF ( BIBLIO_RESULT.author ) %] [% BIBLIO_RESULT.author %][% END %]
[% END %]
</h3>
<!-- COinS / Openurl -->
<span class="Z3988" title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&amp;rft.au=[% BIBLIO_RESULT.author %]&amp;rft.btitle=[% BIBLIO_RESULT.title |url %]&amp;rft.date=[% BIBLIO_RESULT.publicationyear %]&amp;rft.tpages=[% BIBLIO_RESULT.size %]&amp;rft.isbn=[% BIBLIO_RESULT.isbn |url %]&amp;rft.aucorp=&amp;rft.place=[% BIBLIO_RESULT.place %]&amp;rft.pub=[% BIBLIO_RESULT.publisher |url %]&amp;rft.edition=[% BIBLIO_RESULT.edition %]&amp;rft.series=[% BIBLIO_RESULT.series %]&amp;rft.genre="></span>
<table>
[% IF ( BIBLIO_RESULT.isbn ) %]
<tr>
<th scope="row">ISBN</th>
<td>[% BIBLIO_RESULT.isbn %]</td>
</tr>
[% END %]
[% IF ( BIBLIO_RESULT.HASAUTHORS ) %]
<tr>
<th scope="row">Author(s)</th>
<td>
[% IF ( BIBLIO_RESULT.author ) %]
<p>[% BIBLIO_RESULT.author %]</p>
[% END %]
[% IF ( BIBLIO_RESULT.MARCAUTHORS ) %]
[% FOREACH MARCAUTHOR IN BIBLIO_RESULT.MARCAUTHORS %]
<p> [% FOREACH MARCAUTHOR_SUBFIELDS_LOO IN MARCAUTHOR.MARCAUTHOR_SUBFIELDS_LOOP %]
[% MARCAUTHOR_SUBFIELDS_LOO.separator %]
[% MARCAUTHOR_SUBFIELDS_LOO.value %]
[% END %]
</p>
[% END %]
[% END %]
</td>
</tr>
[% END %]
[% IF ( BIBLIO_RESULT.publishercode ) %]
<tr>
<th scope="row">Publisher</th>
<td>[% BIBLIO_RESULT.place %] [% BIBLIO_RESULT.publishercode %] [% BIBLIO_RESULT.publicationyear %]
</td>
</tr>
[% END %]
[% IF ( BIBLIO_RESULT.pages ) %]
<tr>
<th scope="row">Details</th>
<td>[% BIBLIO_RESULT.pages %] [% BIBLIO_RESULT.illus %] [% BIBLIO_RESULT.size %]</td>
</tr>
[% END %]
[% IF ( BIBLIO_RESULT.seriestitle ) %]
<tr>
<th scope="row">Collection</th>
<td> [% BIBLIO_RESULT.seriestitle %]</td>
</tr>
[% END %]
[% IF ( BIBLIO_RESULT.MARCSUBJCTS ) %]
<tr>
<th scope="row">Subject(s)</th>
<td>[% FOREACH MARCSUBJCT IN BIBLIO_RESULT.MARCSUBJCTS %]
<p> [% FOREACH MARCSUBJECT_SUBFIELDS_LOO IN MARCSUBJCT.MARCSUBJECT_SUBFIELDS_LOOP %]
[% MARCSUBJECT_SUBFIELDS_LOO.separator %][% MARCSUBJECT_SUBFIELDS_LOO.value %][% END %]
</p>
[% END %]</td>
</tr>
[% END %]
[% IF ( BIBLIO_RESULT.copyrightdate ) %]
<tr><th scope="row">Copyright</th>
<td> [% BIBLIO_RESULT.copyrightdate %]</td>
</tr>
[% END %]
[% IF ( BIBLIO_RESULT.MARCNOTES ) %]
<tr>
<th scope="row">Notes</th>
<td>
[% FOREACH MARCNOTE IN BIBLIO_RESULT.MARCNOTES %]
<p>- [% MARCNOTE.marcnote %]</p>
[% END %]</td>
</tr>
[% END %]
[% IF ( BIBLIO_RESULT.unititle ) %]
<tr>
<th scope="row">Unified title</th>
<td> [% BIBLIO_RESULT.unititle %]</td>
</tr>
[% END %]
[% IF ( BIBLIO_RESULT.serial ) %]
<tr>
<th scope="row">Serial</th>
<td>[% BIBLIO_RESULT.serial %]</td>
</tr>
[% END %]
[% IF ( BIBLIO_RESULT.dewey ) %]
<tr>
<th scope="row">Dewey</th>
<td>[% BIBLIO_RESULT.dewey %]</td>
</tr>
[% END %]
[% IF ( BIBLIO_RESULT.classification ) %]
<tr>
<th scope="row">Classification</th>
<td> [% BIBLIO_RESULT.classification %]</td>
</tr>
[% END %]
[% IF ( BIBLIO_RESULT.lccn ) %]
<tr>
<th scope="row">LCCN</th>
<td> [% BIBLIO_RESULT.lccn %]</td>
</tr>
[% END %]
[% IF ( BIBLIO_RESULT.MARCurlS ) %]
<tr>
<th scope="row">URL(s)</th>
<td>
[% FOREACH MARCurl IN BIBLIO_RESULT.MARCurlS %]
<p>[% IF ( MARCurl.part ) %][% MARCurl.part %]
<br />[% END %]
[% MARCurl.MARCurl %]
[% IF ( MARCurl.notes ) %][% FOREACH note IN MARCurl.notes %][% note.note %]<br />[% END %][% END %]
[% END %]</p></td>
</tr>[% END %]
<tr>
<th scope="row">Location(s)</th>
<td>[% IF ( BIBLIO_RESULT.ITEM_RESULTS ) %][% FOREACH ITEM_RESULT IN BIBLIO_RESULT.ITEM_RESULTS %]
<p>
[% ITEM_RESULT.branchname %] [% ITEM_RESULT.location_description %]
[% IF ( ITEM_RESULT.itemcallnumber ) %]
([% ITEM_RESULT.itemcallnumber %])
[% END %]
</p>
[% END %][% ELSE %]This record has no items.[% END %]</td>
</tr>
</table>
[% END %]
</form>
[% ELSE %]
[% UNLESS ( print_basket ) %]
<p style="border-top : 1px solid #E8E8E8;">
<form action="/cgi-bin/koha/basket/basket.pl" method="get" name="bookbag_form" id="bookbag_form">
<a id="CheckAll" href="#">Select all</a>
<a id="CheckNone" href="#">Clear all</a>
| <b>Selected items :</b>
<a href="#" onclick="delSelRecords(); return false;">Remove</a>
[% IF ( loggedinusername ) %]
| <a href="#" onclick="addSelToShelf(); return false;">Add to a list</a>
[% END %]
[% IF ( CAN_user_reserveforothers ) %]
| <a href="#" onclick="placeHold(); return false;">Place hold</a>
[% END %]
[% END %]
</p>
<table id="itemst">
<thead><tr>
[% UNLESS ( print_basket ) %]<th>&nbsp;</th>[% END %]
<th>Title</th>
<th>Item type</th>
<th>Location</th>
</tr></thead>
[% FOREACH BIBLIO_RESULT IN BIBLIO_RESULTS %]
[% IF ( BIBLIO_RESULT.even ) %]
<tr class="highlight">
[% ELSE %]
<tr>
[% END %]
[% UNLESS ( print_basket ) %]<td>
<input type="checkbox" value="[% BIBLIO_RESULT.biblionumber %]" name="bib[% BIBLIO_RESULT.biblionumber %]" id="bib[% BIBLIO_RESULT.biblionumber %]" onclick="selRecord(value,checked);" />
</td> [% END %]
<td><a href="#" onclick="openBiblio('[% BIBLIO_RESULT.dest %]',[% BIBLIO_RESULT.biblionumber %])">
[% BIBLIO_RESULT.title |html %]
</a>
[% BIBLIO_RESULT.author %]
<p>[% IF ( BIBLIO_RESULT.publishercode ) %]- [% BIBLIO_RESULT.publishercode %]
[% IF ( BIBLIO_RESULT.place ) %] [% BIBLIO_RESULT.place %][% END %][% END %]
[% IF ( BIBLIO_RESULT.pages ) %] - [% BIBLIO_RESULT.pages %][% IF ( BIBLIO_RESULT.size ) %] [% BIBLIO_RESULT.size %]
[% END %]
[% END %]</p>
[% IF ( BIBLIO_RESULT.notes ) %]
<p>[% BIBLIO_RESULT.notes %]</p>
[% END %]
<!-- COinS / Openurl -->
<span class="Z3988" title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&amp;rft.au=[% BIBLIO_RESULT.author %]&amp;rft.btitle=[% BIBLIO_RESULT.title |url %]&amp;rft.date=[% BIBLIO_RESULT.publicationyear %]&amp;rft.tpages=[% BIBLIO_RESULT.size %]&amp;rft.isbn=[% BIBLIO_RESULT.isbn |url %]&amp;rft.aucorp=&amp;rft.place=[% BIBLIO_RESULT.place %]&amp;rft.pub=[% BIBLIO_RESULT.publisher |url %]&amp;rft.edition=[% BIBLIO_RESULT.edition %]&amp;rft.series=[% BIBLIO_RESULT.series %]&amp;rft.genre="></span>
</td>
<td>[% BIBLIO_RESULT.description %]</td>
<td>[% IF ( BIBLIO_RESULT.ITEM_RESULTS ) %][% FOREACH ITEM_RESULT IN BIBLIO_RESULT.ITEM_RESULTS %]
<p>
[% ITEM_RESULT.branchname %] [% ITEM_RESULT.location_description %]
[% IF ( ITEM_RESULT.itemcallnumber ) %]
([% ITEM_RESULT.itemcallnumber %])
[% END %]
</p>
[% END %][% ELSE %]This record has no items.[% END %]</td>
</tr>
[% END %]
</table></form>
[% END %]
<form name="myform" action="basket/basket.pl" method="get">
<input type="hidden" name="records" id="records" />
</form>
</div>
</div>
</body>
</html>