[freeside-commits] freeside/FS/FS/part_pkg torrus_Common.pm, 1.3, 1.4

Ivan,,, ivan at wavetail.420.am
Sun Jan 23 16:26:13 PST 2011


Update of /home/cvs/cvsroot/freeside/FS/FS/part_pkg
In directory wavetail.420.am:/tmp/cvs-serv12327

Modified Files:
	torrus_Common.pm 
Log Message:
torrus, RT#10574

Index: torrus_Common.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_pkg/torrus_Common.pm,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -w -d -r1.3 -r1.4
--- torrus_Common.pm	24 Jan 2011 00:10:39 -0000	1.3
+++ torrus_Common.pm	24 Jan 2011 00:26:11 -0000	1.4
@@ -5,6 +5,8 @@
 
 our %info = ( 'disabled' => 1 ); #torrus_Common not a usable price plan directly
 
+our $DEBUG = 1;
+
 sub calc_recur {
   my $self = shift;
   my($cust_pkg, $sdate, $details, $param ) = @_;
@@ -28,13 +30,16 @@
   my $self = shift;
   my($cust_pkg, $sdate, $details, $param ) = @_;
 
+
   my @sdate = localtime($$sdate);
   my $rep_date = ($sdate[5]+1900). '-'. ($sdate[4]+1). '-01';
+  warn "searching for MonthlyUsage report for $rep_date\n" if $DEBUG;
   my $rep_sql = "
     SELECT id FROM reports WHERE rep_date = ?
                              AND reportname = 'MonthlyUsage' and iscomplete = 1
   ";
   my $rep_id = $self->scalar_sql($rep_sql, $rep_date) or return 0;
+  warn "report id $rep_id found\n" if $DEBUG;
 
   #abort if ! iscomplete instead?
 
@@ -55,10 +60,12 @@
 
     my $serviceid = $svc_port->serviceid;
 
+    warn "searching for $serviceid usage\n" if $DEBUG;
     my $in  = $self->scalar_sql($sql, $self->_torrus_name, $serviceid.'_IN');
     my $out = $self->scalar_sql($sql, $self->_torrus_name, $serviceid.'_OUT');
 
     my $max = max($in,$out);
+    warn "$serviceid usage is $max\n" if $DEBUG;
 
     my $inc = $self->option($self->_torrus_base);#aggregate instead of per-port?
     $max -= $inc;



More information about the freeside-commits mailing list