Skip to content

Commit

Permalink
Bug 22614: Migrate original request
Browse files Browse the repository at this point in the history
This patch changes an active request's backend and initiates the
migration on that request, rather than creating another and migrating
that.

The majority of the work to accomplish this bug is being carried out in
the backends, since Koha delegates migrations to them.

Signed-off-by: Barry Cannon <bc@interleaf.ie>
Signed-off-by: Assumpta Byrne <abyrne@ait.ie>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
  • Loading branch information
Andrew Isherwood authored and joubu committed Sep 21, 2021
1 parent 4d3d400 commit 3fc80c3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
3 changes: 2 additions & 1 deletion Koha/Illrequest.pm
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,8 @@ Migrate a request from one backend to another.

sub backend_migrate {
my ( $self, $params ) = @_;

# Set the request's backend to be the destination backend
$self->load_backend($params->{backend});
my $response = $self->_backend_capability('migrate',{
request => $self,
other => $params,
Expand Down
4 changes: 4 additions & 0 deletions Koha/Illrequest/Logger.pm
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,10 @@ sub get_log_template {
} else {
# It's probably a backend log, so we need to get the path to the
# template from the backend
#
# We need to load the backend that this log was made from, so we
# can get the template
$params->{request}->load_backend($origin);
my $backend =$params->{request}->{_my_backend};
return $backend->get_log_template_path($action);
}
Expand Down
6 changes: 2 additions & 4 deletions ill/ill-requests.pl
Original file line number Diff line number Diff line change
Expand Up @@ -152,14 +152,12 @@
my $request = Koha::Illrequests->find($params->{illrequest_id});
my $backend_result;
if ( $params->{backend} ) {
my $new_request = Koha::Illrequest->new->load_backend( $params->{backend} );
$backend_result = $new_request->backend_migrate($params);
$backend_result = $request->backend_migrate($params);
if ($backend_result) {
$template->param(
whole => $backend_result,
request => $new_request
request => $request
);
$request = $new_request;
} else {
# Backend failure, redirect back to illview
print $cgi->redirect( '/cgi-bin/koha/ill/ill-requests.pl'
Expand Down

0 comments on commit 3fc80c3

Please sign in to comment.