Bugzilla – Attachment 43053 Details for
Bug 13452
Average checkout report always uses biblioitems.itemtype
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 13452: Fix obvious issues in issues_avg_stats.pl
Bug-13452-Fix-obvious-issues-in-issuesavgstatspl.patch (text/plain), 4.41 KB, created by
Julian Maurice
on 2015-10-02 09:39:07 UTC
(
hide
)
Description:
Bug 13452: Fix obvious issues in issues_avg_stats.pl
Filename:
MIME Type:
Creator:
Julian Maurice
Created:
2015-10-02 09:39:07 UTC
Size:
4.41 KB
patch
obsolete
>From e93ddf264586d85867147165dc3149a918df3250 Mon Sep 17 00:00:00 2001 >From: Julian Maurice <julian.maurice@biblibre.com> >Date: Fri, 2 Oct 2015 11:31:10 +0200 >Subject: [PATCH] Bug 13452: Fix obvious issues in issues_avg_stats.pl > >- Remove joins with issuingrules which are not needed >- Fix the SQL query so that $weight is now the value of COUNT(*) instead > of a timestamp >- QA fix: '$column eq $itype' instead of '$column =~ $itype' (same for > $line) >--- > reports/issues_avg_stats.pl | 22 ++++------------------ > 1 file changed, 4 insertions(+), 18 deletions(-) > >diff --git a/reports/issues_avg_stats.pl b/reports/issues_avg_stats.pl >index 8bcc54f..f2a9a93 100755 >--- a/reports/issues_avg_stats.pl >+++ b/reports/issues_avg_stats.pl >@@ -254,7 +254,7 @@ sub calculate { > $linefilter[2] = @$filters[6] if ($line =~ /returndate/ ) ; > $linefilter[3] = @$filters[7] if ($line =~ /returndate/ ) ; > $linefilter[0] = @$filters[8] if ($line =~ /category/ ) ; >- $linefilter[0] = @$filters[9] if ($line =~ /itemtype/ ) ; >+ $linefilter[0] = @$filters[9] if ($line eq $itype); > $linefilter[0] = @$filters[10] if ($line =~ /branch/ ) ; > $linefilter[0] = @$filters[11] if ($line =~ /sort1/ ) ; > $linefilter[0] = @$filters[12] if ($line =~ /sort2/ ) ; >@@ -271,7 +271,7 @@ sub calculate { > $colfilter[2] = @$filters[6] if ($column =~ /returndate/ ) ; > $colfilter[3] = @$filters[7] if ($column =~ /returndate/ ) ; > $colfilter[0] = @$filters[8] if ($column =~ /category/ ) ; >- $colfilter[0] = @$filters[9] if ($column =~ $itype ) ; >+ $colfilter[0] = @$filters[9] if ($column eq $itype); > $colfilter[0] = @$filters[10] if ($column =~ /branch/ ) ; > $colfilter[0] = @$filters[11] if ($column =~ /sort1/ ) ; > $colfilter[0] = @$filters[12] if ($column =~ /sort2/ ) ; >@@ -305,10 +305,6 @@ sub calculate { > LEFT JOIN borrowers ON borrowers.borrowernumber=old_issues.borrowernumber > LEFT JOIN items ON old_issues.itemnumber=items.itemnumber > LEFT JOIN biblioitems ON (biblioitems.biblioitemnumber=items.biblioitemnumber) >- LEFT JOIN issuingrules ON >- (issuingrules.branchcode=old_issues.branchcode >- AND issuingrules.itemtype=$itype >- AND issuingrules.categorycode=borrowers.categorycode) > WHERE 1"; > > if (($line=~/timestamp/) or ($line=~/returndate/)){ >@@ -375,10 +371,6 @@ sub calculate { > LEFT JOIN borrowers ON borrowers.borrowernumber=old_issues.borrowernumber > LEFT JOIN items ON items.itemnumber=old_issues.itemnumber > LEFT JOIN biblioitems ON (biblioitems.biblioitemnumber=items.biblioitemnumber) >- LEFT JOIN issuingrules ON >- (issuingrules.branchcode=old_issues.branchcode >- AND issuingrules.itemtype=$itype >- AND issuingrules.categorycode=borrowers.categorycode) > WHERE 1"; > > if (($column=~/timestamp/) or ($column=~/returndate/)){ >@@ -404,13 +396,7 @@ sub calculate { > > my $sth2 = $dbh->prepare( $strsth2 ); > >- if (( @colfilter ) and ($colfilter[1])){ >- $sth2->execute("'".$colfilter[0]."'","'".$colfilter[1]."'"); >- } elsif ($colfilter[0]) { >- $sth2->execute; >- } else { >- $sth2->execute; >- } >+ $sth2->execute; > > while (my ($celvalue) = $sth2->fetchrow) { > my %cell; >@@ -445,7 +431,7 @@ sub calculate { > > # Processing average loanperiods > $strcalc .= "SELECT $linefield, $colfield, "; >- $strcalc .= " issuedate, returndate, old_issues.timestamp, COUNT(*), date_due, old_issues.renewals, issuelength FROM `old_issues`,borrowers,biblioitems LEFT JOIN items ON (biblioitems.biblioitemnumber=items.biblioitemnumber) LEFT JOIN issuingrules ON (issuingrules.branchcode=branchcode AND issuingrules.itemtype=$itype AND issuingrules.categorycode=categorycode) WHERE old_issues.itemnumber=items.itemnumber AND old_issues.borrowernumber=borrowers.borrowernumber"; >+ $strcalc .= " issuedate, returndate, COUNT(*) FROM `old_issues`,borrowers,biblioitems LEFT JOIN items ON (biblioitems.biblioitemnumber=items.biblioitemnumber) WHERE old_issues.itemnumber=items.itemnumber AND old_issues.borrowernumber=borrowers.borrowernumber"; > > @$filters[0]=~ s/\*/%/g if (@$filters[0]); > $strcalc .= " AND old_issues.timestamp > '" . @$filters[0] ."'" if ( @$filters[0] ); >-- >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 13452
:
40003
|
40004
|
40798
|
43053
|
48987
|
56246
|
63322
|
63323
|
63324
|
64304
|
64305
|
64306
|
64307
|
64308
|
64309