From 1602b9680d12c668660042f0b198b25b6e2a16ca Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Wed, 23 Oct 2024 23:40:31 +0000 Subject: [PATCH] --- server/AyaNova/biz/CustomFieldsValidator.cs | 31 ++------------------- 1 file changed, 2 insertions(+), 29 deletions(-) diff --git a/server/AyaNova/biz/CustomFieldsValidator.cs b/server/AyaNova/biz/CustomFieldsValidator.cs index a114c907..eb2ffa89 100644 --- a/server/AyaNova/biz/CustomFieldsValidator.cs +++ b/server/AyaNova/biz/CustomFieldsValidator.cs @@ -16,45 +16,19 @@ namespace AyaNova.Biz //case 4615 //this is to eliminate the old block optimization to short circuit checking if there is no custom data present + //that wouldn't work anymore with this case resolution and was really not much of an optimization anyway and just + //increased the code surface for no significant savings if (string.IsNullOrWhiteSpace(customFields)) { customFields = "{}"; } - //case 4615 bool checkPrefix = !string.IsNullOrEmpty(onlyIfStartsWith); var FormTemplate = JArray.Parse(formCustom.Template); var ThisFormCustomFieldsList = FormFieldOptionalCustomizableReference.FormFieldReferenceList(formCustom.FormKey).Where(z => z.IsCustomField == true).Select(z => z.TKey).ToList(); - - - //case 4615 moved this logic into main check below as it would not support startsWith and isn't much of an optimization anyway; less code is best code. - // //If the customFields string is empty then only validation is if any of the fields are required to be filled in - // if (!hasCustomData) - // { - // //iterate the template - // for (int i = 0; i < FormTemplate.Count; i++) - // { - // //get the field customization - // var fldKey = FormTemplate[i]["fld"].Value(); - // var fldRequired = FormTemplate[i]["required"].Value(); - // //Check if this is an expected custom field and that it was set to required - - // //case 4615 - // if (checkPrefix) - // continue; - // if (ThisFormCustomFieldsList.Contains(fldKey) && fldRequired == true) - // { - // //Ok, this field is required but custom fields are all empty so add this error - // biz.AddError(ApiErrorCode.VALIDATION_CUSTOM_REQUIRED_EMPTY, fldKey); - // } - // } - - // return; - // } - //here we have both a bunch of custom fields presumeably and a form customization so let's get cracking... //parse the custom fields, it should contain an object with 16 keys //NOTE: to save bandwidth the actual custom fields look like this: @@ -86,7 +60,6 @@ namespace AyaNova.Biz continue; //It's required, make sure the key is present and contains data - if (CustomFieldData.ContainsKey(InternalCustomFieldName)) { //validate for now that the custom fields set as required have data in them. Note that we are not validating the sanity of the values, only that they exist