From 4d814c7e681fb698387a385b8380583a6410f974 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 --- 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 37e400fbb77..3bce47409fb 100755 --- a/about.pl +++ b/about.pl @@ -354,6 +354,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 3d7744ca56f..d1e39f7764f 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 0f5675a5f8b..eacc8348616 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt @@ -591,6 +591,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 38b41ed774e..2872bfd3bda 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.2