From 2a1406c4766e43460dd3bf8c99c0636b51e9c7c4 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 22 Jul 2020 16:43:38 +0200 Subject: [PATCH] Bug 25826: Add a warning to the about page This patch adds a warning to the about page if the biblionumber field is hidden at the OPAC or staff interface. Test plan: Hide the biblionumber to some framework Confirm that there is a warning on the about page Signed-off-by: Tomas Cohen Arazi Signed-off-by: Nick Clemens Signed-off-by: Jonathan Druart --- about.pl | 28 +++++++++++++++++++ .../intranet-tmpl/prog/en/modules/about.tt | 16 +++++++++-- 2 files changed, 42 insertions(+), 2 deletions(-) diff --git a/about.pl b/about.pl index b44e5313bd..029bd94833 100755 --- a/about.pl +++ b/about.pl @@ -43,6 +43,7 @@ use C4::Installer::PerlModules; use Koha; use Koha::DateUtils qw(dt_from_string output_pref); use Koha::Acquisition::Currencies; +use Koha::BiblioFrameworks; use Koha::Patron::Categories; use Koha::Patrons; use Koha::Caches; @@ -50,6 +51,7 @@ use Koha::Config::SysPrefs; use Koha::Illrequest::Config; use Koha::SearchEngine::Elasticsearch; use Koha::Logger; +use Koha::Filter::MARC::ViewPolicy; use C4::Members::Statistics; @@ -525,6 +527,32 @@ $template->param( 'bad_yaml_prefs' => \@bad_yaml_prefs ) if @bad_yaml_prefs; and not C4::Context->config('bcrypt_settings'); } +{ + my @frameworkcodes = Koha::BiblioFrameworks->search->get_column('frameworkcode'); + my @hidden_biblionumbers; + push @frameworkcodes, ""; # it's not in the biblio_frameworks table! + for my $frameworkcode ( @frameworkcodes ) { + my $shouldhidemarc_opac = Koha::Filter::MARC::ViewPolicy->should_hide_marc( + { + frameworkcode => $frameworkcode, + interface => "opac" + } + ); + push @hidden_biblionumbers, { frameworkcode => $frameworkcode, interface => 'opac' } + if $shouldhidemarc_opac->{biblionumber}; + + my $shouldhidemarc_intranet = Koha::Filter::MARC::ViewPolicy->should_hide_marc( + { + frameworkcode => $frameworkcode, + interface => "intranet" + } + ); + push @hidden_biblionumbers, { frameworkcode => $frameworkcode, interface => 'intranet' } + if $shouldhidemarc_intranet->{biblionumber}; + } + $template->param( warnHiddenBiblionumbers => \@hidden_biblionumbers ); +} + my %versions = C4::Context::get_versions(); $template->param( diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt index 70ed9b183f..e4402d30b3 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt @@ -184,7 +184,7 @@
- [% IF warnPrefBiblioAddsAuthorities || warnPrefEasyAnalyticalRecords || warnPrefAnonymousPatronOPACPrivacy || warnPrefAnonymousPatronAnonSuggestions || warnPrefAnonymousPatronOPACPrivacy_PatronDoesNotExist || warnPrefAnonymousPatronAnonSuggestions_PatronDoesNotExist || warnNoActiveCurrency || warnIsRootUser || xml_config_warnings.size || AutoSelfCheckPatronDoesNotHaveSelfCheckPerm || AutoSelfCheckPatronHasTooManyPerm || warnStatisticsFieldsError || warnNoTemplateCaching || warnILLConfiguration || has_ai_issues || oauth2_missing_deps || bad_yaml_prefs || warnRelationships || log4perl_errors || config_bcrypt_settings_no_set %] + [% IF warnPrefBiblioAddsAuthorities || warnPrefEasyAnalyticalRecords || warnPrefAnonymousPatronOPACPrivacy || warnPrefAnonymousPatronAnonSuggestions || warnPrefAnonymousPatronOPACPrivacy_PatronDoesNotExist || warnPrefAnonymousPatronAnonSuggestions_PatronDoesNotExist || warnNoActiveCurrency || warnIsRootUser || xml_config_warnings.size || AutoSelfCheckPatronDoesNotHaveSelfCheckPerm || AutoSelfCheckPatronHasTooManyPerm || warnStatisticsFieldsError || warnNoTemplateCaching || warnILLConfiguration || has_ai_issues || oauth2_missing_deps || bad_yaml_prefs || warnRelationships || log4perl_errors || config_bcrypt_settings_no_set || warnHiddenBiblionumbers.size %] [% IF (warnIsRootUser) %]

Warning regarding current user

You are logged in as the database administrative user. This is not recommended because some parts of Koha will not function as expected when using this account.

@@ -259,7 +259,7 @@ [% END %] [% END %] - [% IF warnPrefBiblioAddsAuthorities || warnPrefEasyAnalyticalRecords || warnPrefAnonymousPatronOPACPrivacy || warnPrefAnonymousPatronAnonSuggestions || warnPrefAnonymousPatronOPACPrivacy_PatronDoesNotExist || warnPrefAnonymousPatronAnonSuggestions_PatronDoesNotExist || warnNoActiveCurrency || AutoSelfCheckPatronDoesNotHaveSelfCheckPerm || AutoSelfCheckPatronHasTooManyPerm || warnStatisticsFieldsError || warnNoTemplateCaching || warnILLConfiguration || oauth2_missing_deps || bad_yaml_prefs || warnIssuingRules || config_bcrypt_settings_no_set %] + [% IF warnPrefBiblioAddsAuthorities || warnPrefEasyAnalyticalRecords || warnPrefAnonymousPatronOPACPrivacy || warnPrefAnonymousPatronAnonSuggestions || warnPrefAnonymousPatronOPACPrivacy_PatronDoesNotExist || warnPrefAnonymousPatronAnonSuggestions_PatronDoesNotExist || warnNoActiveCurrency || AutoSelfCheckPatronDoesNotHaveSelfCheckPerm || AutoSelfCheckPatronHasTooManyPerm || warnStatisticsFieldsError || warnNoTemplateCaching || warnILLConfiguration || oauth2_missing_deps || bad_yaml_prefs || warnIssuingRules || config_bcrypt_settings_no_set || warnHiddenBiblionumbers.size %]

Warnings regarding the system configuration

@@ -340,6 +340,18 @@ System preference 'Pseudonymization' is set, but there is not 'bcrypt_settings' entry defined in the $KOHA_CONF file. [% END %] + [% IF config_bcrypt_settings_no_set %] + + [% END %] + [% IF warnHiddenBiblionumbers.size %] + + [% END %]
Preferences and parameters
Warning + System preference 'Pseudonymization' is set, but there is not 'bcrypt_settings' entry defined in the $KOHA_CONF file. +
Warning + [% FOR w IN warnHiddenBiblionumbers %] + Biblio framework "[% w.frameworkcode %]" has the biblionumber field hidden at the interface [% w.interface %]
+ [% END %] +
[% END %] -- 2.39.5