Bug 8301 - Display additional system information (preferences) on About page to minim...
authorMarc Veron <veron@veron.ch>
Sun, 24 Jun 2012 19:29:12 +0000 (21:29 +0200)
committerPaul Poulain <paul.poulain@biblibre.com>
Tue, 10 Jul 2012 09:19:02 +0000 (11:19 +0200)
To minimize support questions regarding common mistakes, the About
page should have an additional tab that displays warnings if depractated
and/or mutual excluding system preferences are used.

To test patch use values as displayed on screenshot attached.

New: Shows error message in Tab Server Information if Zebra server is not started
(...and changes added...)

Suggestions for other values to add are welcome.

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>

about.pl
koha-tmpl/intranet-tmpl/prog/en/modules/about.tt

index 9295b33..daf6829 100755 (executable)
--- a/about.pl
+++ b/about.pl
@@ -60,6 +60,18 @@ $apacheVersion = `httpd2 -v` unless $apacheVersion;
 $apacheVersion = (`/usr/sbin/apache2 -V`)[0] unless $apacheVersion;
 my $zebraVersion = `zebraidx -V`;
 
+# Additional system information for warnings
+my $prefNoZebra = C4::Context->preference('nozebra');
+my $prefAutoCreateAuthorities = C4::Context->preference('AutoCreateAuthorities');
+my $prefBiblioAddsAuthorities = C4::Context->preference('BiblioAddsAuthorities');
+my $warnPrefBiblioAddsAuthorities = ( $prefAutoCreateAuthorities && ( !$prefBiblioAddsAuthorities) );
+
+my $prefEasyAnalyticalRecords  = C4::Context->preference('EasyAnalyticalRecords');
+my $prefUseControlNumber  = C4::Context->preference('UseControlNumber');
+my $warnPrefEasyAnalyticalRecords  = ( $prefEasyAnalyticalRecords  && $prefUseControlNumber );
+
+my $errZebraConnection = C4::Context->Zconn("biblioserver",0)->errcode();
+
 $template->param(
     kohaVersion   => $kohaVersion,
     osVersion     => $osVersion,
@@ -69,6 +81,12 @@ $template->param(
     mysqlVersion  => $mysqlVersion,
     apacheVersion => $apacheVersion,
     zebraVersion  => $zebraVersion,
+    prefNoZebra   => $prefNoZebra,
+    prefBiblioAddsAuthorities => $prefBiblioAddsAuthorities,
+    prefAutoCreateAuthorities => $prefAutoCreateAuthorities,
+    warnPrefBiblioAddsAuthorities => $warnPrefBiblioAddsAuthorities,
+    warnPrefEasyAnalyticalRecords  => $warnPrefEasyAnalyticalRecords,
+    errZebraConnection => $errZebraConnection,
 );
 
 my @components = ();
index c383a7b..34f6578 100644 (file)
@@ -26,6 +26,7 @@
         <ul>
         <li><a href="#about">Server Information</a></li>
         <li><a href="#perl">Perl modules</a></li>
+        <li><a href="#sysinfo">System information</a></li>
         <li><a href="#team">Koha Team</a></li>
         <li><a href="#licenses">Licenses</a></li>
         <li><a href="#translations">Translations</a></li>
             <tr><th scope="row">MySQL version: </th><td>[% mysqlVersion |html %]</td></tr>
             <tr><th scope="row">Apache version: </th><td>[% apacheVersion |html %]</td></tr>
             <tr><th scope="row">Zebra version: </th><td>[% zebraVersion |html %]</td></tr>
+            [% IF (errZebraConnection == 10000) %]
+            <tr><th scope="row"><b>Error</b> </th><td>Zebra server seems not to be available. Is it started?</td></tr>
+            [% ELSIF (errZebraConnection) %]
+            <tr><th scope="row"><b>Warning</b> </th><td>Error message from Zebra: [% ( errZebraConnection ) %] </td></tr>
+            [% END %]
         </table>
         </div>
         <div id="perl">
                 [% END %]
             </table>
         </div>
+
+        <div id="sysinfo">
+            <h2>Warnings regarding the system configuration</h2>
+        [% IF ( (prefNoZebra) || (warnPrefBiblioAddsAuthorities) || warnPrefEasyAnalyticalRecords ) %]
+        <table>
+            <caption>Preferences</caption>
+            [% IF (prefNoZebra) %]
+            <tr><th scope="row"><b>Warning</b> </th><td>System preference 'nozebra' set. Deprectated!</td></tr>
+            [% END %]
+            [% IF (warnPrefBiblioAddsAuthorities) %]
+            <tr><th scope="row"><b>Warning</b> </th><td>System preference 'AutoCreateAuthorities' set, but needs 'BiblioAddsAuthorities' set as well.</td></tr>
+            [% END %]
+            [% IF (warnPrefEasyAnalyticalRecords) %]
+            <tr><th scope="row"><b>Warning</b> </th><td>System preference 'EasyAnalyticalRecords' set, but UseControlNumber preference is set to 'Use'. Set it to 'Don't use' or else the 'Show analytics' links in the staff client and the OPAC will be broken.</td></tr>
+            [% END %]
+        </table>
+        [% ELSE %]
+            <p>No warnings</p>
+        [% END %]
+        </div>
+
         <div id="team">
             <h2>Special thanks to the following organizations</h2>
             <ul>