on-demand vs. automatic cards & checks: added DCRD and DCHK payment types
[freeside.git] / FS / FS / svc_domain.pm
index fd57713..3941d6e 100644 (file)
@@ -251,10 +251,6 @@ sub delete {
   return "Can't delete a domain which has accounts!"
     if qsearch( 'svc_acct', { 'domsvc' => $self->svcnum } );
 
-  return "Can't delete a domain with (svc_acct_sm) mail aliases!"
-    if defined( $FS::Record::dbdef->table('svc_acct_sm') )
-       && qsearch('svc_acct_sm', { 'domsvc' => $self->svcnum } );
-
   #return "Can't delete a domain with (domain_record) zone entries!"
   #  if qsearch('domain_record', { 'svcnum' => $self->svcnum } );
 
@@ -269,12 +265,6 @@ sub delete {
   local $FS::UID::AutoCommit = 0;
   my $dbh = dbh;
 
-  my $error = $self->SUPER::delete;
-  if ( $error ) {
-    $dbh->rollback if $oldAutoCommit;
-    return $error;
-  }
-
   foreach my $domain_record ( reverse $self->domain_record ) {
     my $error = $domain_record->delete;
     if ( $error ) {
@@ -282,6 +272,13 @@ sub delete {
       return $error;
     }
   }
+
+  my $error = $self->SUPER::delete;
+  if ( $error ) {
+    $dbh->rollback if $oldAutoCommit;
+    return $error;
+  }
+
   $dbh->commit or die $dbh->errstr if $oldAutoCommit;
 }
 
@@ -294,7 +291,6 @@ returns the error, otherwise returns false.
 
 sub replace {
   my ( $new, $old ) = ( shift, shift );
-  my $error;
 
   return "Can't change domain - reorder."
     if $old->getfield('domain') ne $new->getfield('domain'); 
@@ -386,8 +382,10 @@ sub check {
   $recref->{action} =~ /^(M|N)$/ or return "Illegal action";
   $recref->{action} = $1;
 
-  my $svc_acct = qsearchs( 'svc_acct', { 'svcnum' => $recref->{catchall} } );
-  return "Unknown catchall" unless $svc_acct || ! $recref->{catchall};
+  if ( $recref->{catchall} ne '' ) {
+    my $svc_acct = qsearchs( 'svc_acct', { 'svcnum' => $recref->{catchall} } );
+    return "Unknown catchall" unless $svc_acct;
+  }
 
   $self->ut_textn('purpose');
 
@@ -449,10 +447,6 @@ sub submit_internic {
 
 =back
 
-=head1 VERSION
-
-$Id: svc_domain.pm,v 1.30 2002-05-31 00:18:57 khoff Exp $
-
 =head1 BUGS
 
 All BIND/DNS fields should be included (and exported).