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>
=head2 GetLostItems
- $items = GetLostItems( $where, $orderby );
+ $items = GetLostItems( $where );
This function gets a list of lost items.
{ 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
=item usage in the perl script:
my $where = { barcode => '0001548' };
- my $items = GetLostItems( $where, "homebranch" );
+ my $items = GetLostItems( $where );
$template->param( itemsloop => $items );
=back
sub GetLostItems {
# Getting input args.
my $where = shift;
- my $orderby = shift;
my $dbh = C4::Context->dbh;
my $query = "
$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 );
[% 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>
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;
$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'});
}