use C4::Biblio qw/GetMarcBiblio GetRecordValue GetFrameworkCode/;
my $input = new CGI;
-my $order = $input->param('order') || '';
my $startdate = $input->param('from');
my $enddate = $input->param('to');
my $ratio = $input->param('ratio');
}
my $dbh = C4::Context->dbh;
-my ($sqlorderby, $sqldatewhere) = ("","");
+my $sqldatewhere = "";
$debug and warn format_date_in_iso($startdate) . "\n" . format_date_in_iso($enddate);
my @query_params = ();
if ($startdate) {
push @query_params, format_date_in_iso($enddate);
}
-if ($order eq "biblio") {
- $sqlorderby = " ORDER BY biblio.title, holdingbranch, listcall, l_location ";
-} elsif ($order eq "callnumber") {
- $sqlorderby = " ORDER BY listcall, holdingbranch, l_location ";
-} elsif ($order eq "itemcount") {
- $sqlorderby = " ORDER BY itemcount, reservecount ";
-} elsif ($order eq "itype") {
- $sqlorderby = " ORDER BY l_itype, holdingbranch, listcall ";
-} elsif ($order eq "location") {
- $sqlorderby = " ORDER BY l_location, holdingbranch, listcall ";
-} elsif ($order eq "reservecount") {
- $sqlorderby = " ORDER BY reservecount DESC ";
-} elsif ($order eq "branch") {
- $sqlorderby = " ORDER BY holdingbranch, l_location, listcall ";
-} else {
- $sqlorderby = " ORDER BY reservecount DESC ";
-}
my $strsth =
"SELECT reservedate,
reserves.borrowernumber as borrowernumber,
FROM reserves
LEFT JOIN items ON items.biblionumber=reserves.biblionumber
LEFT JOIN biblio ON reserves.biblionumber=biblio.biblionumber
- WHERE
-notforloan = 0 AND damaged = 0 AND itemlost = 0 AND wthdrawn = 0
+ WHERE
+ notforloan = 0 AND damaged = 0 AND itemlost = 0 AND wthdrawn = 0
$sqldatewhere
";
if (C4::Context->preference('IndependantBranches')){
- $strsth .= " AND items.holdingbranch=? ";
+ $strsth .= " AND items.holdingbranch=? ";
push @query_params, C4::Context->userenv->{'branch'};
}
-$strsth .= " GROUP BY reserves.biblionumber " . $sqlorderby;
+$strsth .= " GROUP BY reserves.biblionumber ORDER BY reservecount DESC";
$template->param(sql => $strsth);
my $sth = $dbh->prepare($strsth);
<script type="text/javascript" src="[% themelang %]/js/datatables.js"></script>
<script type="text/javascript">
//<![CDATA[
- $(document).ready(function() {
- $("th a").hide();
- $(".ratiolimit").click(function () {
+ $(document).ready(function() {
+ $(".ratiolimit").click(function () {
$("#ratio").val($(this).html());
});
- $(".ratiolimit").hover(
+ $(".ratiolimit").hover(
function () { $(this).toggleClass("ulined") },
function () { $(this).toggleClass("ulined") }
);
"iDisplayLength": 20,
"sPaginationType": "four_button"
}));
- });
+ });
//]]>
</script>
<style type="text/css">
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/circ/circulation-home.pl">Circulation</a> › Hold ratios</div>
<div id="doc3" class="yui-t2">
-
<div id="bd">
- <div id="yui-main">
- <div class="yui-b">
+ <div id="yui-main">
+ <div class="yui-b">
<h1>Hold ratios to calculate items needed</h1>
<h3>Calculated on [% todaysdate %]. From [% from %]
- to [% to %]</h3>
+ to [% to %]</h3>
<p>These items have a hold ratio ≥ [% ratio %].</p>
<div class="sql">[% sql %]</div>
[% IF ( reserveloop ) %]
<table id="holdst">
-<thead> <tr>
- <th>Holds
- <a href="/cgi-bin/koha/circ/reserveratios.pl?ratio=[% ratio %]&order=reservecount&from=[% from %]&to=[% to %]">Sort</a>
- </th>
- <th>Items
- <a href="/cgi-bin/koha/circ/reserveratios.pl?ratio=[% ratio %]&order=itemcount&from=[% from %]&to=[% to %]">Sort</a>
- </th>
- <th>Hold ratio</th>
- <th>Title
- <a href="/cgi-bin/koha/circ/reserveratios.pl?ratio=[% ratio %]&order=biblio&from=[% from %]&to=[% to %]">Sort</a>
- </th>
- <th>Holding libraries
- <a href="/cgi-bin/koha/circ/reserveratios.pl?ratio=[% ratio %]&order=branch&from=[% from %]&to=[% to %]">Sort</a>
- </th>
- <th>Location
- <a href="/cgi-bin/koha/circ/reserveratios.pl?ratio=[% ratio %]&order=location&from=[% from %]&to=[% to %]">Sort</a>
- </th>
- <th>Itype
- <a href="/cgi-bin/koha/circ/reserveratios.pl?ratio=[% ratio %]&order=itype&from=[% from %]&to=[% to %]">Sort</a>
- </th>
- <th>Call numbers
- <a href="/cgi-bin/koha/circ/reserveratios.pl?ratio=[% ratio %]&order=callnumber&from=[% from %]&to=[% to %]">Sort</a>
- </th>
- <th>Items needed
- </th>
- </tr></thead>
-
- <tbody>[% FOREACH reserveloo IN reserveloop %]
+ <thead>
<tr>
- <td><p>[% reserveloo.reservecount %]</p></td>
- <td><p>[% reserveloo.itemcount %]</p></td>
- <td><p class="ratiolimit">[% reserveloo.thisratio %]</p></td>
+ <th>Holds</th>
+ <th>Items</th>
+ <th>Hold ratio</th>
+ <th>Title</th>
+ <th>Holding libraries</th>
+ <th>Location</th>
+ <th>Itype</th>
+ <th>Call numbers</th>
+ <th>Items needed</th>
+ </tr>
+ </thead>
+ <tbody>
+ [% FOREACH reserveloo IN reserveloop %]
+ <tr>
+ <td><p>[% reserveloo.reservecount %]</p></td>
+ <td><p>[% reserveloo.itemcount %]</p></td>
+ <td><p class="ratiolimit">[% reserveloo.thisratio %]</p></td>
<td> [% INCLUDE 'biblio-default-view.inc' biblionumber = reserveloo.biblionumber %][% reserveloo.title |html %] [% IF ( reserveloo.subtitle ) %][% FOREACH subtitl IN reserveloo.subtitle %][% subtitl.subfield %][% END %][% END %]</a>[% IF ( reserveloo.author ) %] by [% reserveloo.author %][% END %]
</td>
<td><p>[% reserveloo.listbranch %]</p></td>
<td><p>[% reserveloo.listcall %]</p></td>
<td>[% IF ( reserveloo.thisratio_atleast1 ) %]<p><b>[% reserveloo.ratiocalc %] to order</b></p>[% END %]</td>
</tr>
- [% END %]</tbody>
+ [% END %]
+ </tbody>
</table>
[% ELSE %]
<b>No items found.</b>