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 (-18 / +33 lines)
Lines 503-509 Link Here
503
                        [% END %]
503
                        [% END %]
504
                        [% NEXT IF has_prefs_count < needs_prefs.size || has_perms_count < needs_perms.size || has_all_count < needs_all.size %]
504
                        [% NEXT IF has_prefs_count < needs_prefs.size || has_perms_count < needs_perms.size || has_all_count < needs_all.size %]
505
                        [% IF action.method == 'migrate' %]
505
                        [% IF action.method == 'migrate' %]
506
                            [% IF backends.size > 2 %]
506
                            [% IF Koha.Preference('AutoILLBackendPriority') && backends.size > 1 %]
507
                                <a
508
                                    title="[% action.ui_method_name | html %]"
509
                                    id="ill-toolbar-btn-[% action.id | lower | html %]"
510
                                    class="btn btn-default"
511
                                    href="/cgi-bin/koha/ill/ill-requests.pl?op=[% action.method | uri %]&amp;illrequest_id=[% request.illrequest_id | uri %]&amp;auto_migrate=1"
512
                                >
513
                                    <span class="fa [% action.ui_method_icon | html %]"></span>
514
                                    [% action.ui_method_name | html %]
515
                                </a>
516
                            [% ELSIF backends.size > 2 %]
507
                                <div class="dropdown btn-group">
517
                                <div class="dropdown btn-group">
508
                                    <button class="btn btn-default dropdown-toggle" type="button" id="ill-migrate-dropdown" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
518
                                    <button class="btn btn-default dropdown-toggle" type="button" id="ill-migrate-dropdown" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
509
                                        <i class="fa [% action.ui_method_icon | html %]"></i> [% action.ui_method_name | html %]
519
                                        <i class="fa [% action.ui_method_icon | html %]"></i> [% action.ui_method_name | html %]
Lines 889-913 Link Here
889
                            <p id="autoillbackend-message" class="text-info"></p>
899
                            <p id="autoillbackend-message" class="text-info"></p>
890
                        </fieldset>
900
                        </fieldset>
891
                        <fieldset class="action">
901
                        <fieldset class="action">
892
                            [% FOREACH key IN whole.keys %]
902
                            [% IF auto_migrate %]
893
                                [% value = whole.$key %]
903
                                <a id="confirm-auto-migrate" data-illrequest_id="[% request.illrequest_id %]" class="btn btn-primary disabled">Confirm</a>
894
                                [% IF key != 'op' && key != 'method' && key != 'custom_key' && key != 'custom_value' %]
904
                                <a class="cancel" href="ill-requests.pl">Cancel</a>
895
                                    <input type="hidden" name="[% key | html %]" value="[% value | html %]" />
905
                            [% ELSE %]
906
                                [% FOREACH key IN whole.keys %]
907
                                    [% value = whole.$key %]
908
                                    [% IF key != 'op' && key != 'method' && key != 'custom_key' && key != 'custom_value' %]
909
                                        <input type="hidden" name="[% key | html %]" value="[% value | html %]" />
910
                                    [% END %]
896
                                [% END %]
911
                                [% END %]
912
                                [% custom_keys = whole.custom_key.split('\0') %]
913
                                [% custom_values = whole.custom_value.split('\0') %]
914
                                [% i = 0 %]
915
                                [% FOREACH custom_key IN custom_keys %]
916
                                    <input type="hidden" name="custom_key" value="[% custom_key | html %]" />
917
                                    <input type="hidden" name="custom_value" value="[% custom_values.$i | html %]" />
918
                                    [% i = i + 1 %]
919
                                [% END %]
920
                                <input type="hidden" name="op" value="cud-create" />
921
                                <input type="hidden" name="stage" value="form" />
922
                                <input type="hidden" name="confirm_auto_submitted" value="1" />
923
                                <input type="submit" class="btn btn-primary" value="Confirm" />
924
                                <a class="cancel" href="ill-requests.pl">Cancel</a>
897
                            [% END %]
925
                            [% END %]
898
                            [% custom_keys = whole.custom_key.split('\0') %]
899
                            [% custom_values = whole.custom_value.split('\0') %]
900
                            [% i = 0 %]
901
                            [% FOREACH custom_key IN custom_keys %]
902
                                <input type="hidden" name="custom_key" value="[% custom_key | html %]" />
903
                                <input type="hidden" name="custom_value" value="[% custom_values.$i | html %]" />
904
                                [% i = i + 1 %]
905
                            [% END %]
906
                            <input type="hidden" name="op" value="cud-create" />
907
                            <input type="hidden" name="stage" value="form" />
908
                            <input type="hidden" name="confirm_auto_submitted" value="1" />
909
                            <input type="submit" class="btn btn-primary" value="Confirm" />
910
                            <a class="cancel" href="ill-requests.pl">Cancel</a>
911
                        </fieldset>
926
                        </fieldset>
912
                    </form>
927
                    </form>
913
                </div>
928
                </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