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 /;
37 use Koha
::Acquisition
::Currencies
;
39 use Koha
::Config
::SysPrefs
;
40 use C4
::Members
::Statistics
;
42 #use Smart::Comments '####';
45 my ( $template, $loggedinuser, $cookie ) = get_template_and_user
(
47 template_name
=> "about.tt",
51 flagsrequired
=> { catalogue
=> 1 },
58 $perl_path .= $Config{_exe
} unless $perl_path =~ m/$Config{_exe}$/i;
61 my $zebraVersion = `zebraidx -V`;
63 # Check running PSGI env
64 if ( any
{ /(^psgi\.|^plack\.)/i } keys %ENV ) {
67 psgi_server
=> ($ENV{ PLACK_ENV
}) ?
"Plack ($ENV{PLACK_ENV})" :
68 ($ENV{ MOD_PERL
}) ?
"mod_perl ($ENV{MOD_PERL})" :
73 # Additional system information for warnings
75 my $warnStatisticsFieldsError;
76 my $prefStatisticsFields = C4
::Context
->preference('StatisticsFields');
77 if ($prefStatisticsFields) {
78 $warnStatisticsFieldsError = $prefStatisticsFields
79 unless ( $prefStatisticsFields eq C4
::Members
::Statistics
->get_fields() );
82 my $prefAutoCreateAuthorities = C4
::Context
->preference('AutoCreateAuthorities');
83 my $prefBiblioAddsAuthorities = C4
::Context
->preference('BiblioAddsAuthorities');
84 my $warnPrefBiblioAddsAuthorities = ( $prefAutoCreateAuthorities && ( !$prefBiblioAddsAuthorities) );
86 my $prefEasyAnalyticalRecords = C4
::Context
->preference('EasyAnalyticalRecords');
87 my $prefUseControlNumber = C4
::Context
->preference('UseControlNumber');
88 my $warnPrefEasyAnalyticalRecords = ( $prefEasyAnalyticalRecords && $prefUseControlNumber );
89 my $warnPrefAnonymousPatron = (
90 C4
::Context
->preference('OPACPrivacy')
91 and not C4
::Context
->preference('AnonymousPatron')
94 my $anonymous_patron = Koha
::Patrons
->find( C4
::Context
->preference('AnonymousPatron') );
95 my $warnPrefAnonymousPatron_PatronDoesNotExist = ( not $anonymous_patron and Koha
::Patrons
->search({ privacy
=> 2 })->count );
97 my $errZebraConnection = C4
::Context
->Zconn("biblioserver",0)->errcode();
99 my $warnIsRootUser = (! $loggedinuser);
101 my $warnNoActiveCurrency = (! defined Koha
::Acquisition
::Currencies
->get_active);
102 my @xml_config_warnings;
104 my $context = new C4
::Context
;
106 if ( ! defined C4
::Context
->config('zebra_bib_index_mode') ) {
107 push @xml_config_warnings, {
108 error
=> 'zebra_bib_index_mode_warn'
110 if ($context->{'server'}->{'biblioserver'}->{'config'} !~ /zebra-biblios-dom.cfg/) {
111 push @xml_config_warnings, {
112 error
=> 'zebra_bib_mode_seems_grs1'
116 push @xml_config_warnings, {
117 error
=> 'zebra_bib_mode_seems_dom'
121 push @xml_config_warnings, { error
=> 'zebra_bib_grs_warn' }
122 if C4
::Context
->config('zebra_bib_index_mode') eq 'grs1';
125 if ( (C4
::Context
->config('zebra_bib_index_mode') eq 'dom') &&
126 ($context->{'server'}->{'biblioserver'}->{'config'} !~ /zebra-biblios-dom.cfg/) ) {
128 push @xml_config_warnings, {
129 error
=> 'zebra_bib_index_mode_mismatch_warn'
133 if ( (C4
::Context
->config('zebra_bib_index_mode') eq 'grs1') &&
134 ($context->{'server'}->{'biblioserver'}->{'config'} =~ /zebra-biblios-dom.cfg/) ) {
136 push @xml_config_warnings, {
137 error
=> 'zebra_bib_index_mode_mismatch_warn'
141 if ( ! defined C4
::Context
->config('zebra_auth_index_mode') ) {
142 push @xml_config_warnings, {
143 error
=> 'zebra_auth_index_mode_warn'
145 if ($context->{'server'}->{'authorityserver'}->{'config'} !~ /zebra-authorities-dom.cfg/) {
146 push @xml_config_warnings, {
147 error
=> 'zebra_auth_mode_seems_grs1'
151 push @xml_config_warnings, {
152 error
=> 'zebra_auth_mode_seems_dom'
156 push @xml_config_warnings, { error
=> 'zebra_auth_grs_warn' }
157 if C4
::Context
->config('zebra_auth_index_mode') eq 'grs1';
160 if ( (C4
::Context
->config('zebra_auth_index_mode') eq 'dom') && ($context->{'server'}->{'authorityserver'}->{'config'} !~ /zebra-authorities-dom.cfg/) ) {
161 push @xml_config_warnings, {
162 error
=> 'zebra_auth_index_mode_mismatch_warn'
166 if ( (C4
::Context
->config('zebra_auth_index_mode') eq 'grs1') && ($context->{'server'}->{'authorityserver'}->{'config'} =~ /zebra-authorities-dom.cfg/) ) {
167 push @xml_config_warnings, {
168 error
=> 'zebra_auth_index_mode_mismatch_warn'
172 if ( ! defined C4
::Context
->config('log4perl_conf') ) {
173 push @xml_config_warnings, {
174 error
=> 'log4perl_entry_missing'
178 if ( ! defined C4
::Context
->config('upload_path') ) {
179 if ( Koha
::Config
::SysPrefs
->find('OPACBaseURL')->value ) {
180 # OPACBaseURL seems to be set
181 push @xml_config_warnings, {
182 error
=> 'uploadpath_entry_missing'
185 push @xml_config_warnings, {
186 error
=> 'uploadpath_and_opacbaseurl_entry_missing'
191 # Test QueryParser configuration sanity
192 if ( C4
::Context
->preference( 'UseQueryParser' ) ) {
193 # Get the QueryParser configuration file name
194 my $queryparser_file = C4
::Context
->config( 'queryparser_config' );
195 my $queryparser_fallback_file = '/etc/koha/searchengine/queryparser.yaml';
196 # Check QueryParser is functional
197 my $QParser = C4
::Context
->queryparser();
198 my $queryparser_error = {};
199 if ( ! defined $QParser || ref($QParser) ne 'Koha::QueryParser::Driver::PQF' ) {
200 # Error initializing the QueryParser object
201 # Get the used queryparser.yaml file path to report the user
202 $queryparser_error->{ fallback
} = ( defined $queryparser_file ) ?
0 : 1;
203 $queryparser_error->{ file
} = ( defined $queryparser_file )
205 : $queryparser_fallback_file;
206 # Report error data to the template
207 $template->param( QueryParserError
=> $queryparser_error );
209 # Check for an absent queryparser_config entry in koha-conf.xml
210 if ( ! defined $queryparser_file ) {
211 # Not an error but a warning for the missing entry in koha-conf-xml
212 push @xml_config_warnings, {
213 error
=> 'queryparser_entry_missing',
214 file
=> $queryparser_fallback_file
220 # Test Zebra facets configuration
221 if ( !defined C4
::Context
->config('use_zebra_facets') ) {
222 push @xml_config_warnings, { error
=> 'use_zebra_facets_entry_missing' };
224 if ( C4
::Context
->config('use_zebra_facets') &&
225 C4
::Context
->config('zebra_bib_index_mode') ) {
226 # use_zebra_facets works with DOM
227 push @xml_config_warnings, {
228 error
=> 'use_zebra_facets_needs_dom'
229 } if C4
::Context
->config('zebra_bib_index_mode') ne 'dom' ;
233 # Sco Patron should not contain any other perms than circulate => self_checkout
234 if ( C4
::Context
->preference('WebBasedSelfCheck')
235 and C4
::Context
->preference('AutoSelfCheckAllowed')
237 my $userid = C4
::Context
->preference('AutoSelfCheckID');
238 my $all_permissions = C4
::Auth
::get_user_subpermissions
( $userid );
239 my ( $has_self_checkout_perm, $has_other_permissions );
240 while ( my ( $module, $permissions ) = each %$all_permissions ) {
241 if ( $module eq 'circulate' ) {
242 while ( my ( $permission, $flag ) = each %$permissions ) {
243 if ( $permission eq 'self_checkout' ) {
244 $has_self_checkout_perm = 1;
246 $has_other_permissions = 1;
250 $has_other_permissions = 1;
254 AutoSelfCheckPatronDoesNotHaveSelfCheckPerm
=> not ( $has_self_checkout_perm ),
255 AutoSelfCheckPatronHasTooManyPerm
=> $has_other_permissions,
261 my %versions = C4
::Context
::get_versions
();
264 kohaVersion
=> $versions{'kohaVersion'},
265 osVersion
=> $versions{'osVersion'},
266 perlPath
=> $perl_path,
267 perlVersion
=> $versions{'perlVersion'},
268 perlIncPath
=> [ map { perlinc
=> $_ }, @INC ],
269 mysqlVersion
=> $versions{'mysqlVersion'},
270 apacheVersion
=> $versions{'apacheVersion'},
271 zebraVersion
=> $zebraVersion,
272 prefBiblioAddsAuthorities
=> $prefBiblioAddsAuthorities,
273 prefAutoCreateAuthorities
=> $prefAutoCreateAuthorities,
274 warnPrefBiblioAddsAuthorities
=> $warnPrefBiblioAddsAuthorities,
275 warnPrefEasyAnalyticalRecords
=> $warnPrefEasyAnalyticalRecords,
276 warnPrefAnonymousPatron
=> $warnPrefAnonymousPatron,
277 warnPrefAnonymousPatron_PatronDoesNotExist
=> $warnPrefAnonymousPatron_PatronDoesNotExist,
278 errZebraConnection
=> $errZebraConnection,
279 warnIsRootUser
=> $warnIsRootUser,
280 warnNoActiveCurrency
=> $warnNoActiveCurrency,
281 xml_config_warnings
=> \
@xml_config_warnings,
282 warnStatisticsFieldsError
=> $warnStatisticsFieldsError,
287 my $perl_modules = C4
::Installer
::PerlModules
->new;
288 $perl_modules->versions_info;
290 my @pm_types = qw(missing_pm upgrade_pm current_pm);
292 foreach my $pm_type(@pm_types) {
293 my $modules = $perl_modules->get_attr($pm_type);
294 foreach (@
$modules) {
295 my ($module, $stats) = each %$_;
300 version
=> $stats->{'cur_ver'},
301 missing
=> ($pm_type eq 'missing_pm' ?
1 : 0),
302 upgrade
=> ($pm_type eq 'upgrade_pm' ?
1 : 0),
303 current
=> ($pm_type eq 'current_pm' ?
1 : 0),
304 require => $stats->{'required'},
305 reqversion
=> $stats->{'min_ver'},
311 @components = sort {$a->{'name'} cmp $b->{'name'}} @components;
316 foreach (@components) {
318 unless (++$counter % 4) {
319 push (@
$table, {row
=> $row});
323 # Processing the last line (if there are any modules left)
324 if (scalar(@
$row) > 0) {
325 # Extending $row to the table size
327 # Pushing the last line
328 push (@
$table, {row
=> $row});
332 $template->param( table
=> $table );
335 ## ------------------------------------------
336 ## Koha time line code
340 if ( defined C4
::Context
->config('docdir') ) {
341 $docdir = C4
::Context
->config('docdir');
343 # if no <docdir> is defined in koha-conf.xml, use the default location
344 # this is a work-around to stop breakage on upgraded Kohas, bug 8911
345 $docdir = C4
::Context
->config('intranetdir') . '/docs';
348 if ( open( my $file, "<:encoding(UTF-8)", "$docdir" . "/history.txt" ) ) {
358 shift @lines; #remove header row
361 my ( $date, $desc, $tag ) = split(/\t/);
362 if(!$desc && $date=~ /(?<=\d{4})\s+/) {
363 ($date, $desc)= ($`, $');
375 #foreach my $row2 (@rows2) {
378 push( @$table2, { row2 => $row2 } );
382 $template->param( table2 => $table2 );
384 $template->param( timeline_read_error => 1 );
387 output_html_with_http_headers $query, $cookie, $template->output;