merge webpay support in with autoselection of old realtime_bop and realtime_refund_bop
[freeside.git] / FS / FS / part_export / www_plesk.pm
index a4ebbf5..82d5557 100644 (file)
@@ -10,6 +10,9 @@ tie my %options, 'Tie::IxHash',
   'URL'       => { label=>'URL' },
   'login'     => { label=>'Login' },
   'password'  => { label=>'Password' },
+  'template'  => { label=>'Domain Template' },
+  'web'       => { label=>'Host Website',
+                    type=>'checkbox'          },
   'debug'     => { label=>'Enable debugging',
                     type=>'checkbox'          },
 ;
@@ -36,7 +39,7 @@ sub rebless { shift; }
 sub _export_insert {
   my( $self, $www ) = ( shift, shift );
 
-  eval "use Net::Plesk'";
+  eval "use Net::Plesk;";
   return $@ if $@;
 
   my $plesk = new Net::Plesk (
@@ -71,17 +74,29 @@ sub _export_insert {
                                  $www->domain_record->recdata,
                                        );
 
-  $self->_plesk_command( 'domain_add', 
-                         $www->domain_record->svc_domain->domain,
-                        $gcresp->id,
-                        $www->domain_record->recdata,
-                      );
+  if ($self->option('web')) {
+    $self->_plesk_command( 'domain_add', 
+                           $www->domain_record->svc_domain->domain,
+                          $gcresp->id,
+                          $www->domain_record->recdata,
+                           $self->option('template')?$self->option('template'):'',
+                           $www->svc_acct->username,
+                           $www->svc_acct->_password,
+                        );
+  }else{
+    $self->_plesk_command( 'domain_add', 
+                           $www->domain_record->svc_domain->domain,
+                          $gcresp->id,
+                          $www->domain_record->recdata,
+                           $self->option('template')?$self->option('template'):'',
+                        );
+  }
 }
 
 sub _plesk_command {
   my( $self, $method, @args ) = @_;
 
-  eval "use Net::Plesk'";
+  eval "use Net::Plesk;";
   return $@ if $@;
   
   local($Net::Plesk::DEBUG) = 1