summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorivan <ivan>2002-11-06 04:23:24 +0000
committerivan <ivan>2002-11-06 04:23:24 +0000
commit2184d33d6b20e64b27589924573d5a2ff958286b (patch)
tree842e6802fcaa2e2ebf7c3cbb18514cfe35182057
parent1015c3701a9bc0634690b73705ce7a143b12fdac (diff)
safe regex for sqlradius hour/data billing, closes: Bug#474
-rw-r--r--FS/FS/part_pkg.pm6
1 files changed, 2 insertions, 4 deletions
diff --git a/FS/FS/part_pkg.pm b/FS/FS/part_pkg.pm
index 9c33e9a3b..f290420df 100644
--- a/FS/FS/part_pkg.pm
+++ b/FS/FS/part_pkg.pm
@@ -218,6 +218,8 @@ sub check {
or $r =~ /^my \$min = \$cust_pkg\->seconds_since\(\$cust_pkg\->bill \|\| 0\) \/ 60 \- \s*\d*\.?\d*\s*; \$min = 0 if \$min < 0; \s*\d*\.?\d*\s* \+ \s*\d*\.?\d*\s* \* \$min;\s*$/
+ or $r =~ /^my \$last_bill = \$cust_pkg\->last_bill; my \$hours = \$cust_pkg\->seconds_since_sqlradacct\(\$last_bill, \$sdate \) \/ 3600 - \s*\d\.?\d*\s*; \$hours = 0 if \$hours < 0; my \$input = \$cust_pkg\->attribute_since_sqlradacct\(\$last_bill, \$sdate, "AcctInputOctets" \) \/ 1048576; my \$output = \$cust_pkg\->attribute_since_sqlradacct\(\$last_bill, \$sdate, "AcctOutputOctets" \) \/ 1048576; my \$total = \$input \+ \$output \- \s*\d\.?\d*\s*; \$total = 0 if \$total < 0; my \$input = \$input - \s*\d\.?\d*\s*; \$input = 0 if \$input < 0; my \$output = \$output - \s*\d\.?\d*\s*; \$output = 0 if \$output < 0; \s*\d\.?\d*\s* \+ \s*\d\.?\d*\s* \* \$hours \+ \s*\d\.?\d*\s* \* \$input \+ \s*\d\.?\d*\s* \* \$output \+ \s*\d\.?\d*\s* \* \$total *;\s*$/
+
or do {
#log!
return "illegal recur: $r";
@@ -295,10 +297,6 @@ sub payby {
=back
-=head1 VERSION
-
-$Id: part_pkg.pm,v 1.14 2002-05-09 12:38:39 ivan Exp $
-
=head1 BUGS
The delete method is unimplemented.