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

(-)a/ill/ill-requests.pl (+19 lines)
Lines 170-175 if ($backends_available) { Link Here
170
    } elsif ( $op eq 'migrate' ) {
170
    } elsif ( $op eq 'migrate' ) {
171
171
172
        # We're in the process of migrating a request
172
        # We're in the process of migrating a request
173
        if ( $params->{auto_migrate} ) {
174
175
            my $confirm_auto = Koha::ILL::Request::Workflow::ConfirmAuto->new( $params, 'staff' );
176
            my $illrequest   = Koha::ILL::Requests->find( $params->{illrequest_id} );
177
            my $extended_attributes_hash =
178
                { map { $_->type => $_->value } $illrequest->extended_attributes->search->as_list };
179
            my $new_params = { %{ $illrequest->unblessed }, %$extended_attributes_hash };
180
181
            $template->param( $confirm_auto->confirm_auto_template_params($new_params) );
182
            $template->param(
183
                op           => 'confirmautoill',
184
                auto_migrate => 1,
185
                request      => $illrequest,
186
            );
187
188
            output_html_with_http_headers( $cgi, $cookie, $template->output );
189
            exit;
190
        }
191
173
        my $request = Koha::ILL::Requests->find( $params->{illrequest_id} );
192
        my $request = Koha::ILL::Requests->find( $params->{illrequest_id} );
174
        my $backend_result;
193
        my $backend_result;
175
        if ( $params->{backend} ) {
194
        if ( $params->{backend} ) {
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt (-1 / +16 lines)
Lines 498-504 Link Here
498
                        [% END %]
498
                        [% END %]
499
                        [% NEXT IF has_prefs_count < needs_prefs.size || has_perms_count < needs_perms.size || has_all_count < needs_all.size %]
499
                        [% NEXT IF has_prefs_count < needs_prefs.size || has_perms_count < needs_perms.size || has_all_count < needs_all.size %]
500
                        [% IF action.method == 'migrate' %]
500
                        [% IF action.method == 'migrate' %]
501
                            [% IF backends.size > 2 %]
501
                            [% IF Koha.Preference('AutoILLBackendPriority') && backends.size > 1 %]
502
                                <a
503
                                    title="[% action.ui_method_name | html %]"
504
                                    id="ill-toolbar-btn-[% action.id | lower | html %]"
505
                                    class="btn btn-default"
506
                                    href="/cgi-bin/koha/ill/ill-requests.pl?op=[% action.method | uri %]&amp;illrequest_id=[% request.illrequest_id | uri %]&amp;auto_migrate=1"
507
                                >
508
                                    <span class="fa [% action.ui_method_icon | html %]"></span>
509
                                    [% action.ui_method_name | html %]
510
                                </a>
511
                            [% ELSIF backends.size > 2 %]
502
                                <div class="dropdown btn-group">
512
                                <div class="dropdown btn-group">
503
                                    <button class="btn btn-default dropdown-toggle" type="button" id="ill-migrate-dropdown" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
513
                                    <button class="btn btn-default dropdown-toggle" type="button" id="ill-migrate-dropdown" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
504
                                        <i class="fa [% action.ui_method_icon | html %]"></i> [% action.ui_method_name | html %]
514
                                        <i class="fa [% action.ui_method_icon | html %]"></i> [% action.ui_method_name | html %]
Lines 884-889 Link Here
884
                            <p id="autoillbackend-message" class="text-info"></p>
894
                            <p id="autoillbackend-message" class="text-info"></p>
885
                        </fieldset>
895
                        </fieldset>
886
                        <fieldset class="action">
896
                        <fieldset class="action">
897
                            [% IF auto_migrate %]
898
                                <a id="confirm-auto-migrate" data-illrequest_id="[% request.illrequest_id %]" class="btn btn-primary disabled">Confirm</a>
899
                                <a class="cancel" href="ill-requests.pl">Cancel</a>
900
                            [% ELSE %]
887
                            [% FOREACH key IN whole.keys %]
901
                            [% FOREACH key IN whole.keys %]
888
                                [% value = whole.$key %]
902
                                [% value = whole.$key %]
889
                                [% IF key != 'op' && key != 'method' && key != 'custom_key' && key != 'custom_value' %]
903
                                [% IF key != 'op' && key != 'method' && key != 'custom_key' && key != 'custom_value' %]
Lines 903-908 Link Here
903
                            <input type="hidden" name="confirm_auto_submitted" value="1" />
917
                            <input type="hidden" name="confirm_auto_submitted" value="1" />
904
                            <input type="submit" class="btn btn-primary" value="Confirm" />
918
                            <input type="submit" class="btn btn-primary" value="Confirm" />
905
                            <a class="cancel" href="ill-requests.pl">Cancel</a>
919
                            <a class="cancel" href="ill-requests.pl">Cancel</a>
920
                            [% END %]
906
                        </fieldset>
921
                        </fieldset>
907
                    </form>
922
                    </form>
908
                </div>
923
                </div>
(-)a/koha-tmpl/intranet-tmpl/prog/js/ill-autobackend.js (-1 / +8 lines)
Lines 75-80 $(document).ready(function () { Link Here
75
                "disabled",
75
                "disabled",
76
                false
76
                false
77
            );
77
            );
78
            $("#confirm-auto-migrate").removeClass("disabled");
78
        });
79
        });
79
        _addBackendPlaceholderEl("Standard");
80
        _addBackendPlaceholderEl("Standard");
80
        _addBackendOption("Standard");
81
        _addBackendOption("Standard");
Lines 194-197 $(document).ready(function () { Link Here
194
            });
195
            });
195
        }
196
        }
196
    );
197
    );
198
199
    $("#confirm-auto-migrate").on("click", function () {
200
        let backend = $('input[name="backend"]:checked').val();
201
        let requestId = $(this).data("illrequest_id");
202
        let url = `/cgi-bin/koha/ill/ill-requests.pl?op=migrate&illrequest_id=${encodeURIComponent(requestId)}&backend=${encodeURIComponent(backend)}`;
203
        window.location.href = url;
204
    });
197
});
205
});
198
- 

Return to bug 38819