From d6f5380f80c9fa746df08b0b0d249269c1e65df9 Mon Sep 17 00:00:00 2001 From: Pedro Amorim Date: Thu, 19 Sep 2024 13:49:10 +0000 Subject: [PATCH] Bug 37963: Case 2 - Consider providers returning error messages lower cased Test plan: 1) Apply only test patch for case 1. Run tests: prove t/db_dependent/Koha/BackgroundJob/ErmSushiHarvester.t 2) Verify tests fail. Apply the other patch for case 1. 3) Run tests again. Verify they now pass. 4) Repeat the test plan but using patches for case 2 --- Koha/ERM/EUsage/UsageDataProvider.pm | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Koha/ERM/EUsage/UsageDataProvider.pm b/Koha/ERM/EUsage/UsageDataProvider.pm index 716610052d..b13a760925 100644 --- a/Koha/ERM/EUsage/UsageDataProvider.pm +++ b/Koha/ERM/EUsage/UsageDataProvider.pm @@ -458,12 +458,16 @@ Additionally, adds background job report message(s) if that is the case sub _sushi_errors { my ( $self, $decoded_response ) = @_; - if ( $decoded_response->{Severity} ) { + my $severity = $decoded_response->{Severity} // $decoded_response->{severity}; + my $message = $decoded_response->{Message} // $decoded_response->{message}; + my $code = $decoded_response->{Code} // $decoded_response->{code}; + + if ( $severity ) { $self->{job_callbacks}->{add_message_callback}->( { type => 'error', - code => $decoded_response->{Code}, - message => $decoded_response->{Severity} . ' - ' . $decoded_response->{Message}, + code => $code, + message => $severity . ' - ' . $message, } ) if $self->{job_callbacks}; return 1; -- 2.39.2