From 16bee4eff87fa69b15e783fd81afab51958ff660 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Mon, 17 May 2021 15:35:34 +0000 Subject: [PATCH] --- docs/8.0/ayanova/docs/svc-contracts.md | 3 ++- server/AyaNova/biz/WorkOrderBiz.cs | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/docs/8.0/ayanova/docs/svc-contracts.md b/docs/8.0/ayanova/docs/svc-contracts.md index 28f065a0..04b0c5b8 100644 --- a/docs/8.0/ayanova/docs/svc-contracts.md +++ b/docs/8.0/ayanova/docs/svc-contracts.md @@ -13,5 +13,6 @@ NOTES FOR DOC - PRECEDENCE: Tagged Contract price overrides take precedence over general Contract price overrides. For example, if a Contract has a general discount for Labor rates and also has a tag override for a Labor record and the tags match then the tag override is the one used and the general override is ignored. If no tags matched then the general price override would be applied. Conflict - multiple potential matches: -Contract tagged items are checked against the object in order of the contract tagged override with the most tags to the contract override with the least tags. This is done to try to make the most specific possible tag match. For example, a contract with 3 tagged labor price overrides and their tags selected are: "green", "red, green, blue", "orange, green". AyaNova will attempt to match by starting with the contract labor override with the most tags: "red,green,blue" then "orange,green" and finally "green". If a record is saved tagged with "orange,red,yellow,green,black,blue" it will be matched to the first item tagged "red,green,blue" as it has the most terms that match and it's override terms will be used and the other two will not be used. +Contract tagged items are checked against the object in order of the Contract tagged override with the most tags to the Contract override with the least tags. This is done to try to make the most specific possible tag match. For example, a Contract with 3 tagged labor price overrides and their tags selected are: "green", "red, green, blue", "orange, green". AyaNova will attempt to match by starting with the Contract labor override with the most tags: "red,green,blue" then "orange,green" and finally "green". If a record is saved tagged with "orange,red,yellow,green,black,blue" it will be matched to the first item tagged "red,green,blue" as it has the most terms that match and it's override terms will be used and the other two will not be used. +- Expiration: Contract expiry dates are checked at the time of work order **creation**. If a work order is in progress and has items added after it's Contract has expired the Contract will still apply to that work order. \ No newline at end of file diff --git a/server/AyaNova/biz/WorkOrderBiz.cs b/server/AyaNova/biz/WorkOrderBiz.cs index c67cd591..0eb7d7f5 100644 --- a/server/AyaNova/biz/WorkOrderBiz.cs +++ b/server/AyaNova/biz/WorkOrderBiz.cs @@ -86,7 +86,7 @@ namespace AyaNova.Biz //(seeder or api user, not something AyaNova front end would do) if (newObject.Items.Count > 0)//our front end will post the header alone on new so this indicates a fully populated wo was saved { - await GetCurrentContractFromContractIdAsync(newObject.ContractId); + await GetCurrentContractFromContractIdAsync(newObject.ContractId); await ProcessChangeOfContractAsync(newObject.Id); } @@ -235,7 +235,7 @@ namespace AyaNova.Biz await WorkOrderValidateAsync(putObject, dbObject); if (HasErrors) return null; - // await WorkOrderBizActionsAsync(AyaEvent.Modified, putObject, dbObject, null); + await WorkOrderBizActionsAsync(AyaEvent.Modified, putObject, dbObject, null); ct.Replace(dbObject, putObject); try { @@ -328,7 +328,7 @@ namespace AyaNova.Biz //CREATION ACTIONS if (ayaEvent == AyaEvent.Created) - { + { //applied at time of creation only //CONTRACT AUTO SET if (newObj.ContractId == null && newObj.CustomerId != 0) { @@ -509,7 +509,7 @@ namespace AyaNova.Biz //If Contract has response time then set CompleteByDate - if (mContractInEffect.ResponseTime != TimeSpan.Zero) + if (mContractInEffect!=null && mContractInEffect.ResponseTime != TimeSpan.Zero) { wo.CompleteByDate = DateTime.UtcNow.Add(mContractInEffect.ResponseTime); }