From b16560116b002c6b8bb7c614c97c19dd21e06767 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Sun, 23 Jan 2022 22:25:31 +0000 Subject: [PATCH] --- server/AyaNova/biz/FormFieldReference.cs | 23 +++++++++---------- server/AyaNova/biz/RequiredFieldsValidator.cs | 2 +- server/AyaNova/biz/WorkOrderBiz.cs | 20 ++++++++-------- 3 files changed, 22 insertions(+), 23 deletions(-) diff --git a/server/AyaNova/biz/FormFieldReference.cs b/server/AyaNova/biz/FormFieldReference.cs index a193e386..c611b4ba 100644 --- a/server/AyaNova/biz/FormFieldReference.cs +++ b/server/AyaNova/biz/FormFieldReference.cs @@ -838,7 +838,7 @@ namespace AyaNova.Biz l.Add(new FormField { TKey = "TechSignature", FieldKey = "TechSignature" }); l.Add(new FormField { TKey = "Tags", FieldKey = "Tags" }); l.Add(new FormField { TKey = "Wiki", FieldKey = "Wiki" }); - l.Add(new FormField { TKey = "Attachments", FieldKey = "Attachments" }); + l.Add(new FormField { TKey = "Attachments", FieldKey = "Attachments", Requireable = false }); l.Add(new FormField { TKey = "WorkOrderCustom1", FieldKey = "WorkOrderCustom1", IsCustomField = true }); l.Add(new FormField { TKey = "WorkOrderCustom2", FieldKey = "WorkOrderCustom2", IsCustomField = true }); l.Add(new FormField { TKey = "WorkOrderCustom3", FieldKey = "WorkOrderCustom3", IsCustomField = true }); @@ -861,11 +861,11 @@ namespace AyaNova.Biz l.Add(new FormField { TKey = "WorkOrderItemTechNotes", FieldKey = "TechNotes", TKeySection = "WorkOrderItem" }); l.Add(new FormField { TKey = "Tags", FieldKey = "WorkOrderItemTags", TKeySection = "WorkOrderItem", ModelProperty="Tags" }); l.Add(new FormField { TKey = "Wiki", FieldKey = "WorkOrderItemWiki", TKeySection = "WorkOrderItem", ModelProperty="Wiki" }); - l.Add(new FormField { TKey = "Attachments", FieldKey = "WorkOrderItemAttachments", TKeySection = "WorkOrderItem" }); + l.Add(new FormField { TKey = "Attachments", FieldKey = "WorkOrderItemAttachments", TKeySection = "WorkOrderItem", Requireable = false }); l.Add(new FormField { TKey = "WorkOrderItemWorkOrderStatusID", FieldKey = "WorkOrderItemStatusId", TKeySection = "WorkOrderItem" }); l.Add(new FormField { TKey = "WorkOrderItemPriorityID", FieldKey = "WorkOrderItemPriorityId", TKeySection = "WorkOrderItem" }); l.Add(new FormField { TKey = "WorkOrderItemRequestDate", FieldKey = "RequestDate", TKeySection = "WorkOrderItem" }); - l.Add(new FormField { TKey = "WorkOrderItemWarrantyService", FieldKey = "WorkOrderItemWarrantyService", TKeySection = "WorkOrderItem" }); + l.Add(new FormField { TKey = "WorkOrderItemWarrantyService", FieldKey = "WarrantyService", TKeySection = "WorkOrderItem", Requireable = false }); l.Add(new FormField { TKey = "WorkOrderItemCustom1", FieldKey = "WorkOrderItemCustom1", IsCustomField = true, TKeySection = "WorkOrderItem" }); l.Add(new FormField { TKey = "WorkOrderItemCustom2", FieldKey = "WorkOrderItemCustom2", IsCustomField = true, TKeySection = "WorkOrderItem" }); l.Add(new FormField { TKey = "WorkOrderItemCustom3", FieldKey = "WorkOrderItemCustom3", IsCustomField = true, TKeySection = "WorkOrderItem" }); @@ -897,15 +897,14 @@ namespace AyaNova.Biz l.Add(new FormField { TKey = "WorkOrderItemOutsideServiceList", FieldKey = "WorkOrderItemOutsideServiceList", TKeySection = "WorkOrderItem", Requireable = false }); //WORKORDER ITEM UNIT - l.Add(new FormField { TKey = "WorkOrderItemUnitNotes", FieldKey = "WorkOrderItemUnitNotes", TKeySection = "WorkOrderItemUnit" }); - l.Add(new FormField { TKey = "Unit", FieldKey = "WorkOrderItemUnit", TKeySection = "WorkOrderItemUnit" }); - l.Add(new FormField { TKey = "UnitModelVendorID", FieldKey = "UnitModelVendorID", TKeySection = "WorkOrderItemUnit" }); - l.Add(new FormField { TKey = "UnitModelName", FieldKey = "UnitModelName", TKeySection = "WorkOrderItemUnit" }); - l.Add(new FormField { TKey = "UnitDescription", FieldKey = "UnitDescription", TKeySection = "WorkOrderItemUnit" }); - l.Add(new FormField { TKey = "Tags", FieldKey = "WorkOrderItemUnitTags", TKeySection = "WorkOrderItemUnit" }); - l.Add(new FormField { TKey = "UnitWarrantyInfo", FieldKey = "UnitWarrantyInfo", TKeySection = "WorkOrderItemUnit" }); - l.Add(new FormField { TKey = "Wiki", FieldKey = "WorkOrderItemUnitWiki", TKeySection = "WorkOrderItemUnit" }); - l.Add(new FormField { TKey = "Attachments", FieldKey = "WorkOrderItemUnitAttachments", TKeySection = "WorkOrderItemUnit" }); + l.Add(new FormField { TKey = "WorkOrderItemUnitNotes", FieldKey = "WorkOrderItemUnitNotes", TKeySection = "WorkOrderItemUnit", ModelProperty="Notes" }); + l.Add(new FormField { TKey = "UnitModelVendorID", FieldKey = "UnitModelVendorID", TKeySection = "WorkOrderItemUnit", Requireable = false }); + l.Add(new FormField { TKey = "UnitModelName", FieldKey = "UnitModelName", TKeySection = "WorkOrderItemUnit", Requireable = false }); + l.Add(new FormField { TKey = "UnitDescription", FieldKey = "UnitDescription", TKeySection = "WorkOrderItemUnit", Requireable = false }); + l.Add(new FormField { TKey = "Tags", FieldKey = "WorkOrderItemUnitTags", TKeySection = "WorkOrderItemUnit", ModelProperty="Tags" }); + l.Add(new FormField { TKey = "UnitWarrantyInfo", FieldKey = "UnitWarrantyInfo", TKeySection = "WorkOrderItemUnit", Requireable = false }); + l.Add(new FormField { TKey = "Wiki", FieldKey = "WorkOrderItemUnitWiki", TKeySection = "WorkOrderItemUnit", ModelProperty="Wiki" }); + l.Add(new FormField { TKey = "Attachments", FieldKey = "WorkOrderItemUnitAttachments", TKeySection = "WorkOrderItemUnit", Requireable = false }); l.Add(new FormField { TKey = "WorkOrderItemUnitCustom1", FieldKey = "WorkOrderItemUnitCustom1", IsCustomField = true, TKeySection = "WorkOrderItemUnit" }); l.Add(new FormField { TKey = "WorkOrderItemUnitCustom2", FieldKey = "WorkOrderItemUnitCustom2", IsCustomField = true, TKeySection = "WorkOrderItemUnit" }); l.Add(new FormField { TKey = "WorkOrderItemUnitCustom3", FieldKey = "WorkOrderItemUnitCustom3", IsCustomField = true, TKeySection = "WorkOrderItemUnit" }); diff --git a/server/AyaNova/biz/RequiredFieldsValidator.cs b/server/AyaNova/biz/RequiredFieldsValidator.cs index f83c0569..6ccb3dc3 100644 --- a/server/AyaNova/biz/RequiredFieldsValidator.cs +++ b/server/AyaNova/biz/RequiredFieldsValidator.cs @@ -30,7 +30,7 @@ namespace AyaNova.Biz var proposedObjectType=proposedObject.GetType().ToString(); //don't validate custom fields, just skip them, make sure if it's sectional it matches the section of the object type (workorder sub sections) - if (!FF.IsCustomField && FF.TKeySection == null || proposedObjectType.EndsWith(FF.TKeySection)) + if (!FF.IsCustomField && (FF.TKeySection == null || proposedObjectType.EndsWith(FF.TKeySection))) { //Now get the actual property name from the available fields using the lt key string RequiredPropertyName = FF.FieldKey; diff --git a/server/AyaNova/biz/WorkOrderBiz.cs b/server/AyaNova/biz/WorkOrderBiz.cs index b04feefa..dc7b9a07 100644 --- a/server/AyaNova/biz/WorkOrderBiz.cs +++ b/server/AyaNova/biz/WorkOrderBiz.cs @@ -2603,7 +2603,7 @@ namespace AyaNova.Biz } //Any form customizations to validate? - var FormCustomization = await ct.FormCustom.AsNoTracking().SingleOrDefaultAsync(z => z.FormKey == AyaType.WorkOrderItemExpense.ToString()); + var FormCustomization = await ct.FormCustom.AsNoTracking().SingleOrDefaultAsync(z => z.FormKey == AyaType.WorkOrder.ToString());//all workorder sub items use the workorder key for customization if (FormCustomization != null) { //Yeppers, do the validation, there are two, the custom fields and the regular fields that might be set to required @@ -3010,7 +3010,7 @@ namespace AyaNova.Biz AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "NoChargeQuantity"); //Any form customizations to validate? - var FormCustomization = await ct.FormCustom.AsNoTracking().SingleOrDefaultAsync(z => z.FormKey == AyaType.WorkOrderItemLabor.ToString()); + var FormCustomization = await ct.FormCustom.AsNoTracking().SingleOrDefaultAsync(z => z.FormKey == AyaType.WorkOrder.ToString());//all workorder sub items use the workorder key for customization if (FormCustomization != null) { //Yeppers, do the validation, there are two, the custom fields and the regular fields that might be set to required @@ -3452,7 +3452,7 @@ namespace AyaNova.Biz //Any form customizations to validate? - var FormCustomization = await ct.FormCustom.AsNoTracking().SingleOrDefaultAsync(z => z.FormKey == AyaType.WorkOrderItemLoan.ToString()); + var FormCustomization = await ct.FormCustom.AsNoTracking().SingleOrDefaultAsync(z => z.FormKey == AyaType.WorkOrder.ToString());//all workorder sub items use the workorder key for customization if (FormCustomization != null) { //Yeppers, do the validation, there are two, the custom fields and the regular fields that might be set to required @@ -3779,7 +3779,7 @@ namespace AyaNova.Biz //Any form customizations to validate? - var FormCustomization = await ct.FormCustom.AsNoTracking().SingleOrDefaultAsync(z => z.FormKey == AyaType.WorkOrderItemOutsideService.ToString()); + var FormCustomization = await ct.FormCustom.AsNoTracking().SingleOrDefaultAsync(z => z.FormKey == AyaType.WorkOrder.ToString());//all workorder sub items use the workorder key for customization if (FormCustomization != null) { //Yeppers, do the validation, there are two, the custom fields and the regular fields that might be set to required @@ -4728,7 +4728,7 @@ namespace AyaNova.Biz AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "Quantity", await Translate("InventoryRoleRequired")); //Any form customizations to validate? - var FormCustomization = await ct.FormCustom.AsNoTracking().SingleOrDefaultAsync(z => z.FormKey == AyaType.WorkOrderItemPart.ToString()); + var FormCustomization = await ct.FormCustom.AsNoTracking().SingleOrDefaultAsync(z => z.FormKey == AyaType.WorkOrder.ToString());//all workorder sub items use the workorder key for customization if (FormCustomization != null) { //Yeppers, do the validation, there are two, the custom fields and the regular fields that might be set to required @@ -5021,7 +5021,7 @@ namespace AyaNova.Biz proposedObj.Received = 0;//not a biz rule but a biz adaptation //Any form customizations to validate? - var FormCustomization = await ct.FormCustom.AsNoTracking().SingleOrDefaultAsync(z => z.FormKey == AyaType.WorkOrderItemPartRequest.ToString()); + var FormCustomization = await ct.FormCustom.AsNoTracking().SingleOrDefaultAsync(z => z.FormKey == AyaType.WorkOrder.ToString());//all workorder sub items use the workorder key for customization if (FormCustomization != null) { //Yeppers, do the validation, there are two, the custom fields and the regular fields that might be set to required @@ -5384,7 +5384,7 @@ namespace AyaNova.Biz } } //Any form customizations to validate? - var FormCustomization = await ct.FormCustom.AsNoTracking().SingleOrDefaultAsync(z => z.FormKey == AyaType.WorkOrderItemScheduledUser.ToString()); + var FormCustomization = await ct.FormCustom.AsNoTracking().SingleOrDefaultAsync(z => z.FormKey == AyaType.WorkOrder.ToString());//all workorder sub items use the workorder key for customization if (FormCustomization != null) { //Yeppers, do the validation, there are two, the custom fields and the regular fields that might be set to required @@ -5776,7 +5776,7 @@ namespace AyaNova.Biz AddError(ApiErrorCode.VALIDATION_REQUIRED, "Task"); //Any form customizations to validate? - var FormCustomization = await ct.FormCustom.AsNoTracking().SingleOrDefaultAsync(z => z.FormKey == AyaType.WorkOrderItemTask.ToString()); + var FormCustomization = await ct.FormCustom.AsNoTracking().SingleOrDefaultAsync(z => z.FormKey == AyaType.WorkOrder.ToString());//all workorder sub items use the workorder key for customization if (FormCustomization != null) { //Yeppers, do the validation, there are two, the custom fields and the regular fields that might be set to required @@ -6165,7 +6165,7 @@ namespace AyaNova.Biz AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "NoChargeQuantity"); //Any form customizations to validate? - var FormCustomization = await ct.FormCustom.AsNoTracking().SingleOrDefaultAsync(z => z.FormKey == AyaType.WorkOrderItemTravel.ToString()); + var FormCustomization = await ct.FormCustom.AsNoTracking().SingleOrDefaultAsync(z => z.FormKey == AyaType.WorkOrder.ToString());//all workorder sub items use the workorder key for customization if (FormCustomization != null) { //Yeppers, do the validation, there are two, the custom fields and the regular fields that might be set to required @@ -6500,7 +6500,7 @@ namespace AyaNova.Biz AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "UnitId"); //Any form customizations to validate? - var FormCustomization = await ct.FormCustom.AsNoTracking().SingleOrDefaultAsync(z => z.FormKey == AyaType.WorkOrderItemUnit.ToString()); + var FormCustomization = await ct.FormCustom.AsNoTracking().SingleOrDefaultAsync(z => z.FormKey == AyaType.WorkOrder.ToString());//all workorder sub items use the workorder key for customization if (FormCustomization != null) { //Yeppers, do the validation, there are two, the custom fields and the regular fields that might be set to required