|
Lines 81-86
if ( $backends_available ) {
Link Here
|
| 81 |
); |
81 |
); |
| 82 |
handle_commit_maybe($backend_result, $request); |
82 |
handle_commit_maybe($backend_result, $request); |
| 83 |
|
83 |
|
|
|
84 |
} elsif ( $op eq 'migrate' ) { |
| 85 |
# We're in the process of migrating a request |
| 86 |
my $request = Koha::Illrequests->find($params->{illrequest_id}); |
| 87 |
my $backend_result; |
| 88 |
if ( $params->{backend} ) { |
| 89 |
my $new_request = Koha::Illrequest->new->load_backend( $params->{backend} ); |
| 90 |
$backend_result = $new_request->backend_migrate($params); |
| 91 |
$template->param( |
| 92 |
whole => $backend_result, |
| 93 |
request => $new_request |
| 94 |
); |
| 95 |
} |
| 96 |
else { |
| 97 |
$request = Koha::Illrequests->find( $params->{illrequest_id} ); |
| 98 |
$backend_result = $request->backend_migrate($params); |
| 99 |
$template->param( |
| 100 |
whole => $backend_result, |
| 101 |
request => $request |
| 102 |
); |
| 103 |
} |
| 104 |
handle_commit_maybe( $backend_result, $request ); |
| 105 |
|
| 84 |
} elsif ( $op eq 'confirm' ) { |
106 |
} elsif ( $op eq 'confirm' ) { |
| 85 |
# Backend 'confirm' method |
107 |
# Backend 'confirm' method |
| 86 |
# confirm requires a specific request, so first, find it. |
108 |
# confirm requires a specific request, so first, find it. |
|
Lines 282-297
output_html_with_http_headers( $cgi, $cookie, $template->output );
Link Here
|
| 282 |
|
304 |
|
| 283 |
sub handle_commit_maybe { |
305 |
sub handle_commit_maybe { |
| 284 |
my ( $backend_result, $request ) = @_; |
306 |
my ( $backend_result, $request ) = @_; |
|
|
307 |
|
| 285 |
# We need to special case 'commit' |
308 |
# We need to special case 'commit' |
| 286 |
if ( $backend_result->{stage} eq 'commit' ) { |
309 |
if ( $backend_result->{stage} eq 'commit' ) { |
| 287 |
if ( $backend_result->{next} eq 'illview' ) { |
310 |
if ( $backend_result->{next} eq 'illview' ) { |
|
|
311 |
|
| 288 |
# Redirect to a view of the newly created request |
312 |
# Redirect to a view of the newly created request |
| 289 |
print $cgi->redirect( |
313 |
print $cgi->redirect( '/cgi-bin/koha/ill/ill-requests.pl' |
| 290 |
'/cgi-bin/koha/ill/ill-requests.pl?method=illview&illrequest_id='. |
314 |
. '?method=illview' |
| 291 |
$request->id |
315 |
. '&illrequest_id=' |
| 292 |
); |
316 |
. $request->id ); |
| 293 |
exit; |
317 |
exit; |
| 294 |
} else { |
318 |
} |
|
|
319 |
elsif ( $backend_result->{next} eq 'emigrate' ) { |
| 320 |
|
| 321 |
# Redirect to a view of the newly created request |
| 322 |
print $cgi->redirect( '/cgi-bin/koha/ill/ill-requests.pl' |
| 323 |
. '?method=migrate' |
| 324 |
. '&stage=emigrate' |
| 325 |
. '&illrequest_id=' |
| 326 |
. $request->id ); |
| 327 |
exit; |
| 328 |
} |
| 329 |
else { |
| 295 |
# Redirect to a requests list view |
330 |
# Redirect to a requests list view |
| 296 |
redirect_to_list(); |
331 |
redirect_to_list(); |
| 297 |
} |
332 |
} |