This commit is contained in:
2021-09-01 17:13:46 +00:00
parent f68127f33c
commit f38e3f7a83
3 changed files with 75 additions and 22 deletions

View File

@@ -89,7 +89,15 @@ namespace AyaNova.PlugIn.V8
var scheme = u.Scheme;
var host = u.Host;
var port = u.Port;
edServerUrl.Text = scheme + "://" + host + ":" + port + "/" + util.API_BASE_ROUTE;
//client url for notification default links, help links etc
if ((scheme == "https" && port == 443) || (scheme == "http" && port == 80))
util.GuessClientUrl = scheme + "://" + host + "/";
else
util.GuessClientUrl = scheme + "://" + host + ":" + port + "/";
}
catch (Exception ex)
{

View File

@@ -1729,31 +1729,73 @@ namespace AyaNova.PlugIn.V8
{
if (!progress.KeepGoing) return;
progress.Op("Start Global settings export");
progress.SubOp("Global 'Biz' settings");
//GlobalBizSettings
var a = await util.GetAsync("global-biz-setting");
dynamic d = a.ObjectResponse["data"];
d.allowScheduleConflicts = true;//was not exposed in v7 so setting to same functionality people are used to for v8
d.searchCaseSensitiveOnly = false;//v8 default, not a v7 setting
d.taxPartPurchaseId = await Getv7v8IdMapNullOk(AyaBizUtils.GlobalSettings.TaxPartPurchaseID, RootObjectTypes.TaxCode, false, true);//ok if doesn't migrate
d.taxPartSaleId = await Getv7v8IdMapNullOk(AyaBizUtils.GlobalSettings.TaxPartSaleID, RootObjectTypes.TaxCode, false, true);//ok if doesn't migrate
d.taxRateSaleId = await Getv7v8IdMapNullOk(AyaBizUtils.GlobalSettings.TaxRateSaleID, RootObjectTypes.TaxCode, false, true);//ok if doesn't migrate
d.workLaborScheduleDefaultMinutes = AyaBizUtils.GlobalSettings.LaborSchedUserDfltTimeSpan;
d.workOrderTravelDefaultMinutes = AyaBizUtils.GlobalSettings.TravelDfltTimeSpan;
d.workOrderCompleteByAge = TimeSpan.FromMinutes(AyaBizUtils.GlobalSettings.WorkorderCloseByAge);
d.customerAllowCSR = false;
d.customerAllowViewWO = false;
d.customerAllowWOWiki = false;
d.customerAllowUserSettings = false;
d.customerAllowNotifyServiceImminent = false;
d.customerAllowNotifyCSRAccepted = false;
d.customerAllowNotifyCSRRejected = false;
d.customerAllowNotifyWOCreated = false;
d.customerAllowNotifyWOCompleted = false;
await util.PutAsync("global-biz-setting", d);
{
progress.Append("Exporting Global business settings");
var a = await util.GetAsync("global-biz-setting");
dynamic d = a.ObjectResponse["data"];
d.allowScheduleConflicts = true;//was not exposed in v7 so setting to same functionality people are used to for v8
d.searchCaseSensitiveOnly = false;//v8 default, not a v7 setting
d.taxPartPurchaseId = await Getv7v8IdMapNullOk(AyaBizUtils.GlobalSettings.TaxPartPurchaseID, RootObjectTypes.TaxCode, false, true);//ok if doesn't migrate
d.taxPartSaleId = await Getv7v8IdMapNullOk(AyaBizUtils.GlobalSettings.TaxPartSaleID, RootObjectTypes.TaxCode, false, true);//ok if doesn't migrate
d.taxRateSaleId = await Getv7v8IdMapNullOk(AyaBizUtils.GlobalSettings.TaxRateSaleID, RootObjectTypes.TaxCode, false, true);//ok if doesn't migrate
d.workLaborScheduleDefaultMinutes = AyaBizUtils.GlobalSettings.LaborSchedUserDfltTimeSpan;
d.workOrderTravelDefaultMinutes = AyaBizUtils.GlobalSettings.TravelDfltTimeSpan;
d.workOrderCompleteByAge = TimeSpan.FromMinutes(AyaBizUtils.GlobalSettings.WorkorderCloseByAge);
d.customerAllowCSR = false;
d.customerAllowViewWO = false;
d.customerAllowWOWiki = false;
d.customerAllowUserSettings = false;
d.customerAllowNotifyServiceImminent = false;
d.customerAllowNotifyCSRAccepted = false;
d.customerAllowNotifyCSRRejected = false;
d.customerAllowNotifyWOCreated = false;
d.customerAllowNotifyWOCompleted = false;
await util.PutAsync("global-biz-setting", d);
progress.Append("ACTION REQUIRED: Confirm 'Administration -> Global settings'");
}
//GlobalOpsBackupSettingsController
{
progress.Append("Setting default backup settings");
var a = await util.GetAsync("global-ops-backup-setting");
DateTime utcNow = DateTime.UtcNow;
dynamic d = a.ObjectResponse["data"];
d.backupTime = new DateTime(utcNow.Year, utcNow.Month, utcNow.Day, 23, 50, 0, DateTimeKind.Local).ToUniversalTime();
d.backupSetsToKeep = 3;
d.active = false;
await util.PutAsync("global-ops-backup-setting", d);
progress.Append("ACTION REQUIRED: Confirm 'Server operations -> Backup' settings and set to Active");
}
//GlobalOpsNotificationSettingsController
{
progress.Append("Exporting Global SMTP Notification settings");
var a = await util.GetAsync("global-ops-notification-setting");
dynamic d = a.ObjectResponse["data"];
d.smtpDeliveryActive = false;//start inactive
if (AyaBizUtils.GlobalSettings.NotifySMTPHost.Contains(":"))
{
//per v7 rules the port number is specified on the host if necessary
d.smtpServerAddress = AyaBizUtils.GlobalSettings.NotifySMTPHost.Split(':')[0];
d.smtpServerPort = AyaBizUtils.GlobalSettings.NotifySMTPPort;
}
else
{
d.smtpServerAddress = AyaBizUtils.GlobalSettings.NotifySMTPHost;
d.smtpServerPort = 587;//default IETF port 2021
}
d.smtpAccount = AyaBizUtils.GlobalSettings.NotifySMTPAccount;
d.notifyFromAddress = AyaBizUtils.GlobalSettings.NotifySMTPFrom;
d.ayanovaServerURL = util.GuessClientUrl.TrimEnd('/');
d.connectionSecurity = 3;//default is SSLTLS, 1 would be StartTls but we're assuming a modern mail server here
await util.PutAsync("global-ops-notification-setting", d);
if (AyaBizUtils.GlobalSettings.UseNotification)
progress.Append("ACTION REQUIRED: Confirm 'Server Operations -> Notification settings' and set SMTP notification to Active");
}
}

View File

@@ -27,6 +27,9 @@ namespace AyaNova.PlugIn.V8
public static HttpClient client = null;
//url once known to be good
internal static string ApiBaseUrl { get; set; }
//auth processes url for api and this is the best guess as to the client url to use for notification / help links etc
internal static string GuessClientUrl { get; set; }
internal static string JWT { get; set; }
public static Guid WBIIntegrationID { get { return new Guid("{6946040C-1B50-4eab-BE08-A0E93DB7449F}"); } }