diff --git a/devdocs/todo.txt b/devdocs/todo.txt index 704d0c5e..cfc9ddc0 100644 --- a/devdocs/todo.txt +++ b/devdocs/todo.txt @@ -15,11 +15,6 @@ SERVER - DO ALL THE THINGS!!!! - all the way down to DOCS MANUAL below which isn't urgent and go back to client stuff - - - Resource localization edit wherever possible to change "Common*" such as "CommonActive" to remove the "common" part wherever possible. - - Also check if used anywhere in client or at server and rename there too - - - Error messages from the API, shouldn't they be localized?? - USER object add the custom fields code as in Widget diff --git a/server/AyaNova/biz/FormAvailableFields.cs b/server/AyaNova/biz/FormAvailableFields.cs index 0ae8f06c..c718bba4 100644 --- a/server/AyaNova/biz/FormAvailableFields.cs +++ b/server/AyaNova/biz/FormAvailableFields.cs @@ -40,7 +40,7 @@ namespace AyaNova.Biz l.Add(new FormField("WidgetStartDate", "StartDate", false, false)); l.Add(new FormField("WidgetEndDate", "EndDate", false, false)); l.Add(new FormField("WidgetNotes", "Notes")); - l.Add(new FormField("CommonActive", "Active", true)); + l.Add(new FormField("Active", "Active", true)); l.Add(new FormField("Tags", "Tags", true)); l.Add(new FormField("WidgetCustom1", false, true, true)); l.Add(new FormField("WidgetCustom2", false, true, true)); @@ -60,34 +60,31 @@ namespace AyaNova.Biz l.Add(new FormField("WidgetCustom16", false, true, true)); break; - // case USER_FORM_KEY: - // l.Add(new FormField("WidgetName", false, false));//is not shared localized text key and not hideable as it is in the validation rules for widget - // l.Add(new FormField("WidgetSerial"));//not in validation rules...you get the idea - // l.Add(new FormField("WidgetDollarAmount")); - // l.Add(new FormField("WidgetCount")); - // l.Add(new FormField("WidgetRoles")); - // l.Add(new FormField("WidgetStartDate", false, false)); - // l.Add(new FormField("WidgetEndDate", false, false)); - // l.Add(new FormField("WidgetNotes")); - // l.Add(new FormField("CommonActive", true)); - // l.Add(new FormField("Tags", true)); - // l.Add(new FormField("WidgetCustom1", false, true, true)); - // l.Add(new FormField("WidgetCustom2", false, true, true)); - // l.Add(new FormField("WidgetCustom3", false, true, true)); - // l.Add(new FormField("WidgetCustom4", false, true, true)); - // l.Add(new FormField("WidgetCustom5", false, true, true)); - // l.Add(new FormField("WidgetCustom6", false, true, true)); - // l.Add(new FormField("WidgetCustom7", false, true, true)); - // l.Add(new FormField("WidgetCustom8", false, true, true)); - // l.Add(new FormField("WidgetCustom9", false, true, true)); - // l.Add(new FormField("WidgetCustom10", false, true, true)); - // l.Add(new FormField("WidgetCustom11", false, true, true)); - // l.Add(new FormField("WidgetCustom12", false, true, true)); - // l.Add(new FormField("WidgetCustom13", false, true, true)); - // l.Add(new FormField("WidgetCustom14", false, true, true)); - // l.Add(new FormField("WidgetCustom15", false, true, true)); - // l.Add(new FormField("WidgetCustom16", false, true, true)); - // break; + case USER_FORM_KEY: + l.Add(new FormField("Name", true, false));//is not shared localized text key and not hideable as it is in the validation rules for widget + l.Add(new FormField("EmployeeNumber")); + l.Add(new FormField("Roles", false, false)); + l.Add(new FormField("UserNotes","UserNotes")); + l.Add(new FormField("UserType",false,false)); + l.Add(new FormField("Active", true, false)); + l.Add(new FormField("Tags", true, false)); + l.Add(new FormField("UserCustom1", false, true, true)); + l.Add(new FormField("UserCustom2", false, true, true)); + l.Add(new FormField("UserCustom3", false, true, true)); + l.Add(new FormField("UserCustom4", false, true, true)); + l.Add(new FormField("UserCustom5", false, true, true)); + l.Add(new FormField("UserCustom6", false, true, true)); + l.Add(new FormField("UserCustom7", false, true, true)); + l.Add(new FormField("UserCustom8", false, true, true)); + l.Add(new FormField("UserCustom9", false, true, true)); + l.Add(new FormField("UserCustom10", false, true, true)); + l.Add(new FormField("UserCustom11", false, true, true)); + l.Add(new FormField("UserCustom12", false, true, true)); + l.Add(new FormField("UserCustom13", false, true, true)); + l.Add(new FormField("UserCustom14", false, true, true)); + l.Add(new FormField("UserCustom15", false, true, true)); + l.Add(new FormField("UserCustom16", false, true, true)); + break; @@ -117,16 +114,19 @@ namespace AyaNova.Biz { public string Key { get; set; } public string PropertyName { get; set; } + //NOTE: Not hideable fields don't require a PropertyName value because they are already required and will be validated public bool Hideable { get; set; } public bool SharedLTKey { get; set; } public bool Custom { get; set; } + + public FormField(string key, string propertyName, bool sharedLTKey = false, bool hideable = true, bool custom = false) { Key = key; Hideable = hideable; Custom = custom; SharedLTKey = sharedLTKey; - PropertyName = propertyName; + PropertyName = propertyName;//Only if hideable do they require this as non-hideable ones are automatically validated anyway and this is only required for validation } public FormField(string key, bool sharedLTKey = false, bool hideable = true, bool custom = false) diff --git a/server/AyaNova/biz/RequiredFieldsValidator.cs b/server/AyaNova/biz/RequiredFieldsValidator.cs index 9c561257..a0f58170 100644 --- a/server/AyaNova/biz/RequiredFieldsValidator.cs +++ b/server/AyaNova/biz/RequiredFieldsValidator.cs @@ -27,7 +27,7 @@ namespace AyaNova.Biz var FldLtKey = jo["fld"].Value(); // - e.g.: {template:[{fld:"ltkeyfieldname",hide:"true/false",required:"true/false", type:"bool"},{fld:"ltkeyfieldname",hide:"true/false",required:"true/false", type:"text"]} - //get teh FormField object + //get the FormField object FormField FF = FormFields.Where(x => x.Key == FldLtKey).Single(); if (!string.IsNullOrWhiteSpace(FF.PropertyName)) { diff --git a/server/AyaNova/biz/UserBiz.cs b/server/AyaNova/biz/UserBiz.cs index a0355372..cdd93522 100644 --- a/server/AyaNova/biz/UserBiz.cs +++ b/server/AyaNova/biz/UserBiz.cs @@ -159,12 +159,12 @@ namespace AyaNova.Biz FilterOptions f = new FilterOptions("user"); f. AddField("id", "ID", AyDataType.Integer). - AddField("name", "CommonName", AyDataType.Text). - AddField("active", "CommonActive", AyDataType.Bool). + AddField("name", "Name", AyDataType.Text). + AddField("active", "Active", AyDataType.Bool). AddField("tags", "Tags", AyDataType.Tags). AddField("EmployeeNumber", "UserEmployeeNumber", AyDataType.Text). AddField("usertype", "UserUserType", AyDataType.Enum). - AddField("notes", "WidgetNotes", AyDataType.Text); + AddField("notes", "UserNotes", AyDataType.Text); if (localizeToLocaleId != 0) f.Localize(localizeToLocaleId); @@ -521,7 +521,18 @@ namespace AyaNova.Biz if (!string.IsNullOrWhiteSpace(proposedObj.EmployeeNumber) && proposedObj.EmployeeNumber.Length > 255) AddError(ValidationErrorType.LengthExceeded, "EmployeeNumber", "255 max"); - //CustomFieldsValidator.Validate(this, "user", proposedObj.CustomFields); + //Any form customizations to validate? + var FormCustomization = ct.FormCustom.SingleOrDefault(x => x.FormKey == FormAvailableFields.USER_FORM_KEY); + if (FormCustomization != null) + { + //Yeppers, do the validation, there are two, the custom fields and the regular fields that might be set to required + + //validate users choices for required non custom fields + RequiredFieldsValidator.Validate(this, FormCustomization, proposedObj); + + //validate custom fields + CustomFieldsValidator.Validate(this, FormCustomization, proposedObj.CustomFields); + } return; } diff --git a/server/AyaNova/biz/WidgetBiz.cs b/server/AyaNova/biz/WidgetBiz.cs index c4b1480b..2b822e4c 100644 --- a/server/AyaNova/biz/WidgetBiz.cs +++ b/server/AyaNova/biz/WidgetBiz.cs @@ -252,7 +252,7 @@ namespace AyaNova.Biz AddField("serial", "WidgetSerial", AyDataType.Integer). AddField("notes", "WidgetNotes", AyDataType.Text). AddField("dollaramount", "WidgetDollarAmount", AyDataType.Decimal). - AddField("active", "CommonActive", AyDataType.Bool). + AddField("active", "Active", AyDataType.Bool). AddField("startdate", "WidgetStartDate", AyDataType.Date). AddField("count", "WidgetCount", AyDataType.Integer). AddField("tags", "Tags", AyDataType.Tags).