https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30526 Bug ID: 30526 Summary: The pagination in the REST API does not work if $c->objects->search is called multiple times. Change sponsored?: --- Product: Koha Version: unspecified Hardware: All OS: All Status: NEW Severity: normal Priority: P5 - low Component: REST API Assignee: koha-bugs@lists.koha-community.org Reporter: andreas.jonsson@kreablo.se CC: tomascohen@gmail.com The REST-plugin Koha::REST::Plugin::Pagination defines two methods: dbic_merge_pagination and add_pagination_headers. The method add_pagination_headers use the helper subroutine _build_link. The last call in add_pagination_headers looks like this: push @links, _build_link( $c, { page => $pages, per_page => $per_page, rel => 'last', params => $args->{params} } ); Here is _build_link: sub _build_link { my ( $c, $args ) = @_; my $params = $args->{params}; $params->{_page} = $args->{page}; $params->{_per_page} = $args->{per_page}; Note that the original parameters _page and _per_page is overwritten here. This means that _page will be $pages. Subsequent calls to $c->objects->search will, thus, always return the last page. At least REST::V1::Holds::pickup_locations is affected by this (because a redundant call to $c->objects->search is made if AllowHoldPolicyOverride is activated). This causes the dropdown menu with pickup locations in the holds view to only contain the last page of libraries if there are more than 20 pickup libraries and AllowHoldPolicyOverride is activated. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.