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>.
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 # Additional system information for warnings
64 my $warnStatisticsFieldsError;
65 my $prefStatisticsFields = C4::Context->preference('StatisticsFields');
66 if ($prefStatisticsFields) {
67 $warnStatisticsFieldsError = $prefStatisticsFields
68 unless ( $prefStatisticsFields eq C4::Members::Statistics->get_fields() );
71 my $prefAutoCreateAuthorities = C4::Context->preference('AutoCreateAuthorities');
72 my $prefBiblioAddsAuthorities = C4::Context->preference('BiblioAddsAuthorities');
73 my $warnPrefBiblioAddsAuthorities = ( $prefAutoCreateAuthorities && ( !$prefBiblioAddsAuthorities) );
75 my $prefEasyAnalyticalRecords = C4::Context->preference('EasyAnalyticalRecords');
76 my $prefUseControlNumber = C4::Context->preference('UseControlNumber');
77 my $warnPrefEasyAnalyticalRecords = ( $prefEasyAnalyticalRecords && $prefUseControlNumber );
78 my $warnPrefAnonymousPatron = (
79 C4::Context->preference('OPACPrivacy')
80 and not C4::Context->preference('AnonymousPatron')
83 my $anonymous_patron = Koha::Borrowers->find( C4::Context->preference('AnonymousPatron') );
84 my $warnPrefAnonymousPatron_PatronDoesNotExist = ( not $anonymous_patron and Koha::Borrowers->search({ privacy => 2 })->count );
86 my $errZebraConnection = C4::Context->Zconn("biblioserver",0)->errcode();
88 my $warnIsRootUser = (! $loggedinuser);
90 my $warnNoActiveCurrency = (! defined C4::Budgets->GetCurrency());
91 my @xml_config_warnings;
93 my $context = new C4::Context;
95 if ( ! defined C4::Context->config('zebra_bib_index_mode') ) {
96 push @xml_config_warnings, {
97 error => 'zebra_bib_index_mode_warn'
99 if ($context->{'server'}->{'biblioserver'}->{'config'} !~ /zebra-biblios-dom.cfg/) {
100 push @xml_config_warnings, {
101 error => 'zebra_bib_mode_seems_grs1'
105 push @xml_config_warnings, {
106 error => 'zebra_bib_mode_seems_dom'
110 push @xml_config_warnings, { error => 'zebra_bib_grs_warn' }
111 if C4::Context->config('zebra_bib_index_mode') eq 'grs1';
114 if ( (C4::Context->config('zebra_bib_index_mode') eq 'dom') &&
115 ($context->{'server'}->{'biblioserver'}->{'config'} !~ /zebra-biblios-dom.cfg/) ) {
117 push @xml_config_warnings, {
118 error => 'zebra_bib_index_mode_mismatch_warn'
122 if ( (C4::Context->config('zebra_bib_index_mode') eq 'grs1') &&
123 ($context->{'server'}->{'biblioserver'}->{'config'} =~ /zebra-biblios-dom.cfg/) ) {
125 push @xml_config_warnings, {
126 error => 'zebra_bib_index_mode_mismatch_warn'
130 if ( ! defined C4::Context->config('zebra_auth_index_mode') ) {
131 push @xml_config_warnings, {
132 error => 'zebra_auth_index_mode_warn'
134 if ($context->{'server'}->{'authorityserver'}->{'config'} !~ /zebra-authorities-dom.cfg/) {
135 push @xml_config_warnings, {
136 error => 'zebra_auth_mode_seems_grs1'
140 push @xml_config_warnings, {
141 error => 'zebra_auth_mode_seems_dom'
145 push @xml_config_warnings, { error => 'zebra_auth_grs_warn' }
146 if C4::Context->config('zebra_auth_index_mode') eq 'grs1';
149 if ( (C4::Context->config('zebra_auth_index_mode') eq 'dom') && ($context->{'server'}->{'authorityserver'}->{'config'} !~ /zebra-authorities-dom.cfg/) ) {
150 push @xml_config_warnings, {
151 error => 'zebra_auth_index_mode_mismatch_warn'
155 if ( (C4::Context->config('zebra_auth_index_mode') eq 'grs1') && ($context->{'server'}->{'authorityserver'}->{'config'} =~ /zebra-authorities-dom.cfg/) ) {
156 push @xml_config_warnings, {
157 error => 'zebra_auth_index_mode_mismatch_warn'
161 # Test QueryParser configuration sanity
162 if ( C4::Context->preference( 'UseQueryParser' ) ) {
163 # Get the QueryParser configuration file name
164 my $queryparser_file = C4::Context->config( 'queryparser_config' );
165 my $queryparser_fallback_file = '/etc/koha/searchengine/queryparser.yaml';
166 # Check QueryParser is functional
167 my $QParser = C4::Context->queryparser();
168 my $queryparser_error = {};
169 if ( ! defined $QParser || ref($QParser) ne 'Koha::QueryParser::Driver::PQF' ) {
170 # Error initializing the QueryParser object
171 # Get the used queryparser.yaml file path to report the user
172 $queryparser_error->{ fallback } = ( defined $queryparser_file ) ? 0 : 1;
173 $queryparser_error->{ file } = ( defined $queryparser_file )
175 : $queryparser_fallback_file;
176 # Report error data to the template
177 $template->param( QueryParserError => $queryparser_error );
179 # Check for an absent queryparser_config entry in koha-conf.xml
180 if ( ! defined $queryparser_file ) {
181 # Not an error but a warning for the missing entry in koha-conf-xml
182 push @xml_config_warnings, {
183 error => 'queryparser_entry_missing',
184 file => $queryparser_fallback_file
190 # Test Zebra facets configuration
191 if ( !defined C4::Context->config('use_zebra_facets') ) {
192 push @xml_config_warnings, { error => 'use_zebra_facets_entry_missing' };
194 if ( C4::Context->config('use_zebra_facets') &&
195 C4::Context->config('zebra_bib_index_mode') ) {
196 # use_zebra_facets works with DOM
197 push @xml_config_warnings, {
198 error => 'use_zebra_facets_needs_dom'
199 } if C4::Context->config('zebra_bib_index_mode') ne 'dom' ;
203 # Sco Patron should not contain any other perms than circulate => self_checkout
204 if ( C4::Context->preference('WebBasedSelfCheck')
205 and C4::Context->preference('AutoSelfCheckAllowed')
207 my $userid = C4::Context->preference('AutoSelfCheckID');
208 my $all_permissions = C4::Auth::get_user_subpermissions( $userid );
209 my ( $has_self_checkout_perm, $has_other_permissions );
210 while ( my ( $module, $permissions ) = each %$all_permissions ) {
211 if ( $module eq 'circulate' ) {
212 while ( my ( $permission, $flag ) = each %$permissions ) {
213 if ( $permission eq 'self_checkout' ) {
214 $has_self_checkout_perm = 1;
216 $has_other_permissions = 1;
220 $has_other_permissions = 1;
224 AutoSelfCheckPatronDoesNotHaveSelfCheckPerm => not ( $has_self_checkout_perm ),
225 AutoSelfCheckPatronHasTooManyPerm => $has_other_permissions,
231 my %versions = C4::Context::get_versions();
234 kohaVersion => $versions{'kohaVersion'},
235 osVersion => $versions{'osVersion'},
236 perlPath => $perl_path,
237 perlVersion => $versions{'perlVersion'},
238 perlIncPath => [ map { perlinc => $_ }, @INC ],
239 mysqlVersion => $versions{'mysqlVersion'},
240 apacheVersion => $versions{'apacheVersion'},
241 zebraVersion => $zebraVersion,
242 prefBiblioAddsAuthorities => $prefBiblioAddsAuthorities,
243 prefAutoCreateAuthorities => $prefAutoCreateAuthorities,
244 warnPrefBiblioAddsAuthorities => $warnPrefBiblioAddsAuthorities,
245 warnPrefEasyAnalyticalRecords => $warnPrefEasyAnalyticalRecords,
246 warnPrefAnonymousPatron => $warnPrefAnonymousPatron,
247 warnPrefAnonymousPatron_PatronDoesNotExist => $warnPrefAnonymousPatron_PatronDoesNotExist,
248 errZebraConnection => $errZebraConnection,
249 warnIsRootUser => $warnIsRootUser,
250 warnNoActiveCurrency => $warnNoActiveCurrency,
251 xml_config_warnings => \@xml_config_warnings,
252 warnStatisticsFieldsError => $warnStatisticsFieldsError,
257 my $perl_modules = C4::Installer::PerlModules->new;
258 $perl_modules->version_info;
260 my @pm_types = qw(missing_pm upgrade_pm current_pm);
262 foreach my $pm_type(@pm_types) {
263 my $modules = $perl_modules->get_attr($pm_type);
264 foreach (@$modules) {
265 my ($module, $stats) = each %$_;
270 version => $stats->{'cur_ver'},
271 missing => ($pm_type eq 'missing_pm' ? 1 : 0),
272 upgrade => ($pm_type eq 'upgrade_pm' ? 1 : 0),
273 current => ($pm_type eq 'current_pm' ? 1 : 0),
274 require => $stats->{'required'},
275 reqversion => $stats->{'min_ver'},
281 @components = sort {$a->{'name'} cmp $b->{'name'}} @components;
286 foreach (@components) {
288 unless (++$counter % 4) {
289 push (@$table, {row => $row});
293 # Processing the last line (if there are any modules left)
294 if (scalar(@$row) > 0) {
295 # Extending $row to the table size
297 # Pushing the last line
298 push (@$table, {row => $row});
302 $template->param( table => $table );
305 ## ------------------------------------------
306 ## Koha time line code
310 if ( defined C4::Context->config('docdir') ) {
311 $docdir = C4::Context->config('docdir');
313 # if no <docdir> is defined in koha-conf.xml, use the default location
314 # this is a work-around to stop breakage on upgraded Kohas, bug 8911
315 $docdir = C4::Context->config('intranetdir') . '/docs';
318 if ( open( my $file, "<:encoding(UTF-8)", "$docdir" . "/history.txt" ) ) {
328 shift @lines; #remove header row
331 my ( $date, $desc, $tag ) = split(/\t/);
332 if(!$desc && $date=~ /(?<=\d{4})\s+/) {
333 ($date, $desc)= ($`, $');
345 #foreach my $row2 (@rows2) {
348 push( @$table2, { row2 => $row2 } );
352 $template->param( table2 => $table2 );
354 $template->param( timeline_read_error => 1 );
357 output_html_with_http_headers $query, $cookie, $template->output;