From cb30cb58510d97549f47db56b88999bd6118cac6 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Thu, 22 Jul 2021 17:56:39 +0000 Subject: [PATCH] Bug 28741: Fix use of resumption token params TO test: 1 - Enable OAI-PMH server in Koha 2 - Set OAI-PMH:MaxCount to 5 3 - Define 6 sets in Admin->OAI sets configuration Can setSpec and setName to 1,2,3.... 4 - Browse to: http://localhost:8080/cgi-bin/koha/oai.pl?verb=ListSets 5 - Click 'Show more' 6 - Keep seeing the same 5 - note the page says 'Results fetched -4-0' 7 - Apply patch 8 - Restart all the things 9 - Reload the ListSets URL above 10 - Click 'Show more' 11 - See the 6th set and note no 'Show more' 12 - Set OAI-PMH:MaxCount to 1 13 - Go to the base ListSets url again 14 - Confirm you can 'Show more' until you reach the end --- Koha/OAI/Server/ListSets.pm | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Koha/OAI/Server/ListSets.pm b/Koha/OAI/Server/ListSets.pm index 8a4be18ae4..504c0e3ebb 100644 --- a/Koha/OAI/Server/ListSets.pm +++ b/Koha/OAI/Server/ListSets.pm @@ -35,7 +35,7 @@ sub new { my $sets = GetOAISets; my $pos = 0; foreach my $set (@$sets) { - if ($pos < $token->{offset}) { + if ($pos < $token->{next_id}) { $pos++; next; } @@ -50,15 +50,16 @@ sub new { ) ); $pos++; - last if ($pos + 1 - $token->{offset}) > $repository->{koha_max_count}; + last if ($pos + 1 - $token->{next_id}) > $repository->{koha_max_count}; } $self->resumptionToken( Koha::OAI::Server::ResumptionToken->new( metadataPrefix => $token->{metadata_prefix}, - offset => $pos + cursor => $pos, + next_id => $pos ) - ) if ( $pos > $token->{offset} ); + ) if ( $pos < scalar @$sets ); return $self; } -- 2.20.1