summaryrefslogtreecommitdiff
path: root/FS/FS/svc_domain.pm
diff options
context:
space:
mode:
Diffstat (limited to 'FS/FS/svc_domain.pm')
-rw-r--r--FS/FS/svc_domain.pm62
1 files changed, 52 insertions, 10 deletions
diff --git a/FS/FS/svc_domain.pm b/FS/FS/svc_domain.pm
index 4d85060d3..dde6d3c2c 100644
--- a/FS/FS/svc_domain.pm
+++ b/FS/FS/svc_domain.pm
@@ -207,6 +207,27 @@ sub table_info {
label => 'Acct. default Add trailer to sent mail',
type => 'checkbox',
},
+ 'acct_def_cgp_archiveafter' => {
+ label => 'Archive messages after',
+ type => 'select',
+ select_hash => [
+ -2 => 'default(730 days)',
+ 0 => 'Never',
+ 86400 => '24 hours',
+ 172800 => '2 days',
+ 259200 => '3 days',
+ 432000 => '5 days',
+ 604800 => '7 days',
+ 1209600 => '2 weeks',
+ 2592000 => '30 days',
+ 7776000 => '90 days',
+ 15552000 => '180 days',
+ 31536000 => '365 days',
+ 63072000 => '730 days',
+ ],
+ disable_inventory => 1,
+ disable_select => 1,
+ },
'trailer' => {
label => 'Mail trailer',
type => 'textarea',
@@ -282,9 +303,6 @@ defined. An FS::cust_svc record will be created and inserted.
The additional field I<action> should be set to I<N> for new domains, I<M>
for transfers, or I<I> for no action (registered elsewhere).
-A registration or transfer email will be submitted unless
-$FS::svc_domain::whois_hack is true.
-
The additional field I<email> can be used to manually set the admin contact
email address on this email. Otherwise, the svc_acct records for this package
(see L<FS::cust_pkg>) are searched. If there is exactly one svc_acct record
@@ -320,12 +338,36 @@ sub insert {
local $FS::UID::AutoCommit = 0;
my $dbh = dbh;
- $error = $self->SUPER::insert(@_);
+ $error = $self->SUPER::insert(@_)
+ || $self->insert_defaultrecords;
if ( $error ) {
$dbh->rollback if $oldAutoCommit;
return $error;
}
+ $dbh->commit or die $dbh->errstr if $oldAutoCommit;
+
+ ''; #no error
+}
+
+=item insert_defaultrecords
+
+=cut
+
+sub insert_defaultrecords {
+ my $self = shift;
+
+ local $SIG{HUP} = 'IGNORE';
+ local $SIG{INT} = 'IGNORE';
+ local $SIG{QUIT} = 'IGNORE';
+ local $SIG{TERM} = 'IGNORE';
+ local $SIG{TSTP} = 'IGNORE';
+ local $SIG{PIPE} = 'IGNORE';
+
+ my $oldAutoCommit = $FS::UID::AutoCommit;
+ local $FS::UID::AutoCommit = 0;
+ my $dbh = dbh;
+
if ( $soamachine ) {
my $soa = new FS::domain_record {
'svcnum' => $self->svcnum,
@@ -335,10 +377,10 @@ sub insert {
'recdata' => "$soamachine $soaemail ( ". time2str("%Y%m%d", time). "00 ".
"$soarefresh $soaretry $soaexpire $soadefaultttl )"
};
- $error = $soa->insert;
+ my $error = $soa->insert;
if ( $error ) {
$dbh->rollback if $oldAutoCommit;
- return "couldn't insert SOA record for new domain: $error";
+ return "couldn't insert SOA record: $error";
}
foreach my $record ( @defaultrecords ) {
@@ -353,7 +395,7 @@ sub insert {
my $error = $domain_record->insert;
if ( $error ) {
$dbh->rollback if $oldAutoCommit;
- return "couldn't insert record for new domain: $error";
+ return "couldn't insert record: $error";
}
}
@@ -490,7 +532,7 @@ sub check {
|| $self->ut_enum('acct_def_cgp_rpopallowed', [ '', 'Y' ])
|| $self->ut_enum('acct_def_cgp_mailtoall', [ '', 'Y' ])
|| $self->ut_enum('acct_def_cgp_addmailtrailer', [ '', 'Y' ])
- #XXX archive messages
+ || $self->ut_snumbern('acct_def_cgp_archiveafter')
#preferences
|| $self->ut_alphasn('acct_def_cgp_deletemode')
|| $self->ut_enum('acct_def_cgp_emptytrash',
@@ -501,7 +543,6 @@ sub check {
|| $self->ut_textn('acct_def_cgp_prontoskinname')
|| $self->ut_alphan('acct_def_cgp_sendmdnmode')
#mail
- #XXX rules, archive rule, spam foldering rule(s)
;
return $error if $error;
@@ -521,7 +562,7 @@ sub check {
$recref->{domain} = "$1.$2";
$recref->{suffix} ||= $2;
# hmmmmmmmm.
- } elsif ( $whois_hack && $recref->{domain} =~ /^([\w\-\.]+)\.(\w+)$/ ) {
+ } elsif ( $whois_hack && $recref->{domain} =~ /^([\w\-\.\/]+)\.(\w+)$/ ) {
$recref->{domain} = "$1.$2";
# need to match a list of suffixes - no guarantee they're top-level..
# http://wiki.mozilla.org/TLD_List
@@ -579,6 +620,7 @@ sub domain_record {
'A' => 5,
'TXT' => 6,
'PTR' => 7,
+ 'SRV' => 8,
);
my %sort = (