This commit is contained in:
2019-11-28 16:38:19 +00:00
parent e855d9230d
commit 8e8406ba87
2 changed files with 13 additions and 11 deletions

View File

@@ -62,8 +62,8 @@ namespace AyaNova.Biz
// //
FormCustom outObj = inObj; FormCustom outObj = inObj;
outObj.Template=JsonUtil.CompactJson(outObj.Template); outObj.Template = JsonUtil.CompactJson(outObj.Template);
await ct.FormCustom.AddAsync(outObj); await ct.FormCustom.AddAsync(outObj);
await ct.SaveChangesAsync(); await ct.SaveChangesAsync();
@@ -104,7 +104,7 @@ namespace AyaNova.Biz
//put //put
internal bool Put(FormCustom dbObj, FormCustom inObj) internal bool Put(FormCustom dbObj, FormCustom inObj)
{ {
//Replace the db object with the PUT object //Replace the db object with the PUT object
CopyObject.Copy(inObj, dbObj, "Id"); CopyObject.Copy(inObj, dbObj, "Id");
//Set "original" value of concurrency token to input token //Set "original" value of concurrency token to input token
@@ -115,7 +115,7 @@ namespace AyaNova.Biz
if (HasErrors) if (HasErrors)
return false; return false;
dbObj.Template=JsonUtil.CompactJson(dbObj.Template); dbObj.Template = JsonUtil.CompactJson(dbObj.Template);
//Log modification //Log modification
EventLogProcessor.LogEventToDatabase(new Event(UserId, dbObj.Id, BizType, AyaEvent.Modified), ct); EventLogProcessor.LogEventToDatabase(new Event(UserId, dbObj.Id, BizType, AyaEvent.Modified), ct);
@@ -175,7 +175,7 @@ namespace AyaNova.Biz
//Parse the json, expecting something like this: //Parse the json, expecting something like this:
//[{fld:"ltkeyfieldname",hide:"true/false",required:"true/false", type:"bool"},{fld:"ltkeyfieldname",hide:"true/false",required:"true/false", type:"text"] //[{fld:"ltkeyfieldname",hide:"true/false",required:"true/false", type:"bool"},{fld:"ltkeyfieldname",hide:"true/false",required:"true/false", type:"text"]
//Array at root is valid json and saves a bit of bandwidth so minimal is best //Array at root is valid json and saves a bit of bandwidth so minimal is best
var v = JArray.Parse(inObj.Template); var v = JArray.Parse(inObj.Template);
for (int i = 0; i < v.Count; i++) for (int i = 0; i < v.Count; i++)
{ {
@@ -218,11 +218,12 @@ namespace AyaNova.Biz
} }
//validate if it's a custom field that it has a type specified //validate if it's a custom field that it has a type specified
if (MasterFormField.Custom && formFieldItem["type"]==null){ if (MasterFormField.Custom && formFieldItem["type"] == null)
AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "Template", $"Template array item {i}, \"type\" property value is MISSING for custom filed, Custom fields MUST have types specified"); {
} AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "Template", $"Template array item {i}, \"type\" property value is MISSING for custom filed, Custom fields MUST have types specified");
}
if (formFieldItem["type"] != null) if (formFieldItem["type"] != null)
{ {
@@ -238,7 +239,7 @@ namespace AyaNova.Biz
} }
TODO: why is required required if it's just a regular field being hidden? //other code depends on seeing the required value even if it's not set to true
if (formFieldItem["required"] == null) if (formFieldItem["required"] == null)
AddError(ApiErrorCode.VALIDATION_REQUIRED, "Template", $"Template array item {i}, object is missing required \"required\" property "); AddError(ApiErrorCode.VALIDATION_REQUIRED, "Template", $"Template array item {i}, object is missing required \"required\" property ");

View File

@@ -89,6 +89,7 @@ namespace AyaNova.Util
}, },
{ {
""fld"": ""WidgetSerial"", ""fld"": ""WidgetSerial"",
""required"": ""false"",
""hide"": ""true"" ""hide"": ""true""
}, },
{ {