From e8003f564a253038ec19af3adf4c67706a435fac Mon Sep 17 00:00:00 2001
From: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Date: Tue, 15 Oct 2024 15:35:35 +0000
Subject: [PATCH] Bug 38177: Fix HoldingsIQ pagination

Test plan:
1) Setup all the system preferences in ERM:
<staff_url>/cgi-bin/koha/admin/preferences.pl?tab=erm
2) Enable EBSCO in ERMProviders. Set the ERMProviderEbscoApiKey and ERMProviderEbscoCustomerID prefs.
3) Do a search that returns more than 20 records. Click on a page other than 1. Notice the records do not change (Page is the same).
4) Apply patch. Repeat. Notice pagination now works.
---
 Koha/REST/V1/ERM/EHoldings/Titles/EBSCO.pm | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/Koha/REST/V1/ERM/EHoldings/Titles/EBSCO.pm b/Koha/REST/V1/ERM/EHoldings/Titles/EBSCO.pm
index cacc1c84b5e..1aa42d2173c 100644
--- a/Koha/REST/V1/ERM/EHoldings/Titles/EBSCO.pm
+++ b/Koha/REST/V1/ERM/EHoldings/Titles/EBSCO.pm
@@ -40,13 +40,8 @@ sub list {
 
         my $ebsco = Koha::ERM::Providers::EBSCO->new;
 
-        # We cannot get base_total as a search kw is required by the API
-        my ( $per_page, $page ) = $ebsco->build_query_pagination(
-            {
-                per_page => $c->stash('koha.pagination.per_page'),
-                page     => $c->stash('koha.pagination.page'),
-            }
-        );
+        my $per_page = $c->req->params->to_hash->{_per_page};
+        my $page = $c->req->params->to_hash->{_page};
 
         my $additional_params = $ebsco->build_additional_params( $c->req->params->to_hash );
 
-- 
2.39.5