X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2Fsvc_Common.pm;h=2866bfea49a418b9612b686b86c7831934470828;hp=32c1d90e8db240a1e007e56006b4fc28c3b4790c;hb=48bade3f01a672f235d61a29ad0d0b792fc80eab;hpb=93d2608554affca0d1e49ab1469328960c75848e diff --git a/FS/FS/svc_Common.pm b/FS/FS/svc_Common.pm index 32c1d90e8..2866bfea4 100644 --- a/FS/FS/svc_Common.pm +++ b/FS/FS/svc_Common.pm @@ -249,6 +249,7 @@ sub insert { my $error = $self->set_auto_inventory || $self->check + || $self->_check_duplicate || $self->SUPER::insert; if ( $error ) { $dbh->rollback if $oldAutoCommit; @@ -314,6 +315,10 @@ sub insert { ''; } +#fallbacks +sub _check_duplcate { ''; } +sub table_dupcheck_fields { (); } + =item delete [ , OPTION => VALUE ... ] Deletes this account from the database. If there is an error, returns the @@ -390,6 +395,25 @@ sub replace { return $error; } + #redundant, but so any duplicate fields are maniuplated as appropriate + # (svc_phone.phonenum) + my $error = $new->check; + if ( $error ) { + $dbh->rollback if $oldAutoCommit; + return $error; + } + + #if ( $old->username ne $new->username || $old->domsvc != $new->domsvc ) { + if ( grep { $old->$_ ne $new->$_ } $new->table_dupcheck_fields ) { + + $new->svcpart( $new->cust_svc->svcpart ) unless $new->svcpart; + $error = $new->_check_duplicate; + if ( $error ) { + $dbh->rollback if $oldAutoCommit; + return $error; + } + } + $error = $new->SUPER::replace($old); if ($error) { $dbh->rollback if $oldAutoCommit;