Bug 9984: Remove server-side sort on the hold ratios table
authorJonathan Druart <jonathan.druart@biblibre.com>
Wed, 3 Apr 2013 13:31:08 +0000 (15:31 +0200)
committerJared Camins-Esakov <jcamins@cpbibliography.com>
Mon, 22 Apr 2013 00:44:01 +0000 (20:44 -0400)
JS is a requirement for the staff client, so the sort link on header is
useless.

Test plan:
Check that there is no regression (sort, data, etc.) on the hold ratios
table.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Tested on top of patch for bug 9459.
All tests and QA script pass.
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
circ/reserveratios.pl
koha-tmpl/intranet-tmpl/prog/en/modules/circ/reserveratios.tt

index 209a09e..91d1f6a 100755 (executable)
@@ -32,7 +32,6 @@ use C4::Debug;
 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');
@@ -72,7 +71,7 @@ if ($ratio <= 0) {
 }
 
 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) {
@@ -84,23 +83,6 @@ if ($enddate) {
     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,
@@ -126,17 +108,17 @@ my $strsth =
  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);
index 8a52193..d55382e 100644 (file)
@@ -8,12 +8,11 @@
 <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") }
         );
@@ -25,7 +24,7 @@
             "iDisplayLength": 20,
             "sPaginationType": "four_button"
         }));
-        });
+     });
 //]]>
 </script>
 <style type="text/css">
 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/circ/circulation-home.pl">Circulation</a> &rsaquo; 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 &ge; [% 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 %]&amp;order=reservecount&amp;from=[% from %]&amp;to=[% to %]">Sort</a>
-        </th>
-        <th>Items
-        <a href="/cgi-bin/koha/circ/reserveratios.pl?ratio=[% ratio %]&amp;order=itemcount&amp;from=[% from %]&amp;to=[% to %]">Sort</a>
-        </th>
-        <th>Hold ratio</th>
-        <th>Title
-        <a href="/cgi-bin/koha/circ/reserveratios.pl?ratio=[% ratio %]&amp;order=biblio&amp;from=[% from %]&amp;to=[% to %]">Sort</a>
-        </th>
-        <th>Holding libraries
-        <a href="/cgi-bin/koha/circ/reserveratios.pl?ratio=[% ratio %]&amp;order=branch&amp;from=[% from %]&amp;to=[% to %]">Sort</a>
-        </th>
-        <th>Location
-        <a href="/cgi-bin/koha/circ/reserveratios.pl?ratio=[% ratio %]&amp;order=location&amp;from=[% from %]&amp;to=[% to %]">Sort</a>
-        </th>
-        <th>Itype
-        <a href="/cgi-bin/koha/circ/reserveratios.pl?ratio=[% ratio %]&amp;order=itype&amp;from=[% from %]&amp;to=[% to %]">Sort</a>
-        </th>
-        <th>Call numbers
-        <a href="/cgi-bin/koha/circ/reserveratios.pl?ratio=[% ratio %]&amp;order=callnumber&amp;from=[% from %]&amp;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>
@@ -93,7 +78,8 @@
             <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>