From 7c175c2160e7ed59c3c67b5a7cd890a4ff0b1306 Mon Sep 17 00:00:00 2001 From: Pedro Amorim Date: Thu, 19 Sep 2024 13:55:48 +0000 Subject: [PATCH] Bug 37856: Consider 'Exceptions' not being part of 'Report_Header' When fixing the issue around the missing platform parameter, we noticed this particular provider also returns 'Exceptions' as its own thing, not part of 'Report_Header', despite documentation: https://countermetrics.stoplight.io/docs/counter-sushi-api/7cp0h7n1hm2en-tr-j1-journal-requests-controlled From the link above, search for 'Exceptions'. Notice it should be under 'Report_Header'. Either way, this patch accounts for this possibility. Signed-off-by: David Nind Signed-off-by: Katrin Fischer --- Koha/ERM/EUsage/UsageDataProvider.pm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Koha/ERM/EUsage/UsageDataProvider.pm b/Koha/ERM/EUsage/UsageDataProvider.pm index da4171571f..b9ead5ca86 100644 --- a/Koha/ERM/EUsage/UsageDataProvider.pm +++ b/Koha/ERM/EUsage/UsageDataProvider.pm @@ -474,8 +474,9 @@ sub _sushi_errors { return 1; } - if ( $decoded_response->{Report_Header}->{Exceptions} ) { - foreach my $exception ( @{ $decoded_response->{Report_Header}->{Exceptions} } ) { + my $exceptions = $decoded_response->{Report_Header}->{Exceptions} // $decoded_response->{Exceptions}; + if ( $exceptions ) { + foreach my $exception ( @{ $exceptions } ) { $self->{job_callbacks}->{add_message_callback}->( { type => 'error', -- 2.39.5