Bugzilla – Attachment 54271 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.42 KB, created by
Sophie MEYNIEUX
on 2016-08-10 14:10:57 UTC
(
hide
)
Description:
Bug 13914 : Fix UNION in SQL request for reserves statistics
Filename:
MIME Type:
Creator:
Sophie MEYNIEUX
Created:
2016-08-10 14:10:57 UTC
Size:
2.42 KB
patch
obsolete
>From a6e9430b80b54640b087d7de5ed7e1a56538a124 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 > >--- > reports/reserves_stats.pl | 15 ++++++--------- > 1 file changed, 6 insertions(+), 9 deletions(-) > >diff --git a/reports/reserves_stats.pl b/reports/reserves_stats.pl >index 792a772..a1e66c7 100755 >--- a/reports/reserves_stats.pl >+++ b/reports/reserves_stats.pl >@@ -218,16 +218,16 @@ sub calculate { > # preparing calculation > my $strcalc = "(SELECT $linesql line, $colsql col, "; > $strcalc .= ($process == 1) ? " COUNT(*) calculation" : >- ($process == 2) ? "(COUNT(DISTINCT reserves.borrowernumber)) calculation" : >- ($process == 3) ? "(COUNT(DISTINCT reserves.itemnumber)) calculation" : >- ($process == 4) ? "(COUNT(DISTINCT reserves.biblionumber)) calculation" : '*'; >+ ($process == 2) ? "(COUNT(DISTINCT all_reserves.borrowernumber)) calculation" : >+ ($process == 3) ? "(COUNT(DISTINCT all_reserves.itemnumber)) calculation" : >+ ($process == 4) ? "(COUNT(DISTINCT all_reserves.biblionumber)) calculation" : '*'; > $strcalc .= " >- FROM reserves >+ FROM (select * from reserves union select * from old_reserves) all_reserves > LEFT JOIN borrowers USING (borrowernumber) > "; >- $strcalc .= "LEFT JOIN biblio ON reserves.biblionumber=biblio.biblionumber " >+ $strcalc .= "LEFT JOIN biblio ON all_reserves.biblionumber=biblio.biblionumber " > if ($linefield =~ /^biblio\./ or $colfield =~ /^biblio\./ or any {$_=~/biblio/}keys %$filters_hashref); >- $strcalc .= "LEFT JOIN items ON reserves.itemnumber=items.itemnumber " >+ $strcalc .= "LEFT JOIN items ON all_reserves.itemnumber=items.itemnumber " > if ($linefield =~ /^items\./ or $colfield =~ /^items\./ or any {$_=~/items/}keys %$filters_hashref); > > my @sqlparams; >@@ -267,9 +267,6 @@ 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}; >-- >1.9.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