This commit is contained in:
@@ -112,13 +112,13 @@ namespace AyaNova.Api.Controllers
|
||||
var ret = new
|
||||
{
|
||||
//Actual global settings:
|
||||
SearchCaseSensitiveOnly = AyaNova.Util.ServerGlobalBizSettings.SearchCaseSensitiveOnly,
|
||||
UseInventory = AyaNova.Util.ServerGlobalBizSettings.UseInventory,
|
||||
DefaultTaxPartSaleId = AyaNova.Util.ServerGlobalBizSettings.TaxPartSaleId,
|
||||
DefaultTaxPartPurchaseId = AyaNova.Util.ServerGlobalBizSettings.TaxPartPurchaseId,
|
||||
DefaultTaxRateSaleId = AyaNova.Util.ServerGlobalBizSettings.TaxRateSaleId,
|
||||
WorkOrderTravelDefaultMinutes = AyaNova.Util.ServerGlobalBizSettings.WorkOrderTravelDefaultMinutes,
|
||||
WorkLaborScheduleDefaultMinutes = AyaNova.Util.ServerGlobalBizSettings.WorkLaborScheduleDefaultMinutes,
|
||||
SearchCaseSensitiveOnly = AyaNova.Util.ServerGlobalBizSettings.Cache.SearchCaseSensitiveOnly,
|
||||
UseInventory = AyaNova.Util.ServerGlobalBizSettings.Cache.UseInventory,
|
||||
DefaultTaxPartSaleId = AyaNova.Util.ServerGlobalBizSettings.Cache.TaxPartSaleId,
|
||||
DefaultTaxPartPurchaseId = AyaNova.Util.ServerGlobalBizSettings.Cache.TaxPartPurchaseId,
|
||||
DefaultTaxRateSaleId = AyaNova.Util.ServerGlobalBizSettings.Cache.TaxRateSaleId,
|
||||
WorkOrderTravelDefaultMinutes = AyaNova.Util.ServerGlobalBizSettings.Cache.WorkOrderTravelDefaultMinutes,
|
||||
WorkLaborScheduleDefaultMinutes = AyaNova.Util.ServerGlobalBizSettings.Cache.WorkLaborScheduleDefaultMinutes,
|
||||
|
||||
//used to drive UI in case of unlicensed or attention required
|
||||
LicenseStatus = AyaNova.Core.License.ActiveKey.Status,
|
||||
|
||||
@@ -156,7 +156,7 @@ namespace AyaNova.PickList
|
||||
//all the other templated fields
|
||||
if (HasAutoCompleteQuery && !HasTagSpecificQuery)
|
||||
{
|
||||
if (ServerGlobalBizSettings.SearchCaseSensitiveOnly)
|
||||
if (ServerGlobalBizSettings.Cache.SearchCaseSensitiveOnly)
|
||||
sWhere = $"(array_to_string({valueColumnName},',') like '%{autoCompleteQuery}%')";
|
||||
else
|
||||
sWhere = $"(lower(array_to_string({valueColumnName},',')) like lower('%{autoCompleteQuery}%'))";
|
||||
@@ -171,7 +171,7 @@ namespace AyaNova.PickList
|
||||
lSelect.Add(valueColumnName);
|
||||
lOrderBy.Add(valueColumnName);
|
||||
if (HasAutoCompleteQuery)
|
||||
if (ServerGlobalBizSettings.SearchCaseSensitiveOnly)
|
||||
if (ServerGlobalBizSettings.Cache.SearchCaseSensitiveOnly)
|
||||
sWhere = $"({valueColumnName} like '%{autoCompleteQuery}%')";
|
||||
else
|
||||
sWhere = $"(lower({valueColumnName}) like lower('%{autoCompleteQuery}%'))";
|
||||
@@ -193,7 +193,7 @@ namespace AyaNova.PickList
|
||||
//Where fragment is different for non text fields: it needs to be cast to text to like query on it
|
||||
//(cast (awidget.serial as text) like '%some%')
|
||||
if (HasAutoCompleteQuery)
|
||||
if (ServerGlobalBizSettings.SearchCaseSensitiveOnly)
|
||||
if (ServerGlobalBizSettings.Cache.SearchCaseSensitiveOnly)
|
||||
sWhere = $"(cast ({valueColumnName} as text) like '%{autoCompleteQuery}%')";
|
||||
else
|
||||
sWhere = $"(lower(cast ({valueColumnName} as text)) like lower('%{autoCompleteQuery}%'))";
|
||||
|
||||
@@ -328,6 +328,9 @@ namespace AyaNova.Biz
|
||||
//the translation key is to indicate what the linked object is that is causing the error
|
||||
AddError(ApiErrorCode.VALIDATION_REFERENTIAL_INTEGRITY, "generalerror", await Translate("NotifySubscription"));
|
||||
}
|
||||
|
||||
if (await ct.GlobalBizSettings.AnyAsync(z => z.CustomerDefaultWorkOrderReportId == inObj.Id) == true)
|
||||
AddError(ApiErrorCode.VALIDATION_REFERENTIAL_INTEGRITY, "generalerror", await Translate("GlobalSettings"));
|
||||
}
|
||||
|
||||
|
||||
@@ -383,8 +386,9 @@ namespace AyaNova.Biz
|
||||
}
|
||||
|
||||
//If we get here via the /viewreport url in the client then there is no object type set so we need to set it here from the report
|
||||
if(reportRequest.AType==AyaType.NoType){
|
||||
reportRequest.AType=report.AType;
|
||||
if (reportRequest.AType == AyaType.NoType)
|
||||
{
|
||||
reportRequest.AType = report.AType;
|
||||
}
|
||||
|
||||
|
||||
@@ -410,9 +414,10 @@ namespace AyaNova.Biz
|
||||
|
||||
|
||||
//Get data
|
||||
var ReportData = await GetReportData(reportRequest);
|
||||
var ReportData = await GetReportData(reportRequest);
|
||||
//if GetReportData errored then will return null so need to return that as well here
|
||||
if(ReportData==null){
|
||||
if (ReportData == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -453,9 +458,9 @@ namespace AyaNova.Biz
|
||||
|
||||
//WINDOWS ONLY
|
||||
log.LogDebug($"Windows: Calling browserFetcher download async now:");
|
||||
|
||||
await new BrowserFetcher().DownloadAsync(BrowserFetcher.DefaultChromiumRevision);
|
||||
|
||||
|
||||
await new BrowserFetcher().DownloadAsync(BrowserFetcher.DefaultChromiumRevision);
|
||||
|
||||
}
|
||||
|
||||
System.Text.StringBuilder PageLog = new System.Text.StringBuilder();
|
||||
|
||||
@@ -230,9 +230,9 @@ namespace AyaNova.Biz
|
||||
|
||||
bool isNew = currentObj == null;
|
||||
bool isGlobalDefault = (!isNew
|
||||
&& ServerGlobalBizSettings.TaxPartPurchaseId == proposedObj.Id
|
||||
|| ServerGlobalBizSettings.TaxPartSaleId == proposedObj.Id
|
||||
|| ServerGlobalBizSettings.TaxRateSaleId == proposedObj.Id);
|
||||
&& ServerGlobalBizSettings.Cache.TaxPartPurchaseId == proposedObj.Id
|
||||
|| ServerGlobalBizSettings.Cache.TaxPartSaleId == proposedObj.Id
|
||||
|| ServerGlobalBizSettings.Cache.TaxRateSaleId == proposedObj.Id);
|
||||
|
||||
if (!isNew && (proposedObj.TaxAPct != currentObj.TaxAPct
|
||||
|| proposedObj.TaxBPct != currentObj.TaxBPct
|
||||
@@ -302,9 +302,9 @@ namespace AyaNova.Biz
|
||||
//Referential integrity
|
||||
//FOREIGN KEY CHECKS
|
||||
|
||||
if (ServerGlobalBizSettings.TaxPartPurchaseId == inObj.Id
|
||||
|| ServerGlobalBizSettings.TaxPartSaleId == inObj.Id
|
||||
|| ServerGlobalBizSettings.TaxRateSaleId == inObj.Id)
|
||||
if (ServerGlobalBizSettings.Cache.TaxPartPurchaseId == inObj.Id
|
||||
|| ServerGlobalBizSettings.Cache.TaxPartSaleId == inObj.Id
|
||||
|| ServerGlobalBizSettings.Cache.TaxRateSaleId == inObj.Id)
|
||||
AddError(ApiErrorCode.INVALID_OPERATION, "generalerror", await Translate("TaxCodeDefault"));
|
||||
|
||||
if (await ct.PurchaseOrderItem.AnyAsync(x => x.PurchaseTaxCodeId == inObj.Id))
|
||||
|
||||
@@ -457,8 +457,8 @@ namespace AyaNova.Biz
|
||||
}
|
||||
|
||||
//not set yet, maybe the global default is the way...
|
||||
if (AyaNova.Util.ServerGlobalBizSettings.WorkOrderCompleteByAge != TimeSpan.Zero)
|
||||
newObj.CompleteByDate = DateTime.UtcNow.Add(AyaNova.Util.ServerGlobalBizSettings.WorkOrderCompleteByAge);
|
||||
if (AyaNova.Util.ServerGlobalBizSettings.Cache.WorkOrderCompleteByAge != TimeSpan.Zero)
|
||||
newObj.CompleteByDate = DateTime.UtcNow.Add(AyaNova.Util.ServerGlobalBizSettings.Cache.WorkOrderCompleteByAge);
|
||||
|
||||
}
|
||||
|
||||
@@ -3895,7 +3895,7 @@ namespace AyaNova.Biz
|
||||
{
|
||||
|
||||
|
||||
if (AyaNova.Util.ServerGlobalBizSettings.UseInventory)
|
||||
if (AyaNova.Util.ServerGlobalBizSettings.Cache.UseInventory)
|
||||
{
|
||||
PartInventoryBiz pib = new PartInventoryBiz(ct, UserId, UserTranslationId, CurrentUserRoles);
|
||||
|
||||
|
||||
@@ -22,17 +22,16 @@ namespace AyaNova.Util
|
||||
//!!!!WARNING: BE SURE TO UPDATE THE DbUtil::EmptyBizDataFromDatabaseForSeedingOrImporting WHEN NEW TABLES ADDED!!!!
|
||||
private const int DESIRED_SCHEMA_LEVEL = 1;
|
||||
|
||||
internal const long EXPECTED_COLUMN_COUNT = 928;
|
||||
internal const long EXPECTED_COLUMN_COUNT = 954;
|
||||
internal const long EXPECTED_INDEX_COUNT = 137;
|
||||
internal const long EXPECTED_CHECK_CONSTRAINTS = 415;
|
||||
internal const long EXPECTED_FOREIGN_KEY_CONSTRAINTS = 116;
|
||||
internal const long EXPECTED_FOREIGN_KEY_CONSTRAINTS = 117;
|
||||
internal const long EXPECTED_VIEWS = 6;
|
||||
internal const long EXPECTED_ROUTINES = 2;
|
||||
|
||||
//!!!!WARNING: BE SURE TO UPDATE THE DbUtil::EmptyBizDataFromDatabaseForSeedingOrImporting WHEN NEW TABLES ADDED!!!!
|
||||
|
||||
///////////////////////////////////////////////////////////////// (C927:I137:CC415:FC116:V6:R2)
|
||||
|
||||
///////////////////////////////////////////////////////////////// (C954:I137:CC415:FC117:V6:R2)
|
||||
|
||||
/*
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using AyaNova.Models;
|
||||
|
||||
@@ -13,22 +12,12 @@ namespace AyaNova.Util
|
||||
/// </summary>
|
||||
internal static class ServerGlobalBizSettings
|
||||
{
|
||||
|
||||
internal static bool SearchCaseSensitiveOnly { get; set; }
|
||||
internal static bool UseInventory { get; set; }
|
||||
internal static long? TaxPartPurchaseId { get; set; }
|
||||
internal static long? TaxPartSaleId { get; set; }
|
||||
internal static long? TaxRateSaleId { get; set; }
|
||||
internal static TimeSpan WorkOrderCompleteByAge { get; set; }
|
||||
internal static int WorkLaborScheduleDefaultMinutes { get; set; }
|
||||
internal static int WorkOrderTravelDefaultMinutes { get; set; }
|
||||
|
||||
internal static GlobalBizSettings Cache {get;set;}
|
||||
/// <summary>
|
||||
/// Populate and / or create the settings
|
||||
/// </summary>
|
||||
internal static void Initialize(GlobalBizSettings global, AyContext ct = null)
|
||||
{
|
||||
|
||||
if (global == null)
|
||||
{
|
||||
//fetch or create as not provided (meaning this was called from Startup.cs)
|
||||
@@ -40,20 +29,7 @@ namespace AyaNova.Util
|
||||
ct.SaveChanges();
|
||||
}
|
||||
}
|
||||
|
||||
//We have the object, now copy the static values here
|
||||
SearchCaseSensitiveOnly = global.SearchCaseSensitiveOnly;
|
||||
UseInventory = global.UseInventory;
|
||||
TaxPartPurchaseId = global.TaxPartPurchaseId;
|
||||
TaxPartSaleId = global.TaxPartSaleId;
|
||||
TaxRateSaleId = global.TaxRateSaleId;
|
||||
WorkOrderCompleteByAge = global.WorkOrderCompleteByAge;
|
||||
WorkLaborScheduleDefaultMinutes = global.WorkLaborScheduleDefaultMinutes;
|
||||
WorkOrderTravelDefaultMinutes = global.WorkOrderTravelDefaultMinutes;
|
||||
|
||||
Cache = global;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}//eoc
|
||||
}//eons
|
||||
Reference in New Issue
Block a user