Koha/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/booksellers.tt
Owen Leonard c134e2111c Bug 13039 - Vendor search: sorting of "item count" and "biblio count" columns can be incorrect
On the vendor search results page if some cells contain textual data the
"item count" and "biblio count" columns will sort incorrectly. This
patch sets an explicit numeric sort on these columns. In doing so this
patch also changes the existing column sorting configuration to use
table header cell classes instead of sorting based on index.

This patch also corrects two instances of unescaped ampersands.

To test, search for a vendor which has multiple baskets, at least one of
which should contain canceled orders. Confirm that sorting by item
count, biblio count, date, and closed all work correctly.

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
I have not been able to see the sorting problem, but the
patch causes no regression and everything seems to work nicely.
Passes QA script and tests.

http://bugs.koha-community.org/show_bug.cgi?id=12039
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-19 13:27:00 -03:00

193 lines
9.9 KiB
Text

[% USE KohaDates %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha &rsaquo; Search for vendor [% supplier %]</title>
[% INCLUDE 'doc-head-close.inc' %]
<style type="text/css">
#vendors td{
vertical-align: top;
}
</style>
<link rel="stylesheet" href="[% themelang %]/css/datatables.css" />
[% INCLUDE 'datatables.inc' %]
<script type="text/javascript">
//<![CDATA[
$(document).ready(function() {
$("table.baskets").dataTable($.extend(true, {}, dataTablesDefaults, {
'sDom': 't',
'bPaginate': false,
'bFilter': false,
'bInfo': false,
"aaSorting": [[ 1, "asc" ]],
"aoColumnDefs": [
{ "sType": "title-string", "aTargets" : [ "title-string" ] },
{ "sType": "title-numeric", "aTargets" : [ "title-numeric" ] },
{ 'aTargets': [-1], 'bSortable': false }
]
}));
$("#supplierlist").change(function() {
var id = $(this).find("option:selected").val();
window.location.href = "#" + id;
});
$(".modal").on("show", function(){
var basket = $(this).data("basketno");
var legend = _("Add order to basket %s").format(basket);
$(this).find("legend").html(legend);
});
});
//]]>
</script>
</head>
<body id="acq_booksellers" class="acq">
[% INCLUDE 'header.inc' %]
[% INCLUDE 'acquisitions-search.inc' %]
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> &rsaquo; Search for vendor <em>[% supplier %]</em> </div>
<div id="doc3" class="yui-t2">
<div id="bd">
<div id="yui-main">
<div class="yui-b">
[% INCLUDE 'acquisitions-toolbar.inc' %]
[% UNLESS ( count == 1 ) %]
<h1>You searched on <b>vendor [% supplier %],</b> [% count %] results found</h1>
[% END %]
[% IF ( loop_suppliers.size ) %]
[% UNLESS (count == 1) %]
<p>Choose a vendor in the list to jump directly to the right place.
<select id="supplierlist">
[% FOREACH supplier1 IN loop_suppliers %]
<option value="[% supplier1.booksellerid %]">[% supplier1.name %]</option>
[% END %]
</select>
</p>
[% END %]
[% IF ( allbaskets ) %]
<p><a href="/cgi-bin/koha/acqui/booksellers.pl?supplier=[% supplier %]&amp;booksellerid=[% booksellerid %]">Show active baskets only</a></p>
[% ELSE %]
<p><a href="/cgi-bin/koha/acqui/booksellers.pl?supplier=[% supplier %]&amp;booksellerid=[% booksellerid %]&amp;allbaskets=1">Show all baskets</a></p>
[% END %]
<div id="acqui_order_supplierlist">
[% FOREACH supplier IN loop_suppliers %]
<div class="supplier">
<span class="suppliername">
[% IF (supplier.name) %]
<a name="[% supplier.booksellerid %]" href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% supplier.booksellerid %]">[% supplier.name %]</a>
[% ELSE %]
<a name="[% supplier.booksellerid %]" href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% supplier.booksellerid %]">NO NAME</a>
[% END %]
</span>
<span class="action">
[% IF ( CAN_user_acquisition_order_manage ) %]
[% IF ( supplier.active ) %]
<a class="btn btn-small" href="/cgi-bin/koha/acqui/basketheader.pl?booksellerid=[% supplier.booksellerid %]&amp;op=add_form"><i class="icon-plus"></i> New basket</a>
[% ELSE %]
(inactive)
[% END %]
[% END %]
<a class="btn btn-small" href="/cgi-bin/koha/acqui/parcels.pl?booksellerid=[% supplier.booksellerid %]"><i class="icon-inbox"></i> Receive shipment</a>
</span>
<div class="baskets">
[% IF ( supplier.loop_basket.size ) %]
<table class="baskets">
<thead>
<tr>
<th>No.</th>
<th>Name</th>
<th class="title-numeric">Item count</th>
<th class="title-numeric">Biblio count</th>
<th>Items expected</th>
<th>Created by</th>
<th class="title-string">Date</th>
<th>Basket group</th>
<th class="title-string">Closed</th>
<th>&nbsp;</th>
</tr>
</thead>
<tbody>
[% FOREACH basket IN supplier.loop_basket %]
[% IF ( basket.uncertainprices ) %]
<tr class="problem">
[% ELSE %]
<tr>
[% END %]
<td>[% basket.basketno %]</td>
<td>[% basket.basketname %]</td>
<td>
<span title="[% basket.total_items %]">[% basket.total_items %]
[% IF basket.total_items_cancelled %]
([% basket.total_items_cancelled %] cancelled)
[% END %]
</span>
</td>
<td>
<span title="[% basket.total_biblios %]">[% basket.total_biblios %]
[% IF basket.total_biblios_cancelled %]
([% basket.total_biblios_cancelled %] cancelled)
[% END %]
</span>
</td>
<td>[% basket.expected_items %]</td>
<td>
[% basket.authorisedby_firstname %]
[% basket.authorisedby_surname %]
</td>
<td><span title="[% basket.creationdate %]">[% basket.creationdate | $KohaDates %]</span></td>
<td>
[% IF basket.basketgroup %]
[% basketgroup = basket.basketgroup %]
[% IF basketgroup.closed %]
[% basketgroup.name %] (closed)
[% ELSE %]
<a href="/cgi-bin/koha/acqui/basketgroup.pl?op=add&amp;booksellerid=[% basket.booksellerid %]&amp;basketgroupid=[% basketgroup.id %]">[% basketgroup.name %]</a>
[% END %]
[% END %]
</td>
<td>
[% IF ( basket.closedate ) %]
<span title="[% basket.closedate %]">[% basket.closedate | $KohaDates %]</span>
[% ELSE %]
<span title="9999-99-99"></span>
[% END %]
</td>
<td>
<a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basket.basketno %]">View</a>
[% UNLESS ( basket.closedate ) %]
| <a id="addtoBasketLabel[% basket.basketno %]" href="#addtoBasket[% basket.basketno %]" role="button" data-toggle="modal">Add to basket</a>
<!-- Modal -->
<div id="addtoBasket[% basket.basketno %]" class="modal hide" tabindex="-1" role="dialog" aria-labelledby="addtoBasketLabel[% basket.basketno %]" aria-hidden="true" data-basketno="[% basket.basketname %]">
<div class="modal-body">
[% INCLUDE 'acquisitions-add-to-basket.inc' booksellerid=supplier.booksellerid basketno=basket.basketno %]
</div>
<div class="modal-footer">
<a href="#" class="cancel" data-dismiss="modal" aria-hidden="true">Cancel</a>
</div>
</div>
[% END %]
</td>
</tr>
[% END %][%# FOREACH basket IN supplier.loop_basket %]
</tbody>
</table>
[% ELSE %]
<p>No pending baskets</p>
[% END %][%# IF ( supplier.loop_basket.size ) %]
</div>
</div>
[% END %][%# FOREACH supplier IN loop_suppliers %]
</div>
[% END %][%# IF ( loop_suppliers.size ) %]
</div>
</div>
<div class="yui-b">
[% IF ( booksellerid ) %]
[% INCLUDE 'vendor-menu.inc' %]
[% END %]
[% INCLUDE 'acquisitions-menu.inc' %]
</div>
</div>
[% INCLUDE 'intranet-bottom.inc' %]