Bug 35604 - ILL - Allow for automatic backend selection
Summary: ILL - Allow for automatic backend selection
Status: Signed Off
Alias: None
Product: Koha
Classification: Unclassified
Component: ILL (show other bugs)
Version: Main
Hardware: All All
: P5 - low new feature (vote)
Assignee: Pedro Amorim
QA Contact:
URL: https://github.com/PTFS-Europe/koha/t...
Keywords:
Depends on: 36221 36521
Blocks: 36197
  Show dependency treegraph
 
Reported: 2023-12-19 16:23 UTC by Pedro Amorim
Modified: 2024-05-21 22:54 UTC (History)
10 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
ILL 2.0 flow (232.24 KB, image/jpeg)
2023-12-19 16:23 UTC, Pedro Amorim
Details
Bug 35604: New Backends.pm class. installed_backends method (2.02 KB, patch)
2024-04-15 14:11 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35604: New 'ill-backends' syspref type (6.45 KB, patch)
2024-04-15 14:11 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35604: New AutoILLBackendPriority sys prefs (3.40 KB, patch)
2024-04-15 14:11 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35604: ILL request creation with AutoILLBackendPriority enabled (4.56 KB, patch)
2024-04-15 14:11 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35604: ConfirmAuto workflow stage (28.81 KB, patch)
2024-04-15 14:11 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35604: Add tests (5.76 KB, patch)
2024-04-15 14:12 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35604: Update 'Make an ILL request' link in OPAC search results page (1.59 KB, patch)
2024-04-18 15:14 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35604: Add tests (9.13 KB, patch)
2024-04-19 10:44 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35604: Add tests (9.12 KB, patch)
2024-04-19 10:45 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35604: New Backends.pm class. installed_backends method (2.02 KB, patch)
2024-04-22 13:58 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35604: New 'ill-backends' syspref type (6.45 KB, patch)
2024-04-22 13:58 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35604: New AutoILLBackendPriority sys prefs (3.18 KB, patch)
2024-04-22 13:58 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35604: ILL request creation with AutoILLBackendPriority enabled (4.56 KB, patch)
2024-04-22 13:58 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35604: ConfirmAuto workflow stage (28.84 KB, patch)
2024-04-22 13:58 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35604: Add tests (9.23 KB, patch)
2024-04-22 13:58 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35604: Update 'Make an ILL request' link in OPAC search results page (1.59 KB, patch)
2024-04-22 13:58 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35604: New Backends.pm class. installed_backends method (2.02 KB, patch)
2024-05-17 12:55 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35604: New 'ill-backends' syspref type (6.45 KB, patch)
2024-05-17 12:55 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35604: New AutoILLBackendPriority sys prefs (3.17 KB, patch)
2024-05-17 12:55 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35604: ILL request creation with AutoILLBackendPriority enabled (4.56 KB, patch)
2024-05-17 12:55 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35604: ConfirmAuto workflow stage (28.83 KB, patch)
2024-05-17 12:55 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35604: Add tests (9.25 KB, patch)
2024-05-17 12:55 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35604: Update 'Make an ILL request' link in OPAC search results page (1.59 KB, patch)
2024-05-17 12:55 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35604: New Backends.pm class. installed_backends method (2.07 KB, patch)
2024-05-21 22:51 UTC, David Nind
Details | Diff | Splinter Review
Bug 35604: New 'ill-backends' syspref type (6.50 KB, patch)
2024-05-21 22:51 UTC, David Nind
Details | Diff | Splinter Review
Bug 35604: New AutoILLBackendPriority sys prefs (3.22 KB, patch)
2024-05-21 22:51 UTC, David Nind
Details | Diff | Splinter Review
Bug 35604: ILL request creation with AutoILLBackendPriority enabled (4.60 KB, patch)
2024-05-21 22:51 UTC, David Nind
Details | Diff | Splinter Review
Bug 35604: ConfirmAuto workflow stage (28.87 KB, patch)
2024-05-21 22:51 UTC, David Nind
Details | Diff | Splinter Review
Bug 35604: Add tests (9.29 KB, patch)
2024-05-21 22:51 UTC, David Nind
Details | Diff | Splinter Review
Bug 35604: Update 'Make an ILL request' link in OPAC search results page (1.64 KB, patch)
2024-05-21 22:51 UTC, David Nind
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Pedro Amorim 2023-12-19 16:23:23 UTC
Created attachment 160035 [details]
ILL 2.0 flow

