Bugzilla – Attachment 25100 Details for
Bug 7683
statistic wizard: cataloging
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 7679: Fix several bugs in circulation statistics wizard
Bug-7679-Fix-several-bugs-in-circulation-statistic.patch (text/plain), 6.89 KB, created by
Biblibre Sandboxes
on 2014-02-06 16:12:00 UTC
(
hide
)
Description:
Bug 7679: Fix several bugs in circulation statistics wizard
Filename:
MIME Type:
Creator:
Biblibre Sandboxes
Created:
2014-02-06 16:12:00 UTC
Size:
6.89 KB
patch
obsolete
>From 84fe1eec175d9ed7e141e77366268d5de770c5da Mon Sep 17 00:00:00 2001 >From: Julian Maurice <julian.maurice@biblibre.com> >Date: Wed, 5 Feb 2014 15:40:34 +0100 >Subject: [PATCH] Bug 7679: Fix several bugs in circulation statistics wizard > >- Display values in NULL columns/rows >- Display columns/rows that contain values only in NULL rows/columns >- "To" filter in period row should be inclusive (YYYY-MM-DD should be > YYYY-MM-DD 23:59:59) >- Make it possible to use only the "To" filter in period row (actually > it results in DBI error (2 bind variables instead of 1)) > >Signed-off-by: Koha team AMU <koha.aixmarseille@gmail.com> > >http://bugs.koha-community.org/show_bug.cgi?id=7683 >--- > .../prog/en/modules/reports/issues_stats.tt | 2 +- > reports/issues_stats.pl | 54 +++++++++++--------- > 2 files changed, 31 insertions(+), 25 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/issues_stats.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/issues_stats.tt >index d211c2b..70796a5 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/issues_stats.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/issues_stats.tt >@@ -72,7 +72,7 @@ > [% END %] > <td>[% loopro.rowtitle_display or "UNKNOWN VALUE" |html %]</td> > [% FOREACH loopcel IN loopro.loopcell %] >- <td>[% loopcel.value %]</td> >+ <td>[% loopcel.value || 0 %]</td> > [% END %] > <td>[% loopro.totalrow %]</td> > </tr> >diff --git a/reports/issues_stats.pl b/reports/issues_stats.pl >index 37349fc..e86d064 100755 >--- a/reports/issues_stats.pl >+++ b/reports/issues_stats.pl >@@ -317,23 +317,23 @@ sub calculate { > if($line_attribute_type) { > $strsth = "SELECT attribute FROM borrower_attributes WHERE code = '$line_attribute_type' "; > } else { >- $strsth = "SELECT distinctrow $linefield FROM statistics, "; >+ $strsth = "SELECT distinctrow $linefield FROM statistics "; > > # get stats on items if ccode or location, otherwise borrowers. > $strsth .= > ( $linesource eq 'items' ) >- ? " items WHERE (statistics.itemnumber=items.itemnumber) " >- : " borrowers WHERE (statistics.borrowernumber=borrowers.borrowernumber) "; >+ ? " LEFT JOIN items ON (statistics.itemnumber = items.itemnumber) " >+ : " LEFT JOIN borrowers ON (statistics.borrowernumber = borrowers.borrowernumber) "; > } >- $strsth .= " AND $line is not null "; >+ $strsth .= " WHERE $line is not null "; > > if ( $line =~ /datetime/ ) { > if ( $linefilter[1] and ( $linefilter[0] ) ) { > $strsth .= " AND $line between ? AND ? "; > } elsif ( $linefilter[1] ) { >- $strsth .= " AND $line < ? "; >+ $strsth .= " AND $line <= ? "; > } elsif ( $linefilter[0] ) { >- $strsth .= " AND $line > ? "; >+ $strsth .= " AND $line >= ? "; > } > $strsth .= " AND type ='" . $type . "' " if $type; > $strsth .= " AND dayname(datetime) ='" . $daysel . "' " if $daysel; >@@ -346,8 +346,10 @@ sub calculate { > $debug and warn $strsth; > push @loopfilter, { crit => 'SQL =', sql => 1, filter => $strsth }; > my $sth = $dbh->prepare($strsth); >- if ( (@linefilter) and ( $linefilter[1] ) ) { >- $sth->execute( $linefilter[0], $linefilter[1] ); >+ if ( (@linefilter) and ($linefilter[0]) and ($linefilter[1]) ) { >+ $sth->execute( $linefilter[0], $linefilter[1] . " 23:59:59" ); >+ } elsif ( $linefilter[1] ) { >+ $sth->execute( $linefilter[1] . " 23:59:59" ); > } elsif ( $linefilter[0] ) { > $sth->execute( $linefilter[0] ); > } else { >@@ -403,23 +405,23 @@ sub calculate { > if($column_attribute_type) { > $strsth2 = "SELECT attribute FROM borrower_attributes WHERE code = '$column_attribute_type' "; > } else { >- $strsth2 = "SELECT distinctrow $colfield FROM statistics, "; >+ $strsth2 = "SELECT distinctrow $colfield FROM statistics "; > > # get stats on items if ccode or location, otherwise borrowers. > $strsth2 .= > ( $colsource eq 'items' ) >- ? "items WHERE (statistics.itemnumber=items.itemnumber) " >- : "borrowers WHERE (statistics.borrowernumber=borrowers.borrowernumber) "; >+ ? "LEFT JOIN items ON (statistics.itemnumber = items.itemnumber) " >+ : "LEFT JOIN borrowers ON (statistics.borrowernumber = borrowers.borrowernumber) "; > } >- $strsth2 .= " AND $column IS NOT NULL "; >+ $strsth2 .= " WHERE $column IS NOT NULL "; > > if ( $column =~ /datetime/ ) { > if ( ( $colfilter[1] ) and ( $colfilter[0] ) ) { > $strsth2 .= " AND $column BETWEEN ? AND ? "; > } elsif ( $colfilter[1] ) { >- $strsth2 .= " AND $column < ? "; >+ $strsth2 .= " AND $column <= ? "; > } elsif ( $colfilter[0] ) { >- $strsth2 .= " AND $column > ? "; >+ $strsth2 .= " AND $column >= ? "; > } > $strsth2 .= " AND type ='". $type ."' " if $type; > $strsth2 .= " AND dayname(datetime) ='". $daysel ."' " if $daysel; >@@ -433,8 +435,10 @@ sub calculate { > $debug and warn $strsth2; > push @loopfilter, { crit => 'SQL =', sql => 1, filter => $strsth2 }; > my $sth2 = $dbh->prepare($strsth2); >- if ( (@colfilter) and ( $colfilter[1] ) ) { >- $sth2->execute( $colfilter[0], $colfilter[1] ); >+ if ( (@colfilter) and ($colfilter[0]) and ($colfilter[1]) ) { >+ $sth2->execute( $colfilter[0], $colfilter[1] . " 23:59:59" ); >+ } elsif ( $colfilter[1] ) { >+ $sth2->execute( $colfilter[1] . " 23:59:59" ); > } elsif ( $colfilter[0] ) { > $sth2->execute( $colfilter[0] ); > } else { >@@ -598,12 +602,11 @@ sub calculate { > my $value = table_get(\%table, $row->{rowtitle}, $col->{coltitle}); > push @loopcell, { value => $value }; > } >- my $rowtitle = ( $row->{rowtitle} eq "NULL" ) ? "zzEMPTY" : $row->{rowtitle}; > push @looprow, > { 'rowtitle_display' => $row->{rowtitle_display}, >- 'rowtitle' => $rowtitle, >+ 'rowtitle' => $row->{rowtitle}, > 'loopcell' => \@loopcell, >- 'totalrow' => table_get(\%table, $rowtitle, 'totalrow'), >+ 'totalrow' => table_get(\%table, $row->{rowtitle}, 'totalrow'), > }; > } > for my $col (@loopcol) { >@@ -630,11 +633,14 @@ sub calculate { > return [ ( \%globalline ) ]; > } > >-sub null_to_zzempty ($) { >- my $string = shift; >- defined($string) or return 'zzEMPTY'; >- ($string eq "NULL") and return 'zzEMPTY'; >- return $string; # else return the valid value >+sub null_to_zzempty { >+ my $string = shift; >+ >+ if (!defined($string) or $string eq '' or uc($string) eq 'NULL') { >+ return 'zzEMPTY'; >+ } >+ >+ return $string; > } > > sub table_set { >-- >1.7.2.5
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 7683
:
12762
|
12785
|
12940
|
14399
|
14466
|
16327
|
16328
|
16329
|
16367
|
16775
|
20241
|
20242
|
20243
|
20244
|
20245
|
21357
|
21358
|
23683
|
23684
|
23685
|
23686
|
23687
|
23688
|
23689
|
23690
|
23691
|
25072
|
25073
|
25091
|
25092
|
25093
|
25094
|
25095
|
25096
|
25097
|
25098
|
25099
|
25100
|
26678
|
26679
|
26680
|
26681
|
26682
|
28466
|
28467
|
28468
|
28469
|
28470
|
36489
|
36490
|
36491
|
36492
|
36493
|
39129
|
39130
|
39131
|
39132
|
39133
|
41821
|
41829
|
44651
|
44652
|
44653
|
44654
|
44655
|
45238
|
45239
|
45240
|
45241
|
45242