Bug 10915: fix About->timeline breakage on incompletely upgraded Koha
[koha-ffzg.git] / about.pl
index 3c641b3..0ba7291 100755 (executable)
--- a/about.pl
+++ b/about.pl
@@ -61,7 +61,6 @@ $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) );
@@ -69,6 +68,10 @@ my $warnPrefBiblioAddsAuthorities = ( $prefAutoCreateAuthorities && ( !$prefBibl
 my $prefEasyAnalyticalRecords  = C4::Context->preference('EasyAnalyticalRecords');
 my $prefUseControlNumber  = C4::Context->preference('UseControlNumber');
 my $warnPrefEasyAnalyticalRecords  = ( $prefEasyAnalyticalRecords  && $prefUseControlNumber );
+my $warnPrefAnonymousPatron = (
+    C4::Context->preference('OPACPrivacy')
+        and not C4::Context->preference('AnonymousPatron')
+);
 
 my $errZebraConnection = C4::Context->Zconn("biblioserver",0)->errcode();
 
@@ -83,11 +86,11 @@ $template->param(
     mysqlVersion  => $mysqlVersion,
     apacheVersion => $apacheVersion,
     zebraVersion  => $zebraVersion,
-    prefNoZebra   => $prefNoZebra,
     prefBiblioAddsAuthorities => $prefBiblioAddsAuthorities,
     prefAutoCreateAuthorities => $prefAutoCreateAuthorities,
     warnPrefBiblioAddsAuthorities => $warnPrefBiblioAddsAuthorities,
     warnPrefEasyAnalyticalRecords  => $warnPrefEasyAnalyticalRecords,
+    warnPrefAnonymousPatron => $warnPrefAnonymousPatron,
     errZebraConnection => $errZebraConnection,
     warnIsRootUser => $warnIsRootUser,
 );
@@ -145,8 +148,16 @@ $template->param( table => $table );
 ## Koha time line code
 
 #get file location
-my $dir = C4::Context->config('intranetdir');
-open( my $file, "<", "$dir" . "/docs/history.txt" );
+my $docdir;
+if ( defined C4::Context->config('docdir') ) {
+    $docdir = C4::Context->config('docdir');
+} else {
+    # if no <docdir> is defined in koha-conf.xml, use the default location
+    # this is a work-around to stop breakage on upgraded Kohas, bug 8911
+    $docdir = C4::Context->config('intranetdir') . '/docs';
+}
+
+open( my $file, "<", "$docdir" . "/history.txt" );
 my $i = 0;
 
 my @rows2 = ();