From 0fc96cd9dcc1e3cd665e5397ddbae41270731e0d Mon Sep 17 00:00:00 2001 From: Katrin Fischer Date: Sun, 14 Jan 2024 00:24:14 +0000 Subject: [PATCH] Bug 35807: Improve display of appliced filters and results contents This makes various improvements to the display of the results: * Filters now display as a list. * If codes can be resolved into a description, this is done in the filters and results table for: * Home library * Item types (for both setting of item_level_ityes) * Collection * Shelving location * Not for loan status * The first cell displays a nice description for row/column filters that have been selected (X / Y) * Date formatting is used and date columns sort correctly for different DateFormat settings To test: * Verify above changes by testing several combinations of row / column combinations and filters Note: The "Count deleted items" option changes the search form and the data. Everything should still displa nicely if this is used. Note: Removes unused class 'hilighted' used for marking even/uneven cells in the past. --- .../en/modules/reports/catalogue_stats.tt | 103 +++++++++++++++--- reports/catalogue_stats.pl | 38 +++---- 2 files changed, 104 insertions(+), 37 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/catalogue_stats.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/catalogue_stats.tt index b112ed67f6..c31e0262e4 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/catalogue_stats.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/catalogue_stats.tt @@ -1,5 +1,8 @@ [% USE raw %] [% USE Branches %] +[% USE ItemTypes %] +[% USE AuthorisedValues %] +[% USE KohaDates %] [% PROCESS 'i18n.inc' %] [% SET footerjs = 1 %] [% INCLUDE 'doc-head-open.inc' %] @@ -46,20 +49,79 @@

Catalog statistics

[% IF ( do_it ) %] [% FOREACH mainloo IN mainloop %] - [% IF ( mainloo.loopfilter ) %] + [% IF ( mainloo.loopfilter.size > 0 ) %]

Filtered on:

- [% FOREACH loopfilte IN mainloo.loopfilter %] -

[% loopfilte.crit | html %] =[% loopfilte.filter | html %]

