From 6b8748248b6ef27783a222bbed83da9e5207fd7a 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: Andrew Fuerste-Henry --- about.pl | 28 +++++++++++++++++++ .../intranet-tmpl/prog/en/modules/about.tt | 11 ++++++-- 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/about.pl b/about.pl index fdf5fa567b..e7785aeddc 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; @@ -518,6 +520,32 @@ $template->param( 'bad_yaml_prefs' => \@bad_yaml_prefs ) if @bad_yaml_prefs; } } +{ + 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 b3b7b4cd81..07e0d02535 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt @@ -187,7 +187,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 %] + [% 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 || 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.

@@ -262,7 +262,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 %] + [% IF warnPrefBiblioAddsAuthorities || warnPrefEasyAnalyticalRecords || warnPrefAnonymousPatronOPACPrivacy || warnPrefAnonymousPatronAnonSuggestions || warnPrefAnonymousPatronOPACPrivacy_PatronDoesNotExist || warnPrefAnonymousPatronAnonSuggestions_PatronDoesNotExist || warnNoActiveCurrency || AutoSelfCheckPatronDoesNotHaveSelfCheckPerm || AutoSelfCheckPatronHasTooManyPerm || warnStatisticsFieldsError || warnNoTemplateCaching || warnILLConfiguration || oauth2_missing_deps || bad_yaml_prefs || warnIssuingRules || warnHiddenBiblionumbers.size %]

Warnings regarding the system configuration

@@ -344,6 +344,13 @@ [% END %] + [% IF warnHiddenBiblionumbers.size %] + + [% END %]
Preferences and parameters
Warning + [% FOR w IN warnHiddenBiblionumbers %] + Biblio framework "[% w.frameworkcode %]" has the biblionumber field hidden at the interface [% w.interface %]
+ [% END %] +
[% END %] -- 2.39.5