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 / +11 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 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">
503
                                        <span class="fa [% action.ui_method_icon | html %]"></span>
504
                                    [% action.ui_method_name | html %]
505
                                    </a>
506
                                [% ELSIF backends.size > 2 %]
502
                                <div class="dropdown btn-group">
507
                                <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">
508
                                    <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 %]
509
                                        <i class="fa [% action.ui_method_icon | html %]"></i> [% action.ui_method_name | html %]
Lines 886-891 Link Here
886
                            <p id="autoillbackend-message" class="text-info"></p>
891
                            <p id="autoillbackend-message" class="text-info"></p>
887
                        </fieldset>
892
                        </fieldset>
888
                        <fieldset class="action">
893
                        <fieldset class="action">
894
                            [% IF auto_migrate %]
895
                                <a id="confirm-auto-migrate" data-illrequest_id="[% request.illrequest_id %]" class="btn btn-primary disabled">Confirm</a>
896
                                <a class="cancel" href="ill-requests.pl">Cancel</a>
897
                            [% ELSE %]
889
                            [% FOREACH key IN whole.keys %]
898
                            [% FOREACH key IN whole.keys %]
890
                                [% value = whole.$key %]
899
                                [% value = whole.$key %]
891
                                [% IF key != 'op' && key != 'method' && key != 'custom_key' && key != 'custom_value' %]
900
                                [% IF key != 'op' && key != 'method' && key != 'custom_key' && key != 'custom_value' %]
Lines 905-910 Link Here
905
                            <input type="hidden" name="confirm_auto_submitted" value="1" />
914
                            <input type="hidden" name="confirm_auto_submitted" value="1" />
906
                            <input type="submit" class="btn btn-primary" value="Confirm" />
915
                            <input type="submit" class="btn btn-primary" value="Confirm" />
907
                            <a class="cancel" href="ill-requests.pl">Cancel</a>
916
                            <a class="cancel" href="ill-requests.pl">Cancel</a>
917
                            [% END %]
908
                        </fieldset>
918
                        </fieldset>
909
                    </form>
919
                    </form>
910
                </div>
920
                </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