From 7de1a7ba75caa43ee34520e19f8f753f11542b9a 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 (cherry picked from commit 6b8748248b6ef27783a222bbed83da9e5207fd7a) Signed-off-by: Victor Grousset/tuxayo --- 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 9df3dd46a4..3cb0d9c5d1 100755 --- a/about.pl +++ b/about.pl @@ -42,12 +42,14 @@ use C4::Installer; 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; use Koha::Config::SysPrefs; use Koha::Illrequest::Config; use Koha::SearchEngine::Elasticsearch; +use Koha::Filter::MARC::ViewPolicy; use C4::Members::Statistics; @@ -516,6 +518,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 7a0955b271..37eebe443a 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 || QueryParserError || warnIsRootUser || xml_config_warnings.size || AutoSelfCheckPatronDoesNotHaveSelfCheckPerm || AutoSelfCheckPatronHasTooManyPerm || warnStatisticsFieldsError || warnNoTemplateCaching || warnILLConfiguration || has_ai_issues || oauth2_missing_deps || bad_yaml_prefs || warnRelationships %] + [% IF warnPrefBiblioAddsAuthorities || warnPrefEasyAnalyticalRecords || warnPrefAnonymousPatronOPACPrivacy || warnPrefAnonymousPatronAnonSuggestions || warnPrefAnonymousPatronOPACPrivacy_PatronDoesNotExist || warnPrefAnonymousPatronAnonSuggestions_PatronDoesNotExist || warnNoActiveCurrency || QueryParserError || warnIsRootUser || xml_config_warnings.size || AutoSelfCheckPatronDoesNotHaveSelfCheckPerm || AutoSelfCheckPatronHasTooManyPerm || warnStatisticsFieldsError || warnNoTemplateCaching || warnILLConfiguration || has_ai_issues || oauth2_missing_deps || bad_yaml_prefs || warnRelationships || 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.

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

Warnings regarding the system configuration

@@ -343,6 +343,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