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 (+29 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 265-270 sub handle_commit_maybe { Link Here
265
                $request->id
287
                $request->id
266
            );
288
            );
267
            exit;
289
            exit;
290
        } elsif ( $backend_result->{next} eq 'emigrate' ) {
291
            # Redirect to a view of the newly created request
292
            print $cgi->redirect(
293
                '/cgi-bin/koha/ill/ill-requests.pl?method=migrate&stage=emigrate&illrequest_id='.
294
                $request->id
295
            );
296
            exit;
268
        } else {
297
        } else {
269
            # Redirect to a requests list view
298
            # Redirect to a requests list view
270
            redirect_to_list();
299
            redirect_to_list();
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt (-1 / +28 lines)
Lines 494-499 Link Here
494
                                <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 %]">
494
                                <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 %]">
495
                                <span class="fa [% action.ui_method_icon | html %]"></span>
495
                                <span class="fa [% action.ui_method_icon | html %]"></span>
496
                                [% action.ui_method_name | html %]
496
                                [% action.ui_method_name | html %]
497
                            [% ELSIF action.method == 'migrate' %]
498
                                [% IF backends.size > 2 %]
499
                                    <div class="dropdown btn-group">
500
                                        <button class="btn btn-sm btn-default dropdown-toggle" type="button" id="ill-migrate-dropdown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
501
                                            <i class="fa [% action.ui_method_icon | html %]"></i> [% action.ui_method_name | html %] <span class="caret"></span>
502
                                        </button>
503
                                        <ul class="dropdown-menu" aria-labelledby="ill-migrate-dropdown">
504
                                            [% FOREACH backend IN backends %]
505
                                                [% IF backend != request.backend %]
506
                                                    <li><a href="/cgi-bin/koha/ill/ill-requests.pl?method=[% action.method | html %]&amp;illrequest_id=[% request.illrequest_id | html %]&amp;backend=[% backend | html%]">[% backend | html %]</a></li>
507
                                                [% END %]
508
                                            [% END %]
509
                                        </ul>
510
                                    </div>
511
                                [% ELSIF backends.size == 2 %]
512
                                    [% FOREACH backend IN backends %]
513
                                        [% IF backend != request.backend %]
514
                                            <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 %]">
515
                                            <span class="fa [% action.ui_method_icon | html %]"></span>
516
                                            [% action.ui_method_name | html %]
517
                                            </a>
518
                                        [% END %]
519
                                    [% END %]
520
                                [% END %]
521
                            [% ELSIF action.method != 0 %]
522
                                <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  %]">
523
                                <span class="fa [% action.ui_method_icon | html %]"></span>
524
                                [% action.ui_method_name | html %]
497
                                </a>
525
                                </a>
498
                            [% END %]
526
                            [% END %]
499
                        [% END %]
527
                        [% END %]
500
- 

Return to bug 20640