Browse Source

Bug 28125: Display a warning on the about page for OPACHiddenItems is needed

If OPACHiddenItems is containing badly construct it will lead to
inconsistent behaviours. For instance the holds view will not display
any items, when the detail page will display all of them (because we are
not using the same code, we are in transition to merge it).

This patch suggests to add a warning to the about page in case the query
generated by Koha::Items->filter_by_visible_in_opac produces a warning

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Bug 28125: (QA follow-up) Fix missing filter

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
21.05.x
Jonathan Druart 3 years ago
parent
commit
71574961f7
  1. 5
      about.pl
  2. 7
      koha-tmpl/intranet-tmpl/prog/en/modules/about.tt
  3. 8
      t/db_dependent/Koha/Items.t

5
about.pl

@ -201,6 +201,10 @@ my $warnPrefAnonymousPatronOPACPrivacy_PatronDoesNotExist = ( not $anonymous_pat
my $warnPrefKohaAdminEmailAddress = not Email::Valid->address(C4::Context->preference('KohaAdminEmailAddress'));
my $c = Koha::Items->filter_by_visible_in_opac->count;
my @warnings = C4::Context->dbh->selectrow_array('SHOW WARNINGS');
my $warnPrefOpacHiddenItems = $warnings[2];
my $invalid_yesno = Koha::Config::SysPrefs->search(
{
type => 'YesNo',
@ -601,6 +605,7 @@ $template->param(
warnPrefAnonymousPatronOPACPrivacy_PatronDoesNotExist => $warnPrefAnonymousPatronOPACPrivacy_PatronDoesNotExist,
warnPrefAnonymousPatronAnonSuggestions_PatronDoesNotExist => $warnPrefAnonymousPatronAnonSuggestions_PatronDoesNotExist,
warnPrefKohaAdminEmailAddress => $warnPrefKohaAdminEmailAddress,
warnPrefOpacHiddenItems => $warnPrefOpacHiddenItems,
errZebraConnection => $errZebraConnection,
warnIsRootUser => $warnIsRootUser,
warnNoActiveCurrency => $warnNoActiveCurrency,

7
koha-tmpl/intranet-tmpl/prog/en/modules/about.tt

@ -215,7 +215,7 @@
</div>
<div id="sysinfo">
[% IF warnPrefBiblioAddsAuthorities || warnPrefEasyAnalyticalRecords || warnPrefAnonymousPatronOPACPrivacy || warnPrefAnonymousPatronAnonSuggestions || warnPrefAnonymousPatronOPACPrivacy_PatronDoesNotExist || warnPrefAnonymousPatronAnonSuggestions_PatronDoesNotExist || warnPrefKohaAdminEmailAddress || invalid_yesno.count || 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 || warnConnectBroker %]
[% IF warnPrefBiblioAddsAuthorities || warnPrefEasyAnalyticalRecords || warnPrefAnonymousPatronOPACPrivacy || warnPrefAnonymousPatronAnonSuggestions || warnPrefAnonymousPatronOPACPrivacy_PatronDoesNotExist || warnPrefAnonymousPatronAnonSuggestions_PatronDoesNotExist || warnPrefKohaAdminEmailAddress || warnPrefOpacHiddenItems || invalid_yesno.count || 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 || warnConnectBroker %]
[% IF (warnIsRootUser) %]
<h2>Warning regarding current user</h2>
<p>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.</p>
@ -299,7 +299,7 @@
Contact your system administrator.
[% END %]
[% IF warnPrefBiblioAddsAuthorities || warnPrefEasyAnalyticalRecords || warnPrefAnonymousPatronOPACPrivacy || warnPrefAnonymousPatronAnonSuggestions || warnPrefAnonymousPatronOPACPrivacy_PatronDoesNotExist || warnPrefAnonymousPatronAnonSuggestions_PatronDoesNotExist || warnPrefKohaAdminEmailAddress || invalid_yesno.count || warnNoActiveCurrency || AutoSelfCheckPatronDoesNotHaveSelfCheckPerm || AutoSelfCheckPatronHasTooManyPerm || warnStatisticsFieldsError || warnNoTemplateCaching || warnILLConfiguration || oauth2_missing_deps || bad_yaml_prefs || warnIssuingRules || config_bcrypt_settings_no_set || warnHiddenBiblionumbers.size || paypal_enabled %]
[% IF warnPrefBiblioAddsAuthorities || warnPrefEasyAnalyticalRecords || warnPrefAnonymousPatronOPACPrivacy || warnPrefAnonymousPatronAnonSuggestions || warnPrefAnonymousPatronOPACPrivacy_PatronDoesNotExist || warnPrefAnonymousPatronAnonSuggestions_PatronDoesNotExist || warnPrefKohaAdminEmailAddress || warnPrefOpacHiddenItems || invalid_yesno.count || warnNoActiveCurrency || AutoSelfCheckPatronDoesNotHaveSelfCheckPerm || AutoSelfCheckPatronHasTooManyPerm || warnStatisticsFieldsError || warnNoTemplateCaching || warnILLConfiguration || oauth2_missing_deps || bad_yaml_prefs || warnIssuingRules || config_bcrypt_settings_no_set || warnHiddenBiblionumbers.size || paypal_enabled %]
<h2>Warnings regarding the system configuration</h2>
<table>
<caption>Preferences and parameters</caption>
@ -324,6 +324,9 @@
[% IF warnPrefKohaAdminEmailAddress %]
<tr><th scope="row"><strong>Warning</strong> </th><td>System preference 'KohaAdminEmailAddress' does not contain a valid email address. Emails will not be sent.</td></tr>
[% END %]
[% IF warnPrefOpacHiddenItems %]
<tr><th scope="row"><strong>Warning</strong> </th><td>System preference 'OpacHiddenItems' generates a warning and will produce unexpected behaviors: [% warnPrefOpacHiddenItems | html %]</th></tr>
[% END %]
[% IF invalid_yesno.count %]
[% FOR p IN invalid_yesno %]
<tr><th scope="row"><strong>Warning</strong> </th><td>System preference '[% p.variable | html %]' must be '0' or '1', but is [% IF p.value.defined %]'[% p.value | html%]'[% ELSE %]NULL[% END %].</td></tr>

8
t/db_dependent/Koha/Items.t

@ -1494,7 +1494,7 @@ $schema->storage->txn_rollback;
subtest 'filter_by_visible_in_opac() tests' => sub {
plan tests => 11;
plan tests => 12;
$schema->storage->txn_begin;
@ -1641,6 +1641,12 @@ subtest 'filter_by_visible_in_opac() tests' => sub {
'The right item is returned'
);
# Make sure the warning on the about page will work
$rules = { itemlost => ['AB'] };
my $c = Koha::Items->filter_by_visible_in_opac->count;
my @warnings = C4::Context->dbh->selectrow_array('SHOW WARNINGS');
is( $warnings[2], q{Truncated incorrect DOUBLE value: 'AB'});
$schema->storage->txn_rollback;
};

Loading…
Cancel
Save