3 # Copyright Pat Eyler 2003
4 # Copyright Biblibre 2006
5 # Parts Copyright Liblime 2008
6 # Parts Copyright Chris Nighswonger 2010
8 # This file is part of Koha.
10 # Koha is free software; you can redistribute it and/or modify it
11 # under the terms of the GNU General Public License as published by
12 # the Free Software Foundation; either version 3 of the License, or
13 # (at your option) any later version.
15 # Koha is distributed in the hope that it will be useful, but
16 # WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 # GNU General Public License for more details.
20 # You should have received a copy of the GNU General Public License
21 # along with Koha; if not, see <http://www.gnu.org/licenses>.
26 use List
::MoreUtils qw
/ any /;
38 use Koha
::Config
::SysPrefs
;
39 use C4
::Members
::Statistics
;
41 #use Smart::Comments '####';
44 my ( $template, $loggedinuser, $cookie ) = get_template_and_user
(
46 template_name
=> "about.tt",
50 flagsrequired
=> { catalogue
=> 1 },
57 $perl_path .= $Config{_exe
} unless $perl_path =~ m/$Config{_exe}$/i;
60 my $zebraVersion = `zebraidx -V`;
62 # Check running PSGI env
63 if ( any
{ /(^psgi\.|^plack\.)/i } keys %ENV ) {
66 psgi_server
=> ($ENV{ PLACK_ENV
}) ?
"Plack ($ENV{PLACK_ENV})" :
67 ($ENV{ MOD_PERL
}) ?
"mod_perl ($ENV{MOD_PERL})" :
72 # Additional system information for warnings
74 my $warnStatisticsFieldsError;
75 my $prefStatisticsFields = C4
::Context
->preference('StatisticsFields');
76 if ($prefStatisticsFields) {
77 $warnStatisticsFieldsError = $prefStatisticsFields
78 unless ( $prefStatisticsFields eq C4
::Members
::Statistics
->get_fields() );
81 my $prefAutoCreateAuthorities = C4
::Context
->preference('AutoCreateAuthorities');
82 my $prefBiblioAddsAuthorities = C4
::Context
->preference('BiblioAddsAuthorities');
83 my $warnPrefBiblioAddsAuthorities = ( $prefAutoCreateAuthorities && ( !$prefBiblioAddsAuthorities) );
85 my $prefEasyAnalyticalRecords = C4
::Context
->preference('EasyAnalyticalRecords');
86 my $prefUseControlNumber = C4
::Context
->preference('UseControlNumber');
87 my $warnPrefEasyAnalyticalRecords = ( $prefEasyAnalyticalRecords && $prefUseControlNumber );
88 my $warnPrefAnonymousPatron = (
89 C4
::Context
->preference('OPACPrivacy')
90 and not C4
::Context
->preference('AnonymousPatron')
93 my $anonymous_patron = Koha
::Borrowers
->find( C4
::Context
->preference('AnonymousPatron') );
94 my $warnPrefAnonymousPatron_PatronDoesNotExist = ( not $anonymous_patron and Koha
::Borrowers
->search({ privacy
=> 2 })->count );
96 my $errZebraConnection = C4
::Context
->Zconn("biblioserver",0)->errcode();
98 my $warnIsRootUser = (! $loggedinuser);
100 my $warnNoActiveCurrency = (! defined C4
::Budgets
->GetCurrency());
101 my @xml_config_warnings;
103 my $context = new C4
::Context
;
105 if ( ! defined C4
::Context
->config('zebra_bib_index_mode') ) {
106 push @xml_config_warnings, {
107 error
=> 'zebra_bib_index_mode_warn'
109 if ($context->{'server'}->{'biblioserver'}->{'config'} !~ /zebra-biblios-dom.cfg/) {
110 push @xml_config_warnings, {
111 error
=> 'zebra_bib_mode_seems_grs1'
115 push @xml_config_warnings, {
116 error
=> 'zebra_bib_mode_seems_dom'
120 push @xml_config_warnings, { error
=> 'zebra_bib_grs_warn' }
121 if C4
::Context
->config('zebra_bib_index_mode') eq 'grs1';
124 if ( (C4
::Context
->config('zebra_bib_index_mode') eq 'dom') &&
125 ($context->{'server'}->{'biblioserver'}->{'config'} !~ /zebra-biblios-dom.cfg/) ) {
127 push @xml_config_warnings, {
128 error
=> 'zebra_bib_index_mode_mismatch_warn'
132 if ( (C4
::Context
->config('zebra_bib_index_mode') eq 'grs1') &&
133 ($context->{'server'}->{'biblioserver'}->{'config'} =~ /zebra-biblios-dom.cfg/) ) {
135 push @xml_config_warnings, {
136 error
=> 'zebra_bib_index_mode_mismatch_warn'
140 if ( ! defined C4
::Context
->config('zebra_auth_index_mode') ) {
141 push @xml_config_warnings, {
142 error
=> 'zebra_auth_index_mode_warn'
144 if ($context->{'server'}->{'authorityserver'}->{'config'} !~ /zebra-authorities-dom.cfg/) {
145 push @xml_config_warnings, {
146 error
=> 'zebra_auth_mode_seems_grs1'
150 push @xml_config_warnings, {
151 error
=> 'zebra_auth_mode_seems_dom'
155 push @xml_config_warnings, { error
=> 'zebra_auth_grs_warn' }
156 if C4
::Context
->config('zebra_auth_index_mode') eq 'grs1';
159 if ( (C4
::Context
->config('zebra_auth_index_mode') eq 'dom') && ($context->{'server'}->{'authorityserver'}->{'config'} !~ /zebra-authorities-dom.cfg/) ) {
160 push @xml_config_warnings, {
161 error
=> 'zebra_auth_index_mode_mismatch_warn'
165 if ( (C4
::Context
->config('zebra_auth_index_mode') eq 'grs1') && ($context->{'server'}->{'authorityserver'}->{'config'} =~ /zebra-authorities-dom.cfg/) ) {
166 push @xml_config_warnings, {
167 error
=> 'zebra_auth_index_mode_mismatch_warn'
171 if ( ! defined C4
::Context
->config('log4perl_conf') ) {
172 push @xml_config_warnings, {
173 error
=> 'log4perl_entry_missing'
177 if ( ! defined C4
::Context
->config('upload_path') ) {
178 if ( Koha
::Config
::SysPrefs
->find('OPACBaseURL')->value ) {
179 # OPACBaseURL seems to be set
180 push @xml_config_warnings, {
181 error
=> 'uploadpath_entry_missing'
184 push @xml_config_warnings, {
185 error
=> 'uploadpath_and_opacbaseurl_entry_missing'
190 # Test QueryParser configuration sanity
191 if ( C4
::Context
->preference( 'UseQueryParser' ) ) {
192 # Get the QueryParser configuration file name
193 my $queryparser_file = C4
::Context
->config( 'queryparser_config' );
194 my $queryparser_fallback_file = '/etc/koha/searchengine/queryparser.yaml';
195 # Check QueryParser is functional
196 my $QParser = C4
::Context
->queryparser();
197 my $queryparser_error = {};
198 if ( ! defined $QParser || ref($QParser) ne 'Koha::QueryParser::Driver::PQF' ) {
199 # Error initializing the QueryParser object
200 # Get the used queryparser.yaml file path to report the user
201 $queryparser_error->{ fallback
} = ( defined $queryparser_file ) ?
0 : 1;
202 $queryparser_error->{ file
} = ( defined $queryparser_file )
204 : $queryparser_fallback_file;
205 # Report error data to the template
206 $template->param( QueryParserError
=> $queryparser_error );
208 # Check for an absent queryparser_config entry in koha-conf.xml
209 if ( ! defined $queryparser_file ) {
210 # Not an error but a warning for the missing entry in koha-conf-xml
211 push @xml_config_warnings, {
212 error
=> 'queryparser_entry_missing',
213 file
=> $queryparser_fallback_file
219 # Test Zebra facets configuration
220 if ( !defined C4
::Context
->config('use_zebra_facets') ) {
221 push @xml_config_warnings, { error
=> 'use_zebra_facets_entry_missing' };
223 if ( C4
::Context
->config('use_zebra_facets') &&
224 C4
::Context
->config('zebra_bib_index_mode') ) {
225 # use_zebra_facets works with DOM
226 push @xml_config_warnings, {
227 error
=> 'use_zebra_facets_needs_dom'
228 } if C4
::Context
->config('zebra_bib_index_mode') ne 'dom' ;
232 # Sco Patron should not contain any other perms than circulate => self_checkout
233 if ( C4
::Context
->preference('WebBasedSelfCheck')
234 and C4
::Context
->preference('AutoSelfCheckAllowed')
236 my $userid = C4
::Context
->preference('AutoSelfCheckID');
237 my $all_permissions = C4
::Auth
::get_user_subpermissions
( $userid );
238 my ( $has_self_checkout_perm, $has_other_permissions );
239 while ( my ( $module, $permissions ) = each %$all_permissions ) {
240 if ( $module eq 'circulate' ) {
241 while ( my ( $permission, $flag ) = each %$permissions ) {
242 if ( $permission eq 'self_checkout' ) {
243 $has_self_checkout_perm = 1;
245 $has_other_permissions = 1;
249 $has_other_permissions = 1;
253 AutoSelfCheckPatronDoesNotHaveSelfCheckPerm
=> not ( $has_self_checkout_perm ),
254 AutoSelfCheckPatronHasTooManyPerm
=> $has_other_permissions,
260 my %versions = C4
::Context
::get_versions
();
263 kohaVersion
=> $versions{'kohaVersion'},
264 osVersion
=> $versions{'osVersion'},
265 perlPath
=> $perl_path,
266 perlVersion
=> $versions{'perlVersion'},
267 perlIncPath
=> [ map { perlinc
=> $_ }, @INC ],
268 mysqlVersion
=> $versions{'mysqlVersion'},
269 apacheVersion
=> $versions{'apacheVersion'},
270 zebraVersion
=> $zebraVersion,
271 prefBiblioAddsAuthorities
=> $prefBiblioAddsAuthorities,
272 prefAutoCreateAuthorities
=> $prefAutoCreateAuthorities,
273 warnPrefBiblioAddsAuthorities
=> $warnPrefBiblioAddsAuthorities,
274 warnPrefEasyAnalyticalRecords
=> $warnPrefEasyAnalyticalRecords,
275 warnPrefAnonymousPatron
=> $warnPrefAnonymousPatron,
276 warnPrefAnonymousPatron_PatronDoesNotExist
=> $warnPrefAnonymousPatron_PatronDoesNotExist,
277 errZebraConnection
=> $errZebraConnection,
278 warnIsRootUser
=> $warnIsRootUser,
279 warnNoActiveCurrency
=> $warnNoActiveCurrency,
280 xml_config_warnings
=> \
@xml_config_warnings,
281 warnStatisticsFieldsError
=> $warnStatisticsFieldsError,
286 my $perl_modules = C4
::Installer
::PerlModules
->new;
287 $perl_modules->version_info;
289 my @pm_types = qw(missing_pm upgrade_pm current_pm);
291 foreach my $pm_type(@pm_types) {
292 my $modules = $perl_modules->get_attr($pm_type);
293 foreach (@
$modules) {
294 my ($module, $stats) = each %$_;
299 version
=> $stats->{'cur_ver'},
300 missing
=> ($pm_type eq 'missing_pm' ?
1 : 0),
301 upgrade
=> ($pm_type eq 'upgrade_pm' ?
1 : 0),
302 current
=> ($pm_type eq 'current_pm' ?
1 : 0),
303 require => $stats->{'required'},
304 reqversion
=> $stats->{'min_ver'},
310 @components = sort {$a->{'name'} cmp $b->{'name'}} @components;
315 foreach (@components) {
317 unless (++$counter % 4) {
318 push (@
$table, {row
=> $row});
322 # Processing the last line (if there are any modules left)
323 if (scalar(@
$row) > 0) {
324 # Extending $row to the table size
326 # Pushing the last line
327 push (@
$table, {row
=> $row});
331 $template->param( table
=> $table );
334 ## ------------------------------------------
335 ## Koha time line code
339 if ( defined C4
::Context
->config('docdir') ) {
340 $docdir = C4
::Context
->config('docdir');
342 # if no <docdir> is defined in koha-conf.xml, use the default location
343 # this is a work-around to stop breakage on upgraded Kohas, bug 8911
344 $docdir = C4
::Context
->config('intranetdir') . '/docs';
347 if ( open( my $file, "<:encoding(UTF-8)", "$docdir" . "/history.txt" ) ) {
357 shift @lines; #remove header row
360 my ( $date, $desc, $tag ) = split(/\t/);
361 if(!$desc && $date=~ /(?<=\d{4})\s+/) {
362 ($date, $desc)= ($`, $');
374 #foreach my $row2 (@rows2) {
377 push( @$table2, { row2 => $row2 } );
381 $template->param( table2 => $table2 );
383 $template->param( timeline_read_error => 1 );
386 output_html_with_http_headers $query, $cookie, $template->output;