From 6b33b62004394b13c721f1d8ecb1d871d4d041fe 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. --- 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 6dcb8b37dc..b6737806a2 100755 --- a/about.pl +++ b/about.pl @@ -320,6 +320,13 @@ if ( C4::Context->preference('ILLModule') ) { $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 e32242e54a..f03aa11428 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 1db1f99a53..97c409159c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt @@ -568,6 +568,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 87d73fc747..6fc4e685cc 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 @@ -120,7 +120,7 @@
[% 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.30.2