Bugzilla – Attachment 190867 Details for
Bug 41111
AutoILLBackendPriority should consider a 'yellow' stage
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 41111: Add an yellow state to ILLAutoBackendPriority
Bug-41111-Add-an-yellow-state-to-ILLAutoBackendPri.patch (text/plain), 5.87 KB, created by
David Nind
on 2026-01-03 19:19:07 UTC
(
hide
)
Description:
Bug 41111: Add an yellow state to ILLAutoBackendPriority
Filename:
MIME Type:
Creator:
David Nind
Created:
2026-01-03 19:19:07 UTC
Size:
5.87 KB
patch
obsolete
>From 4a465895e072eebe3009145df79e5aecbae0fc35 Mon Sep 17 00:00:00 2001 >From: Pedro Amorim <pedro.amorim@openfifth.co.uk> >Date: Fri, 24 Oct 2025 13:26:24 +0000 >Subject: [PATCH] Bug 41111: Add an yellow state to ILLAutoBackendPriority > >Originally, AutoILLBackendPriority only considered 2 states: green or red. This patch introduces a yellow state. >Yellow means the Staff UI can pick that backend, but Koha will only suggest that as the goto backend if no other 'green' backends exist. >If both green and yellow backends are returned, Koha will suggest the top green in priority. >OPAC will never consider 'yellow' backends. Functionality there stays the same: Pick first 'green' backend in priority or default to Standard. > >Test plan: >1) Enable ILLModule >2) Install this dummy backend plugin designed for testing purposes only: >https://github.com/openfifth/koha-ill-backend-plugin/releases/tag/v2.0.7 >3) Enable AutoILLBackendPriority by ticking "PluginBackend" >4) Create a new ILL request, visit: ><staff_url>/cgi-bin/koha/ill/ill-requests.pl?method=create&backend=Standard >5) If you put 'red' as title, the backend will return unavailable. If you put 'green' on title the backend will return available. If you put 'yellow' on the backend it'll return the new 'yellow' stage. If title doesnt match that it'll return one of the 3 at random. > >Signed-off-by: David Nind <david@davidnind.com> >--- > .../intranet-tmpl/prog/js/ill-autobackend.js | 40 ++++++++++++++++--- > .../opac-tmpl/bootstrap/js/ill-autobackend.js | 18 ++++++++- > 2 files changed, 50 insertions(+), 8 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/js/ill-autobackend.js b/koha-tmpl/intranet-tmpl/prog/js/ill-autobackend.js >index 2670daf163..3fa275b771 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/ill-autobackend.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/ill-autobackend.js >@@ -24,8 +24,13 @@ $(document).ready(function () { > auto_backend.available = 0; > }, > success: function (data) { >- _addSuccessMessage(auto_backend.name, data); >- auto_backend.available = 1; >+ if (data.success !== undefined && data.success !== null) { >+ _addSuccessMessage(auto_backend.name, data); >+ auto_backend.available = 1; >+ } else if (data.warning) { >+ _addWarningMessage(auto_backend.name, data); >+ auto_backend.available = 0; >+ } > }, > error: function (request, textstatus) { > if (textstatus === "timeout") { >@@ -81,6 +86,20 @@ $(document).ready(function () { > _addBackendOption("Standard"); > } > >+ function _addWarningMessage(auto_backend_name, data) { >+ _removeVerifyingMessage(auto_backend_name); >+ $( >+ auto_ill_el + " > #backend-" + auto_backend_name + " #backendcol" >+ ).append( >+ '<div style="color:#8a6804;" class="text-warning mb-2"><i class="fa fa-exclamation-circle"></i> ' + >+ "<strong>" + >+ __("Warning.") + >+ "</strong><br>" + >+ data.warning + >+ "</div>" >+ ); >+ } >+ > function _addSuccessMessage(auto_backend_name, data) { > _removeVerifyingMessage(auto_backend_name); > $( >@@ -189,10 +208,19 @@ $(document).ready(function () { > "background-color": "", > border: "", > }); >- $(this).closest(".list-group-item").css({ >- "background-color": "rgba(0, 128, 0, 0.1)", >- border: "1px solid rgba(0, 128, 0, 0.7)", >- }); >+ if ($(this).parent().siblings().find(".text-success").length > 0) { >+ $(this).closest(".list-group-item").css({ >+ "background-color": "rgba(0, 128, 0, 0.1)", >+ border: "1px solid rgba(0, 128, 0, 0.7)", >+ }); >+ } else if ( >+ $(this).parent().siblings().find(".text-warning").length > 0 >+ ) { >+ $(this).closest(".list-group-item").css({ >+ "background-color": "rgba(255, 228, 0, 0.1)", >+ border: "1px solid rgba(255, 228, 0, 0.7)", >+ }); >+ } > } > ); > >diff --git a/koha-tmpl/opac-tmpl/bootstrap/js/ill-autobackend.js b/koha-tmpl/opac-tmpl/bootstrap/js/ill-autobackend.js >index 7c59e3d185..b15482fc6c 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/js/ill-autobackend.js >+++ b/koha-tmpl/opac-tmpl/bootstrap/js/ill-autobackend.js >@@ -24,8 +24,13 @@ $(document).ready(function () { > auto_backend.available = 0; > }, > success: function (data) { >- _addSuccessMessage(auto_backend.name); >- auto_backend.available = 1; >+ if (data.success !== undefined && data.success !== null) { >+ _addSuccessMessage(auto_backend.name); >+ auto_backend.available = 1; >+ } else if (data.warning) { >+ _addWarningMessage(auto_backend.name, data); >+ auto_backend.available = 0; >+ } > }, > error: function (request, textstatus) { > if (textstatus === "timeout") { >@@ -80,6 +85,15 @@ $(document).ready(function () { > _addBackendOption("Standard"); > } > >+ function _addWarningMessage(auto_backend_name, data) { >+ _removeVerifyingMessage(auto_backend_name); >+ $(auto_ill_el + " > #backend-" + auto_backend_name).append( >+ '<span style="color:#8a6804;" class="text-warning"><i class="fa-solid fa-check"></i> ' + >+ __("Warning.").format(auto_backend_name) + >+ "</span>" >+ ); >+ } >+ > function _addSuccessMessage(auto_backend_name) { > _removeVerifyingMessage(auto_backend_name); > $(auto_ill_el + " > #backend-" + auto_backend_name).append( >-- >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 41111
:
188478
|
188520
|
188521
|
190839
| 190867