diff options
author | jeff <jeff> | 2007-02-01 02:13:58 +0000 |
---|---|---|
committer | jeff <jeff> | 2007-02-01 02:13:58 +0000 |
commit | 6b03e02d41a9c90ff88d060f16d570b4d2a3d626 (patch) | |
tree | ffe7be602757a5adcc07e3d0112521df42ab67ec | |
parent | ff40e4713971790ef6e334bfb34c3657b7d23d80 (diff) |
better solution to ticket 1455
-rw-r--r-- | FS/FS/part_export/sqlradius.pm | 10 | ||||
-rw-r--r-- | FS/FS/svc_acct.pm | 23 |
2 files changed, 26 insertions, 7 deletions
diff --git a/FS/FS/part_export/sqlradius.pm b/FS/FS/part_export/sqlradius.pm index c2a1dabf3..5bf9b7a6a 100644 --- a/FS/FS/part_export/sqlradius.pm +++ b/FS/FS/part_export/sqlradius.pm @@ -31,10 +31,7 @@ tie %options, 'Tie::IxHash', type => 'checkbox', label => 'Show the Called-Station-ID on session reports', }, - 'keep_password' => { - type => 'checkbox', - label => 'Do not change the password on suspend and unsuspend events', - }, + 'overlimit_groups' => { label => 'Radius groups to assign to svc_acct which has exceeded its bandwidth or time limit', } , 'groups_susp_reason' => { label => 'Radius group mapping to reason (via template user)', type => 'textarea', @@ -205,9 +202,8 @@ sub _export_replace { sub _export_suspend { my( $self, $svc_acct ) = (shift, shift); - my $new = $self->option('keep_password') ? $svc_acct - : $svc_acct->clone_suspended; - + my $new = $svc_acct->clone_suspended; + local $SIG{HUP} = 'IGNORE'; local $SIG{INT} = 'IGNORE'; local $SIG{QUIT} = 'IGNORE'; diff --git a/FS/FS/svc_acct.pm b/FS/FS/svc_acct.pm index 6a681ca89..001514010 100644 --- a/FS/FS/svc_acct.pm +++ b/FS/FS/svc_acct.pm @@ -1518,6 +1518,29 @@ sub _op_usage { my $action = $op2action{$op}; + if ( &{$op2condition{$op}}($self, $column, $amount) ) { + my $cust_pkg = $self->cust_svc->cust_pkg; + foreach my $part_export ( $self->cust_svc->part_svc->part_export ) { + if ($part_export->option('overlimit_groups')) { + my ($new,$old); + my $other = new FS::svc_acct $self->hashref; + my $groups = &{ $self->_fieldhandlers->{'usergroup'} } + ($self, $part_export->option('overlimit_groups')); + $other->usergroup( $groups ); + if ($action eq 'suspend'){ + $new = $other; $old = $self; + }else{ + $new = $self; $old = $other; + } + my $error = $part_export->export_replace($new, $old); + if ( $error ) { + $dbh->rollback if $oldAutoCommit; + return "Error replacing radius groups in export, ${op}: $error"; + } + } + } + } + if ( $conf->exists("svc_acct-usage_$action") && &{$op2condition{$op}}($self, $column, $amount) ) { #my $error = $self->$action(); |