Bugzilla – Attachment 167248 Details for
Bug 36585
Patrons with the most checkouts Report when outputting to CSV doesn't have the total
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
improve bor_issues_top report
0001-Bug-36585-improve-bor_issues_top-report.patch (text/plain), 6.42 KB, created by
Michael Hafen
on 2024-05-29 19:52:34 UTC
(
hide
)
Description:
improve bor_issues_top report
Filename:
MIME Type:
Creator:
Michael Hafen
Created:
2024-05-29 19:52:34 UTC
Size:
6.42 KB
patch
obsolete
>From 32b3f63095d230a12fde89a5efab7c979a1078f0 Mon Sep 17 00:00:00 2001 >From: Michael Hafen <michael.hafen@washk12.org> >Date: Thu, 11 Apr 2024 16:33:39 -0600 >Subject: [PATCH] Bug 36585: improve bor_issues_top report >Content-Type: text/plain; charset="utf-8" > >Try the following with and without a group by, specifically item type. > >1. Generate the report with output to screen with a group by. >2. Observe that the patron name is repeated for each column group. >3. Observe that there is no total column. >4. Generate the report with output to csv. >5. Observe that the total check outs is not in the csv. >6. Apply patch. restart Koha. >7. Generate the report to csv again. >8. Observe that the total checkouts is in the csv. >9. Generate the report to screen again. >10. Observe that there is a total column and the patron name is only in one >column. >--- > .../prog/en/modules/reports/bor_issues_top.tt | 15 +++--- > reports/bor_issues_top.pl | 50 +++++++++++-------- > 2 files changed, 36 insertions(+), 29 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/bor_issues_top.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/bor_issues_top.tt >index c867cc5b35..f79f801912 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/bor_issues_top.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/bor_issues_top.tt >@@ -86,13 +86,14 @@ > <table> > <tr> > <th rowspan="2">Rank</th> >+ <th rowspan="2">Patron</th> >+ <th rowspan="2">Total</th> > [% FOREACH loopco IN mainloo.loopcol %] >- <th colspan="2">[% loopco.coltitle | html %]</th> >+ <th>[% loopco.coltitle | html %]</th> > [% END %] > </tr> > <tr> > [% FOREACH loopco IN mainloo.loopcol %] >- <th>Patron</th> > <th>Checkout count</th> > [% END %] > </tr> >@@ -100,13 +101,13 @@ > <tr> > [% IF ( loopro.hilighted ) %]<td>[% ELSE %]<td>[% END %] > [% loopro.rowtitle | html %]</td> >+ [% IF ( loopro.hilighted ) %]<td>[% ELSE %]<td>[% END %] >+ [% IF ( loopro.reference ) %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% loopro.reference | uri %]">[% END %] >+ [% IF ( loopro.patron ) %][% loopro.patron | html %][% END %] >+ [% IF ( loopro.reference ) %]</a>[% END %] >+ </td> > [% FOREACH loopcel IN loopro.loopcell %] > [% IF ( loopcel.hilighted ) %]<td>[% ELSE %]<td>[% END %] >- [% IF ( loopcel.reference ) %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% loopcel.reference | uri %]">[% END %] >- [% IF ( loopcel.value ) %][% loopcel.value | html %][% END %] >- [% IF ( loopcel.reference ) %]</a>[% END %] >- </td> >- [% IF ( loopcel.hilighted ) %]<td>[% ELSE %]<td>[% END %] > [% IF ( loopcel.count ) %][% loopcel.count | html %][% END %] > </td> > [% END %] >diff --git a/reports/bor_issues_top.pl b/reports/bor_issues_top.pl >index 439db23810..617b3c9703 100755 >--- a/reports/bor_issues_top.pl >+++ b/reports/bor_issues_top.pl >@@ -68,23 +68,25 @@ if ($do_it) { > -filename=>"$basename.csv" ); > my $cols = @$results[0]->{loopcol}; > my $lines = @$results[0]->{looprow}; >-# header top-right >+# header top-left > print @$results[0]->{line} ."/". @$results[0]->{column} .$sep; >+ print "Patron".$sep; >+ print "Total".$sep; > # Other header > print join($sep, map {$_->{coltitle}} @$cols); >- print $sep . "Total\n"; >+ print "\n"; > # Table > foreach my $line ( @$lines ) { > my $x = $line->{loopcell}; > print $line->{rowtitle}.$sep; >- print join($sep, map {$_->{value}} @$x); >- print $sep,$line->{totalrow}; >+ print '"'.$line->{patron}.'"'.$sep; >+ print join($sep, map {$_->{count}} @$x); > print "\n"; > } > # footer > print "TOTAL"; > $cols = @$results[0]->{loopfooter}; >- print join($sep, map {$_->{totalcol}} @$cols); >+ print join($sep, map {$_->{total}} @$cols); > print $sep.@$results[0]->{total}; > } > exit; >@@ -148,7 +150,7 @@ sub calculate { > my $colorder; > if ($column){ > $column = "old_issues." .$column if (($column=~/branchcode/) or ($column=~/timestamp/)); >- $column = "biblioitems.".$column if $column=~/itemtype/; >+ $column = "items.itype" if $column=~/itemtype/; > $column = "borrowers." .$column if $column=~/categorycode/; > my @colfilter ; > if ($column =~ /timestamp/) { >@@ -245,7 +247,7 @@ sub calculate { > 'old_issues.returndate >', > 'old_issues.returndate <', > 'old_issues.branchcode like', >- 'biblioitems.itemtype like', >+ 'items.itype like', > 'borrowers.categorycode like', > ); > foreach ((@$filters)[0..9]) { >@@ -309,24 +311,28 @@ sub calculate { > foreach my $id (@ranked_ids) { > my @loopcell; > >- foreach my $key (@cols_in_order) { >- if($column){ >- push @loopcell, { >- value => $patrons{$id}->{name}, >- reference => $id, >- count => $patrons{$id}->{allcols}->{$key}, >- }; >- }else{ >- push @loopcell, { >- value => $patrons{$id}->{name}, >- reference => $id, >- count => $patrons{$id}->{total}, >- }; >- } >+ if($column){ >+ # Total >+ push @loopcell, { >+ count => $patrons{$id}->{total}, >+ }; >+ foreach my $key (@cols_in_order) { >+ push @loopcell, { >+ count => $patrons{$id}->{allcols}->{$key}, >+ }; >+ $grantotal += $patrons{$id}->{allcols}->{$key}; >+ } >+ }else{ >+ push @loopcell, { >+ count => $patrons{$id}->{total}, >+ }; >+ $grantotal += $patrons{$id}->{total}; > } > push @looprow,{ 'rowtitle' => $i++ , > 'loopcell' => \@loopcell, > 'hilighted' => ($i%2), >+ 'patron' => $patrons{$id}->{name}, >+ 'reference' => $id, > }; > # use a limit, if a limit is defined > last if $i > $limit and $limit >@@ -336,7 +342,7 @@ sub calculate { > $globalline{loopfilter}=\@loopfilter; > # the core of the table > $globalline{looprow} = \@looprow; >- $globalline{loopcol} = [ map {{coltitle=>$_}} @cols_in_order ]; >+ $globalline{loopcol} = [ map {{coltitle=>$_}} @cols_in_order ] if ($column); > # the foot (totals by borrower type) > $globalline{loopfooter} = []; > $globalline{total}= $grantotal; # FIXME: useless >-- >2.34.1 >
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 36585
:
164782
|
167248
|
167251