Bugzilla – Attachment 40003 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: 'Average loan time' report to obey item-level_itypes preference
Bug-13452-Average-loan-time-report-to-obey-item-le.patch (text/plain), 9.09 KB, created by
Katrin Fischer
on 2015-06-09 00:10:38 UTC
(
hide
)
Description:
Bug 13452: 'Average loan time' report to obey item-level_itypes preference
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2015-06-09 00:10:38 UTC
Size:
9.09 KB
patch
obsolete
>From ce38cdb939c77c65030aba01f4634a239f8524f4 Mon Sep 17 00:00:00 2001 >From: Katrin Fischer <Katrin.Fischer.83@web.de> >Date: Tue, 9 Jun 2015 01:04:07 +0200 >Subject: [PATCH] Bug 13452: 'Average loan time' report to obey > item-level_itypes preference > >Fixes the 'Average loan time' report so that the system >preference setting item-level_itypes is taken into account. > >Before the patch, the report was always using the biblio >level itemtype. With the patch, it will depend on the pref >setting. > >To test: >- Run various reports, compare results with both > possible pref settings >- Try limiting your search in various ways, especially > on a specific itemtype >- Make sure you switch checkboxes in testing, > using itemtype as the row or as the column > >Notes: >- Filtering on a specific itemtype does > not work without the patch as it fixes a bug there. >- Fixes headings and breadcrumbs so that the name of the report > is the same as on the reports start page >--- > .../prog/en/modules/reports/issues_avg_stats.tt | 4 +-- > reports/issues_avg_stats.pl | 33 ++++++++++------------ > 2 files changed, 17 insertions(+), 20 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/issues_avg_stats.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/issues_avg_stats.tt >index 67d0a13..3493381 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/issues_avg_stats.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/issues_avg_stats.tt >@@ -1,5 +1,5 @@ > [% INCLUDE 'doc-head-open.inc' %] >-<title>Koha › Reports › Average checkout period</title> >+<title>Koha › Reports › Average loan time</title> > [% INCLUDE 'doc-head-close.inc' %] > [% INCLUDE 'calendar.inc' %] > <script type="text/javascript"> >@@ -40,7 +40,7 @@ > [% INCLUDE 'header.inc' %] > [% INCLUDE 'cat-search.inc' %] > >-<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/reports/reports-home.pl">Reports</a> [% IF ( do_it ) %]› <a href="/cgi-bin/koha/reports/issues_avg_stats.pl">Average checkout period</a> › Results [% ELSE %]› Average checkout period[% END %]</div> >+<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/reports/reports-home.pl">Reports</a> [% IF ( do_it ) %]› <a href="/cgi-bin/koha/reports/issues_avg_stats.pl">Average loan time</a> › Results [% ELSE %]› Average loan time[% END %]</div> > > <div id="doc3" class="yui-t2"> > >diff --git a/reports/issues_avg_stats.pl b/reports/issues_avg_stats.pl >index 772acd6..8bcc54f 100755 >--- a/reports/issues_avg_stats.pl >+++ b/reports/issues_avg_stats.pl >@@ -56,6 +56,8 @@ my $rodsp = $input->param("ReturnDisplay"); > my $calc = $input->param("Cellvalue"); > my $output = $input->param("output"); > my $basename = $input->param("basename"); >+my $itype = C4::Context->preference('item-level_itypes') ? "items.itype" : "biblioitems.itemtype"; >+ > #warn "calcul : ".$calc; > my ($template, $borrowernumber, $cookie) > = get_template_and_user({template_name => $fullreportname, >@@ -242,8 +244,7 @@ sub calculate { > # warn "filtres ".@filters[2]; > # warn "filtres ".@filters[3]; > $line = "old_issues.".$line if ($line=~/branchcode/) or ($line=~/timestamp/); >- $line = "biblioitems.".$line if $line=~/itemtype/; >- >+ if ( $line=~/itemtype/ ) { $line = $itype; } > $linefilter[0] = @$filters[0] if ($line =~ /timestamp/ ) ; > $linefilter[1] = @$filters[1] if ($line =~ /timestamp/ ) ; > $linefilter[2] = @$filters[2] if ($line =~ /timestamp/ ) ; >@@ -255,13 +256,11 @@ sub calculate { > $linefilter[0] = @$filters[8] if ($line =~ /category/ ) ; > $linefilter[0] = @$filters[9] if ($line =~ /itemtype/ ) ; > $linefilter[0] = @$filters[10] if ($line =~ /branch/ ) ; >-# $linefilter[0] = @$filters[11] if ($line =~ /sort2/ ) ; > $linefilter[0] = @$filters[11] if ($line =~ /sort1/ ) ; > $linefilter[0] = @$filters[12] if ($line =~ /sort2/ ) ; >-#warn "filtre lignes".$linefilter[0]." ".$linefilter[1]; >-# >+ > $column = "old_issues.".$column if (($column=~/branchcode/) or ($column=~/timestamp/)); >- $column = "biblioitems.".$column if $column=~/itemtype/; >+ if ( $column=~/itemtype/ ) { $column = $itype; } > my @colfilter ; > $colfilter[0] = @$filters[0] if ($column =~ /timestamp/ ) ; > $colfilter[1] = @$filters[1] if ($column =~ /timestamp/ ) ; >@@ -272,12 +271,10 @@ 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 =~ /itemtype/ ) ; >+ $colfilter[0] = @$filters[9] if ($column =~ $itype ) ; > $colfilter[0] = @$filters[10] if ($column =~ /branch/ ) ; >-# $colfilter[0] = @$filters[11] if ($column =~ /sort2/ ) ; > $colfilter[0] = @$filters[11] if ($column =~ /sort1/ ) ; > $colfilter[0] = @$filters[12] if ($column =~ /sort2/ ) ; >-#warn "filtre col ".$colfilter[0]." ".$colfilter[1]; > > # 1st, loop rows. > my $linefield; >@@ -310,7 +307,7 @@ sub calculate { > LEFT JOIN biblioitems ON (biblioitems.biblioitemnumber=items.biblioitemnumber) > LEFT JOIN issuingrules ON > (issuingrules.branchcode=old_issues.branchcode >- AND issuingrules.itemtype=biblioitems.itemtype >+ AND issuingrules.itemtype=$itype > AND issuingrules.categorycode=borrowers.categorycode) > WHERE 1"; > >@@ -338,7 +335,6 @@ sub calculate { > my $sth = $dbh->prepare( $strsth ); > $sth->execute; > >- > while ( my ($celvalue) = $sth->fetchrow) { > my %cell; > if ($celvalue) { >@@ -372,7 +368,7 @@ sub calculate { > $colfield .= $column; > $colorder .= $column; > } >- >+ > my $strsth2; > $strsth2 .= "SELECT distinctrow $colfield > FROM `old_issues` >@@ -381,7 +377,7 @@ sub calculate { > LEFT JOIN biblioitems ON (biblioitems.biblioitemnumber=items.biblioitemnumber) > LEFT JOIN issuingrules ON > (issuingrules.branchcode=old_issues.branchcode >- AND issuingrules.itemtype=biblioitems.itemtype >+ AND issuingrules.itemtype=$itype > AND issuingrules.categorycode=borrowers.categorycode) > WHERE 1"; > >@@ -407,14 +403,14 @@ sub calculate { > $strsth2 .=" ORDER BY $colorder"; > > my $sth2 = $dbh->prepare( $strsth2 ); >+ > if (( @colfilter ) and ($colfilter[1])){ > $sth2->execute("'".$colfilter[0]."'","'".$colfilter[1]."'"); > } elsif ($colfilter[0]) { >- $sth2->execute($colfilter[0]); >+ $sth2->execute; > } else { > $sth2->execute; > } >- > > while (my ($celvalue) = $sth2->fetchrow) { > my %cell; >@@ -449,7 +445,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=biblioitems.itemtype AND issuingrules.categorycode=categorycode) WHERE old_issues.itemnumber=items.itemnumber AND old_issues.borrowernumber=borrowers.borrowernumber"; >+ $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"; > > @$filters[0]=~ s/\*/%/g if (@$filters[0]); > $strcalc .= " AND old_issues.timestamp > '" . @$filters[0] ."'" if ( @$filters[0] ); >@@ -462,7 +458,7 @@ sub calculate { > @$filters[8]=~ s/\*/%/g if (@$filters[8]); > $strcalc .= " AND borrowers.categorycode like '" . @$filters[8] ."'" if ( @$filters[8] ); > @$filters[9]=~ s/\*/%/g if (@$filters[9]); >- $strcalc .= " AND biblioitems.itemtype like '" . @$filters[9] ."'" if ( @$filters[9] ); >+ $strcalc .= " AND $itype like '" . @$filters[9] ."'" if ( @$filters[9] ); > @$filters[10]=~ s/\*/%/g if (@$filters[10]); > $strcalc .= " AND old_issues.branchcode like '" . @$filters[10] ."'" if ( @$filters[10] ); > @$filters[11]=~ s/\*/%/g if (@$filters[11]); >@@ -486,7 +482,7 @@ sub calculate { > my $err; > my $emptycol; > my $weightrow; >- >+ > while (my @data = $dbcalc->fetchrow) { > my ($row, $col, $issuedate, $returndate, $weight)=@data; > # warn "filling table $row / $col / $issuedate / $returndate /$weight"; >@@ -579,6 +575,7 @@ sub calculate { > $globalline{column} = $column; > push @mainloop,\%globalline; > return \@mainloop; >+ > } > > 1; >-- >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