- foreach my $nsmachine ( @nsmachines ) {
- my $ns = new FS::domain_record {
- 'svcnum' => $self->svcnum,
- 'reczone' => '@',
- 'recaf' => 'IN',
- 'rectype' => 'NS',
- 'recdata' => $nsmachine,
- };
- my $error = $ns->insert;
- if ( $error ) {
- $dbh->rollback if $oldAutoCommit;
- return "couldn't insert NS record for new domain: $error";
- }
- }
-
- foreach my $mxmachine ( @mxmachines ) {
- my $mx = new FS::domain_record {
- 'svcnum' => $self->svcnum,
- 'reczone' => '@',
- 'recaf' => 'IN',
- 'rectype' => 'MX',
- 'recdata' => $mxmachine,
- };
- my $error = $mx->insert;
- if ( $error ) {
- $dbh->rollback if $oldAutoCommit;
- return "couldn't insert MX record for new domain: $error";
- }
- }
-
- foreach my $arecord ( keys %arecords ) {
- my $arec = new FS::domain_record {
- 'svcnum' => $self->svcnum,
- 'reczone' => $arecord,
- 'recaf' => 'IN',
- 'rectype' => 'A',
- 'recdata' => $arecords{$arecord},
- };
- my $error = $arec->insert;
- if ( $error ) {
- $dbh->rollback if $oldAutoCommit;
- return "WARNING: couldn't insert A record for new domain: $error";
- }
- }
-
- foreach my $cnamerecord ( keys %cnamerecords ) {
- my $cnamerec = new FS::domain_record {
+ foreach my $record ( @defaultrecords ) {
+ my($zone,$af,$type,$data) = split(/\s+/,$record,4);
+ my $domain_record = new FS::domain_record {