[freeside-commits] branch FREESIDE_2_3_BRANCH updated. 5dc38d70da9bdaeebc4a90c955022cdf917f62ad
Ivan
ivan at 420.am
Fri Jun 1 01:29:33 PDT 2012
The branch, FREESIDE_2_3_BRANCH has been updated
via 5dc38d70da9bdaeebc4a90c955022cdf917f62ad (commit)
from cf8051f1b06d78a1267c468ce067b03f25575162 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 5dc38d70da9bdaeebc4a90c955022cdf917f62ad
Author: Ivan Kohler <ivan at freeside.biz>
Date: Fri Jun 1 01:29:30 2012 -0700
don't leave dangling cust_svc records when running inside a big transaction (i.e. data import)
diff --git a/FS/FS/svc_Common.pm b/FS/FS/svc_Common.pm
index 19f5819..a6daf44 100644
--- a/FS/FS/svc_Common.pm
+++ b/FS/FS/svc_Common.pm
@@ -244,6 +244,7 @@ sub insert {
my $svcnum = $self->svcnum;
my $cust_svc = $svcnum ? qsearchs('cust_svc',{'svcnum'=>$self->svcnum}) : '';
+ my $inserted_cust_svc = 0;
#unless ( $svcnum ) {
if ( !$svcnum or !$cust_svc ) {
$cust_svc = new FS::cust_svc ( {
@@ -257,6 +258,7 @@ sub insert {
$dbh->rollback if $oldAutoCommit;
return $error;
}
+ $inserted_cust_svc = 1;
$svcnum = $self->svcnum($cust_svc->svcnum);
} else {
#$cust_svc = qsearchs('cust_svc',{'svcnum'=>$self->svcnum});
@@ -275,6 +277,10 @@ sub insert {
|| $self->preinsert_hook
|| $self->SUPER::insert;
if ( $error ) {
+ if ( $inserted_cust_svc ) {
+ my $derror = $cust_svc->delete;
+ die $derror if $derror;
+ }
$dbh->rollback if $oldAutoCommit;
return $error;
}
-----------------------------------------------------------------------
Summary of changes:
FS/FS/svc_Common.pm | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
More information about the freeside-commits
mailing list