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

(-)a/ill/ill-requests.pl (+19 lines)
Lines 185-190 if ( $backends_available ) { Link Here
185
        }
185
        }
186
    } elsif ( $op eq 'migrate' ) {
186
    } elsif ( $op eq 'migrate' ) {
187
        # We're in the process of migrating a request
187
        # We're in the process of migrating a request
188
        if ( $params->{auto_migrate} ) {
189
190
            my $confirm_auto = Koha::ILL::Request::Workflow::ConfirmAuto->new( $params, 'staff' );
191
            my $illrequest   = Koha::ILL::Requests->find( $params->{illrequest_id} );
192
            my $extended_attributes_hash =
193
                { map { $_->type => $_->value } $illrequest->extended_attributes->search->as_list };
194
            my $new_params = { %{ $illrequest->unblessed }, %$extended_attributes_hash };
195
196
            $template->param( $confirm_auto->confirm_auto_template_params($new_params) );
197
            $template->param(
198
                op           => 'confirmautoill',
199
                auto_migrate => 1,
200
                request      => $illrequest,
201
            );
202
203
            output_html_with_http_headers( $cgi, $cookie, $template->output );
204
            exit;
205
        }
206
188
        my $request = Koha::ILL::Requests->find($params->{illrequest_id});
207
        my $request = Koha::ILL::Requests->find($params->{illrequest_id});
189
        my $backend_result;
208
        my $backend_result;
190
        if ( $params->{backend} ) {
209
        if ( $params->{backend} ) {
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt (-1 / +11 lines)
Lines 607-613 Link Here
607
                            [% END %]
607
                            [% END %]
608
                            [% NEXT IF has_prefs_count < needs_prefs.size || has_perms_count < needs_perms.size || has_all_count < needs_all.size %]
608
                            [% NEXT IF has_prefs_count < needs_prefs.size || has_perms_count < needs_perms.size || has_all_count < needs_all.size %]
609
                            [% IF action.method == 'migrate' %]
609
                            [% IF action.method == 'migrate' %]
610
                                [% IF backends.size > 2 %]
610
                                [% IF Koha.Preference('AutoILLBackendPriority') && backends.size > 1 %]
611
                                    <a title="[% action.ui_method_name | html %]" id="ill-toolbar-btn-[% action.id | lower | html %]" class="btn btn-default" href="/cgi-bin/koha/ill/ill-requests.pl?op=[% action.method | uri %]&amp;illrequest_id=[% request.illrequest_id | uri %]&amp;auto_migrate=1">
612
                                        <span class="fa [% action.ui_method_icon | html %]"></span>
613
                                    [% action.ui_method_name | html %]
614
                                    </a>
615
                                [% ELSIF backends.size > 2 %]
611
                                    <div class="dropdown btn-group">
616
                                    <div class="dropdown btn-group">
612
                                        <button class="btn btn-default dropdown-toggle" type="button" id="ill-migrate-dropdown" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
617
                                        <button class="btn btn-default dropdown-toggle" type="button" id="ill-migrate-dropdown" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
613
                                            <i class="fa [% action.ui_method_icon | html %]"></i> [% action.ui_method_name | html %]
618
                                            <i class="fa [% action.ui_method_icon | html %]"></i> [% action.ui_method_name | html %]
Lines 1040-1045 Link Here
1040
                                <p id="autoillbackend-message" class="text-info"></p>
1045
                                <p id="autoillbackend-message" class="text-info"></p>
1041
                            </fieldset>
1046
                            </fieldset>
1042
                            <fieldset class="action">
1047
                            <fieldset class="action">
1048
                                [% IF auto_migrate %]
1049
                                <a id="confirm-auto-migrate" data-illrequest_id="[% request.illrequest_id %]" class="btn btn-primary disabled">Confirm</a>
1050
                                <a class="cancel" href="ill-requests.pl">Cancel</a>
1051
                                [% ELSE %]
1043
                                [% FOREACH key IN whole.keys %]
1052
                                [% FOREACH key IN whole.keys %]
1044
                                    [% value = whole.$key %]
1053
                                    [% value = whole.$key %]
1045
                                    [% IF key != 'method' && key != 'custom_key' && key != 'custom_value' %]
1054
                                    [% IF key != 'method' && key != 'custom_key' && key != 'custom_value' %]
Lines 1059-1064 Link Here
1059
                                <input type="hidden" name="confirm_auto_submitted" value="1">
1068
                                <input type="hidden" name="confirm_auto_submitted" value="1">
1060
                                <input type="submit" class="btn btn-primary" value="Confirm" />
1069
                                <input type="submit" class="btn btn-primary" value="Confirm" />
1061
                                <a class="cancel" href="ill-requests.pl">Cancel</a>
1070
                                <a class="cancel" href="ill-requests.pl">Cancel</a>
1071
                                [% END %]
1062
                            </fieldset>
1072
                            </fieldset>
1063
                        </form>
1073
                        </form>
1064
                    </div>
1074
                    </div>
(-)a/koha-tmpl/intranet-tmpl/prog/js/ill-autobackend.js (-1 / +8 lines)
Lines 79-84 $(document).ready(function () { Link Here
79
                "disabled",
79
                "disabled",
80
                false
80
                false
81
            );
81
            );
82
            $('#confirm-auto-migrate').removeClass('disabled');
82
        });
83
        });
83
        _addBackendPlaceholderEl("Standard");
84
        _addBackendPlaceholderEl("Standard");
84
        _addBackendOption("Standard");
85
        _addBackendOption("Standard");
Lines 174-177 $(document).ready(function () { Link Here
174
        });
175
        });
175
    });
176
    });
176
177
178
    $('#confirm-auto-migrate').on('click', function() {
179
        let backend = $('input[name="backend"]:checked').val();
180
        let requestId = $(this).data('illrequest_id');
181
        let url = `/cgi-bin/koha/ill/ill-requests.pl?op=migrate&illrequest_id=${encodeURIComponent(requestId)}&backend=${encodeURIComponent(backend)}`;
182
        window.location.href = url;
183
    });
184
177
});
185
});
178
- 

Return to bug 38819