X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=catalogue%2Fitemsearch.pl;h=72074a8fdf843a21334c4da86eee99d0d933c7a5;hb=3bf31ae4d4dec818c48b4833e128d0a49c3419f3;hp=9de6fc601f2f2d00721c9a88473aa1375eef4858;hpb=9d6d641d1f8b77271800f43bc027b651f9aea52b;p=koha-ffzg.git diff --git a/catalogue/itemsearch.pl b/catalogue/itemsearch.pl index 9de6fc601f..72074a8fdf 100755 --- a/catalogue/itemsearch.pl +++ b/catalogue/itemsearch.pl @@ -62,7 +62,7 @@ if (defined $format and $format eq 'json') { push @f, $columns[$i]; push @c, 'and'; - if ( grep { $_ eq $columns[$i] } qw( ccode homebranch holdingbranch location itype notforloan itemlost ) ) { + if ( grep { $_ eq $columns[$i] } qw( ccode homebranch holdingbranch location itype notforloan itemlost onloan ) ) { push @q, "$word"; push @op, '='; } else { @@ -185,6 +185,21 @@ if ( defined $format ) { } } + # null/is not null parameters + foreach my $p (qw( onloan )) { + my $v = $cgi->param($p) // ''; + my $f = { + field => $p, + operator => "is", + }; + if ( $v eq 'IS NOT NULL' ) { + $f->{query} = "not null"; + } elsif ( $v eq 'IS NULL' ) { + $f->{query} = "null"; + } + push @{ $filter->{filters} }, $f unless ( $v eq "" ); + } + if (my $itemcallnumber_from = scalar $cgi->param('itemcallnumber_from')) { push @{ $filter->{filters} }, { field => 'itemcallnumber', @@ -230,14 +245,17 @@ if ( defined $format ) { my $biblio = Koha::Biblios->find( $item->{biblionumber} ); $item->{biblio} = $biblio; $item->{biblioitem} = $biblio->biblioitem->unblessed; + my $checkout = Koha::Checkouts->find({ itemnumber => $item->{itemnumber} }); + $item->{checkout} = $checkout; } } $template->param( - filter => $filter, + filter => $filter, search_params => $search_params, - results => $results, - total_rows => $total_rows, + results => $results, + total_rows => $total_rows, + user => Koha::Patrons->find( $borrowernumber ), ); if ($format eq 'csv') { @@ -259,14 +277,8 @@ if ( defined $format ) { # Display the search form -my @branches = map { value => $_->branchcode, label => $_->branchname }, Koha::Libraries->search( {}, { order_by => 'branchname' } ); -my @itemtypes; -foreach my $itemtype ( Koha::ItemTypes->search ) { - push @itemtypes, { - value => $itemtype->itemtype, - label => $itemtype->translated_description, - }; -} +my @branches = map { value => $_->branchcode, label => $_->branchname }, Koha::Libraries->search( {}, { order_by => 'branchname' } )->as_list; +my @itemtypes = map { value => $_->itemtype, label => $_->translated_description }, Koha::ItemTypes->search_with_localization->as_list; my @ccodes = Koha::AuthorisedValues->get_descriptions_by_koha_field({ kohafield => 'items.ccode' }); foreach my $ccode (@ccodes) {