From 83e8f0e0c3cbfaa2114d9c0c7d0a1ae21c63b8fe Mon Sep 17 00:00:00 2001 From: Pedro Amorim Date: Fri, 15 Dec 2023 15:07:37 -0100 Subject: [PATCH] Bug 35570: Prevent use of ILL module if deprecated FreeForm backend is installed Test plan: 1) This patch should not be applied in order to be able to go through the previous patch's test plan 2) Install FreeForm, run: bash <(curl -s https://raw.githubusercontent.com/ammopt/koha-ill-dev/master/start-ill-dev.sh) 3) Please note that you need to be using FreeForm's reorganize_ILL branch at: https://github.com/PTFS-Europe/koha-ill-freeform/commits/reorganize_ILL/ 4) Visit ILL page: /cgi-bin/koha/ill/ill-requests.pl 5) Notice there's a configuration error preventing the use of the ILL module. 6) Click the 'about page' link and verify there is a warning about FreeForm 7) Remove FreeForm from /kohadevbox/koha/Koha/Illbackends and refresh the page 8) Repeat 4), notice the requests are listed as expected and you can now use the ILL module again. Signed-off-by: David Nind Signed-off-by: Tomas Cohen Arazi Signed-off-by: Katrin Fischer --- about.pl | 7 +++++++ ill/ill-requests.pl | 6 ++++++ koha-tmpl/intranet-tmpl/prog/en/modules/about.tt | 11 +++++++++++ .../intranet-tmpl/prog/en/modules/ill/ill-requests.tt | 2 +- 4 files changed, 25 insertions(+), 1 deletion(-) diff --git a/about.pl b/about.pl index 4e54b5a2fd..c2f6e6f591 100755 --- a/about.pl +++ b/about.pl @@ -357,6 +357,13 @@ if($tab eq 'sysinfo') { $warnILLConfiguration = 1; } + # Check if deprecated 'FreeForm' backend is installed + my $available_backends = Koha::ILL::Request::Config->new->available_backends; + if ( grep( /FreeForm/, @{$available_backends} ) ) { + $template->param( ill_deprecated_backend_freeform_is_installed => 1 ); + $warnILLConfiguration = 1; + } + if ( !C4::Context->preference('ILLPartnerCode') ) { # partner code not defined $template->param( ill_partner_code_not_defined => 1 ); diff --git a/ill/ill-requests.pl b/ill/ill-requests.pl index 4abde0fdb8..3f093bb062 100755 --- a/ill/ill-requests.pl +++ b/ill/ill-requests.pl @@ -72,6 +72,12 @@ $template->param( have_batch => have_batch_backends($backends) ); +if ( grep( /FreeForm/, @{$backends} ) ) { + $template->param( + ill_deprecated_backend_freeform_is_installed => 1, + ); +} + if ( $backends_available ) { # Establish what metadata enrichment plugins we have available my $enrichment_services = get_metadata_enrichment(); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt index d709615576..78739af4f8 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt @@ -594,6 +594,17 @@ [% END %] + [% IF ill_deprecated_backend_freeform_is_installed %] + + Warning + +

The ILL module is enabled, but the deprecated 'FreeForm' backend is installed.

+

'FreeForm' has since become part of core Koha as 'Standard'.

+

All 'FreeForm' ILL content should've been migrated to 'Standard' upon upgrading Koha to 24.05.

+

To avoid confusion or redundancy, please uninstall the 'FreeForm' backend before using the ILL module.

+ + + [% END %] [% END %] [% IF weasyprint_missing %] 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 5f4759bfaf..23c6e7424f 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 @@ -125,7 +125,7 @@ [% INCLUDE 'messages.inc' %] [% END %]
- [% IF !backends_available || !has_branch %] + [% IF !backends_available || !has_branch || ill_deprecated_backend_freeform_is_installed %]
ILL module configuration problem. Take a look at the about page
[% ELSE %] [% INCLUDE 'ill-toolbar.inc' %] -- 2.39.5