X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fcust_svc.pm;h=118ab79d20d419be6979de3cef99be98571372e9;hb=4f9e876b1e2549e09bafc85289951bbb973194aa;hp=7ee9b3f4099ab739c6b4e42d2a98fef179662859;hpb=6c420cf8a5f93e425840c0cb8ba841affa081f76;p=freeside.git diff --git a/FS/FS/cust_svc.pm b/FS/FS/cust_svc.pm index 7ee9b3f40..118ab79d2 100644 --- a/FS/FS/cust_svc.pm +++ b/FS/FS/cust_svc.pm @@ -172,15 +172,9 @@ sub replace { local $FS::UID::AutoCommit = 0; my $dbh = dbh; - my $error = $new->SUPER::replace($old); - if ( $error ) { - $dbh->rollback if $oldAutoCommit; - return $error if $error; - } - if ( $new->svcpart != $old->svcpart ) { my $svc_x = $new->svc_x; - my $new_svc_x = ref($svc_x)->new({$svc_x->hash}); + my $new_svc_x = ref($svc_x)->new({$svc_x->hash, svcpart=>$new->svcpart }); my $error = $new_svc_x->replace($svc_x); if ( $error ) { $dbh->rollback if $oldAutoCommit; @@ -188,6 +182,12 @@ sub replace { } } + my $error = $new->SUPER::replace($old); + if ( $error ) { + $dbh->rollback if $oldAutoCommit; + return $error if $error; + } + $dbh->commit or die $dbh->errstr if $oldAutoCommit; ''; #no error