Currently WIP but open to feedback from those interested/available:
https://github.com/PTFS-Europe/koha/commits/ill_2.0/

This work depends on bug 35570 (native Standard ILL backend) and is currently being tested with an ILL backend plugin:
https://github.com/PTFS-Europe/koha-ill-reprintsdesk/tree/pluginify

Even if no one is able to test this at this point, the provided diagram should represent roughly the final intended result, feedback from that alone would be greatly appreciated!
Comment 1 Pedro Amorim 2024-04-15 14:11:49 UTC Comment hidden (obsolete)
Comment 2 Pedro Amorim 2024-04-15 14:11:51 UTC Comment hidden (obsolete)
Comment 3 Pedro Amorim 2024-04-15 14:11:54 UTC Comment hidden (obsolete)
Comment 4 Pedro Amorim 2024-04-15 14:11:57 UTC Comment hidden (obsolete)
Comment 5 Pedro Amorim 2024-04-15 14:11:59 UTC Comment hidden (obsolete)
Comment 6 Pedro Amorim 2024-04-15 14:12:02 UTC Comment hidden (obsolete)
Comment 7 Pedro Amorim 2024-04-18 15:14:57 UTC Comment hidden (obsolete)
Comment 8 Pedro Amorim 2024-04-19 10:44:51 UTC Comment hidden (obsolete)
Comment 9 Pedro Amorim 2024-04-19 10:45:23 UTC Comment hidden (obsolete)
Comment 10 Pedro Amorim 2024-04-19 10:46:24 UTC Comment hidden (obsolete)
Comment 11 Pedro Amorim 2024-04-22 13:58:15 UTC Comment hidden (obsolete)
Comment 12 Pedro Amorim 2024-04-22 13:58:18 UTC Comment hidden (obsolete)
Comment 13 Pedro Amorim 2024-04-22 13:58:21 UTC Comment hidden (obsolete)
Comment 14 Pedro Amorim 2024-04-22 13:58:25 UTC Comment hidden (obsolete)
Comment 15 Pedro Amorim 2024-04-22 13:58:29 UTC Comment hidden (obsolete)
Comment 16 Pedro Amorim 2024-04-22 13:58:36 UTC Comment hidden (obsolete)
Comment 17 Pedro Amorim 2024-04-22 13:58:39 UTC Comment hidden (obsolete)
Comment 18 Pedro Amorim 2024-04-22 13:59:06 UTC
Rebase needed after bug 35151 and bug 35568 pushed to main
Comment 19 Pedro Amorim 2024-05-17 12:55:13 UTC
Created attachment 166897 [details] [review]
Bug 35604: New Backends.pm class. installed_backends method
Comment 20 Pedro Amorim 2024-05-17 12:55:16 UTC
Created attachment 166898 [details] [review]
Bug 35604: New 'ill-backends' syspref type

UI rendering of sortable ILL backends
Comment 21 Pedro Amorim 2024-05-17 12:55:19 UTC
Created attachment 166899 [details] [review]
Bug 35604: New AutoILLBackendPriority sys prefs
Comment 22 Pedro Amorim 2024-05-17 12:55:22 UTC
Created attachment 166900 [details] [review]
Bug 35604: ILL request creation with AutoILLBackendPriority enabled
Comment 23 Pedro Amorim 2024-05-17 12:55:25 UTC
Created attachment 166901 [details] [review]
Bug 35604: ConfirmAuto workflow stage
Comment 24 Pedro Amorim 2024-05-17 12:55:28 UTC
Created attachment 166902 [details] [review]
Bug 35604: Add tests

Test plan:
Apply patches

