From f49adba138c7deb6736c50a75e1863b1d4647669 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marc=20V=C3=A9ron?= Date: Sun, 18 Oct 2015 18:27:58 +0200 Subject: [PATCH] Bug 12721 - Syspref StatisticsFields: Warning on About page and text change in System preferences This patch adds a warning to the about page if the syspref 'StatisticsFields' is misconfigured. Additionally, the text on Home > Administration > SystemPreferences for 'Statistics Fields' is changed. To test: - Apply patch - Edit syspref 'StatisticsFields'. Verify that the explanation makes sense. - Leave field empty => verify that no message appears on About page, tab System information - Insert valid field names, e.g. location|itype => verify that no message appears on the About page - Add trailing char => verify that the warning message appears on the About page - Fill in some garbage or misspell a field name => verify that the warning message appears on the About page Signed-off-by: Aleisha Signed-off-by: Katrin Fischer Signed-off-by: Brendan Gallagher (cherry picked from commit 95f492b4d2505103269b295a34bab74804df9746) Signed-off-by: Julian Maurice (cherry picked from commit f6694ce92ff4b60aea1234e9a138853fb0406f18) Signed-off-by: Chris Cormack --- about.pl | 11 +++++++++++ koha-tmpl/intranet-tmpl/prog/en/modules/about.tt | 7 +++++-- .../prog/en/modules/admin/preferences/patrons.pref | 2 +- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/about.pl b/about.pl index 044a1df4cc..250e6db2a9 100755 --- a/about.pl +++ b/about.pl @@ -35,6 +35,8 @@ use C4::Installer; use Koha; use Koha::Borrowers; +use Koha::Config::SysPrefs; +use C4::Members::Statistics; #use Smart::Comments '####'; @@ -58,6 +60,14 @@ if ($^O ne 'VMS') { my $zebraVersion = `zebraidx -V`; # Additional system information for warnings + +my $warnStatisticsFieldsError; +my $prefStatisticsFields = C4::Context->preference('StatisticsFields'); +if ($prefStatisticsFields) { + $warnStatisticsFieldsError = $prefStatisticsFields + unless ( $prefStatisticsFields eq C4::Members::Statistics->get_fields() ); +} + my $prefAutoCreateAuthorities = C4::Context->preference('AutoCreateAuthorities'); my $prefBiblioAddsAuthorities = C4::Context->preference('BiblioAddsAuthorities'); my $warnPrefBiblioAddsAuthorities = ( $prefAutoCreateAuthorities && ( !$prefBiblioAddsAuthorities) ); @@ -239,6 +249,7 @@ $template->param( warnIsRootUser => $warnIsRootUser, warnNoActiveCurrency => $warnNoActiveCurrency, xml_config_warnings => \@xml_config_warnings, + warnStatisticsFieldsError => $warnStatisticsFieldsError, ); my @components = (); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt index 5703340811..05d2e54215 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt @@ -101,7 +101,7 @@
[% IF warnPrefBiblioAddsAuthorities || warnPrefEasyAnalyticalRecords || warnPrefAnonymousPatron || - warnNoActiveCurrency || QueryParserError || warnIsRootUser || xml_config_warnings.size || AutoSelfCheckPatronDoesNotHaveSelfCheckPerm || AutoSelfCheckPatronHasTooManyPerm %] + warnNoActiveCurrency || QueryParserError || warnIsRootUser || xml_config_warnings.size || AutoSelfCheckPatronDoesNotHaveSelfCheckPerm || AutoSelfCheckPatronHasTooManyPerm || warnStatisticsFieldsError %] [% IF (warnIsRootUser) %]

Warning regarding current user

You are logged in as the database administrative user. This is not recommended because some parts of Koha will not function as expected when using this account.

@@ -109,7 +109,7 @@ [% END %] [% IF warnPrefBiblioAddsAuthorities || warnPrefEasyAnalyticalRecords || warnPrefAnonymousPatron || - warnNoActiveCurrency || QueryParserError || AutoSelfCheckPatronDoesNotHaveSelfCheckPerm || AutoSelfCheckPatronHasTooManyPerm %] + warnNoActiveCurrency || QueryParserError || AutoSelfCheckPatronDoesNotHaveSelfCheckPerm || AutoSelfCheckPatronHasTooManyPerm || warnStatisticsFieldsError%]

Warnings regarding the system configuration

@@ -128,6 +128,9 @@ [% IF warnNoActiveCurrency %] [% END %] + [% IF warnStatisticsFieldsError %] + + [% END %] [% IF QueryParserError %]
Preferences and parameters
Warning No active currency is defined. Please go to Administration > Currencies and exchange rates and mark one currency as active.
Warning System preference 'StatisticsFields' contains field names not belonging to the items database table: [% warnStatisticsFieldsError %]
Warning You have set UseQueryParser but there was a problem inititializing QueryParser. diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref index a483bb71cf..6cf0c3f4ed 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref @@ -124,7 +124,7 @@ Patrons: - "Show the following fields from the items database table as columns on the statistics tab on the patron record: " - pref: StatisticsFields class: multi - - (separate fields with |) + - "(separate fields with |, without trailing |). Default if empty: location|itype|ccode" - - pref: EnableBorrowerFiles choices: -- 2.39.5