diff options
author | Ivan Kohler <ivan@freeside.biz> | 2018-10-28 19:01:52 -0700 |
---|---|---|
committer | Ivan Kohler <ivan@freeside.biz> | 2018-10-28 19:01:52 -0700 |
commit | d47a9089d83e31e89aed4e6605566f7131510ffe (patch) | |
tree | 8d2afc8a38b6847291ce26b2b96bb1b2fe756de8 /FS/FS/svc_acct.pm | |
parent | 37037466136f2c2826e02b6b9ac6719919074d2e (diff) |
fix svc_acct->replace on bill, RT#81529
Diffstat (limited to 'FS/FS/svc_acct.pm')
-rw-r--r-- | FS/FS/svc_acct.pm | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/FS/FS/svc_acct.pm b/FS/FS/svc_acct.pm index 1118c0d..32190b1 100644 --- a/FS/FS/svc_acct.pm +++ b/FS/FS/svc_acct.pm @@ -2008,14 +2008,16 @@ sub _op_usage { die "Can't update $column for svcnum". $self->svcnum if $rv == 0; - #$self->snapshot; #not necessary, we retain the old values - #create an object with the updated usage values - my $new = qsearchs('svc_acct', { 'svcnum' => $self->svcnum }); - #call exports - my $error = $new->replace($self); - if ( $error ) { - $dbh->rollback if $oldAutoCommit; - return "Error replacing: $error"; + if ( $conf->exists('radius-chillispot-max') ) { + #$self->snapshot; #not necessary, we retain the old values + #create an object with the updated usage values + my $new = qsearchs('svc_acct', { 'svcnum' => $self->svcnum }); + #call exports + my $error = $new->replace($self); + if ( $error ) { + $dbh->rollback if $oldAutoCommit; + return "Error replacing: $error"; + } } #overlimit_action eq 'cancel' handling @@ -2205,15 +2207,17 @@ sub set_usage { die "Can't update usage for svcnum ". $self->svcnum if $rv == 0; } - - #$self->snapshot; #not necessary, we retain the old values - #create an object with the updated usage values - my $new = qsearchs('svc_acct', { 'svcnum' => $self->svcnum }); - local($FS::Record::nowarn_identical) = 1; - my $error = $new->replace($self); #call exports - if ( $error ) { - $dbh->rollback if $oldAutoCommit; - return "Error replacing: $error"; + + if ( $conf->exists('radius-chillispot-max') ) { + #$self->snapshot; #not necessary, we retain the old values + #create an object with the updated usage values + my $new = qsearchs('svc_acct', { 'svcnum' => $self->svcnum }); + local($FS::Record::nowarn_identical) = 1; + my $error = $new->replace($self); #call exports + if ( $error ) { + $dbh->rollback if $oldAutoCommit; + return "Error replacing: $error"; + } } if ( $reset ) { |