[freeside-commits] freeside/FS/FS/Report/Table Monthly.pm, 1.20, 1.21
Mark Wells
mark at wavetail.420.am
Fri May 21 12:09:06 PDT 2010
Update of /home/cvs/cvsroot/freeside/FS/FS/Report/Table
In directory wavetail.420.am:/tmp/cvs-serv7712/FS/FS/Report/Table
Modified Files:
Monthly.pm
Log Message:
RT#8504: option to aggregate agents on sales report
Index: Monthly.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Report/Table/Monthly.pm,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -w -d -r1.20 -r1.21
--- Monthly.pm 8 Apr 2010 01:15:25 -0000 1.20
+++ Monthly.pm 21 May 2010 19:09:04 -0000 1.21
@@ -1,13 +1,14 @@
package FS::Report::Table::Monthly;
use strict;
-use vars qw( @ISA );
+use vars qw( @ISA $DEBUG );
use Time::Local;
use FS::UID qw( dbh );
use FS::Report::Table;
use FS::CurrentUser;
@ISA = qw( FS::Report::Table );
+$DEBUG = 0; # turning this on will trace all SQL statements, VERY noisy
=head1 NAME
@@ -378,12 +379,12 @@
}
if ( $opt{'use_override'} ) {
- $where = "(
+ $where = "AND (
part_pkg.classnum $comparison AND pkgpart_override IS NULL OR
override.classnum $comparison AND pkgpart_override IS NOT NULL
)";
} else {
- $where = "part_pkg.classnum $comparison";
+ $where = "AND part_pkg.classnum $comparison";
}
}
@@ -404,7 +405,7 @@
LEFT JOIN part_pkg USING ( pkgpart )
LEFT JOIN part_pkg AS override ON pkgpart_override = override.pkgpart
WHERE pkgnum != 0
- AND $where
+ $where
AND ". $self->in_time_period_and_agent($speriod, $eperiod, $agentnum);
if ($opt{use_usage} && $opt{use_usage} eq 'recurring') {
@@ -569,6 +570,7 @@
sub scalar_sql {
my( $self, $sql ) = ( shift, shift );
my $sth = dbh->prepare($sql) or die dbh->errstr;
+ warn "FS::Report::Table::Monthly\n$sql\n" if $DEBUG;
$sth->execute
or die "Unexpected error executing statement $sql: ". $sth->errstr;
$sth->fetchrow_arrayref->[0] || 0;
More information about the freeside-commits
mailing list