From 1fa827acf7c0e6548b498501b54880f3f6a720dc Mon Sep 17 00:00:00 2001 From: miker Date: Thu, 5 Oct 2006 21:21:21 +0000 Subject: [PATCH] updating the reporter git-svn-id: svn://svn.open-ils.org/ILS/trunk@6398 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/examples/reporter-sql-builder-test.pl | 8 ++++---- .../src/perlmods/OpenILS/Reporter/SQLBuilder.pm | 5 +++-- Open-ILS/src/reporter/clark-kent.pl | 13 +++++++------ 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/Open-ILS/examples/reporter-sql-builder-test.pl b/Open-ILS/examples/reporter-sql-builder-test.pl index 846c5c0fa0..8672673fbf 100755 --- a/Open-ILS/examples/reporter-sql-builder-test.pl +++ b/Open-ILS/examples/reporter-sql-builder-test.pl @@ -22,10 +22,6 @@ my $report = { column => { transform => count => colname => 'id' }, alias => '::PARAM3', }, - { relation=> 'circ-id-mb', - column => { transform => sum => colname => 'amount' }, - alias => 'total bills', - }, ], from => { table => 'action.circulation', @@ -91,6 +87,9 @@ my $report = { column => 'barcode', }, ], + pivot_default => 0, + pivot_data => 4, + pivot_label => 2, }; my $params = { @@ -108,6 +107,7 @@ my $r = OpenILS::Reporter::SQLBuilder->new; $r->register_params( $params ); my $rs = $r->parse_report( $report ); +$rs->relative_time('2006-10-01T00:00:00-4'); print "Column Labels: " . join(', ', $rs->column_label_list) . "\n"; print $rs->toSQL; diff --git a/Open-ILS/src/perlmods/OpenILS/Reporter/SQLBuilder.pm b/Open-ILS/src/perlmods/OpenILS/Reporter/SQLBuilder.pm index f5aee5b2a9..c2bfb96311 100644 --- a/Open-ILS/src/perlmods/OpenILS/Reporter/SQLBuilder.pm +++ b/Open-ILS/src/perlmods/OpenILS/Reporter/SQLBuilder.pm @@ -882,11 +882,12 @@ sub new { sub _flesh_conditions { my $cond = shift; + my $builder = shift; $cond = [$cond] unless (ref($cond) eq 'ARRAY'); my @out; for my $c (@$cond) { - push @out, OpenILS::Reporter::SQLBuilder::Input->new( $c ); + push @out, OpenILS::Reporter::SQLBuilder::Input->new( $c )->set_builder( $builder ); } return \@out; @@ -899,7 +900,7 @@ sub toSQL { my $sql = $self->SUPER::toSQL; my ($op) = keys %{ $self->{_condition} }; - my $val = _flesh_conditions( $self->resolve_param( $self->{_condition}->{$op} ) ); + my $val = _flesh_conditions( $self->resolve_param( $self->{_condition}->{$op} ), $self->builder ); if (lc($op) eq 'in') { $sql .= " IN (". join(",", map { $_->toSQL } @$val).")"; diff --git a/Open-ILS/src/reporter/clark-kent.pl b/Open-ILS/src/reporter/clark-kent.pl index 3234904500..82c8bb7ca7 100755 --- a/Open-ILS/src/reporter/clark-kent.pl +++ b/Open-ILS/src/reporter/clark-kent.pl @@ -577,7 +577,7 @@ sub draw_bars { my $max_y = 0; for my $vcol (@values) { next unless (defined $vcol); - + $pic_data[$set] ||= []; my $pos = 0; for my $row (@$data) { @@ -598,11 +598,11 @@ sub draw_bars { my @no_use; my $set_index = 0; for my $dataset (@pic_data) { - splice(@$dataset,$_,1) for (sort { $b <=> $a } @trim_cols); + splice(@$dataset,$_,1) for (reverse sort @trim_cols); if (grep { $_ } @$dataset) { push @new_data, $dataset; - push @use_me, $set_index; + push @use_me, $set_index if ($set_index > 0); } else { push @no_use, $set_index; } @@ -613,7 +613,7 @@ sub draw_bars { return [] unless ($new_data[0] && @{$new_data[0]}); for my $col (@use_me) { - push @leg, $r->{column_labels}->[$col + @groups - 1] if (map { 1 } grep { $col == $_ } @values); + push @leg, $r->{column_labels}->[$values[$col - 1]]; } my $w = 100 + 10 * scalar(@{$new_data[0]}); @@ -688,6 +688,7 @@ sub draw_lines { my $max_y = 0; for my $vcol (@values) { next unless (defined $vcol); + $pic_data[$set] ||= []; for my $row (@$data) { @@ -708,7 +709,7 @@ sub draw_lines { if (grep { $_ } @$dataset) { push @new_data, $dataset; - push @use_me, $set_index; + push @use_me, $set_index if ($set_index > 0); } else { push @no_use, $set_index; } @@ -717,7 +718,7 @@ sub draw_lines { } for my $col (@use_me) { - push @leg, $r->{column_labels}->[$col + @groups - 1] if (map { 1 } grep { $col == $_ } @values); + push @leg, $r->{column_labels}->[$values[$col - 1]]; } my $w = 100 + 10 * scalar(@{$new_data[0]}); -- 2.43.2