X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=reports%2Fissues_stats.pl;h=2f8a7e359f011c9355f75a48147e2d1fa73e7c97;hb=edf8ad5d5da9c11e0dc61c1df40ce977e9e6a125;hp=11ecc77ac3013e353ae777fae1ab3043d86c48f4;hpb=50ddd8d060eee70fb1a70831b0d88f5b909b467a;p=koha_fer diff --git a/reports/issues_stats.pl b/reports/issues_stats.pl index 11ecc77ac3..2f8a7e359f 100755 --- a/reports/issues_stats.pl +++ b/reports/issues_stats.pl @@ -14,11 +14,12 @@ # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR # A PARTICULAR PURPOSE. See the GNU General Public License for more details. # -# You should have received a copy of the GNU General Public License along with -# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place, -# Suite 330, Boston, MA 02111-1307 USA +# You should have received a copy of the GNU General Public License along +# with Koha; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. use strict; +#use warnings; FIXME - Bug 2505 use CGI; use Date::Manip; @@ -60,13 +61,12 @@ my $monthsel = $input->param("PeriodMonthSel"); my $calc = $input->param("Cellvalue"); my $output = $input->param("output"); my $basename = $input->param("basename"); -my $mime = $input->param("MIME"); my ($template, $borrowernumber, $cookie) = get_template_and_user({ template_name => $fullreportname, query => $input, type => "intranet", authnotrequired => 0, - flagsrequired => {reports => 1}, + flagsrequired => {reports => '*'}, debug => 0, }); our $sep = $input->param("sep"); @@ -137,19 +137,6 @@ for my $itype ( sort {$itemtypes->{$a}->{description} cmp $itemtypes->{$b}->{des push @itemtypeloop, { code => $itype , description => $itemtypes->{$itype}->{description} } ; } -my $branches=GetBranches(); -my @branchloop; -foreach (sort {$branches->{$a}->{'branchname'} cmp $branches->{$b}->{'branchname'}} keys %$branches) { - my $thisbranch = ''; # FIXME - my %row = ( - branchcode => $_, - selected => ($thisbranch eq $_ ? 1 : 0), - code => $branches->{$_}->{'branchcode'}, - description => $branches->{$_}->{'branchname'}, - ); - push @branchloop, \%row; -} - # location list my @locations; foreach (sort keys %$locations) { @@ -161,13 +148,10 @@ foreach (sort {$ccodes->{$a} cmp $ccodes->{$b}} keys %$ccodes) { push @ccodes, { code => $_, description => $ccodes->{$_} }; } -# various -my @mime = (C4::Context->preference("MIME")); - my $CGIextChoice=CGI::scrolling_list( -name => 'MIME', -id => 'MIME', - -values => \@mime, + -values => ['CSV'], # FIXME translation -size => 1, -multiple => 0 ); @@ -178,7 +162,7 @@ $template->param( itemtypeloop => \@itemtypeloop, locationloop => \@locations, ccodeloop => \@ccodes, - branchloop => \@branchloop, + branchloop => GetBranchesLoop(C4::Context->userenv->{'branch'}), hassort1=> $hassort1, hassort2=> $hassort2, Bsort1 => $Bsort1, @@ -203,7 +187,7 @@ sub calculate { # Checking filters # my @loopfilter; - for (my $i=0;$i<=10;$i++) { + for (my $i=0;$i<=12;$i++) { my %cell; (@$filters[$i]) or next; if (($i==1) and (@$filters[$i-1])) { @@ -216,17 +200,21 @@ sub calculate { $cell{filter} = format_date(@$filters[$i]); } $cell{crit} = - ($i==0) ? "Period From" : - ($i==1) ? "Period To" : - ($i==2) ? "Patron Category =" : - ($i==3) ? "Item Type =" : - ($i==4) ? "Library =" : - ($i==5) ? "Collection =" : - ($i==6) ? "Location =" : - ($i==7) ? "Item callnumber >=" : - ($i==8) ? "Item callnumber <" : - ($i==9) ? "sort1 =" : - ($i==10)? "sort2 =" : "UNKNOWN FILTER ($i)"; + ( $i == 0 ) ? "Period From" + : ( $i == 1 ) ? "Period To" + : ( $i == 2 ) ? "Patron Category =" + : ( $i == 3 ) ? "Item Type =" + : ( $i == 4 ) ? "Library =" + : ( $i == 5 ) ? "Collection =" + : ( $i == 6 ) ? "Location =" + : ( $i == 7 ) ? "Item callnumber >=" + : ( $i == 8 ) ? "Item callnumber <" + : ( $i == 9 ) ? "sort1 =" + : ( $i == 10 ) ? "sort2 =" + : ( $i == 11 ) ? "Home library =" + : ( $i == 12 )? "Holding library =" + : "UNKNOWN FILTER ($i)"; + # FIXME - no translation mechanism ! push @loopfilter, \%cell; } @@ -239,29 +227,39 @@ sub calculate { $debug and warn "filtres ". join "|", @filters; my ($colsource, $linesource); $linefilter[1] = @$filters[1] if ($line =~ /datetime/); - $linefilter[0] = ($line =~ /datetime/) ? @$filters[0] : - ($line =~ /category/) ? @$filters[2] : - ($line =~ /itemtype/) ? @$filters[3] : - ($line =~ /branch/ ) ? @$filters[4] : - ($line =~ /ccode/ ) ? @$filters[5] : - ($line =~ /location/) ? @$filters[6] : - ($line =~ /sort1/ ) ? @$filters[9] : - ($line =~ /sort2/ ) ? @$filters[10] : undef ; - if ($line =~ /ccode/ or $line =~ /location/) { + $linefilter[0] = + ( $line =~ /datetime/ ) ? @$filters[0] + : ( $line =~ /category/ ) ? @$filters[2] + : ( $line =~ /itemtype/ ) ? @$filters[3] + : ( $line =~ /^branch/ ) ? @$filters[4] + : ( $line =~ /ccode/ ) ? @$filters[5] + : ( $line =~ /location/ ) ? @$filters[6] + : ( $line =~ /sort1/ ) ? @$filters[9] + : ( $line =~ /sort2/ ) ? @$filters[10] + : ( $line =~ /homebranch/) ? @$filters[11] + : ( $line =~ /holdingbranch/) ? @$filters[12] + : undef; + + if ( $line =~ /ccode/ or $line =~ /location/ or $line =~ /homebranch/ or $line =~ /holdingbranch/ ) { $linesource = 'items'; } my @colfilter; $colfilter[1] = @$filters[1] if ($column =~ /datetime/); - $colfilter[0] = ($column =~ /datetime/) ? @$filters[0] : - ($column =~ /category/) ? @$filters[2] : - ($column =~ /itemtype/) ? @$filters[3] : - ($column =~ /branch/ ) ? @$filters[4] : - ($column =~ /ccode/ ) ? @$filters[5] : - ($column =~ /location/) ? @$filters[6] : - ($column =~ /sort1/ ) ? @$filters[9] : - ($column =~ /sort1/ ) ? @$filters[10] : undef ; - if ($column =~ /ccode/ or $column =~ /location/) { + $colfilter[0] = + ( $column =~ /datetime/ ) ? @$filters[0] + : ( $column =~ /category/ ) ? @$filters[2] + : ( $column =~ /itemtype/ ) ? @$filters[3] + : ( $column =~ /^branch/ ) ? @$filters[4] + : ( $column =~ /ccode/ ) ? @$filters[5] + : ( $column =~ /location/ ) ? @$filters[6] + : ( $column =~ /sort1/ ) ? @$filters[9] + : ( $column =~ /sort1/ ) ? @$filters[10] + : ( $column =~ /homebranch/) ? @$filters[11] + : ( $column =~ /holdingbranch/) ? @$filters[12] + : undef; + + if ( $column =~ /ccode/ or $column =~ /location/ or $column =~ /homebranch/ or $column =~ /holdingbranch/ ) { $colsource = 'items'; } # 1st, loop rows. @@ -350,8 +348,8 @@ sub calculate { } else { $colfield = $column; } - $colorder = ($colfield =~ /dayname/) ? "weekday($line)" : - ($colfield =~ /^month/ ) ? " month($line)" : $colfield; + $colorder = ($colfield =~ /dayname/) ? "weekday($column)" : + ($colfield =~ /^month/ ) ? " month($column)" : $colfield; my $strsth2 = "SELECT distinctrow $colfield FROM statistics, "; # get stats on items if ccode or location, otherwise borrowers. $strsth2 .= ($colsource eq 'items' ) ?