Bugzilla – Attachment 54604 Details for
Bug 7679
Add new filters to circulation statistics wizard
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 7679: Various fixes for circulation statistics wizard
Bug-7679-Various-fixes-for-circulation-statistics-.patch (text/plain), 3.64 KB, created by
Julian Maurice
on 2016-08-19 09:34:56 UTC
(
hide
)
Description:
Bug 7679: Various fixes for circulation statistics wizard
Filename:
MIME Type:
Creator:
Julian Maurice
Created:
2016-08-19 09:34:56 UTC
Size:
3.64 KB
patch
obsolete
>From abc20c7ddbcc70b4dd8acfc63edbf55429c3150e Mon Sep 17 00:00:00 2001 >From: Julian Maurice <julian.maurice@biblibre.com> >Date: Mon, 24 Mar 2014 11:56:58 +0100 >Subject: [PATCH] Bug 7679: Various fixes for circulation statistics wizard > >- use SQL TRIM functions to avoid having '' and ' ' considered as > different values >- use Text::Unaccent to remove accents from columns or rows values when > accessing %table. This is required as MySQL consider as equals two > strings that differ only by their accents when using GROUP BY clause. >- Exclude '' values from the list of columns or rows. Otherwise we could > have a row 'UNKNOWN VALUE' and a row 'NULL' which both have the same > values in their cells. >--- > reports/issues_stats.pl | 25 ++++++++++++++++--------- > 1 file changed, 16 insertions(+), 9 deletions(-) > >diff --git a/reports/issues_stats.pl b/reports/issues_stats.pl >index 21c1237..77f5f13 100755 >--- a/reports/issues_stats.pl >+++ b/reports/issues_stats.pl >@@ -22,6 +22,7 @@ use warnings; > > use CGI qw ( -utf8 ); > use Date::Manip; >+use Text::Unaccent; > > use C4::Auth; > use C4::Debug; >@@ -320,7 +321,7 @@ sub calculate { > ( $linesource eq 'items' ) > ? " LEFT JOIN items ON (statistics.itemnumber = items.itemnumber) " > : " LEFT JOIN borrowers ON (statistics.borrowernumber = borrowers.borrowernumber) "; >- $strsth .= " WHERE $line is not null "; >+ $strsth .= " WHERE $line is not null AND $line != '' "; > } > > if ( $line =~ /datetime/ ) { >@@ -408,7 +409,7 @@ sub calculate { > ( $colsource eq 'items' ) > ? "LEFT JOIN items ON (statistics.itemnumber = items.itemnumber) " > : "LEFT JOIN borrowers ON (statistics.borrowernumber = borrowers.borrowernumber) "; >- $strsth2 .= " WHERE $column IS NOT NULL "; >+ $strsth2 .= " WHERE $column IS NOT NULL AND $column != '' "; > } > > if ( $column =~ /datetime/ ) { >@@ -480,14 +481,14 @@ sub calculate { > # preparing calculation > my $strcalc = "SELECT "; > if($line_attribute_type) { >- $strcalc .= "attribute_$line_attribute_type.attribute AS line_attribute, "; >+ $strcalc .= "TRIM(attribute_$line_attribute_type.attribute) AS line_attribute, "; > } else { >- $strcalc .= "$linefield, "; >+ $strcalc .= "TRIM($linefield), "; > } > if($column_attribute_type) { >- $strcalc .= "attribute_$column_attribute_type.attribute AS column_attribute, "; >+ $strcalc .= "TRIM(attribute_$column_attribute_type.attribute) AS column_attribute, "; > } else { >- $strcalc .= "$colfield, "; >+ $strcalc .= "TRIM($colfield), "; > } > $strcalc .= > ( $process == 1 ) ? " COUNT(*) " >@@ -642,19 +643,25 @@ sub null_to_zzempty { > sub table_set { > my ($table, $row, $col, $val) = @_; > >- $table->{ null_to_zzempty(lc($row)) }->{ null_to_zzempty(lc($col)) } = $val; >+ $row = lc(unac_string('utf-8', $row // '')); >+ $col = lc(unac_string('utf-8', $col // '')); >+ $table->{ null_to_zzempty($row) }->{ null_to_zzempty($col) } = $val; > } > > sub table_get { > my ($table, $row, $col) = @_; > >- return $table->{ null_to_zzempty(lc($row)) }->{ null_to_zzempty(lc($col)) }; >+ $row = lc(unac_string('utf-8', $row // '')); >+ $col = lc(unac_string('utf-8', $col // '')); >+ return $table->{ null_to_zzempty($row) }->{ null_to_zzempty($col) }; > } > > sub table_inc { > my ($table, $row, $col, $inc) = @_; > >- $table->{ null_to_zzempty(lc($row // '')) }->{ null_to_zzempty(lc($col // '')) } += $inc; >+ $row = lc(unac_string('utf-8', $row // '')); >+ $col = lc(unac_string('utf-8', $col // '')); >+ $table->{ null_to_zzempty($row) }->{ null_to_zzempty($col) } += $inc; > } > > 1; >-- >2.1.4
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 7679
:
11479
|
13099
|
16242
|
16243
|
17798
|
22745
|
25053
|
25443
|
26531
|
31311
|
39250
|
39251
|
39252
|
39253
|
39254
|
39255
|
39256
|
39257
|
46184
|
46185
|
46186
|
46187
|
46188
|
46189
|
46190
|
46191
|
46192
|
46193
|
46194
|
46195
|
46196
|
46197
|
46198
|
46199
|
54598
|
54599
|
54600
|
54601
|
54602
|
54603
|
54604
|
54605
|
55481
|
55482
|
55483
|
55484
|
55485
|
55486
|
55487
|
55488
|
56877
|
56878
|
56879
|
56880
|
56881
|
56882
|
56883
|
56884
|
56885
|
56886
|
56887
|
56888