- [% END %] + [% END %]
- + [%- BLOCK row_column -%] + [%- SWITCH code -%] + [%- CASE ['items.itemcallnumber', 'deleteditems.itemcallnumber'] -%]Item call number + [%- CASE ['items.itype', 'deleteditems.itype', 'itemtype'] -%]Item type + [%- CASE 'publishercode' -%]Publisher + [%- CASE ['copyrightdate', 'publicationyear'] -%]Publication year + [%- CASE ['items.homebranch', 'deleteditems.homebranch'] -%]Home library + [%- CASE ['items.location', 'deleteditems.location'] -%]Shelving location + [%- CASE ['items.ccode', 'deleteditems.ccode'] -%]Collection + [%- CASE ['items.notforloan', 'deleteditems.notforloan'] -%]Not for loan + [%- CASE ['items.materials', 'deleteditems.materials'] -%]Materials specified + [%- CASE ['items.dateaccessioned', 'deleteditems.dateaccessioned'] -%]Date acquired + [%- CASE 'deleteditems.timestamp' -%]Date deleted + [%- CASE -%][% code | html %] + [%- END -%] + [%- END -%] + [%- BLOCK display_text -%] + [%- SWITCH type -%] + [%- CASE ['items.itype', 'deleteditems.itype', 'itemtype'] -%][% ItemTypes.GetDescription( code ) | html %] + [%- CASE ['items.homebranch', 'deleteditems.homebranch'] -%][% Branches.GetName( code ) | html %] + [%- CASE ['items.location', 'deleteditems.location'] -%] + [% IF code == "NULL" %] + No location + [% ELSE %] + [% AuthorisedValues.GetByCode('LOC', code) | html %] + [% END %] + [%- CASE ['items.ccode', 'deleteditems.ccode'] -%] + [% IF code == "NULL" %] + No collection + [% ELSE %] + [% AuthorisedValues.GetByCode('CCODE', code) | html %] + [% END %] + [%- CASE ['items.notforloan', 'deleteditems.notforloan'] -%][% IF code != 0 %][% AuthorisedValues.GetByCode('NOT_LOAN', code) | html %][% END %] + [%- CASE ['items.dateaccessioned', 'deleteditems.dateaccessioned', 'deleteditems.timestamp'] -%][% code | $KohaDates %] + [%- CASE -%][% IF code == "NULL" %]Empty[% ELSE %][% code | html %][% END %] + [%- END -%] + [%- END -%] + [% FOREACH loopco IN mainloo.loopcol %] - + [% END %] @@ -67,18 +129,23 @@ [% FOREACH loopro IN mainloo.looprow %] - [% IF ( loopro.hilighted ) %] - [% FOREACH loopcel IN loopro.loopcell %] - [% IF ( loopcel.hilighted ) %] - [% END %] - [% IF ( loopro.hilighted ) %] + [% FOREACH loopcel IN loopro.loopcell %] + + [% END %] + diff --git a/reports/catalogue_stats.pl b/reports/catalogue_stats.pl index b4d72a384b..51a33e72f4 100755 --- a/reports/catalogue_stats.pl +++ b/reports/catalogue_stats.pl @@ -184,7 +184,7 @@ sub calculate { # Checking filters # my @loopfilter; - for ( my $i = 0 ; $i <= @$filters ; $i++ ) { + foreach my $i ( 0 .. scalar @$filters ) { my %cell; if ( defined @$filters[$i] and @$filters[$i] ne '' and $i != 11 ) { if ( ( ( $i == 1 ) or ( $i == 5 ) ) and ( @$filters[ $i - 1 ] ) ) { @@ -192,24 +192,24 @@ sub calculate { } $cell{filter} .= @$filters[$i]; $cell{crit} .= - ( $i == 0 ) ? "Item CallNumber From" - : ( $i == 1 ) ? "Item CallNumber To" - : ( $i == 2 ) ? "Item type" - : ( $i == 3 ) ? "Publisher" - : ( $i == 4 ) ? "Publication year From" - : ( $i == 5 ) ? "Publication year To" - : ( $i == 6 ) ? "Library" - : ( $i == 7 ) ? "Shelving Location" - : ( $i == 8 ) ? "Collection Code" - : ( $i == 9 ) ? "Status" - : ( $i == 10 ) ? "Materials" - : ( $i == 12 and $filters->[11] == 0 ) ? "Barcode (not like)" - : ( $i == 12 and $filters->[11] == 1 ) ? "Barcode (like)" - : ( $i == 13 ) ? "Date acquired (item) from" - : ( $i == 14 ) ? "Date acquired (item) to" - : ( $i == 15 ) ? "Date deleted (item) from" - : ( $i == 16 ) ? "Date deleted (item) to" - : ''; + ( $i == 0 ) ? "callnum_from" + : ( $i == 1 ) ? "callnum_to" + : ( $i == 2 ) ? "itype" + : ( $i == 3 ) ? "publisher" + : ( $i == 4 ) ? "pubyear_from" + : ( $i == 5 ) ? "pubyear_to" + : ( $i == 6 ) ? "library" + : ( $i == 7 ) ? "location" + : ( $i == 8 ) ? "collection" + : ( $i == 9 ) ? "nfl_status" + : ( $i == 10 ) ? "materials" + : ( $i == 12 and $filters->[11] == 0 ) ? "barcode_unlike" + : ( $i == 12 and $filters->[11] == 1 ) ? "barcode_like" + : ( $i == 13 ) ? "acquired_from" + : ( $i == 14 ) ? "acquired_to" + : ( $i == 15 ) ? "deleted_from" + : ( $i == 16 ) ? "deleted_to" + : ''; push @loopfilter, \%cell; } -- 2.30.2
[% mainloo.line | html %] / [% mainloo.column | html %][%- PROCESS row_column code=mainloo.line -%] / [%- PROCESS row_column code=mainloo.column -%][% loopco.coltitle | html %] + [%- PROCESS display_text code=loopco.coltitle type=mainloo.column -%] + TOTAL
[% ELSE %][% END %] - [% loopro.rowtitle | html %][% ELSE %][% END %] - [% IF ( loopcel.value ) %] - [% loopcel.value | html %] - [% ELSE %] -   - [% END %] - [% ELSE %][% END %] + [% IF mainloo.line.search(".dateaccessioned") || mainloo.line == "deleteditems.timestamp" %] + + [% ELSE %] + + [% END %] + [%- PROCESS display_text code=loopro.rowtitle type=mainloo.line -%] + + [% IF ( loopcel.value ) %] + [% loopcel.value | html %] + [% ELSE %] +   + [% END %] + [% loopro.totalrow | html %]