[freeside-commits] freeside/FS/FS/part_export domreg_opensrs.pm, 1.1.2.2, 1.1.2.3

Richard Siddall rsiddall at wavetail.420.am
Fri May 15 19:31:36 PDT 2009


Update of /home/cvs/cvsroot/freeside/FS/FS/part_export
In directory wavetail.420.am:/tmp/cvs-serv3978/FS/FS/part_export

Modified Files:
      Tag: FREESIDE_1_7_BRANCH
	domreg_opensrs.pm 
Log Message:
Provide better diagnostics when the cust_main owning this domain lacks
fields required for use as a contact handle in the domain registration
record.
Also temporarily disable the ability to use the export for only registration
or only transfers.


Index: domreg_opensrs.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_export/domreg_opensrs.pm,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -d -r1.1.2.2 -r1.1.2.3
--- domreg_opensrs.pm	15 May 2009 19:43:06 -0000	1.1.2.2
+++ domreg_opensrs.pm	16 May 2009 02:31:34 -0000	1.1.2.3
@@ -51,12 +51,12 @@
                       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 @@
   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 @@
 
   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 @@
   }
 
   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;



More information about the freeside-commits mailing list