This commit is contained in:
2022-02-11 18:42:53 +00:00
parent 16f9ac727c
commit 6f09698476
3 changed files with 36 additions and 38 deletions

View File

@@ -58,7 +58,7 @@ namespace AyaNova.Biz
AuthorizationRoles.BizAdmin,
UserType.NotService);//picked not service arbitrarily, probably a non-factor
}
private VizCache vc = new VizCache();
private ObjectCache oc = new ObjectCache();
@@ -2118,7 +2118,7 @@ namespace AyaNova.Biz
//POTENTIAL CONTRACT ADJUSTMENTS
//First check if there is a matching tagged service rate contract discount, that takes precedence
if (c.ContractServiceRateOverrideItems.Count > 0 && Rate!=null)
if (c.ContractServiceRateOverrideItems.Count > 0 && Rate != null)
{
//Iterate all contract tagged items in order of ones with the most tags first
foreach (var csr in c.ContractServiceRateOverrideItems.OrderByDescending(z => z.Tags.Count))
@@ -3925,23 +3925,21 @@ namespace AyaNova.Biz
return;
}
if (!isNew && UserIsRestrictedType && currentObj.CompletedByUserId != UserId)
if (!isNew && UserIsRestrictedType)
{
//restricted users are not allowed to edit any task unless they are the selected User
AddError(ApiErrorCode.NOT_AUTHORIZED, "generalerror");
return;
//Existing record so just make sure they haven't changed the not changeable fields from the db version
//* Tasks: view and edit existing tasks, set completion type and date only, no add or remove or changing other fields
//note that UI will prevent this, this rule is only backup for 3rd party api users
if (currentObj.Task != proposedObj.Task) AddError(ApiErrorCode.VALIDATION_NOT_CHANGEABLE, "Task");
if (currentObj.CompletedByUserId != UserId) AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "CompletedByUserId");
if (currentObj.Sequence != proposedObj.Sequence) AddError(ApiErrorCode.VALIDATION_NOT_CHANGEABLE, "Sequence");
// //Existing record so just make sure they haven't changed the not changeable fields from the db version
// //* Tasks: view and edit existing tasks, set completion type and date only, no add or remove or changing other fields
// //note that UI will prevent this, this rule is only backup for 3rd party api users
// if (currentObj.Task != proposedObj.Task) AddError(ApiErrorCode.VALIDATION_NOT_CHANGEABLE, "Task");
// if (currentObj.CompletedByUserId != UserId) AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "CompletedByUserId");
// if (currentObj.Sequence != proposedObj.Sequence) AddError(ApiErrorCode.VALIDATION_NOT_CHANGEABLE, "Sequence");
//they *are* permitted to change the date and status but only if they are the selected user:
//note that UI will prevent this, this rule is only backup for 3rd party api users
if (currentObj.CompletedDate != proposedObj.CompletedDate && currentObj.CompletedByUserId != UserId) AddError(ApiErrorCode.VALIDATION_NOT_CHANGEABLE, "CompletedDate");
if (currentObj.Status != proposedObj.Status && currentObj.CompletedByUserId != UserId) AddError(ApiErrorCode.VALIDATION_NOT_CHANGEABLE, "Status");
}
if (string.IsNullOrWhiteSpace(proposedObj.Task))
AddError(ApiErrorCode.VALIDATION_REQUIRED, "Task");
@@ -4224,7 +4222,7 @@ namespace AyaNova.Biz
//POTENTIAL CONTRACT ADJUSTMENTS
//First check if there is a matching tagged Travel rate contract discount, that takes precedence
if (c.ContractTravelRateOverrideItems.Count > 0 && Rate!=null)
if (c.ContractTravelRateOverrideItems.Count > 0 && Rate != null)
{
//Iterate all contract tagged items in order of ones with the most tags first
foreach (var csr in c.ContractTravelRateOverrideItems.OrderByDescending(z => z.Tags.Count))