From 1aae63606caeb389a40bd644b1f9e30917325573 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Fri, 16 Aug 2019 12:17:42 +0100 Subject: [PATCH] Bug 23445: (RM follow-up) Add warning for unexpected lengthunit Discussions on this bug highlighted worries about behind the scenes fallbacks to 'days' as a lengthunit should the lengthunit be set to an unrecognised value. This patch adds a warning to the about page for any such occurrences so librarians may be made aware of and resolve the issue. Signed-off-by: Martin Renvoize --- about.pl | 16 ++++++++++++++++ .../intranet-tmpl/prog/en/modules/about.tt | 17 ++++++++++++++++- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/about.pl b/about.pl index dacd39db2d..4738c32ad0 100755 --- a/about.pl +++ b/about.pl @@ -444,6 +444,22 @@ $template->param( 'bad_yaml_prefs' => \@bad_yaml_prefs ) if @bad_yaml_prefs; ); } } + +# Circ rule warnings +{ + my $dbh = C4::Context->dbh; + my $units = $dbh->selectall_arrayref( + q|SELECT branchcode, categorycode, itemtype, lengthunit FROM issuingrules WHERE lengthunit NOT IN ( 'days', 'hours' ); |, + { Slice => {} } + ); + + if (@$units) { + $template->param( + warnIssuingRules => 1, + ir_units => $units, + ); + } +} 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 60ce4ac21d..e935a74ca4 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt @@ -229,7 +229,7 @@
[% END %] - [% IF warnPrefBiblioAddsAuthorities || warnPrefEasyAnalyticalRecords || warnPrefAnonymousPatron || warnPrefAnonymousPatron_PatronDoesNotExist || warnNoActiveCurrency || QueryParserError || AutoSelfCheckPatronDoesNotHaveSelfCheckPerm || AutoSelfCheckPatronHasTooManyPerm || warnStatisticsFieldsError || warnNoTemplateCaching || warnILLConfiguration || oauth2_missing_deps || bad_yaml_prefs %] + [% IF warnPrefBiblioAddsAuthorities || warnPrefEasyAnalyticalRecords || warnPrefAnonymousPatron || warnPrefAnonymousPatron_PatronDoesNotExist || warnNoActiveCurrency || QueryParserError || AutoSelfCheckPatronDoesNotHaveSelfCheckPerm || AutoSelfCheckPatronHasTooManyPerm || warnStatisticsFieldsError || warnNoTemplateCaching || warnILLConfiguration || oauth2_missing_deps || bad_yaml_prefs || warnIssuingRules %]

Warnings regarding the system configuration

@@ -383,6 +383,21 @@
Preferences and parameters
[% END %] + [% IF warnIssuingRules %] + + + [% FOREACH unit IN ir_units %] + + + + + [% END %] +
Issuing rules
WarningThe [% unit.branchcode | html %], [% unit.categorycode | html %], [% unit.itemtype %] + issuingrule will fallback to 'days' for 'lengthunit' as it is incorrectly defined as + [% unit.lengthunit | html %]. +
+ [% END %] + [% ELSE %]

No warnings.

[% END %] -- 2.39.5