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

(-)a/ill/ill-requests.pl (+19 lines)
Lines 176-181 if ( $backends_available ) { Link Here
176
        }
176
        }
177
    } elsif ( $op eq 'migrate' ) {
177
    } elsif ( $op eq 'migrate' ) {
178
        # We're in the process of migrating a request
178
        # We're in the process of migrating a request
179
        if ( $params->{auto_migrate} ) {
180
181
            my $confirm_auto = Koha::ILL::Request::Workflow::ConfirmAuto->new( $params, 'staff' );
182
            my $illrequest   = Koha::ILL::Requests->find( $params->{illrequest_id} );
183
            my $extended_attributes_hash =
184
                { map { $_->type => $_->value } $illrequest->extended_attributes->search->as_list };
185
            my $new_params = { %{ $illrequest->unblessed }, %$extended_attributes_hash };
186
187
            $template->param( $confirm_auto->confirm_auto_template_params($new_params) );
188
            $template->param(
189
                op           => 'confirmautoill',
190
                auto_migrate => 1,
191
                request      => $illrequest,
192
            );
193
194
            output_html_with_http_headers( $cgi, $cookie, $template->output );
195
            exit;
196
        }
197
179
        my $request = Koha::ILL::Requests->find($params->{illrequest_id});
198
        my $request = Koha::ILL::Requests->find($params->{illrequest_id});
180
        my $backend_result;
199
        my $backend_result;
181
        if ( $params->{backend} ) {
200
        if ( $params->{backend} ) {
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt (-1 / +11 lines)
Lines 600-606 Link Here
600
                            [% END %]
600
                            [% END %]
601
                            [% NEXT IF has_prefs_count < needs_prefs.size || has_perms_count < needs_perms.size || has_all_count < needs_all.size %]
601
                            [% NEXT IF has_prefs_count < needs_prefs.size || has_perms_count < needs_perms.size || has_all_count < needs_all.size %]
602
                            [% IF action.method == 'migrate' %]
602
                            [% IF action.method == 'migrate' %]
603
                                [% IF backends.size > 2 %]
603
                                [% IF Koha.Preference('AutoILLBackendPriority') && backends.size > 1 %]
604
                                    <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">
605
                                        <span class="fa [% action.ui_method_icon | html %]"></span>
606
                                    [% action.ui_method_name | html %]
607
                                    </a>
608
                                [% ELSIF backends.size > 2 %]
604
                                    <div class="dropdown btn-group">
609
                                    <div class="dropdown btn-group">
605
                                        <button class="btn btn-default dropdown-toggle" type="button" id="ill-migrate-dropdown" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
610
                                        <button class="btn btn-default dropdown-toggle" type="button" id="ill-migrate-dropdown" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
606
                                            <i class="fa [% action.ui_method_icon | html %]"></i> [% action.ui_method_name | html %]
611
                                            <i class="fa [% action.ui_method_icon | html %]"></i> [% action.ui_method_name | html %]
Lines 968-973 Link Here
968
                                <p id="autoillbackend-message" class="text-info"></p>
973
                                <p id="autoillbackend-message" class="text-info"></p>
969
                            </fieldset>
974
                            </fieldset>
970
                            <fieldset class="action">
975
                            <fieldset class="action">
976
                                [% IF auto_migrate %]
977
                                <a id="confirm-auto-migrate" data-illrequest_id="[% request.illrequest_id %]" class="btn btn-primary disabled">Confirm</a>
978
                                <a class="cancel" href="ill-requests.pl">Cancel</a>
979
                                [% ELSE %]
971
                                [% FOREACH key IN whole.keys %]
980
                                [% FOREACH key IN whole.keys %]
972
                                    [% value = whole.$key %]
981
                                    [% value = whole.$key %]
973
                                    [% IF key != 'method' && key != 'custom_key' && key != 'custom_value' %]
982
                                    [% IF key != 'method' && key != 'custom_key' && key != 'custom_value' %]
Lines 987-992 Link Here
987
                                <input type="hidden" name="confirm_auto_submitted" value="1">
996
                                <input type="hidden" name="confirm_auto_submitted" value="1">
988
                                <input type="submit" class="btn btn-primary" value="Confirm" />
997
                                <input type="submit" class="btn btn-primary" value="Confirm" />
989
                                <a class="cancel" href="ill-requests.pl">Cancel</a>
998
                                <a class="cancel" href="ill-requests.pl">Cancel</a>
999
                                [% END %]
990
                            </fieldset>
1000
                            </fieldset>
991
                        </form>
1001
                        </form>
992
                    </div>
1002
                    </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