From a67a40a900cf69910394a9bc058653a59e8833be Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Mon, 8 Sep 2014 11:25:05 +0000 Subject: [PATCH] [SIGNED-OFF] Bug 13219: Added graphs to cataloging report http://bugs.koha-community.org/show_bug.cgi?id=13219 Signed-off-by: Bernardo Gonzalez Kriegel --- .../prog/en/modules/reports/catalogue_stats.tt | 50 ++++++++++++++++- reports/catalogue_stats.pl | 58 +++++++++++++++++++- 2 files changed, 105 insertions(+), 3 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/catalogue_stats.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/catalogue_stats.tt index 9290ea7..ca72d92 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/catalogue_stats.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/catalogue_stats.tt @@ -2,6 +2,7 @@ Koha › Reports [% IF ( do_it ) %]› Catalog statistics › Results[% ELSE %]› Catalog statistics[% END %] [% INCLUDE 'doc-head-close.inc' %] [% INCLUDE 'calendar.inc' %] + +[% END %] + [% INCLUDE 'intranet-bottom.inc' %] diff --git a/reports/catalogue_stats.pl b/reports/catalogue_stats.pl index 5e7848d..fe1c1e1 100755 --- a/reports/catalogue_stats.pl +++ b/reports/catalogue_stats.pl @@ -194,6 +194,7 @@ sub calculate { my $barcodelike = @$filters[13]; my $barcodefilter = @$filters[14]; my $not; + my $colors = get_colors(); # extract parameters my $dbh = C4::Context->dbh; @@ -493,7 +494,8 @@ if($barcodefilter){ # my %cell; # %cell = {coltitle => "zzEMPTY"}; push @loopcol,{coltitle => "NULL"} if ($emptycol); - + + my $loopcount = '0'; foreach my $row ( sort keys %table ) { my @loopcell; #@loopcol ensures the order for columns is common with column titles @@ -505,8 +507,17 @@ if($barcodefilter){ push @looprow,{ 'rowtitle' => ($row eq "zzEMPTY")?"NULL":$row, 'loopcell' => \@loopcell, 'hilighted' => ($hilighted *= -1 > 0), - 'totalrow' => $table{$row}->{totalrow} + 'totalrow' => $table{$row}->{totalrow}, + 'fill' => ${$colors}[$loopcount]->{fill}, + 'stroke' => ${$colors}[$loopcount]->{stroke}, + 'point' => ${$colors}[$loopcount]->{point}, + 'highlight' => ${$colors}[$loopcount]->{highlight}, + }; + $loopcount++; + if ( $loopcount == '6' ) { + $loopcount = '0'; + } } # warn "footer processing"; @@ -535,4 +546,47 @@ if($barcodefilter){ return \@mainloop; } +sub get_colors { + my $colors = [ + { + fill => "rgba(151,187,205,0.2)", + stroke => "rgba(151,187,205,1)", + point => "rgba(151,187,205,1)", + highlight => "rgba(151,187,205,1)", + }, + { + fill => "rgba(216,191,216,0.2)", + stroke => "rgba(216,191,216,1)", + point => "rgba(216,191,216,1)", + highlight => "rgba(216,191,216,1)", + }, + { + fill => "rgba(240,128,128,0.2)", + stroke => "rgba(240,128,128,1)", + point => "rgba(240,128,128,1)", + highlight => "rgba(240,128,128,1)", + }, + { + fill => "rgba(240,230,140,0.2)", + stroke => "rgba(240,230,140,1)", + point => "rgba(240,230,140,1)", + highlight => "rgba(240,230,140,1)", + }, + { + fill => "rgba(152,251,152,0.2)", + stroke => "rgba(152,251,152,1)", + point => "rgba(152,251,152,1)", + highlight => "rgba(152,251,152,1)", + }, + { + fill => "rgba(216,191,216,0.2)", + stroke => "rgba(216,191,216,1)", + point => "rgba(216,191,216,1)", + highlight => "rgba(216,191,216,1)", + }, + ]; + + return $colors; +} + 1; -- 1.7.9.5