Bugzilla – Attachment 50622 Details for
Bug 12721
Prevent software error if incorrect fieldnames given in sypref StatisticsFields
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 12721 - Syspref StatisticsFields: Warning on About page and text change in System preferences
Bug-12721---Syspref-StatisticsFields-Warning-on-Ab.patch (text/plain), 5.63 KB, created by
Marc Véron
on 2016-04-25 09:44:47 UTC
(
hide
)
Description:
Bug 12721 - Syspref StatisticsFields: Warning on About page and text change in System preferences
Filename:
MIME Type:
Creator:
Marc Véron
Created:
2016-04-25 09:44:47 UTC
Size:
5.63 KB
patch
obsolete
>From 38864155428d0f835354e6a45b13ca1b8e3ca142 Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Marc=20V=C3=A9ron?= <veron@veron.ch> >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 >--- > about.pl | 10 ++++++++++ > koha-tmpl/intranet-tmpl/prog/en/modules/about.tt | 7 +++++-- > .../prog/en/modules/admin/preferences/patrons.pref | 2 +- > 3 files changed, 16 insertions(+), 3 deletions(-) > >diff --git a/about.pl b/about.pl >index 6b77677..ca8ff9f 100755 >--- a/about.pl >+++ b/about.pl >@@ -37,6 +37,7 @@ use Koha; > use Koha::Acquisition::Currencies; > use Koha::Patrons; > use Koha::Config::SysPrefs; >+use C4::Members::Statistics; > > #use Smart::Comments '####'; > >@@ -70,6 +71,14 @@ if ( any { /(^psgi\.|^plack\.)/i } keys %ENV ) { > } > > # 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) ); >@@ -270,6 +279,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 a7663d1..e22c672 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt >@@ -104,7 +104,7 @@ > > <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> >@@ -112,7 +112,7 @@ > [% 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> >@@ -131,6 +131,9 @@ > [% 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. >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 22c2b27..b4b2a1c 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 >@@ -129,7 +129,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: >-- >1.7.10.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 12721
:
43573
|
43575
|
44316
|
50622
|
50668
|
50669
|
50792
|
50855
|
50897
|
50898
|
50899
|
50900