From 701d58049bab6ac7c4e6591d90bc739ef987af31 Mon Sep 17 00:00:00 2001 From: Christopher York Date: Tue, 11 Dec 2012 16:45:17 -0600 Subject: [PATCH] Fixed: @hostName is required to create website - removed this requirement Fixed: Temporary URL / Instant alias is not properly created / assigned to the created website Added: New @createZoneRecord parameter on "CreateUserWizard" to allow WHMCS module to determine if a DNS Zone is to be created or not. --- .../PackagesProxy.cs | 23 ++++++++----- .../Code/Wizards/UserCreationWizard.cs | 33 ++++++++++--------- .../esPackages.asmx.cs | 4 +-- 3 files changed, 35 insertions(+), 25 deletions(-) diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/PackagesProxy.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/PackagesProxy.cs index 83b3a007..0150666a 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/PackagesProxy.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/PackagesProxy.cs @@ -2743,7 +2743,8 @@ namespace WebsitePanel.EnterpriseServer { bool createFtpAccount, string ftpAccountName, bool createMailAccount, - string hostName) { + string hostName, + bool createZoneRecord) { object[] results = this.Invoke("CreateUserWizard", new object[] { parentPackageId, username, @@ -2764,7 +2765,8 @@ namespace WebsitePanel.EnterpriseServer { createFtpAccount, ftpAccountName, createMailAccount, - hostName}); + hostName, + createZoneRecord}); return ((int)(results[0])); } @@ -2789,7 +2791,8 @@ namespace WebsitePanel.EnterpriseServer { bool createFtpAccount, string ftpAccountName, bool createMailAccount, - string hostName, + string hostName, + bool createZoneRecord, System.AsyncCallback callback, object asyncState) { return this.BeginInvoke("CreateUserWizard", new object[] { @@ -2812,7 +2815,8 @@ namespace WebsitePanel.EnterpriseServer { createFtpAccount, ftpAccountName, createMailAccount, - hostName}, callback, asyncState); + hostName, + createZoneRecord}, callback, asyncState); } /// @@ -2842,8 +2846,9 @@ namespace WebsitePanel.EnterpriseServer { bool createFtpAccount, string ftpAccountName, bool createMailAccount, - string hostName) { - this.CreateUserWizardAsync(parentPackageId, username, password, roleId, firstName, lastName, email, secondaryEmail, htmlMail, sendAccountLetter, createPackage, planId, sendPackageLetter, domainName, tempDomain, createWebSite, createFtpAccount, ftpAccountName, createMailAccount, hostName, null); + string hostName, + bool createZoneRecord) { + this.CreateUserWizardAsync(parentPackageId, username, password, roleId, firstName, lastName, email, secondaryEmail, htmlMail, sendAccountLetter, createPackage, planId, sendPackageLetter, domainName, tempDomain, createWebSite, createFtpAccount, ftpAccountName, createMailAccount, hostName, createZoneRecord, null); } /// @@ -2867,7 +2872,8 @@ namespace WebsitePanel.EnterpriseServer { bool createFtpAccount, string ftpAccountName, bool createMailAccount, - string hostName, + string hostName, + bool createZoneRecord, object userState) { if ((this.CreateUserWizardOperationCompleted == null)) { this.CreateUserWizardOperationCompleted = new System.Threading.SendOrPostCallback(this.OnCreateUserWizardOperationCompleted); @@ -2892,7 +2898,8 @@ namespace WebsitePanel.EnterpriseServer { createFtpAccount, ftpAccountName, createMailAccount, - hostName}, this.CreateUserWizardOperationCompleted, userState); + hostName, + createZoneRecord}, this.CreateUserWizardOperationCompleted, userState); } private void OnCreateUserWizardOperationCompleted(object arg) { diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/Wizards/UserCreationWizard.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/Wizards/UserCreationWizard.cs index c1d24976..e9be078d 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/Wizards/UserCreationWizard.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/Wizards/UserCreationWizard.cs @@ -50,7 +50,7 @@ namespace WebsitePanel.EnterpriseServer bool sendAccountLetter, bool createPackage, int planId, bool sendPackageLetter, string domainName, bool tempDomain, bool createWebSite, - bool createFtpAccount, string ftpAccountName, bool createMailAccount, string hostName) + bool createFtpAccount, string ftpAccountName, bool createMailAccount, string hostName, bool createZoneRecord) { UserCreationWizard wizard = new UserCreationWizard(); @@ -59,7 +59,7 @@ namespace WebsitePanel.EnterpriseServer sendAccountLetter, createPackage, planId, sendPackageLetter, domainName, tempDomain, createWebSite, - createFtpAccount, ftpAccountName, createMailAccount, hostName); + createFtpAccount, ftpAccountName, createMailAccount, hostName, createZoneRecord); } // private fields @@ -72,7 +72,7 @@ namespace WebsitePanel.EnterpriseServer bool sendAccountLetter, bool createPackage, int planId, bool sendPackageLetter, string domainName, bool tempDomain, bool createWebSite, - bool createFtpAccount, string ftpAccountName, bool createMailAccount, string hostName) + bool createFtpAccount, string ftpAccountName, bool createMailAccount, string hostName, bool createZoneRecord) { // check account @@ -173,7 +173,7 @@ namespace WebsitePanel.EnterpriseServer domain.PackageId = createdPackageId; domain.DomainName = domainName; domain.HostingAllowed = false; - domainId = ServerController.AddDomain(domain, false, !tempDomain); + domainId = ServerController.AddDomain(domain, false, createZoneRecord); if (domainId < 0) { // rollback wizard @@ -193,7 +193,7 @@ namespace WebsitePanel.EnterpriseServer } } - if (createWebSite && !String.IsNullOrEmpty(domainName) && !String.IsNullOrEmpty(hostName)) + if (createWebSite && !String.IsNullOrEmpty(domainName)) { // create web site try @@ -301,16 +301,6 @@ namespace WebsitePanel.EnterpriseServer MailServerController.UpdateMailDomain(mailDomain); int mailDomainId = mailDomain.Id; - - // set mail domain pointer - // load domain instant alias - string instantAlias = ServerController.GetDomainAlias(createdPackageId, domainName); - DomainInfo instantDomain = ServerController.GetDomain(instantAlias); - if (instantDomain == null || instantDomain.MailDomainId > 0) - instantAlias = ""; - - if (!String.IsNullOrEmpty(instantAlias)) - MailServerController.AddMailDomainPointer(mailDomainId, instantDomain.DomainId); } catch (Exception ex) { @@ -320,6 +310,19 @@ namespace WebsitePanel.EnterpriseServer // error while creating mail account throw new Exception("Could not create mail account", ex); } + + // Instant Alias / Temporary URL + if (tempDomain && (domainId > 0)) + { + int instantAliasId = ServerController.CreateDomainInstantAlias("", domainId); + if (instantAliasId < 0) + { + // rollback wizard + Rollback(); + + return instantAliasId; + } + } } } diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esPackages.asmx.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esPackages.asmx.cs index 225297d8..1eb8e8ee 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esPackages.asmx.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esPackages.asmx.cs @@ -436,13 +436,13 @@ namespace WebsitePanel.EnterpriseServer bool sendAccountLetter, bool createPackage, int planId, bool sendPackageLetter, string domainName, bool tempDomain, bool createWebSite, - bool createFtpAccount, string ftpAccountName, bool createMailAccount, string hostName) + bool createFtpAccount, string ftpAccountName, bool createMailAccount, string hostName, bool createZoneRecord) { return UserCreationWizard.CreateUserAccount(parentPackageId, username, password, roleId, firstName, lastName, email, secondaryEmail, htmlMail, sendAccountLetter, createPackage, planId, sendPackageLetter, domainName, tempDomain, createWebSite, createFtpAccount, ftpAccountName, - createMailAccount, hostName); + createMailAccount, hostName, createZoneRecord); } #endregion