[Koha-devel] maxItemsinSearchResults

Chris Cormack chris at bigballofwax.co.nz
Mon May 10 09:37:27 CEST 2010


Hi All

There is a system preference maxItemsinSearchResults, which is only
used in 2 places, both in C4::Search.
It's not referenced anywhere else and hence is not set.

But by not setting it, it means that in the staff client the counts of
items available at each branch behaves in an unexpected way.

my ( $availableitemscount, $onloanitemscount, $otheritemscount );
        $maxitems =
          ( C4::Context->preference('maxItemsinSearchResults') )
          ? C4::Context->preference('maxItemsinSearchResults') - 1
          : 1;
        for my $key ( sort keys %$onloan_items ) {
            (++$onloanitemscount > $maxitems) and last;
            push @onloan_items_loop, $onloan_items->{$key};
        }
        for my $key ( sort keys %$other_items ) {
            (++$otheritemscount > $maxitems) and last;
            push @other_items_loop, $other_items->{$key};
        }
        for my $key ( sort keys %$available_items ) {
            (++$availableitemscount > $maxitems) and last;
            push @available_items_loop, $available_items->{$key}
        }

So as it's not set, $maxitems is always 1, so at most the count for 2
branches (yes the code is broken in other ways) is shown. So if you
have 6 items, each at a different branch, and all available, then you
will only see at most 2 listed in the branches breakdown on the search
results page.

The way I see it, we either kill the references to this
systempreference, or add it back (I can only assume it existed at one
time).
Opinions?

Chris



More information about the Koha-devel mailing list