Bugzilla – Attachment 161473 Details for
Bug 33452
Update patron statistics report
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 33452: Improve display of applied filters and results table
Bug-33452-Improve-display-of-applied-filters-and-r.patch (text/plain), 11.89 KB, created by
Lucas Gass (lukeg)
on 2024-01-25 23:43:02 UTC
(
hide
)
Description:
Bug 33452: Improve display of applied filters and results table
Filename:
MIME Type:
Creator:
Lucas Gass (lukeg)
Created:
2024-01-25 23:43:02 UTC
Size:
11.89 KB
patch
obsolete
>From 42068d63712e927b51a4fb4832aab8792d35c805 Mon Sep 17 00:00:00 2001 >From: Katrin Fischer <katrin.fischer.83@web.de> >Date: Sat, 13 Jan 2024 21:18:55 +0000 >Subject: [PATCH] Bug 33452: Improve display of applied filters and results > table > >This makes various improvements on the display of the results: > >* Filters didn't display the value that was filtered on >* Filter labels were not translatable >* Results table showed line/column using untranslatable codes >* Results table showed library and patron category codes > instead of descriptions > >To test: >* Use the various filters in the form >* Use various combinations of row/column >* Verify it all works as expected and display is much improved > >Note: >* In the filters, the code for extended patron attributs will > be used as label. >* In the results table only patron category codes and library > codes translate to descriptions. > Other values from pull downs haven't been implemented yet. > >Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> >--- > .../en/modules/reports/borrowers_stats.tt | 69 ++++++++++++++++--- > reports/borrowers_stats.pl | 32 +++++---- > 2 files changed, 78 insertions(+), 23 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/borrowers_stats.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/borrowers_stats.tt >index c3be44acf9..009f904e2a 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/borrowers_stats.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/borrowers_stats.tt >@@ -1,5 +1,8 @@ > [% USE raw %] >+[% USE KohaDates %] >+[% USE Categories %] > [% USE Branches %] >+[% USE AuthorisedValues %] > [% USE Koha %] > [% USE Asset %] > [% PROCESS 'i18n.inc' %] >@@ -53,18 +56,68 @@ > <h1>Patrons statistics</h1> > [% IF ( do_it ) %] > [% FOREACH mainloo IN mainloop %] >- [% IF ( mainloo.loopfilter.size>0 ) %] >+ [% IF ( mainloo.loopfilter.size > 0 ) %] > <p>Filtered on:</p> >- [% FOREACH loopfilte IN mainloo.loopfilter %] >- <p> >- [% loopfilte.crit | html %] = [% loopfilte.filter | html %] >- </p> >+ <ul> >+ [% FOREACH f IN mainloo.loopfilter %] >+ [% SWITCH f.crit %] >+ [% CASE 'category' %]<li>Patron category: [% Categories.GetName( f.filter ) | html %]</li> >+ [% CASE 'status' %] >+ <li><span>Patron status:</span> >+ [% SWITCH f.filter %] >+ [% CASE 'debarred' %]<span>Restricted</span> >+ [% CASE 'gonenoaddress' %]<span>Gone no address</span> >+ [% CASE 'lost' %]<span>Lost card</span> >+ [% CASE %]<span>[% f.filter | html %]</span> >+ [% END %] >+ </li> >+ [% CASE 'activity' %] >+ <li><span>Patron activity:</span> >+ [% SWITCH f.filter %] >+ [% CASE 'active' %]<span>Active<span> >+ [% CASE 'nonactive' %]<span>Not active</span> >+ [% END %] >+ </li> >+ [% CASE 'zip' %]<li>ZIP/Postal code: [% f.filter | html %]</li> >+ [% CASE 'library' %]<li>Library: [% Branches.GetName( f.filter ) | html %]</li> >+ [% CASE 'dob_from' %]<li>Date of birth (from): [% f.filter | $KohaDates %]</li> >+ [% CASE 'dob_to' %]<li>Date of birth (to): [% f.filter | $KohaDates %]</li> >+ [% CASE 'gender' %] >+ <li><span>Gender:</span> >+ [% SWITCH f.filter %] >+ [% CASE 'F' %]<span>Female<span> >+ [% CASE 'M' %]<span>Male</span> >+ [% CASE 'O' %][% tp('gender', 'Other') | html %] >+ [% CASE %]<span>[% f.filter | html %]</span> >+ [% END %] >+ </li> >+ [% CASE 'sort1' %]<li>Sort 1: [% AuthorisedValues.GetByCode('Bsort1', f.filter) | html %]</li> >+ [% CASE 'sort2' %]<li>Sort 2: [% AuthorisedValues.GetByCode('Bsort2', f.filter) | html %]</li> >+ [% CASE %] >+ [% IF f.crit.search("attribute_") %] >+ <li>[% f.crit.replace("attribute_","") | html %]: [% f.filter | html %]</li> >+ [% ELSE %] >+ <li>[% f.crit | html %]: [% f.filter | html %]</li> >+ [% END %] >+ [% END %] > [% END %] >+ </ul> > [% END %] > <div class="page-section"> > <table> > <tr> >- <th>[% mainloo.line | html %] / [% mainloo.column | html %]</th> >+ [%- BLOCK row_column -%] >+ [%- SWITCH code -%] >+ [%- CASE 'categorycode' -%]<span>Patron category</span> >+ [%- CASE 'zipcode' -%]<span>ZIP/Postal code</span> >+ [%- CASE 'branchcode' -%]<span>Library</span> >+ [%- CASE 'sex' -%]<span>Gender</span> >+ [%- CASE 'sort1' -%]<span>Sort 1</span> >+ [%- CASE 'sort2' -%]<span>Sort 2</span> >+ [%- CASE -%][% code | html %] >+ [%- END -%] >+ [%- END -%] >+ <th>[%- PROCESS row_column code=mainloo.line -%] / [%- PROCESS row_column code=mainloo.column -%]</th> > [% FOREACH loopco IN mainloo.loopcol %] > <th> > [% IF ( loopco.coltitle_display ) %][% loopco.coltitle_display | html %][% ELSE %][% loopco.coltitle | html %][% END %] >@@ -207,7 +260,7 @@ > <td colspan="2"></td> > <td> > <label for="from">From</label> >- <input type="text" size="10" id="from" name="Filter" class="flatpickr"data-date_to="to" /> >+ <input type="text" size="10" id="from" name="Filter" class="flatpickr" data-date_to="to" /> > <label for="to">To</label> > <input size="10" id="to" name="Filter" value="" type="text" class="flatpickr" /> > <span class="hint">[% INCLUDE 'date-format.inc' %]</span> >@@ -235,7 +288,7 @@ > <select id="sort1" name="Filter"> > <option value=""/> > [% FOREACH SORT1_LOO IN SORT1_LOOP %] >- <option value="[% SORT1_LOO.authorized_value | html %]">[% SORT1_LOO.lib | html %]</option> >+ <option value="[% SORT1_LOO.authorised_value | html %]">[% SORT1_LOO.lib | html %]</option> > [% END %] > </select> > </td> >diff --git a/reports/borrowers_stats.pl b/reports/borrowers_stats.pl >index 4e0f645999..b7136b874e 100755 >--- a/reports/borrowers_stats.pl >+++ b/reports/borrowers_stats.pl >@@ -181,34 +181,35 @@ sub calculate { > else { $colfilter = ''; } > > my @loopfilter; >- foreach my $i (0 .. scalar @$filters) { >- my %cell; >+ foreach my $i ( 0 .. scalar @$filters ) { > if ( @$filters[$i] ) { >- if ( $i == 0) { $cell{crit} = "Cat code"; } >- elsif ( $i == 1 ) { $cell{crit} = "ZIP/Postal code"; } >- elsif ( $i == 2 ) { $cell{crit} = "Branch code"; } >- elsif ( $i == 3 || >- $i == 4 ) { $cell{crit} = "Date of birth"; } >- elsif ( $i == 5 ) { $cell{crit} = "Sex"; } >- elsif ( $i == 6 ) { $cell{crit} = "Sort1"; } >- elsif ( $i == 7 ) { $cell{crit} = "Sort2"; } >- else { $cell{crit} = "Unknown"; } >+ my %cell = ( filter => @$filters[$i] ); >+ if ( $i == 0 ) { $cell{crit} = "category"; } >+ elsif ( $i == 1 ) { $cell{crit} = "zip"; } >+ elsif ( $i == 2 ) { $cell{crit} = "library"; } >+ elsif ( $i == 3 ) { $cell{crit} = "dob_from"; } >+ elsif ( $i == 4 ) { $cell{crit} = "dob_to"; } >+ elsif ( $i == 5 ) { $cell{crit} = "gender"; } >+ elsif ( $i == 6 ) { $cell{crit} = "sort1"; } >+ elsif ( $i == 7 ) { $cell{crit} = "sort2"; } >+ else { $cell{crit} = "unknown"; } > > push @loopfilter, \%cell; > } > } >+ > foreach my $type (keys %$attr_filters) { > if($attr_filters->{$type}) { > push @loopfilter, { >- crit => "Attribute $type", >+ crit => "attribute_$type", > filter => $attr_filters->{$type} > } > } > } > > my @branchcodes = Koha::Libraries->search->get_column('branchcode'); >- ($status ) and push @loopfilter,{crit=>"Status", filter=>$status }; >- ($activity) and push @loopfilter,{crit=>"Activity",filter=>$activity}; >+ ($status) and push @loopfilter, { crit => "status", filter => $status }; >+ ($activity) and push @loopfilter, { crit => "activity", filter => $activity }; > # year of activity > my ( $period_year, $period_month, $period_day )=Add_Delta_YM( Today(),-$period, 0); > my $newperioddate=$period_year."-".$period_month."-".$period_day; >@@ -254,6 +255,7 @@ sub calculate { > if ($celvalue) { > $cell{rowtitle} = $celvalue; > $cell{rowtitle_display} = ($patron_categories->find($celvalue)->description || "$celvalue\*") if ($line eq 'categorycode'); >+ $cell{rowtitle_display} = (Koha::Libraries->find($celvalue)->branchname || "$celvalue\*") if ($line eq 'branchcode'); > } > $cell{totalrow} = 0; > push @loopline, \%cell; >@@ -299,8 +301,8 @@ sub calculate { > my %cell; > if (defined $celvalue) { > $cell{coltitle} = $celvalue; >- # $cell{coltitle_display} = ($colfield eq 'branchcode') ? $branches->{$celvalue}->{branchname} : $celvalue; > $cell{coltitle_display} = $patron_categories->find($celvalue)->description if ($column eq 'categorycode'); >+ $cell{coltitle_display} = (Koha::Libraries->find($celvalue)->branchname || "$celvalue\*") if ($column eq 'branchcode'); > } > push @loopcol, \%cell; > } >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 33452
:
161021
|
161022
|
161023
|
161471
|
161472
| 161473