Bug 13372: Sort is done by DataTables

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>
This commit is contained in:
Jonathan Druart 2014-12-15 11:16:50 +01:00 committed by Tomas Cohen Arazi
parent 03382a089d
commit cc119bd856
3 changed files with 7 additions and 29 deletions

View 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 );

View File

@ -96,21 +96,9 @@
[% 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>

View File

@ -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'});
}