From 3c2e40c224e1aac8628e994bb7e15170faea88e8 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 2 Jan 2020 11:26:49 +0100 Subject: [PATCH] Bug 24327: Add warning to the about page is AnonSugggestions but AnonymousPatron This patch adds a warning to the about page if AnonSuggestions is set but AnonymousPatron. Test plan: Turn on AnonSuggestions and set AnonymousPatron to 0 => You see a warning on the about page Turn on AnonSuggestions and set AnonymousPatron to an invalid value => You see a warning on the about page Turn off AnonSuggestions => No warning Turn on AnonSuggestions and set AnonymousPatron to a valid value => No warning Signed-off-by: hc Signed-off-by: Katrin Fischer Signed-off-by: Martin Renvoize --- about.pl | 22 ++++++++++++++----- .../intranet-tmpl/prog/en/modules/about.tt | 14 ++++++++---- 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/about.pl b/about.pl index dc6380099b..18293b5db4 100755 --- a/about.pl +++ b/about.pl @@ -159,13 +159,21 @@ my $warnPrefBiblioAddsAuthorities = ( $prefAutoCreateAuthorities && ( !$prefBibl my $prefEasyAnalyticalRecords = C4::Context->preference('EasyAnalyticalRecords'); my $prefUseControlNumber = C4::Context->preference('UseControlNumber'); my $warnPrefEasyAnalyticalRecords = ( $prefEasyAnalyticalRecords && $prefUseControlNumber ); -my $warnPrefAnonymousPatron = ( + +my $AnonymousPatron = C4::Context->preference('AnonymousPatron'); +my $warnPrefAnonymousPatronOPACPrivacy = ( C4::Context->preference('OPACPrivacy') - and not C4::Context->preference('AnonymousPatron') + and not $AnonymousPatron +); +my $warnPrefAnonymousPatronAnonSuggestions = ( + C4::Context->preference('AnonSuggestions') + and not $AnonymousPatron ); -my $anonymous_patron = Koha::Patrons->find( C4::Context->preference('AnonymousPatron') ); -my $warnPrefAnonymousPatron_PatronDoesNotExist = ( not $anonymous_patron and Koha::Patrons->search({ privacy => 2 })->count ); +my $anonymous_patron = Koha::Patrons->find( $AnonymousPatron ); +my $warnPrefAnonymousPatronAnonSuggestions_PatronDoesNotExist = ( $AnonymousPatron && C4::Context->preference('AnonSuggestions') && not $anonymous_patron ); + +my $warnPrefAnonymousPatronOPACPrivacy_PatronDoesNotExist = ( not $anonymous_patron and Koha::Patrons->search({ privacy => 2 })->count ); my $errZebraConnection = C4::Context->Zconn("biblioserver",0)->errcode(); @@ -520,8 +528,10 @@ $template->param( prefAutoCreateAuthorities => $prefAutoCreateAuthorities, warnPrefBiblioAddsAuthorities => $warnPrefBiblioAddsAuthorities, warnPrefEasyAnalyticalRecords => $warnPrefEasyAnalyticalRecords, - warnPrefAnonymousPatron => $warnPrefAnonymousPatron, - warnPrefAnonymousPatron_PatronDoesNotExist => $warnPrefAnonymousPatron_PatronDoesNotExist, + warnPrefAnonymousPatronOPACPrivacy => $warnPrefAnonymousPatronOPACPrivacy, + warnPrefAnonymousPatronAnonSuggestions => $warnPrefAnonymousPatronAnonSuggestions, + warnPrefAnonymousPatronOPACPrivacy_PatronDoesNotExist => $warnPrefAnonymousPatronOPACPrivacy_PatronDoesNotExist, + warnPrefAnonymousPatronAnonSuggestions_PatronDoesNotExist => $warnPrefAnonymousPatronAnonSuggestions_PatronDoesNotExist, errZebraConnection => $errZebraConnection, warnIsRootUser => $warnIsRootUser, warnNoActiveCurrency => $warnNoActiveCurrency, diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt index 11423f2f6b..c612e90b51 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 || warnPrefAnonymousPatron || warnPrefAnonymousPatron_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 %] [% 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.

@@ -246,7 +246,7 @@ [% END %] [% END %] - [% IF warnPrefBiblioAddsAuthorities || warnPrefEasyAnalyticalRecords || warnPrefAnonymousPatron || warnPrefAnonymousPatron_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 %]

Warnings regarding the system configuration

@@ -256,12 +256,18 @@ [% IF (warnPrefEasyAnalyticalRecords) %] [% END %] - [% IF warnPrefAnonymousPatron %] + [% IF warnPrefAnonymousPatronOPACPrivacy %] [% END %] - [% IF warnPrefAnonymousPatron_PatronDoesNotExist %] + [% IF warnPrefAnonymousPatronAnonSuggestions %] + + [% END %] + [% IF warnPrefAnonymousPatronOPACPrivacy_PatronDoesNotExist %] [% END %] + [% IF warnPrefAnonymousPatronAnonSuggestions_PatronDoesNotExist %] + + [% END %] [% IF warnNoActiveCurrency %] [% END %] -- 2.39.5
Preferences and parameters
Warning System preference 'EasyAnalyticalRecords' set, but UseControlNumber preference is set to 'Use'. Set it to 'Don't use' or else the 'Show analytics' links in the staff client and the OPAC will be broken.
Warning System preference 'OPACPrivacy' set, but AnonymousPatron preference is set to '0'. Set it to a valid borrower number if you want that this feature works correctly.
Warning System preference 'AnonSuggestions' set, but AnonymousPatron preference is set to '0'. Set it to a valid borrower number if you want that this feature works correctly.
Warning Some patrons have requested a privacy on returning item but the AnonymousPatron pref is not set correctly. Set it to a valid borrower number if you want that this feature works correctly.
Warning System preference 'AnonSuggestions' set, but AnonymousPatron preference is not set correctly. Set it to a valid borrower number if you want that this feature works correctly.
Warning No active currency is defined. Please go to Administration > Currencies and exchange rates and mark one currency as active.