This commit is contained in:
@@ -16,45 +16,19 @@ namespace AyaNova.Biz
|
|||||||
|
|
||||||
//case 4615
|
//case 4615
|
||||||
//this is to eliminate the old block optimization to short circuit checking if there is no custom data present
|
//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))
|
if (string.IsNullOrWhiteSpace(customFields))
|
||||||
{
|
{
|
||||||
customFields = "{}";
|
customFields = "{}";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//case 4615
|
//case 4615
|
||||||
bool checkPrefix = !string.IsNullOrEmpty(onlyIfStartsWith);
|
bool checkPrefix = !string.IsNullOrEmpty(onlyIfStartsWith);
|
||||||
|
|
||||||
var FormTemplate = JArray.Parse(formCustom.Template);
|
var FormTemplate = JArray.Parse(formCustom.Template);
|
||||||
var ThisFormCustomFieldsList = FormFieldOptionalCustomizableReference.FormFieldReferenceList(formCustom.FormKey).Where(z => z.IsCustomField == true).Select(z => z.TKey).ToList();
|
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<string>();
|
|
||||||
// var fldRequired = FormTemplate[i]["required"].Value<bool>();
|
|
||||||
// //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...
|
//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
|
//parse the custom fields, it should contain an object with 16 keys
|
||||||
//NOTE: to save bandwidth the actual custom fields look like this:
|
//NOTE: to save bandwidth the actual custom fields look like this:
|
||||||
@@ -86,7 +60,6 @@ namespace AyaNova.Biz
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
//It's required, make sure the key is present and contains data
|
//It's required, make sure the key is present and contains data
|
||||||
|
|
||||||
if (CustomFieldData.ContainsKey(InternalCustomFieldName))
|
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
|
//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
|
||||||
|
|||||||
Reference in New Issue
Block a user