From c765cfecf651a506cf3982ad15ac96991e683d6e 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 Signed-off-by: David Nind Signed-off-by: Tomas Cohen Arazi Signed-off-by: Jonathan Druart --- 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..6fc245daeb 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->{cursor}) { $pos++; next; } @@ -50,15 +50,16 @@ sub new { ) ); $pos++; - last if ($pos + 1 - $token->{offset}) > $repository->{koha_max_count}; + last if ($pos + 1 - $token->{cursor}) > $repository->{koha_max_count}; } $self->resumptionToken( Koha::OAI::Server::ResumptionToken->new( metadataPrefix => $token->{metadata_prefix}, - offset => $pos + cursor => $pos, + next_id => $pos + 1 ) - ) if ( $pos > $token->{offset} ); + ) if ( $pos < scalar @$sets ); return $self; } -- 2.39.5