diff options
author | rsiddall <rsiddall> | 2009-05-16 02:29:54 +0000 |
---|---|---|
committer | rsiddall <rsiddall> | 2009-05-16 02:29:54 +0000 |
commit | 4f1256b03a041ddf12faa8e7891065ad5e1e9399 (patch) | |
tree | a41a4d1b2515e9e4e93356a3d3d58faf9e9722e8 /FS/FS/part_export/domreg_opensrs.pm | |
parent | ad84bf7cfdb56aa1fe268ea315b7a2f7dd768db2 (diff) |
Provide better diagnostics when the cust_main owning this domain does not
provide fields required for use as a contact handle in the domain
registration record.
Also temporarily disable the ability to have the export do only registration
or only transfers.
Diffstat (limited to 'FS/FS/part_export/domreg_opensrs.pm')
-rw-r--r-- | FS/FS/part_export/domreg_opensrs.pm | 45 |
1 files changed, 37 insertions, 8 deletions
diff --git a/FS/FS/part_export/domreg_opensrs.pm b/FS/FS/part_export/domreg_opensrs.pm index ec73d3ce5..5d5c59530 100644 --- a/FS/FS/part_export/domreg_opensrs.pm +++ b/FS/FS/part_export/domreg_opensrs.pm @@ -51,12 +51,12 @@ tie %options, 'Tie::IxHash', type => 'select', options => [ 0, 1, 2, 3 ], default => 0 }, - 'register' => { label => 'Use for registration', - type => 'checkbox', - default => '1' }, - 'transfer' => { label => 'Use for transfer', - type => 'checkbox', - default => '1' }, +# 'register' => { label => 'Use for registration', +# type => 'checkbox', +# default => '1' }, +# 'transfer' => { label => 'Use for transfer', +# type => 'checkbox', +# default => '1' }, 'tlds' => { label => 'Use this export for these top-level domains (TLDs)', type => 'select', multi => 1, @@ -154,6 +154,32 @@ sub gen_contact_info return $c; } +sub validate_contact_info { + my $c = shift; + + my %fields = ( + firstname => "first name", + lastname => "last name", + address => "street address", + city => "city", + state => "state", + zip => "ZIP/postal code", + country => "country", + email => "email address", + phone => "phone number", + ); + my @err = (); + foreach (keys %fields) { + if (!defined($c->{$_}) || !$c->{$_}) { + push @err, $fields{$_}; + } + } + if (scalar(@err) > 0) { + return "Contact information needs: " . join(', ', @err); + } + undef; +} + sub testmode { my $self = shift; @@ -183,6 +209,9 @@ sub _export_insert { my $c = gen_contact_info($cust_main); + my $err = validate_contact_info($c); + return $err if $err; + my $srs = Net::OpenSRS->new(); $srs->debug_level( $self->option('debug_level') ); # Output should be in the Apache error log @@ -198,10 +227,10 @@ sub _export_insert { } if ($svc_domain->action eq 'N') { - return "Domain registration not enabled" if !$self->option('register'); +# return "Domain registration not enabled" if !$self->option('register'); return $srs->last_response() if !$srs->register_domain( $svc_domain->domain, $c); } elsif ($svc_domain->action eq 'M') { - return "Domain transfer not enabled" if !$self->option('transfer'); +# return "Domain transfer not enabled" if !$self->option('transfer'); return $srs->last_response() if !$srs->transfer_domain( $svc_domain->domain, $c); } else { return "Unknown domain action " . $svc_domain->action; |