From cdf0d7640f379d67231c183a1fe9d3a6497871bc Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Thu, 1 Nov 2018 15:29:08 +0000 Subject: [PATCH] Bug 20640: (follow-up) Degrade gracefully on error Signed-off-by: Katrin Fischer Signed-off-by: Nick Clemens --- Koha/Illrequest.pm | 5 +++-- ill/ill-requests.pl | 24 ++++++++++++++++++++---- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/Koha/Illrequest.pm b/Koha/Illrequest.pm index f9b49955ee..ff834f14f5 100644 --- a/Koha/Illrequest.pm +++ b/Koha/Illrequest.pm @@ -536,11 +536,12 @@ Migrate a request from one backend to another. sub backend_migrate { my ( $self, $params ) = @_; - my $response = $self->_backend->migrate({ + my $response = $self->_backend_capability('migrate',{ request => $self, other => $params, }); - return $self->expandTemplate($response); + return $self->expandTemplate($response) if $response; + return $response; } =head2 backend_confirm diff --git a/ill/ill-requests.pl b/ill/ill-requests.pl index 0a29785147..77a8d05560 100755 --- a/ill/ill-requests.pl +++ b/ill/ill-requests.pl @@ -93,10 +93,26 @@ if ( $backends_available ) { if ( $params->{backend} ) { my $new_request = Koha::Illrequest->new->load_backend( $params->{backend} ); $backend_result = $new_request->backend_migrate($params); - $template->param( - whole => $backend_result, - request => $new_request - ); + if ($backend_result) { + $template->param( + whole => $backend_result, + request => $new_request + ); + } else { + # backend failure + $backend_result = { + stage => 'commit', + next => 'illview', + error => { + message => 'Migrating to backedn does not support migrate', + status => 'Migrating to backedn does not support migrate' + } + }; + $template->param( + whole => $backend_result, + request => $request + ); + } } else { $request = Koha::Illrequests->find( $params->{illrequest_id} ); -- 2.39.5