This commit is contained in:
2022-03-25 19:48:34 +00:00
parent c5222bb9d2
commit d7a690e8f9
4 changed files with 15 additions and 8 deletions

2
.vscode/launch.json vendored
View File

@@ -48,7 +48,7 @@
"AYANOVA_DATA_PATH": "c:\\temp\\ravendata",
"AYANOVA_USE_URLS": "http://*:7575;",
//"AYANOVA_PERMANENTLY_ERASE_DATABASE":"true",
"AYANOVA_SERVER_TEST_MODE": "false",
"AYANOVA_SERVER_TEST_MODE": "true",
"AYANOVA_SERVER_TEST_MODE_TZ_OFFSET": "-8",
//"AYANOVA_REPORT_RENDERING_TIMEOUT":"1",
"AYANOVA_SERVER_TEST_MODE_SEEDLEVEL": "small",

View File

@@ -448,7 +448,7 @@ namespace AyaNova.Biz
//Set linked objects
if (o.BillHeadOffice)
{
if (j["HeadOfficeViz"] == null)
if (JsonUtil.JTokenIsNullOrEmpty(j["HeadOfficeViz"]))
AddError(ApiErrorCode.VALIDATION_REQUIRED, "HeadOfficeViz");
else
{
@@ -458,16 +458,16 @@ namespace AyaNova.Biz
AddError(ApiErrorCode.NOT_FOUND, "HeadOfficeViz", $"'{(string)j["HeadOfficeViz"]}'");
}
}
if (j["ContractViz"] != null)
if (!JsonUtil.JTokenIsNullOrEmpty(j["ContractViz"]))
{
o.ContractId = await ct.Contract.AsNoTracking().Where(z => z.Name == (string)j["ContractViz"]).Select(x => x.Id).FirstOrDefaultAsync();
if (o.ContractId == 0)
AddError(ApiErrorCode.NOT_FOUND, "ContractViz", $"'{(string)j["ContractViz"]}'");
if (j["ContractExpires"] != null)
o.ContractExpires = (DateTime)j["ContractExpires"];
else
if (JsonUtil.JTokenIsNullOrEmpty(j["ContractExpires"]))
o.ContractExpires = DateTime.UtcNow.Subtract(new TimeSpan(0, 1, 0));//expired one minute ago to be safe, can't guess what the contract should be
else
o.ContractExpires = (DateTime)j["ContractExpires"];
}

View File

@@ -2,6 +2,7 @@ using System;
using System.Reflection;
using System.Linq;
using System.Collections.Generic;
using Newtonsoft.Json.Linq;
namespace AyaNova.Util
{
@@ -58,8 +59,12 @@ namespace AyaNova.Util
public static string GetImportTag()
{
return "z-import-" + DateTime.Now.ToString("yyyyMMddHHmmss");
return "zz-import-" + DateTime.Now.ToString("yyyyMMddHHmmss");
}
}//eoc
}//eons

View File

@@ -75,9 +75,11 @@ namespace AyaNova.Util
(token.Type == JTokenType.Array && !token.HasValues) ||
(token.Type == JTokenType.Object && !token.HasValues) ||
(token.Type == JTokenType.String && token.ToString() == String.Empty) ||
(token.Type == JTokenType.Null);
(token.Type == JTokenType.Null) ||
(token.Type == JTokenType.Undefined);
}
//Contract resolver used for exporting to file translations and report templates
//and ignoring specified propertes
public class ShouldSerializeContractResolver : DefaultContractResolver