Bugzilla – Attachment 55521 Details for
Bug 13914
The holds statistics report returns random data
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 13914 : Fix UNION in SQL request for reserves statistics
Bug-13914--Fix-UNION-in-SQL-request-for-reserves-s.patch (text/plain), 2.25 KB, created by
Jonathan Druart
on 2016-09-13 09:09:28 UTC
(
hide
)
Description:
Bug 13914 : Fix UNION in SQL request for reserves statistics
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2016-09-13 09:09:28 UTC
Size:
2.25 KB
patch
obsolete
>From e48a45095887e730799cd8476d389f97b82b512c Mon Sep 17 00:00:00 2001 >From: Sophie Meynieux <sophie.meynieux@biblibre.com> >Date: Wed, 10 Aug 2016 16:06:35 +0200 >Subject: [PATCH] Bug 13914 : Fix UNION in SQL request for reserves statistics > >Test plan >========= >On Reports > reservations, select all statuses as line, pickup library as column (empty) and a range of hold date. Keep the results >Run the same reports but with statuses as column and pickup library as line >You should get the same results on another display. > >* Without patch, if you've got representative data, most of the time you can observe significant differences between both results > >* With the patch, results are always the same (and right if you request directly your database) > >Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz> > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > reports/reserves_stats.pl | 7 ++----- > 1 file changed, 2 insertions(+), 5 deletions(-) > >diff --git a/reports/reserves_stats.pl b/reports/reserves_stats.pl >index f4d19e7..fe1d73c 100755 >--- a/reports/reserves_stats.pl >+++ b/reports/reserves_stats.pl >@@ -221,7 +221,7 @@ sub calculate { > ($process == 3) ? "(COUNT(DISTINCT reserves.itemnumber)) calculation" : > ($process == 4) ? "(COUNT(DISTINCT reserves.biblionumber)) calculation" : '*'; > $strcalc .= " >- FROM reserves >+ FROM (select * from reserves union select * from old_reserves) reserves > LEFT JOIN borrowers USING (borrowernumber) > "; > $strcalc .= "LEFT JOIN biblio ON reserves.biblionumber=biblio.biblionumber " >@@ -266,14 +266,11 @@ sub calculate { > $strcalc .= " WHERE ".join(" AND ",@sqlwhere) if (@sqlwhere); > $strcalc .= " AND (".join(" OR ",@sqlor).")" if (@sqlor); > $strcalc .= " GROUP BY line, col )"; >- my $strcalc_old=$strcalc; >- $strcalc_old=~s/reserves/old_reserves/g; >- $strcalc.=qq{ UNION $strcalc_old ORDER BY line, col}; > ($debug) and print STDERR $strcalc; > my $dbcalc = $dbh->prepare($strcalc); > push @loopfilter, {crit=>'SQL =', sql=>1, filter=>$strcalc}; > @sqlparams=(@sqlparams,@sqlorparams); >- $dbcalc->execute(@sqlparams,@sqlparams); >+ $dbcalc->execute(@sqlparams); > my ($emptycol,$emptyrow); > my $data = $dbcalc->fetchall_hashref([qw(line col)]); > my %cols_hash; >-- >2.8.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 13914
:
37267
|
54271
|
54279
|
55173
| 55521