X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fsvc_Common.pm;h=ac7cab72f288b01089a00573d27a7d924fa87259;hb=fb13e429f8499f6eadad09c1452489ca0f4f7031;hp=5bea5b0ce479436a1b95f2de9e5081129510a12e;hpb=6cd87c0d3b5280446301c647fa5f1ec5a593fa3f;p=freeside.git diff --git a/FS/FS/svc_Common.pm b/FS/FS/svc_Common.pm index 5bea5b0ce..ac7cab72f 100644 --- a/FS/FS/svc_Common.pm +++ b/FS/FS/svc_Common.pm @@ -48,6 +48,10 @@ sub insert { local $SIG{TSTP} = 'IGNORE'; local $SIG{PIPE} = 'IGNORE'; + my $oldAutoCommit = $FS::UID::AutoCommit; + local $FS::UID::AutoCommit = 0; + my $dbh = dbh; + $error = $self->check; return $error if $error; @@ -55,21 +59,26 @@ sub insert { my $cust_svc; unless ( $svcnum ) { $cust_svc = new FS::cust_svc ( { - 'svcnum' => $svcnum, + #hua?# 'svcnum' => $svcnum, 'pkgnum' => $self->pkgnum, 'svcpart' => $self->svcpart, } ); $error = $cust_svc->insert; - return $error if $error; + if ( $error ) { + $dbh->rollback if $oldAutoCommit; + return $error; + } $svcnum = $self->svcnum($cust_svc->svcnum); } $error = $self->SUPER::insert; if ( $error ) { - $cust_svc->delete if $cust_svc; + $dbh->rollback if $oldAutoCommit; return $error; } + $dbh->commit or die $dbh->errstr if $oldAutoCommit; + ''; } @@ -184,7 +193,7 @@ sub cancel { ''; } =head1 VERSION -$Id: svc_Common.pm,v 1.1 1999-08-04 09:03:53 ivan Exp $ +$Id: svc_Common.pm,v 1.3 2001-04-15 13:35:12 ivan Exp $ =head1 BUGS