Bugzilla – Attachment 176121 Details for
Bug 38819
ILL - 'Switch provider' should use AutoILLBackendPriority
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 38819: Auto migrate controller logic
Bug-38819-Auto-migrate-controller-logic.patch (text/plain), 6.54 KB, created by
Pedro Amorim
on 2025-01-03 15:58:23 UTC
(
hide
)
Description:
Bug 38819: Auto migrate controller logic
Filename:
MIME Type:
Creator:
Pedro Amorim
Created:
2025-01-03 15:58:23 UTC
Size:
6.54 KB
patch
obsolete
>From 9f41a8d86f7d38238fee1e9c87bb92c7131eb20a Mon Sep 17 00:00:00 2001 >From: Pedro Amorim <pedro.amorim@ptfs-europe.com> >Date: Fri, 3 Jan 2025 12:36:38 -0100 >Subject: [PATCH] Bug 38819: Auto migrate controller logic > >Test plan, k-t-d: >0) Install the 'PluginBackend' plugin: >https://github.com/PTFS-Europe/koha-ill-backend-plugin/releases/tag/v2.0.6 >1) Enable ILLModule syspref and check the "PluginBackend" backend in AutoILLBackendPriority: >http://localhost:8081/cgi-bin/koha/admin/preferences.pl?tab=interlibrary_loans >2) Create a new 'auto' ILL request: >http://localhost:8081/cgi-bin/koha/ill/ill-requests.pl?method=create&backend=Standard >3) Select type 'journal article', add '123' as DOI, '42' as cardnumber and any library >4) You should be on the automatic backend screen. The PluginBackend has a 50% chance to return available, so this step may suggest PluginBackend or Standard. Pick whatever was suggested. Click 'confirm'. >5) You are now on the request detail page. Click "Switch provider". You should be back on the automatic backend screen. >Repeat this step as many times needed to switch from Standard <-> PluginBackend multiple times. Ensure it always succeeds. >--- > ill/ill-requests.pl | 19 +++++++++++++++++++ > .../prog/en/modules/ill/ill-requests.tt | 12 +++++++++++- > .../intranet-tmpl/prog/js/ill-autobackend.js | 8 ++++++++ > 3 files changed, 38 insertions(+), 1 deletion(-) > >diff --git a/ill/ill-requests.pl b/ill/ill-requests.pl >index b1f2233e601..050fab9441f 100755 >--- a/ill/ill-requests.pl >+++ b/ill/ill-requests.pl >@@ -185,6 +185,25 @@ if ( $backends_available ) { > } > } elsif ( $op eq 'migrate' ) { > # We're in the process of migrating a request >+ if ( $params->{auto_migrate} ) { >+ >+ my $confirm_auto = Koha::ILL::Request::Workflow::ConfirmAuto->new( $params, 'staff' ); >+ my $illrequest = Koha::ILL::Requests->find( $params->{illrequest_id} ); >+ my $extended_attributes_hash = >+ { map { $_->type => $_->value } $illrequest->extended_attributes->search->as_list }; >+ my $new_params = { %{ $illrequest->unblessed }, %$extended_attributes_hash }; >+ >+ $template->param( $confirm_auto->confirm_auto_template_params($new_params) ); >+ $template->param( >+ op => 'confirmautoill', >+ auto_migrate => 1, >+ request => $illrequest, >+ ); >+ >+ output_html_with_http_headers( $cgi, $cookie, $template->output ); >+ exit; >+ } >+ > my $request = Koha::ILL::Requests->find($params->{illrequest_id}); > my $backend_result; > if ( $params->{backend} ) { >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt >index 305b182a5f2..5bf81e39087 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt >@@ -607,7 +607,12 @@ > [% END %] > [% NEXT IF has_prefs_count < needs_prefs.size || has_perms_count < needs_perms.size || has_all_count < needs_all.size %] > [% IF action.method == 'migrate' %] >- [% IF backends.size > 2 %] >+ [% IF Koha.Preference('AutoILLBackendPriority') && backends.size > 1 %] >+ <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 %]&illrequest_id=[% request.illrequest_id | uri %]&auto_migrate=1"> >+ <span class="fa [% action.ui_method_icon | html %]"></span> >+ [% action.ui_method_name | html %] >+ </a> >+ [% ELSIF backends.size > 2 %] > <div class="dropdown btn-group"> > <button class="btn btn-default dropdown-toggle" type="button" id="ill-migrate-dropdown" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="true"> > <i class="fa [% action.ui_method_icon | html %]"></i> [% action.ui_method_name | html %] >@@ -1040,6 +1045,10 @@ > <p id="autoillbackend-message" class="text-info"></p> > </fieldset> > <fieldset class="action"> >+ [% IF auto_migrate %] >+ <a id="confirm-auto-migrate" data-illrequest_id="[% request.illrequest_id %]" class="btn btn-primary disabled">Confirm</a> >+ <a class="cancel" href="ill-requests.pl">Cancel</a> >+ [% ELSE %] > [% FOREACH key IN whole.keys %] > [% value = whole.$key %] > [% IF key != 'method' && key != 'custom_key' && key != 'custom_value' %] >@@ -1059,6 +1068,7 @@ > <input type="hidden" name="confirm_auto_submitted" value="1"> > <input type="submit" class="btn btn-primary" value="Confirm" /> > <a class="cancel" href="ill-requests.pl">Cancel</a> >+ [% END %] > </fieldset> > </form> > </div> >diff --git a/koha-tmpl/intranet-tmpl/prog/js/ill-autobackend.js b/koha-tmpl/intranet-tmpl/prog/js/ill-autobackend.js >index 75ed10221d9..1be67e25baa 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/ill-autobackend.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/ill-autobackend.js >@@ -79,6 +79,7 @@ $(document).ready(function () { > "disabled", > false > ); >+ $('#confirm-auto-migrate').removeClass('disabled'); > }); > _addBackendPlaceholderEl("Standard"); > _addBackendOption("Standard"); >@@ -174,4 +175,11 @@ $(document).ready(function () { > }); > }); > >+ $('#confirm-auto-migrate').on('click', function() { >+ let backend = $('input[name="backend"]:checked').val(); >+ let requestId = $(this).data('illrequest_id'); >+ let url = `/cgi-bin/koha/ill/ill-requests.pl?op=migrate&illrequest_id=${encodeURIComponent(requestId)}&backend=${encodeURIComponent(backend)}`; >+ window.location.href = url; >+ }); >+ > }); >-- >2.39.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 38819
:
176121
|
176122
|
176123
|
176139
|
176140
|
176141
|
176519
|
176520
|
176521
|
176575