Bug 32588: Make filters on 'items with no checkouts' report translatable
authorKatrin Fischer <katrin.fischer.83@web.de>
Sat, 7 Jan 2023 02:11:48 +0000 (02:11 +0000)
committerTomas Cohen Arazi <tomascohen@theke.io>
Tue, 31 Jan 2023 13:59:33 +0000 (10:59 -0300)
This makes the filters on top of the 'items with no checkouts' report
translatable. The descriptions of the filters used the wrong terms and
were also pulled from the .pl file, making them untranslatable.

To test:
* Without patch: Run the 'items with no checkouts' report with various
  settigs.
* Verify, that the display on top doesn't use standard terminology
  Doc type = item type, Branch = library
* Apply patch
* Verify display is improved and standard terminology is used

If you know how to, you can also confirm strings show up nicely in
translations:
https://wiki.koha-community.org/wiki/Translating_Koha#Updating_the_po_files_in_your_installation

Signed-off-by: Frédéric Demians <f.demians@tamil.fr>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
koha-tmpl/intranet-tmpl/prog/en/modules/reports/catalogue_out.tt
reports/catalogue_out.pl

index 73060fd..cc4262d 100644 (file)
                     [% FOREACH mainloo IN mainloop %]
                         [% IF ( mainloo.loopfilter ) %]
                             <p>Filtered on:</p>
-                            [% FOREACH loopfilte IN mainloo.loopfilter %]
-                                [% IF ( loopfilte.err ) %]
-                                    <p class="error">Error:
-                                [% ELSE %]
-                                    <p>
-                                [% END %]
-                                [% IF ( loopfilte.sql ) %]
-                                    <span class="sql">
-                                        [% loopfilte.crit | html %] = [% loopfilte.filter | html %]
-                                    </span>
-                                [% ELSE %]
-                                    <span>[% loopfilte.crit | html %] = [% loopfilte.filter | html %]</span>
-                                    [% IF ( loopfilte.crit == "by" ) %]
-                                        [% group_by = loopfilte.filter %]
+                            <ul>
+                                [% FOREACH loopfilte IN mainloo.loopfilter %]
+                                    [% IF ( loopfilte.err ) %]
+                                        <p class="error">Error: [% loopfilte.filter | html %]</p>
+                                    [% ELSIF ( loopfilte.sql ) %]
+                                        <span class="sql">
+                                            [% loopfilte.crit | html %] = [% loopfilte.filter | html %]
+                                        </span>
+                                    [% ELSE %]
+                                        [% SWITCH loopfilte.crit %]
+                                            [% CASE 'homelibrary' %]<li>Home library: [% Branches.GetName( loopfilte.filter ) | html %]</li>
+                                            [% CASE 'itemtype' %]<li>Item type: [% ItemTypes.GetDescription( loopfilte.filter ) | html %]</li>
+                                            [% CASE 'limit' %]<li>Limit: [% loopfilte.filter | html %]</li>
+                                            [% CASE 'by' %]
+                                                <li>By:
+                                                    [% group_by = loopfilte.filter %]
+                                                    [% IF ( group_by == "homebranch") %]
+                                                        Home library
+                                                    [% ELSIF ( group_by == "itype" ) %]
+                                                        Item type
+                                                    [% ELSE %]
+                                                        None
+                                                    [% END %]
+                                                </li>
+                                            [% CASE %]<li>[% loopfilte.crit %]: [% loopfilte.filter | html %]</li>
+                                        [% END %]
                                     [% END %]
                                 [% END %]
-                                </p>
-                            [% END %]
+                            </ul>
                         [% END %]
 
                         [% IF ( mainloo.looptables ) %]
@@ -78,7 +89,7 @@
                                                 [% ELSIF ( group_by=="homebranch" ) %]
                                                     <a href="#table[% looptable.coltitle | uri %]">[% Branches.GetName( looptable.coltitle ) | html %]</a>
                                                 [% ELSE %]
-                                                    <a href="#table[% looptable.coltitle | uri %]">[% looptable.coltitle | html %]</a>
+                                                    <a href="#table[% looptable.coltitle | uri %]">Ungrouped</a>
                                                 [% END %]
                                             </td>
                                             <td>
index 5196179..c03dcb2 100755 (executable)
@@ -76,8 +76,8 @@ sub calculate {
             if ( ( $i == 1 ) and ( @$filters[ $i - 1 ] ) ) {
                 $cell{err} = 1 if ( @$filters[$i] < @$filters[ $i - 1 ] );
             }
-            $cell{crit} = "Branch"   if ( $i == 0 );
-            $cell{crit} = "Doc Type" if ( $i == 1 );
+            $cell{crit} = "homelibrary"   if ( $i == 0 );
+            $cell{crit} = "itemtype" if ( $i == 1 );
             push @loopfilter, \%cell;
         }
     }