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 <aleishaamohia@hotmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
use Koha::Acquisition::Currencies;
use Koha::Patrons;
use Koha::Config::SysPrefs;
+use C4::Members::Statistics;
#use Smart::Comments '####';
}
# 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) );
warnIsRootUser => $warnIsRootUser,
warnNoActiveCurrency => $warnNoActiveCurrency,
xml_config_warnings => \@xml_config_warnings,
+ warnStatisticsFieldsError => $warnStatisticsFieldsError,
);
my @components = ();
<div id="sysinfo">
[% 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) %]
<h2>Warning regarding current user</h2>
<p>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.</p>
[% END %]
[% IF warnPrefBiblioAddsAuthorities || warnPrefEasyAnalyticalRecords || warnPrefAnonymousPatron ||
- warnNoActiveCurrency || QueryParserError || AutoSelfCheckPatronDoesNotHaveSelfCheckPerm || AutoSelfCheckPatronHasTooManyPerm %]
+ warnNoActiveCurrency || QueryParserError || AutoSelfCheckPatronDoesNotHaveSelfCheckPerm || AutoSelfCheckPatronHasTooManyPerm || warnStatisticsFieldsError%]
<h2>Warnings regarding the system configuration</h2>
<table>
<caption>Preferences and parameters</caption>
[% IF warnNoActiveCurrency %]
<tr><th scope="row"><b>Warning</b> </th><td>No active currency is defined. Please go to <a href="/cgi-bin/koha/admin/currency.pl">Administration > Currencies and exchange rates</a> and mark one currency as active.</td></tr>
[% END %]
+ [% IF warnStatisticsFieldsError %]
+ <tr><th scope="row"><b>Warning</b> </th><td>System preference 'StatisticsFields' contains field names not belonging to the items database table: [% warnStatisticsFieldsError %] </td></tr>
+ [% END %]
[% IF QueryParserError %]
<tr><th scope="row"><b>Warning</b> </th><td>
You have set UseQueryParser but there was a problem inititializing QueryParser.
- "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: