X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fsvc_acct.pm;h=3e3ecb5bd3417f0b639ea5e7a9f0b5fca849bd24;hb=477015901c379f8cd6ba46cfaa4a9ae284ae582d;hp=f26b2109f33850c0fd190d629ea42c73dcc1f48c;hpb=4fd5994039666584fa14b7b2afbb4cd0d6481b21;p=freeside.git diff --git a/FS/FS/svc_acct.pm b/FS/FS/svc_acct.pm index f26b2109f..3e3ecb5bd 100644 --- a/FS/FS/svc_acct.pm +++ b/FS/FS/svc_acct.pm @@ -14,6 +14,7 @@ use vars qw( @ISA $DEBUG $me $conf $skip_fuzzyfiles $radius_password $radius_ip $dirhash @saltset @pw_set ); +use Scalar::Util qw( blessed ); use Carp; use Fcntl qw(:flock); use Date::Format; @@ -368,15 +369,6 @@ sub _lastlog { ' ('. $self->email. "): $time\n" if $DEBUG; - local $SIG{HUP} = 'IGNORE'; - local $SIG{INT} = 'IGNORE'; - local $SIG{QUIT} = 'IGNORE'; - local $SIG{TERM} = 'IGNORE'; - local $SIG{TSTP} = 'IGNORE'; - local $SIG{PIPE} = 'IGNORE'; - - my $oldAutoCommit = $FS::UID::AutoCommit; - local $FS::UID::AutoCommit = 0; my $dbh = dbh; my $sql = "UPDATE svc_acct SET last_log$op = ? WHERE svcnum = ?"; @@ -391,9 +383,6 @@ sub _lastlog { die "Can't update last_log$op for svcnum". $self->svcnum if $rv == 0; - warn "$me update successful; committing\n" - if $DEBUG; - $dbh->commit or die $dbh->errstr if $oldAutoCommit; $self->{'Hash'}->{"last_log$op"} = $time; }else{ $self->getfield("last_log$op"); @@ -746,14 +735,15 @@ contain an arrayref of group names. See L. =cut sub replace { - my ( $new, $old ) = ( shift, shift ); - my $error; + my $new = shift; + + my $old = ( blessed($_[0]) && $_[0]->isa('FS::Record') ) + ? shift + : $new->replace_old; + warn "$me replacing $old with $new\n" if $DEBUG; - # We absolutely have to have an old vs. new record to make this work. - if (!defined($old)) { - $old = qsearchs( 'svc_acct', { 'svcnum' => $new->svcnum } ); - } + my $error; return "can't modify system account" if $old->_check_system;