Staff:
1) Visit the ILL sysprefs page:
/cgi-bin/koha/admin/preferences.pl?tab=interlibrary_loans
2) Enable ILLModule
3) Check the new AutoILLBackendPriority syspref. Notice it shows "No available backends"
4) Install 2 backend plugins from here:
https://github.com/PTFS-Europe/koha-ill-backend-plugin/releases/tag/v2.0.5
https://github.com/PTFS-Europe/koha-ill-reprintsdesk/releases/tag/rc-v3.0.0
5) Repeat 1. Notice the backends now show.
6) Enable both for AutoILLBackendPriority by ticking each respective checkbox. Save.
7) Visit ILL requests:
http://localhost:8081/cgi-bin/koha/ill/ill-requests.pl
8) Press "New auto ILL request"
9) You are presented the "Standard" create form. Pick type "journal" and put '123' on DOI. Enter '42' on cardnumber and pick a library. Click Create.
10) Notice you are now shown the "Confirm auto backend" stage screen.
11) PluginBackend has a 50% chance of being available or not for testing purposes. If it is, it'll suggest PluginBackend, if not, it'll default to Standard. ReprintsDesk will always error because it's missing credentials.
12) Pick any of the backends or accept the suggested one, click 'Create'. The request has been placed in that specific backend.

OPAC:
1) Following from the previous test plan, visit OPAC ill requests:
http://localhost:8080/cgi-bin/koha/opac-illrequests.pl
2) Click "Create a new auto request" and repeat the same inputs as before. Click 'Create'.
3) Notice you're directed to "Confirming your request" screen. It's doing the same as it does in the Staff UI, except it does not allow the patron to pick a different backend, it'll always selected the first available backend in the priority.
4) Create more requests, you'll notice some of them will land on PluginBackend, others will land on 'Standard' because PluginBackend will sometimes be available and others not.

Do more testing:
- Reorder the backends in the AutoILLBackendPriority syspref and save, notice they're shown and suggested accordingly after creating a request.
- Disable all backends from AutoILLBackendPriority. Notice the original behaviour of requiring the user to select a backend before creating the request is restored on both opac and staff.

Run unit tests:
prove t/db_dependent/Illrequest/ConfirmAuto.t
prove t/db_dependent/Koha/ILL/Backends.t
Comment 25 Pedro Amorim 2024-05-17 12:55:31 UTC
Created attachment 166903 [details] [review]
Bug 35604: Update 'Make an ILL request' link in OPAC search results page
Comment 26 Pedro Amorim 2024-05-17 12:56:32 UTC
Rebase needed after bug 34655 and bug 36503
Comment 27 David Nind 2024-05-20 04:57:09 UTC
Everything in the test plan works, except for one test. I don't know what this means.... (note: the two plugins from the test plan are still installed).

prove t/db_dependent/Koha/ILL/Backends.t
t/db_dependent/Koha/ILL/Backends.t .. 1/4 
    #   Failed test 'Only one backend installed, happens to be a plugin'
    #   at t/db_dependent/Koha/ILL/Backends.t line 59.
    #     Structures begin differing at:
    #          $got->[0] = 'PluginBackend'
    #     $expected->[0] = 'Test Plugin'

    #   Failed test 'Two backends are installed, one plugin and one directory backend'
    #   at t/db_dependent/Koha/ILL/Backends.t line 75.
    #     Structures begin differing at:
    #          $got->[1] = 'PluginBackend'
    #     $expected->[1] = 'Test Plugin'
    # Looks like you failed 2 tests of 2.

#   Failed test 'installed_backends() tests'
#   at t/db_dependent/Koha/ILL/Backends.t line 84.
# Looks like you failed 1 test of 4.
t/db_dependent/Koha/ILL/Backends.t .. Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/4 subtests 

Test Summary Report
-------------------
t/db_dependent/Koha/ILL/Backends.t (Wstat: 256 (exited 1) Tests: 4 Failed: 1)
  Failed test:  4
  Non-zero exit status: 1
Files=1, Tests=4,  1 wallclock secs ( 0.01 usr  0.01 sys +  1.12 cusr  0.19 csys =  1.33 CPU)
Result: FAIL
Comment 28 Pedro Amorim 2024-05-21 08:44:01 UTC
Thanks David.
I believe plugin tests should be run without having any plugin (at all) installed.
The unit test is expecting a particular result but because you have other plugins installed is returning something different.
Would you please test it again without any plugin installed?
Apologies, should've made this clear in the test plan!
Very much appreciated for your testing!!
Comment 29 David Nind 2024-05-21 22:51:27 UTC
Created attachment 166995 [details] [review]
Bug 35604: New Backends.pm class. installed_backends method

