Bugzilla – Attachment 186063 Details for
Bug 39345
Koha must support COUNTER 5.1
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 39345: Use data provider report release to establish service URL
Bug-39345-Use-data-provider-report-release-to-esta.patch (text/plain), 3.78 KB, created by
Pedro Amorim
on 2025-09-03 09:41:40 UTC
(
hide
)
Description:
Bug 39345: Use data provider report release to establish service URL
Filename:
MIME Type:
Creator:
Pedro Amorim
Created:
2025-09-03 09:41:40 UTC
Size:
3.78 KB
patch
obsolete
>From 94252f55b82cfaa886b066a3d055b09a300fac06 Mon Sep 17 00:00:00 2001 >From: Pedro Amorim <pedro.amorim@openfifth.co.uk> >Date: Wed, 20 Aug 2025 10:05:24 +0000 >Subject: [PATCH] Bug 39345: Use data provider report release to establish > service URL > >Signed-off-by: Eric Phetteplace <phette23@gmail.com> >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >--- > Koha/ERM/EUsage/UsageDataProvider.pm | 19 ++++++++++++------- > Koha/REST/V1/ERM/EUsage/CounterRegistry.pm | 10 +++++++++- > 2 files changed, 21 insertions(+), 8 deletions(-) > >diff --git a/Koha/ERM/EUsage/UsageDataProvider.pm b/Koha/ERM/EUsage/UsageDataProvider.pm >index b7acc76ab53..876b6dc2f8e 100644 >--- a/Koha/ERM/EUsage/UsageDataProvider.pm >+++ b/Koha/ERM/EUsage/UsageDataProvider.pm >@@ -269,7 +269,7 @@ Tests the connection of the harvester to the SUSHI service and returns any alert > sub test_connection { > my ($self) = @_; > >- my $url = _validate_url( $self->service_url, 'status' ); >+ my $url = $self->_validate_url( $self->service_url, 'status' ); > $url .= 'status'; > $url .= '?customer_id=' . $self->customer_id; > $url .= '&requestor_id=' . $self->requestor_id if $self->requestor_id; >@@ -384,7 +384,7 @@ sub _build_url_query { > $self->erm_usage_data_provider_id; > } > >- my $url = _validate_url( $self->service_url, 'harvest' ); >+ my $url = $self->_validate_url( $self->service_url, 'harvest' ); > > $url .= lc $self->{report_type}; > $url .= '?customer_id=' . $self->customer_id; >@@ -401,22 +401,27 @@ sub _build_url_query { > > Checks whether the url ends in a trailing "/" and adds one if not > >-my $url = _validate_url($url, 'harvest') >+my $url = $self->_validate_url($url, 'harvest') > > $caller is either the harvest_sushi function ("harvest") or the test_connection function ("status") > > =cut > > sub _validate_url { >- my ( $url, $caller ) = @_; >+ my ( $self, $url, $caller ) = @_; > > if ( $caller eq 'harvest' ) { > >- # Not all urls will end in "/" - add one so they are standardised > $url = _check_trailing_character($url); > >- # All SUSHI report requests should be to the "/reports" endpoint >- # Not all providers in the counter registry include this in their data so we need to check and add it >+ # Default to 5.1 if anything other than '5' >+ my $report_release = $self->report_release eq '5' ? $self->report_release : '5.1'; >+ >+ if ( $report_release eq '5.1' ) { >+ my $reports_param = substr $url, -4; >+ $url .= 'r51/' if $reports_param ne 'r51/'; >+ } >+ > my $reports_param = substr $url, -8; > $url .= 'reports/' if $reports_param ne 'reports/'; > } else { >diff --git a/Koha/REST/V1/ERM/EUsage/CounterRegistry.pm b/Koha/REST/V1/ERM/EUsage/CounterRegistry.pm >index 7cb336d86f5..8be354fd3ea 100644 >--- a/Koha/REST/V1/ERM/EUsage/CounterRegistry.pm >+++ b/Koha/REST/V1/ERM/EUsage/CounterRegistry.pm >@@ -90,7 +90,15 @@ sub list { > my @counter_5_supporting_platforms; > foreach my $platform (@$result) { > my $name_check = index( lc $platform->{name}, lc $search_string ); >- my @services = grep { $_->{counter_release} eq '5' } @{ $platform->{sushi_services} }; >+ >+ # TODO: >+ # We should also consider COUNTER 5.1 here, but the COUNTER registry response is not great. >+ # Visit the following URL: >+ # <staff_url>/api/v1/erm/counter_registry?_per_page=-1&q={"name":"wiley"} >+ # Notice the response comes back as the only sushi service being counter release 5, >+ # but for all supported reports, both '5' and '5.1' are returned. >+ >+ my @services = grep { $_->{counter_release} eq '5' } @{ $platform->{sushi_services} }; > if ( scalar(@services) > 0 > && $name_check != -1 > && scalar( @{ $platform->{reports} } ) > 0 ) >-- >2.39.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 39345
:
185593
|
185594
|
185595
|
185596
|
185618
|
185619
|
185620
|
185621
|
185658
|
185659
|
185660
|
185661
|
185662
|
185663
|
185664
|
185922
|
185923
|
185924
|
185925
|
185926
|
185927
|
185928
|
186016
|
186042
|
186043
|
186044
|
186060
|
186061
|
186062
| 186063 |
186064
|
186065
|
186066
|
186067
|
186068