Bug 13372: Sort is done by DataTables
authorJonathan Druart <jonathan.druart@biblibre.com>
Mon, 15 Dec 2014 10:16:50 +0000 (11:16 +0100)
committerTomas Cohen Arazi <tomascohen@gmail.com>
Fri, 10 Apr 2015 13:22:59 +0000 (10:22 -0300)
This patch removes the order by filter on the items lost report.
The sort can now be done by DataTables.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
C4/Items.pm
koha-tmpl/intranet-tmpl/prog/en/modules/reports/itemslost.tt
reports/itemslost.pl

index aea1c1d..22a8bc2 100644 (file)
@@ -960,7 +960,7 @@ sub GetItemLocation {
 
 =head2 GetLostItems
 
-  $items = GetLostItems( $where, $orderby );
+  $items = GetLostItems( $where );
 
 This function gets a list of lost items.
 
@@ -974,9 +974,6 @@ and the value to match as value. For example:
 { barcode    => 'abc123',
   homebranch => 'CPL',    }
 
-C<$orderby> is a field of the items table by which the resultset
-should be orderd.
-
 =item return:
 
 C<$items> is a reference to an array full of hashrefs with columns
@@ -985,7 +982,7 @@ from the "items" table as keys.
 =item usage in the perl script:
 
   my $where = { barcode => '0001548' };
-  my $items = GetLostItems( $where, "homebranch" );
+  my $items = GetLostItems( $where );
   $template->param( itemsloop => $items );
 
 =back
@@ -995,7 +992,6 @@ from the "items" table as keys.
 sub GetLostItems {
     # Getting input args.
     my $where   = shift;
-    my $orderby = shift;
     my $dbh     = C4::Context->dbh;
 
     my $query   = "
@@ -1015,11 +1011,6 @@ sub GetLostItems {
         $query .= " AND $key LIKE ?";
         push @query_parameters, "%$where->{$key}%";
     }
-    my @ordervalues = qw/title author homebranch itype barcode price replacementprice lib datelastseen location/;
-    
-    if ( defined $orderby && grep($orderby, @ordervalues)) {
-        $query .= ' ORDER BY '.$orderby;
-    }
 
     my $sth = $dbh->prepare($query);
     $sth->execute( @query_parameters );
index b751a29..e72f446 100644 (file)
        [% ELSE %]
        
        <form name="f" action="/cgi-bin/koha/reports/itemslost.pl" method="post">
-<fieldset class="rows"><ol>    <li><label for="orderbyfilter">Order by: </label>
-    <select id="orderbyfilter" name="orderbyfilter">
-        <option value=""> --- </option>
-        <option value="title">Title</option>
-        <option value="author">Author</option>
-        <option value="homebranch">Home library</option>
-        <option value="itype">Item types</option>
-        <option value="barcode">Barcode</option>
-        <option value="price">Price</option>
-        <option value="replacementprice">Replacement price</option>
-        <option value="lib">Lost code</option>
-        <option value="datelastseen">Date last seen</option>
-        <option value="location">Location</option>
-    </select></li>
-       
+    <fieldset class="rows">
+        <ol>
+
        <li><label for="barcodefilter">Barcode: </label><input type="text" name="barcodefilter" id="barcodefilter" size="6" /></li>
        <li><label for="branchfilter">Library: </label><select name="branchfilter" id="branchfilter">
                 <option value="">All</option>
index 450ed45..53f3404 100755 (executable)
@@ -53,7 +53,6 @@ my $params = $query->Vars;
 my $get_items = $params->{'get_items'};
 
 if ( $get_items ) {
-    my $orderbyfilter    = $params->{'orderbyfilter'}   || undef;
     my $branchfilter     = $params->{'branchfilter'}    || undef;
     my $barcodefilter    = $params->{'barcodefilter'}   || undef;
     my $itemtypesfilter  = $params->{'itemtypesfilter'} || undef;
@@ -63,11 +62,11 @@ if ( $get_items ) {
     $where{'homebranch'}       = $branchfilter    if defined $branchfilter;
     $where{'barcode'}          = $barcodefilter   if defined $barcodefilter;
     $where{'authorised_value'} = $loststatusfilter if defined $loststatusfilter;
-    
+
     my $itype = C4::Context->preference('item-level_itypes') ? "itype" : "itemtype";
     $where{$itype}            = $itemtypesfilter if defined $itemtypesfilter;
 
-    my $items = GetLostItems( \%where, $orderbyfilter ); 
+    my $items = GetLostItems( \%where );
     foreach my $it (@$items) {
         $it->{'datelastseen'} = format_date($it->{'datelastseen'});
     }