Signed-off-by: David Nind <david@davidnind.com>
Comment 30 David Nind 2024-05-21 22:51:30 UTC
Created attachment 166996 [details] [review]
Bug 35604: New 'ill-backends' syspref type

UI rendering of sortable ILL backends

Signed-off-by: David Nind <david@davidnind.com>
Comment 31 David Nind 2024-05-21 22:51:33 UTC
Created attachment 166997 [details] [review]
Bug 35604: New AutoILLBackendPriority sys prefs

Signed-off-by: David Nind <david@davidnind.com>
Comment 32 David Nind 2024-05-21 22:51:36 UTC
Created attachment 166998 [details] [review]
Bug 35604: ILL request creation with AutoILLBackendPriority enabled

Signed-off-by: David Nind <david@davidnind.com>
Comment 33 David Nind 2024-05-21 22:51:39 UTC
Created attachment 166999 [details] [review]
Bug 35604: ConfirmAuto workflow stage

Signed-off-by: David Nind <david@davidnind.com>
Comment 34 David Nind 2024-05-21 22:51:42 UTC
Created attachment 167000 [details] [review]
Bug 35604: Add tests

Test plan:
Apply patches

Staff:
1) Visit the ILL sysprefs page:
/cgi-bin/koha/admin/preferences.pl?tab=interlibrary_loans
2) Enable ILLModule
3) Check the new AutoILLBackendPriority syspref. Notice it shows "No available backends"
4) Install 2 backend plugins from here:
https://github.com/PTFS-Europe/koha-ill-backend-plugin/releases/tag/v2.0.5
https://github.com/PTFS-Europe/koha-ill-reprintsdesk/releases/tag/rc-v3.0.0
5) Repeat 1. Notice the backends now show.
6) Enable both for AutoILLBackendPriority by ticking each respective checkbox. Save.
7) Visit ILL requests:
http://localhost:8081/cgi-bin/koha/ill/ill-requests.pl
8) Press "New auto ILL request"
9) You are presented the "Standard" create form. Pick type "journal" and put '123' on DOI. Enter '42' on cardnumber and pick a library. Click Create.
10) Notice you are now shown the "Confirm auto backend" stage screen.
11) PluginBackend has a 50% chance of being available or not for testing purposes. If it is, it'll suggest PluginBackend, if not, it'll default to Standard. ReprintsDesk will always error because it's missing credentials.
12) Pick any of the backends or accept the suggested one, click 'Create'. The request has been placed in that specific backend.

OPAC:
1) Following from the previous test plan, visit OPAC ill requests:
http://localhost:8080/cgi-bin/koha/opac-illrequests.pl
2) Click "Create a new auto request" and repeat the same inputs as before. Click 'Create'.
3) Notice you're directed to "Confirming your request" screen. It's doing the same as it does in the Staff UI, except it does not allow the patron to pick a different backend, it'll always selected the first available backend in the priority.
4) Create more requests, you'll notice some of them will land on PluginBackend, others will land on 'Standard' because PluginBackend will sometimes be available and others not.

Do more testing:
- Reorder the backends in the AutoILLBackendPriority syspref and save, notice they're shown and suggested accordingly after creating a request.
- Disable all backends from AutoILLBackendPriority. Notice the original behaviour of requiring the user to select a backend before creating the request is restored on both opac and staff.

Run unit tests:
prove t/db_dependent/Illrequest/ConfirmAuto.t
prove t/db_dependent/Koha/ILL/Backends.t

Signed-off-by: David Nind <david@davidnind.com>
Comment 35 David Nind 2024-05-21 22:51:45 UTC
Created attachment 167001 [details] [review]
Bug 35604: Update 'Make an ILL request' link in OPAC search results page

Signed-off-by: David Nind <david@davidnind.com>
Comment 36 David Nind 2024-05-21 22:54:08 UTC
(In reply to Pedro Amorim from comment #28)
> Thanks David.
> I believe plugin tests should be run without having any plugin (at all)
> installed.
> The unit test is expecting a particular result but because you have other
> plugins installed is returning something different.
> Would you please test it again without any plugin installed?
> Apologies, should've made this clear in the test plan!
> Very much appreciated for your testing!!

Retested without plugins, and test pass.

Now signed off.

Thanks!

David