From 5b50e2905459693bff8645ec68e2011dea9a7e05 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Wed, 26 Jan 2022 22:54:09 +0000 Subject: [PATCH] --- docs/8.0/ayanova/docs/ay-customize.md | 2 ++ server/AyaNova/biz/FormFieldReference.cs | 12 ++++---- server/AyaNova/biz/RequiredFieldsValidator.cs | 29 +++++++++++++++++-- 3 files changed, 35 insertions(+), 8 deletions(-) diff --git a/docs/8.0/ayanova/docs/ay-customize.md b/docs/8.0/ayanova/docs/ay-customize.md index 0da2aa04..1d701d4b 100644 --- a/docs/8.0/ayanova/docs/ay-customize.md +++ b/docs/8.0/ayanova/docs/ay-customize.md @@ -33,6 +33,8 @@ When a field is customized, the currently logged in user who is _doing_ the cust Other Users who logged in before the form customization changes were made and saved will need to log out and back in again to see the customization changes take effect on _their_ device as customizations are only fetched from the AyaNova server as part of the login process. +(Note that Quotes and Preventive Maintenance form customizations display their sub sections as "WorkOrderItem*" rather than "QuoteItem*" or "PMItem*" as there are no separate translation keys for those objects, however, customizations made in those forms will correctly apply to PM's and Quotes.) + ### Hiding / showing fields To hide a field uncheck it's "Visible" checkbox and checkmark it to show on the form. diff --git a/server/AyaNova/biz/FormFieldReference.cs b/server/AyaNova/biz/FormFieldReference.cs index 9fb2cc3b..6412c535 100644 --- a/server/AyaNova/biz/FormFieldReference.cs +++ b/server/AyaNova/biz/FormFieldReference.cs @@ -1013,7 +1013,7 @@ namespace AyaNova.Biz l.Add(new FormField { TKey = "TaxBAmt", FieldKey = "ExpenseTaxBViz", TKeySection = "WorkOrderItemExpense", Requireable = false }); l.Add(new FormField { TKey = "LineTotal", FieldKey = "ExpenseLineTotalViz", TKeySection = "WorkOrderItemExpense", Requireable = false }); - //WORKORDER ITEM LOAN WorkOrderItemLoanRate ? + //WORKORDER ITEM LOAN l.Add(new FormField { TKey = "WorkOrderItemLoanRate", TKeySection = "WorkOrderItemLoan", ModelProperty = "Rate", Requireable = false }); l.Add(new FormField { TKey = "WorkOrderItemLoanNotes", TKeySection = "WorkOrderItemLoan", ModelProperty = "Notes" }); l.Add(new FormField { TKey = "WorkOrderItemLoanOutDate", TKeySection = "WorkOrderItemLoan", ModelProperty = "OutDate" }); @@ -1179,7 +1179,7 @@ namespace AyaNova.Biz //QUOTE ITEM PART l.Add(new FormField { TKey = "WorkOrderItemPartDescription", ModelProperty = "Description", TKeySection = "WorkOrderItemPart" }); l.Add(new FormField { TKey = "PurchaseOrderItemSerialNumbers", ModelProperty = "Serials", TKeySection = "WorkOrderItemPart" }); - l.Add(new FormField { TKey = "WorkOrderItemPartSuggestedQuantity", TKeySection = "WorkOrderItemPart", Requireable = false });//requires at least a zero so effectively can't be required + //l.Add(new FormField { TKey = "WorkOrderItemPartSuggestedQuantity", TKeySection = "WorkOrderItemPart", Requireable = false });//requires at least a zero so effectively can't be required l.Add(new FormField { TKey = "WorkOrderItemPartTaxPartSaleID", ModelProperty = "TaxPartSaleId", TKeySection = "WorkOrderItemPart" }); l.Add(new FormField { TKey = "PartDescription", TKeySection = "WorkOrderItemPart", Requireable = false }); l.Add(new FormField { TKey = "PartUPC", TKeySection = "WorkOrderItemPart", Requireable = false }); @@ -1245,6 +1245,7 @@ namespace AyaNova.Biz l.Add(new FormField { TKey = "LineTotal", FieldKey = "ExpenseLineTotalViz", TKeySection = "WorkOrderItemExpense", Requireable = false }); //QUOTE ITEM LOAN + l.Add(new FormField { TKey = "WorkOrderItemLoanRate", TKeySection = "WorkOrderItemLoan", ModelProperty = "Rate", Requireable = false }); l.Add(new FormField { TKey = "WorkOrderItemLoanNotes", TKeySection = "WorkOrderItemLoan", ModelProperty = "Notes" }); l.Add(new FormField { TKey = "WorkOrderItemLoanOutDate", TKeySection = "WorkOrderItemLoan", ModelProperty = "OutDate" }); l.Add(new FormField { TKey = "WorkOrderItemLoanDueDate", TKeySection = "WorkOrderItemLoan", ModelProperty = "DueDate" }); @@ -1254,7 +1255,7 @@ namespace AyaNova.Biz l.Add(new FormField { TKey = "ListPrice", FieldKey = "LoanListPrice", TKeySection = "WorkOrderItemLoan", Requireable = false }); l.Add(new FormField { TKey = "Price", FieldKey = "LoanPriceViz", TKeySection = "WorkOrderItemLoan", Requireable = false }); l.Add(new FormField { TKey = "PriceOverride", FieldKey = "LoanPriceOverride", TKeySection = "WorkOrderItemLoan", ModelProperty = "PriceOverride" }); - l.Add(new FormField { TKey = "UnitOfMeasure", FieldKey = "LoanUnitOfMeasureViz", TKeySection = "WorkOrderItemLoan", Requireable = false }); + //l.Add(new FormField { TKey = "UnitOfMeasure", FieldKey = "LoanUnitOfMeasureViz", TKeySection = "WorkOrderItemLoan", Requireable = false }); l.Add(new FormField { TKey = "NetPrice", FieldKey = "LoanNetViz", TKeySection = "WorkOrderItemLoan", Requireable = false }); l.Add(new FormField { TKey = "TaxAAmt", FieldKey = "LoanTaxAViz", TKeySection = "WorkOrderItemLoan", Requireable = false }); l.Add(new FormField { TKey = "TaxBAmt", FieldKey = "LoanTaxBViz", TKeySection = "WorkOrderItemLoan", Requireable = false }); @@ -1445,7 +1446,7 @@ namespace AyaNova.Biz //PM ITEM PART l.Add(new FormField { TKey = "WorkOrderItemPartDescription", ModelProperty = "Description", TKeySection = "WorkOrderItemPart" }); l.Add(new FormField { TKey = "PurchaseOrderItemSerialNumbers", ModelProperty = "Serials", TKeySection = "WorkOrderItemPart" }); - l.Add(new FormField { TKey = "WorkOrderItemPartSuggestedQuantity", TKeySection = "WorkOrderItemPart", Requireable = false });//requires at least a zero so effectively can't be required + //l.Add(new FormField { TKey = "WorkOrderItemPartSuggestedQuantity", TKeySection = "WorkOrderItemPart", Requireable = false });//requires at least a zero so effectively can't be required l.Add(new FormField { TKey = "WorkOrderItemPartTaxPartSaleID", ModelProperty = "TaxPartSaleId", TKeySection = "WorkOrderItemPart" }); l.Add(new FormField { TKey = "PartDescription", TKeySection = "WorkOrderItemPart", Requireable = false }); l.Add(new FormField { TKey = "PartUPC", TKeySection = "WorkOrderItemPart", Requireable = false }); @@ -1511,6 +1512,7 @@ namespace AyaNova.Biz l.Add(new FormField { TKey = "LineTotal", FieldKey = "ExpenseLineTotalViz", TKeySection = "WorkOrderItemExpense", Requireable = false }); //PM ITEM LOAN + l.Add(new FormField { TKey = "WorkOrderItemLoanRate", TKeySection = "WorkOrderItemLoan", ModelProperty = "Rate", Requireable = false }); l.Add(new FormField { TKey = "WorkOrderItemLoanNotes", TKeySection = "WorkOrderItemLoan", ModelProperty = "Notes" }); l.Add(new FormField { TKey = "WorkOrderItemLoanOutDate", TKeySection = "WorkOrderItemLoan", ModelProperty = "OutDate" }); l.Add(new FormField { TKey = "WorkOrderItemLoanDueDate", TKeySection = "WorkOrderItemLoan", ModelProperty = "DueDate" }); @@ -1520,7 +1522,7 @@ namespace AyaNova.Biz l.Add(new FormField { TKey = "ListPrice", FieldKey = "LoanListPrice", TKeySection = "WorkOrderItemLoan", Requireable = false }); l.Add(new FormField { TKey = "Price", FieldKey = "LoanPriceViz", TKeySection = "WorkOrderItemLoan", Requireable = false }); l.Add(new FormField { TKey = "PriceOverride", FieldKey = "LoanPriceOverride", TKeySection = "WorkOrderItemLoan", ModelProperty = "PriceOverride" }); - l.Add(new FormField { TKey = "UnitOfMeasure", FieldKey = "LoanUnitOfMeasureViz", TKeySection = "WorkOrderItemLoan", Requireable = false }); + // l.Add(new FormField { TKey = "UnitOfMeasure", FieldKey = "LoanUnitOfMeasureViz", TKeySection = "WorkOrderItemLoan", Requireable = false }); l.Add(new FormField { TKey = "NetPrice", FieldKey = "LoanNetViz", TKeySection = "WorkOrderItemLoan", Requireable = false }); l.Add(new FormField { TKey = "TaxAAmt", FieldKey = "LoanTaxAViz", TKeySection = "WorkOrderItemLoan", Requireable = false }); l.Add(new FormField { TKey = "TaxBAmt", FieldKey = "LoanTaxBViz", TKeySection = "WorkOrderItemLoan", Requireable = false }); diff --git a/server/AyaNova/biz/RequiredFieldsValidator.cs b/server/AyaNova/biz/RequiredFieldsValidator.cs index daeed4de..7aad6c6e 100644 --- a/server/AyaNova/biz/RequiredFieldsValidator.cs +++ b/server/AyaNova/biz/RequiredFieldsValidator.cs @@ -30,10 +30,33 @@ namespace AyaNova.Biz //get the type and because of quote and pm subsections "TKeySection" property being named "WorkOrder" in the formFieldReference due to lack of separate //translations for quote and pm subitems it's necessary to adjust the name here first before matching - var proposedObjectType=proposedObject.GetType().ToString().Replace("QuoteItem","WorkOrderItem").Replace("PMItem","WorkOrderItem"); - //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))) + var proposedObjectType = proposedObject.GetType().ToString().Replace("AyaNova.Models.", "").Replace("QuoteItem", "WorkOrderItem").Replace("PMItem", "WorkOrderItem"); + + //hacky last minute work around but workorder, quote and pm header objects have no tkeysection normally which can cause interference here with duplicate fields i.e. Tags in subsections + //as they will have the header rule applied if we just leave the tkeysection as null so for here we workaround that by creating a temporary tkeysection + if (FF.TKeySection == null) { + switch (proposedObjectType) + { + case "WorkOrder": + FF.TKeySection = proposedObjectType; + break; + case "Quote": + FF.TKeySection = proposedObjectType; + break; + case "PM": + FF.TKeySection = proposedObjectType; + break; + } + } + + //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 == FF.TKeySection)) + { + + //bugbug: if section is workorderitem and field is tags but there is a tags required in workorder htat has NOT tkeysection it applies that rule + + //Now get the actual property name from the available fields using the lt key string RequiredPropertyName = FF.FieldKey; //there might be a more specific model property due to being a workorder sub item duplicate such as WorkOrderItemTags vs WorkOrderTags