[freeside-commits] freeside/FS/FS/part_export sqlradius.pm, 1.25.2.8, 1.25.2.9
Ivan,,,
ivan at wavetail.420.am
Mon Jun 23 19:09:41 PDT 2008
Update of /home/cvs/cvsroot/freeside/FS/FS/part_export
In directory wavetail.420.am:/tmp/cvs-serv12299
Modified Files:
Tag: FREESIDE_1_7_BRANCH
sqlradius.pm
Log Message:
prevent decrementing time/bandwidth for old RADIUS records
Index: sqlradius.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_export/sqlradius.pm,v
retrieving revision 1.25.2.8
retrieving revision 1.25.2.9
diff -u -d -r1.25.2.8 -r1.25.2.9
--- sqlradius.pm 18 May 2008 22:55:43 -0000 1.25.2.8
+++ sqlradius.pm 24 Jun 2008 02:09:38 -0000 1.25.2.9
@@ -677,16 +677,26 @@
} elsif ( scalar(@svc_acct) > 1 ) {
warn "WARNING: multiple svc_acct records found $errinfo - skipping\n";
} else {
- warn "found svc_acct ". $svc_acct[0]->svcnum. " $errinfo\n" if $DEBUG;
- $svc_acct[0]->last_login($AcctStartTime);
- $svc_acct[0]->last_logout($AcctStopTime);
- my @stati;
- push @stati, _try_decrement($svc_acct[0], 'seconds', $AcctSessionTime);
- push @stati, _try_decrement($svc_acct[0], 'upbytes', $AcctInputOctets);
- push @stati, _try_decrement($svc_acct[0], 'downbytes', $AcctOutputOctets);
- push @stati, _try_decrement($svc_acct[0], 'totalbytes', $AcctInputOctets +
- $AcctOutputOctets);
- $status=join(' ', @stati);
+
+ my $svc_acct = $svc_acct[0];
+ warn "found svc_acct ". $svc_acct->svcnum. " $errinfo\n" if $DEBUG;
+
+ $svc_acct->last_login($AcctStartTime);
+ $svc_acct->last_logout($AcctStopTime);
+
+ my $cust_pkg = $svc_acct->cust_svc->cust_pkg;
+ if ( $cust_pkg && $AcctStopTime < ( $cust_pkg->last_bill
+ || $cust_pkg->setup ) ) {
+ $status = 'skipped (too old)';
+ } else {
+ my @st;
+ push @st, _try_decrement($svc_acct, 'seconds', $AcctSessionTime );
+ push @st, _try_decrement($svc_acct, 'upbytes', $AcctInputOctets );
+ push @st, _try_decrement($svc_acct, 'downbytes', $AcctOutputOctets );
+ push @st, _try_decrement($svc_acct, 'totalbytes', $AcctInputOctets
+ + $AcctOutputOctets);
+ $status=join(' ', @st);
+ }
}
warn "setting FreesideStatus to $status $errinfo\n" if $DEBUG;
More information about the freeside-commits
mailing list