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.
This commit is contained in:
Christopher York 2012-12-11 16:45:17 -06:00
parent da9aafcb26
commit 701d58049b
3 changed files with 35 additions and 25 deletions

View file

@ -2743,7 +2743,8 @@ namespace WebsitePanel.EnterpriseServer {
bool createFtpAccount, bool createFtpAccount,
string ftpAccountName, string ftpAccountName,
bool createMailAccount, bool createMailAccount,
string hostName) { string hostName,
bool createZoneRecord) {
object[] results = this.Invoke("CreateUserWizard", new object[] { object[] results = this.Invoke("CreateUserWizard", new object[] {
parentPackageId, parentPackageId,
username, username,
@ -2764,7 +2765,8 @@ namespace WebsitePanel.EnterpriseServer {
createFtpAccount, createFtpAccount,
ftpAccountName, ftpAccountName,
createMailAccount, createMailAccount,
hostName}); hostName,
createZoneRecord});
return ((int)(results[0])); return ((int)(results[0]));
} }
@ -2789,7 +2791,8 @@ namespace WebsitePanel.EnterpriseServer {
bool createFtpAccount, bool createFtpAccount,
string ftpAccountName, string ftpAccountName,
bool createMailAccount, bool createMailAccount,
string hostName, string hostName,
bool createZoneRecord,
System.AsyncCallback callback, System.AsyncCallback callback,
object asyncState) { object asyncState) {
return this.BeginInvoke("CreateUserWizard", new object[] { return this.BeginInvoke("CreateUserWizard", new object[] {
@ -2812,7 +2815,8 @@ namespace WebsitePanel.EnterpriseServer {
createFtpAccount, createFtpAccount,
ftpAccountName, ftpAccountName,
createMailAccount, createMailAccount,
hostName}, callback, asyncState); hostName,
createZoneRecord}, callback, asyncState);
} }
/// <remarks/> /// <remarks/>
@ -2842,8 +2846,9 @@ namespace WebsitePanel.EnterpriseServer {
bool createFtpAccount, bool createFtpAccount,
string ftpAccountName, string ftpAccountName,
bool createMailAccount, bool createMailAccount,
string hostName) { 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); 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);
} }
/// <remarks/> /// <remarks/>
@ -2867,7 +2872,8 @@ namespace WebsitePanel.EnterpriseServer {
bool createFtpAccount, bool createFtpAccount,
string ftpAccountName, string ftpAccountName,
bool createMailAccount, bool createMailAccount,
string hostName, string hostName,
bool createZoneRecord,
object userState) { object userState) {
if ((this.CreateUserWizardOperationCompleted == null)) { if ((this.CreateUserWizardOperationCompleted == null)) {
this.CreateUserWizardOperationCompleted = new System.Threading.SendOrPostCallback(this.OnCreateUserWizardOperationCompleted); this.CreateUserWizardOperationCompleted = new System.Threading.SendOrPostCallback(this.OnCreateUserWizardOperationCompleted);
@ -2892,7 +2898,8 @@ namespace WebsitePanel.EnterpriseServer {
createFtpAccount, createFtpAccount,
ftpAccountName, ftpAccountName,
createMailAccount, createMailAccount,
hostName}, this.CreateUserWizardOperationCompleted, userState); hostName,
createZoneRecord}, this.CreateUserWizardOperationCompleted, userState);
} }
private void OnCreateUserWizardOperationCompleted(object arg) { private void OnCreateUserWizardOperationCompleted(object arg) {

View file

@ -50,7 +50,7 @@ namespace WebsitePanel.EnterpriseServer
bool sendAccountLetter, bool sendAccountLetter,
bool createPackage, int planId, bool sendPackageLetter, bool createPackage, int planId, bool sendPackageLetter,
string domainName, bool tempDomain, bool createWebSite, 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(); UserCreationWizard wizard = new UserCreationWizard();
@ -59,7 +59,7 @@ namespace WebsitePanel.EnterpriseServer
sendAccountLetter, sendAccountLetter,
createPackage, planId, sendPackageLetter, createPackage, planId, sendPackageLetter,
domainName, tempDomain, createWebSite, domainName, tempDomain, createWebSite,
createFtpAccount, ftpAccountName, createMailAccount, hostName); createFtpAccount, ftpAccountName, createMailAccount, hostName, createZoneRecord);
} }
// private fields // private fields
@ -72,7 +72,7 @@ namespace WebsitePanel.EnterpriseServer
bool sendAccountLetter, bool sendAccountLetter,
bool createPackage, int planId, bool sendPackageLetter, bool createPackage, int planId, bool sendPackageLetter,
string domainName, bool tempDomain, bool createWebSite, 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 // check account
@ -173,7 +173,7 @@ namespace WebsitePanel.EnterpriseServer
domain.PackageId = createdPackageId; domain.PackageId = createdPackageId;
domain.DomainName = domainName; domain.DomainName = domainName;
domain.HostingAllowed = false; domain.HostingAllowed = false;
domainId = ServerController.AddDomain(domain, false, !tempDomain); domainId = ServerController.AddDomain(domain, false, createZoneRecord);
if (domainId < 0) if (domainId < 0)
{ {
// rollback wizard // 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 // create web site
try try
@ -301,16 +301,6 @@ namespace WebsitePanel.EnterpriseServer
MailServerController.UpdateMailDomain(mailDomain); MailServerController.UpdateMailDomain(mailDomain);
int mailDomainId = mailDomain.Id; 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) catch (Exception ex)
{ {
@ -320,6 +310,19 @@ namespace WebsitePanel.EnterpriseServer
// error while creating mail account // error while creating mail account
throw new Exception("Could not create mail account", ex); 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;
}
}
} }
} }

View file

@ -436,13 +436,13 @@ namespace WebsitePanel.EnterpriseServer
bool sendAccountLetter, bool sendAccountLetter,
bool createPackage, int planId, bool sendPackageLetter, bool createPackage, int planId, bool sendPackageLetter,
string domainName, bool tempDomain, bool createWebSite, 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, return UserCreationWizard.CreateUserAccount(parentPackageId, username, password,
roleId, firstName, lastName, email, secondaryEmail, htmlMail, sendAccountLetter, roleId, firstName, lastName, email, secondaryEmail, htmlMail, sendAccountLetter,
createPackage, planId, createPackage, planId,
sendPackageLetter, domainName, tempDomain, createWebSite, createFtpAccount, ftpAccountName, sendPackageLetter, domainName, tempDomain, createWebSite, createFtpAccount, ftpAccountName,
createMailAccount, hostName); createMailAccount, hostName, createZoneRecord);
} }
#endregion #endregion