|
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 264-279
output_html_with_http_headers( $cgi, $cookie, $template->output );
Link Here
|
| 264 |
|
286 |
|
| 265 |
sub handle_commit_maybe { |
287 |
sub handle_commit_maybe { |
| 266 |
my ( $backend_result, $request ) = @_; |
288 |
my ( $backend_result, $request ) = @_; |
|
|
289 |
|
| 267 |
# We need to special case 'commit' |
290 |
# We need to special case 'commit' |
| 268 |
if ( $backend_result->{stage} eq 'commit' ) { |
291 |
if ( $backend_result->{stage} eq 'commit' ) { |
| 269 |
if ( $backend_result->{next} eq 'illview' ) { |
292 |
if ( $backend_result->{next} eq 'illview' ) { |
|
|
293 |
|
| 270 |
# Redirect to a view of the newly created request |
294 |
# Redirect to a view of the newly created request |
| 271 |
print $cgi->redirect( |
295 |
print $cgi->redirect( '/cgi-bin/koha/ill/ill-requests.pl' |
| 272 |
'/cgi-bin/koha/ill/ill-requests.pl?method=illview&illrequest_id='. |
296 |
. '?method=illview' |
| 273 |
$request->id |
297 |
. '&illrequest_id=' |
| 274 |
); |
298 |
. $request->id ); |
| 275 |
exit; |
299 |
exit; |
| 276 |
} else { |
300 |
} |
|
|
301 |
elsif ( $backend_result->{next} eq 'emigrate' ) { |
| 302 |
|
| 303 |
# Redirect to a view of the newly created request |
| 304 |
print $cgi->redirect( '/cgi-bin/koha/ill/ill-requests.pl' |
| 305 |
. '?method=migrate' |
| 306 |
. '&stage=emigrate' |
| 307 |
. '&illrequest_id=' |
| 308 |
. $request->id ); |
| 309 |
exit; |
| 310 |
} |
| 311 |
else { |
| 277 |
# Redirect to a requests list view |
312 |
# Redirect to a requests list view |
| 278 |
redirect_to_list(); |
313 |
redirect_to_list(); |
| 279 |
} |
314 |
} |