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

(-)a/Koha/Illrequest.pm (+16 lines)
Lines 527-532 sub mark_completed { Link Here
527
    };
527
    };
528
}
528
}
529
529
530
=head2 backend_migrate
531
532
Migrate a request from one backend to another.
533
534
=cut
535
536
sub backend_migrate {
537
    my ( $self, $params ) = @_;
538
539
    my $response = $self->_backend->migrate({
540
            request    => $self,
541
            other      => $params,
542
        });
543
    return $self->expandTemplate($response);
544
}
545
530
=head2 backend_confirm
546
=head2 backend_confirm
531
547
532
Confirm a request. The backend handles setting of mandatory fields in the commit stage:
548
Confirm a request. The backend handles setting of mandatory fields in the commit stage:
(-)a/ill/ill-requests.pl (-5 / +40 lines)
Lines 86-91 if ( $backends_available ) { Link Here
86
        );
86
        );
87
        handle_commit_maybe($backend_result, $request);
87
        handle_commit_maybe($backend_result, $request);
88
88
89
    } elsif ( $op eq 'migrate' ) {
90
        # We're in the process of migrating a request
91
        my $request = Koha::Illrequests->find($params->{illrequest_id});
92
        my $backend_result;
93
        if ( $params->{backend} ) {
94
            my $new_request = Koha::Illrequest->new->load_backend( $params->{backend} );
95
            $backend_result = $new_request->backend_migrate($params);
96
            $template->param(
97
                whole   => $backend_result,
98
                request => $new_request
99
            );
100
        }
101
        else {
102
            $request = Koha::Illrequests->find( $params->{illrequest_id} );
103
            $backend_result = $request->backend_migrate($params);
104
            $template->param(
105
                whole   => $backend_result,
106
                request => $request
107
            );
108
        }
109
        handle_commit_maybe( $backend_result, $request );
110
89
    } elsif ( $op eq 'confirm' ) {
111
    } elsif ( $op eq 'confirm' ) {
90
        # Backend 'confirm' method
112
        # Backend 'confirm' method
91
        # confirm requires a specific request, so first, find it.
113
        # confirm requires a specific request, so first, find it.
Lines 287-302 output_html_with_http_headers( $cgi, $cookie, $template->output ); Link Here
287
309
288
sub handle_commit_maybe {
310
sub handle_commit_maybe {
289
    my ( $backend_result, $request ) = @_;
311
    my ( $backend_result, $request ) = @_;
312
290
    # We need to special case 'commit'
313
    # We need to special case 'commit'
291
    if ( $backend_result->{stage} eq 'commit' ) {
314
    if ( $backend_result->{stage} eq 'commit' ) {
292
        if ( $backend_result->{next} eq 'illview' ) {
315
        if ( $backend_result->{next} eq 'illview' ) {
316
293
            # Redirect to a view of the newly created request
317
            # Redirect to a view of the newly created request
294
            print $cgi->redirect(
318
            print $cgi->redirect( '/cgi-bin/koha/ill/ill-requests.pl'
295
                '/cgi-bin/koha/ill/ill-requests.pl?method=illview&illrequest_id='.
319
                  . '?method=illview'
296
                $request->id
320
                  . '&illrequest_id='
297
            );
321
                  . $request->id );
298
            exit;
322
            exit;
299
        } else {
323
        }
324
        elsif ( $backend_result->{next} eq 'emigrate' ) {
325
326
            # Redirect to a view of the newly created request
327
            print $cgi->redirect( '/cgi-bin/koha/ill/ill-requests.pl'
328
                  . '?method=migrate'
329
                  . '&stage=emigrate'
330
                  . '&illrequest_id='
331
                  . $request->id );
332
            exit;
333
        }
334
        else {
300
            # Redirect to a requests list view
335
            # Redirect to a requests list view
301
            redirect_to_list();
336
            redirect_to_list();
302
        }
337
        }
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt (-3 / +26 lines)
Lines 509-516 Link Here
509
                        Edit request
509
                        Edit request
510
                        </a>
510
                        </a>
511
                        [% FOREACH action IN request.available_actions %]
511
                        [% FOREACH action IN request.available_actions %]
512
                            [% IF action.method != 0 %]
512
                            [% IF action.method == 'migrate' %]
513
                                <a title="[% action.ui_method_name | html %]" id="ill-toolbar-btn-[% action.id | lower | html %]" class="btn btn-sm btn-default" href="/cgi-bin/koha/ill/ill-requests.pl?method=[% action.method | html %]&amp;illrequest_id=[% request.illrequest_id | html %]">
513
                                [% IF backends.size > 2 %]
514
                                    <div class="dropdown btn-group">
515
                                        <button class="btn btn-sm btn-default dropdown-toggle" type="button" id="ill-migrate-dropdown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
516
                                            <i class="fa [% action.ui_method_icon | html %]"></i> [% action.ui_method_name | html %] <span class="caret"></span>
517
                                        </button>
518
                                        <ul class="dropdown-menu" aria-labelledby="ill-migrate-dropdown">
519
                                            [% FOREACH backend IN backends %]
520
                                                [% IF backend != request.backend %]
521
                                                    <li><a href="/cgi-bin/koha/ill/ill-requests.pl?method=[% action.method | uri %]&amp;illrequest_id=[% request.illrequest_id | uri %]&amp;backend=[% backend | uri %]">[% backend | html %]</a></li>
522
                                                [% END %]
523
                                            [% END %]
524
                                        </ul>
525
                                    </div>
526
                                [% ELSIF backends.size == 2 %]
527
                                    [% FOREACH backend IN backends %]
528
                                        [% IF backend != request.backend %]
529
                                            <a title="[% action.ui_method_name | html %]" id="ill-toolbar-btn-[% action.id | lower | html %]" class="btn btn-sm btn-default" href="/cgi-bin/koha/ill/ill-requests.pl?method=[% action.method | uri %]&amp;illrequest_id=[% request.illrequest_id | uri %]">
530
                                            <span class="fa [% action.ui_method_icon | html %]"></span>
531
                                            [% action.ui_method_name | html %]
532
                                            </a>
533
                                        [% END %]
534
                                    [% END %]
535
                                [% END %]
536
                            [% ELSIF action.method != 0 %]
537
                                <a title="[% action.ui_method_name | html %]" id="ill-toolbar-btn-[% action.id | lower | html %]" class="btn btn-sm btn-default" href="/cgi-bin/koha/ill/ill-requests.pl?method=[% action.method | uri %]&amp;illrequest_id=[% request.illrequest_id | uri %]">
514
                                <span class="fa [% action.ui_method_icon | html %]"></span>
538
                                <span class="fa [% action.ui_method_icon | html %]"></span>
515
                                [% action.ui_method_name | html %]
539
                                [% action.ui_method_name | html %]
516
                                </a>
540
                                </a>
517
- 

Return to bug 20640