View | Details | Raw Unified | Return to bug 20640
Collapse All | Expand All

(-)a/Koha/Illrequest.pm (+16 lines)
Lines 515-520 sub mark_completed { Link Here
515
    };
515
    };
516
}
516
}
517
517
518
=head2 backend_migrate
519
520
Migrate a request from one backend to another.
521
522
=cut
523
524
sub backend_migrate {
525
    my ( $self, $params ) = @_;
526
527
    my $response = $self->_backend->migrate({
528
            request    => $self,
529
            other      => $params,
530
        });
531
    return $self->expandTemplate($response);
532
}
533
518
=head2 backend_confirm
534
=head2 backend_confirm
519
535
520
Confirm a request. The backend handles setting of mandatory fields in the commit stage:
536
Confirm a request. The backend handles setting of mandatory fields in the commit stage:
(-)a/ill/ill-requests.pl (-5 / +40 lines)
Lines 76-81 if ( $backends_available ) { Link Here
76
        );
76
        );
77
        handle_commit_maybe($backend_result, $request);
77
        handle_commit_maybe($backend_result, $request);
78
78
79
    } elsif ( $op eq 'migrate' ) {
80
        # We're in the process of migrating a request
81
        my $request = Koha::Illrequests->find($params->{illrequest_id});
82
        my $backend_result;
83
        if ( $params->{backend} ) {
84
            my $new_request = Koha::Illrequest->new->load_backend( $params->{backend} );
85
            $backend_result = $new_request->backend_migrate($params);
86
            $template->param(
87
                whole   => $backend_result,
88
                request => $new_request
89
            );
90
        }
91
        else {
92
            $request = Koha::Illrequests->find( $params->{illrequest_id} );
93
            $backend_result = $request->backend_migrate($params);
94
            $template->param(
95
                whole   => $backend_result,
96
                request => $request
97
            );
98
        }
99
        handle_commit_maybe( $backend_result, $request );
100
79
    } elsif ( $op eq 'confirm' ) {
101
    } elsif ( $op eq 'confirm' ) {
80
        # Backend 'confirm' method
102
        # Backend 'confirm' method
81
        # confirm requires a specific request, so first, find it.
103
        # confirm requires a specific request, so first, find it.
Lines 256-271 output_html_with_http_headers( $cgi, $cookie, $template->output ); Link Here
256
278
257
sub handle_commit_maybe {
279
sub handle_commit_maybe {
258
    my ( $backend_result, $request ) = @_;
280
    my ( $backend_result, $request ) = @_;
281
259
    # We need to special case 'commit'
282
    # We need to special case 'commit'
260
    if ( $backend_result->{stage} eq 'commit' ) {
283
    if ( $backend_result->{stage} eq 'commit' ) {
261
        if ( $backend_result->{next} eq 'illview' ) {
284
        if ( $backend_result->{next} eq 'illview' ) {
285
262
            # Redirect to a view of the newly created request
286
            # Redirect to a view of the newly created request
263
            print $cgi->redirect(
287
            print $cgi->redirect( '/cgi-bin/koha/ill/ill-requests.pl'
264
                '/cgi-bin/koha/ill/ill-requests.pl?method=illview&illrequest_id='.
288
                  . '?method=illview'
265
                $request->id
289
                  . '&illrequest_id='
266
            );
290
                  . $request->id );
267
            exit;
291
            exit;
268
        } else {
292
        }
293
        elsif ( $backend_result->{next} eq 'emigrate' ) {
294
295
            # Redirect to a view of the newly created request
296
            print $cgi->redirect( '/cgi-bin/koha/ill/ill-requests.pl'
297
                  . '?method=migrate'
298
                  . '&stage=emigrate'
299
                  . '&illrequest_id='
300
                  . $request->id );
301
            exit;
302
        }
303
        else {
269
            # Redirect to a requests list view
304
            # Redirect to a requests list view
270
            redirect_to_list();
305
            redirect_to_list();
271
        }
306
        }
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt (-2 / +25 lines)
Lines 489-495 Link Here
489
                        Edit request
489
                        Edit request
490
                        </a>
490
                        </a>
491
                        [% FOREACH action IN actions %]
491
                        [% FOREACH action IN actions %]
492
                            [% IF action.method != 0 %]
492
                            [% IF action.method == 'migrate' %]
493
                                [% IF backends.size > 2 %]
494
                                    <div class="dropdown btn-group">
495
                                        <button class="btn btn-sm btn-default dropdown-toggle" type="button" id="ill-migrate-dropdown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
496
                                            <i class="fa [% action.ui_method_icon %]"></i> [% action.ui_method_name %] <span class="caret"></span>
497
                                        </button>
498
                                        <ul class="dropdown-menu" aria-labelledby="ill-migrate-dropdown">
499
                                            [% FOREACH backend IN backends %]
500
                                                [% IF backend != request.backend %]
501
                                                    <li><a href="/cgi-bin/koha/ill/ill-requests.pl?method=[% action.method %]&amp;illrequest_id=[% request.illrequest_id %]&amp;backend=[% backend %]">[% backend %]</a></li>
502
                                                [% END %]
503
                                            [% END %]
504
                                        </ul>
505
                                    </div>
506
                                [% ELSIF backends.size == 2 %]
507
                                    [% FOREACH backend IN backends %]
508
                                        [% IF backend != request.backend %]
509
                                            <a title="[% action.ui_method_name %]" id="ill-toolbar-btn-[% action.id | lower %]" class="btn btn-sm btn-default" href="/cgi-bin/koha/ill/ill-requests.pl?method=[% action.method %]&amp;illrequest_id=[% request.illrequest_id %]">
510
                                            <span class="fa [% action.ui_method_icon %]"></span>
511
                                            [% action.ui_method_name %]
512
                                            </a>
513
                                        [% END %]
514
                                    [% END %]
515
                                [% END %]
516
                            [% ELSIF action.method != 0 %]
493
                                <a title="[% action.ui_method_name %]" id="ill-toolbar-btn-[% action.id | lower %]" class="btn btn-sm btn-default" href="/cgi-bin/koha/ill/ill-requests.pl?method=[% action.method %]&amp;illrequest_id=[% request.illrequest_id %]">
517
                                <a title="[% action.ui_method_name %]" id="ill-toolbar-btn-[% action.id | lower %]" class="btn btn-sm btn-default" href="/cgi-bin/koha/ill/ill-requests.pl?method=[% action.method %]&amp;illrequest_id=[% request.illrequest_id %]">
494
                                <span class="fa [% action.ui_method_icon %]"></span>
518
                                <span class="fa [% action.ui_method_icon %]"></span>
495
                                [% action.ui_method_name %]
519
                                [% action.ui_method_name %]
496
- 

Return to bug 20640