From 4b79948400f1a02549329fe1329e7c0cab004cd0 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Mon, 6 Nov 2017 12:45:24 -0300 Subject: [PATCH] Bug 7317: Add partner_code checks to abot page This patch adds checks to the configured (or fallback) partner_code. It produces two different warnings: - Configured partner_code doesn't match an existing patron category code. - partner_code is not defined, a fallback to ILLLIBS is done Signed-off-by: Tomas Cohen Arazi Signed-off-by: Jonathan Druart --- about.pl | 20 ++++++++++++++++++- .../intranet-tmpl/prog/en/modules/about.tt | 14 ++++++++++++- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/about.pl b/about.pl index a7daa3780c..5e481738c7 100755 --- a/about.pl +++ b/about.pl @@ -35,6 +35,7 @@ use C4::Installer; use Koha; use Koha::Acquisition::Currencies; +use Koha::Patron::Categories; use Koha::Patrons; use Koha::Caches; use Koha::Config::SysPrefs; @@ -261,16 +262,33 @@ if ( !defined C4::Context->config('use_zebra_facets') ) { } } +# ILL module checks if ( C4::Context->preference('ILLModule') ) { my $warnILLConfiguration = 0; + my $ill_config_from_file = C4::Context->config("interlibrary_loans"); + my $ill_config = Koha::Illrequest::Config->new; + my $available_ill_backends = - ( scalar @{ Koha::Illrequest::Config->new->available_backends } > 0 ); + ( scalar @{ $ill_config->available_backends } > 0 ); + # Check backends if ( !$available_ill_backends ) { $template->param( no_ill_backends => 1 ); $warnILLConfiguration = 1; } + # Check partner_code + if ( !Koha::Patron::Categories->find($ill_config->partner_code) ) { + $template->param( ill_partner_code_doesnt_exist => $ill_config->partner_code ); + $warnILLConfiguration = 1; + } + + if ( !$ill_config_from_file->{partner_code} ) { + # partner code not defined + $template->param( ill_partner_code_not_defined => 1 ); + $warnILLConfiguration = 1; + } + $template->param( warnILLConfiguration => $warnILLConfiguration ); } diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt index 42b29743f8..7ce8c89d30 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt @@ -227,9 +227,21 @@ [% END %] [% IF warnILLConfiguration %] + [% IF no_ill_backends %] Warning - [% IF no_ill_backends %]The ILL module is enabled, but there are no backends available.[%END %] + The ILL module is enabled, but there are no backends available. + [% END %] + [% IF ill_partner_code_not_defined %] + Warning + The ILL module is enabled, but no 'partner_code' defined in koha-conf.xml. Falling back to the hardcoded 'ILLLIBS'. + + [%END %] + [% IF ill_partner_code_doesnt_exist %] + Warning + The ILL module is enabled, but the configured 'partner_code' ([% ill_partner_code_doesnt_exist %]) is not defined on the system. + + [% END %] [% END %] [% END %] -- 2.39.5