Bug 18936: Fix warning about page about wrong lengthunit
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Wed, 22 Jan 2020 13:14:41 +0000 (14:14 +0100)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Tue, 4 Feb 2020 09:56:27 +0000 (09:56 +0000)
Signed-off-by: Minna Kivinen <minna.kivinen@hamk.fi>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

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

index 18293b5..42fe42f 100755 (executable)
--- a/about.pl
+++ b/about.pl
@@ -456,12 +456,9 @@ $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 => {} }
-    );
+    my $units = Koha::CirculationRules->search({ rule_name => 'lengthunit', rule_value => { -not_in => ['days', 'hours'] } });
 
-    if (@$units) {
+    if ( $units->count ) {
         $template->param(
             warnIssuingRules => 1,
             ir_units         => $units,
index 1c94254..1540b56 100644 (file)
                 [% FOREACH unit IN ir_units %]
                 <tr>
                     <th scope="row"><b>Warning</b></th>
-                    <td>The [% unit.branchcode | html %], [% unit.categorycode | html %], [% unit.itemtype | html %] 
-                        issuingrule will fallback to 'days' for 'lengthunit' as it is incorrectly defined as 
-                        [% unit.lengthunit | html %]. 
+                    <td>The [% unit.branchcode || 'branchcode=default' | html %], [% unit.categorycode || 'categorycode=default' | html %], [% unit.itemtype || 'itemtype=default' | html %]
+                        issuingrule will fallback to 'days' for 'lengthunit' as it is incorrectly defined as
+                        [% unit.rule_value | html %].
                     </td>
                 </tr>
                 [% END %]