This commit is contained in:
@@ -318,7 +318,7 @@ MULTIPLE discount / markup ITEMS
|
|||||||
|
|
||||||
|
|
||||||
//VALIDATE TAGGED ITEMS
|
//VALIDATE TAGGED ITEMS
|
||||||
|
//PARTS
|
||||||
if (proposedObj.ContractPartOverrideItems.Count > 1)
|
if (proposedObj.ContractPartOverrideItems.Count > 1)
|
||||||
{
|
{
|
||||||
List<string> allTags = new List<string>();
|
List<string> allTags = new List<string>();
|
||||||
@@ -350,7 +350,7 @@ MULTIPLE discount / markup ITEMS
|
|||||||
AddError(ApiErrorCode.VALIDATION_REQUIRED, $"ContractPartOverrideItems[{i}].OverrideType");
|
AddError(ApiErrorCode.VALIDATION_REQUIRED, $"ContractPartOverrideItems[{i}].OverrideType");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//SERVICE RATES
|
||||||
if (proposedObj.ContractServiceRateOverrideItems.Count > 1)
|
if (proposedObj.ContractServiceRateOverrideItems.Count > 1)
|
||||||
{
|
{
|
||||||
List<string> allTags = new List<string>();
|
List<string> allTags = new List<string>();
|
||||||
@@ -377,12 +377,13 @@ MULTIPLE discount / markup ITEMS
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (item.OverridePct == 0)
|
if (item.OverridePct == 0)
|
||||||
AddError(ApiErrorCode.VALIDATION_REQUIRED, $"ContractPartOverrideItems[{i}].OverridePct");
|
AddError(ApiErrorCode.VALIDATION_REQUIRED, $"ContractServiceRateOverrideItems[{i}].OverridePct");
|
||||||
if (item.OverrideType == ContractOverrideType.NotSet)
|
if (item.OverrideType == ContractOverrideType.NotSet)
|
||||||
AddError(ApiErrorCode.VALIDATION_REQUIRED, $"ContractPartOverrideItems[{i}].OverrideType");
|
AddError(ApiErrorCode.VALIDATION_REQUIRED, $"ContractServiceRateOverrideItems[{i}].OverrideType");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//TRAVEL RATES
|
||||||
if (proposedObj.ContractTravelRateOverrideItems.Count > 1)
|
if (proposedObj.ContractTravelRateOverrideItems.Count > 1)
|
||||||
{
|
{
|
||||||
List<string> allTags = new List<string>();
|
List<string> allTags = new List<string>();
|
||||||
@@ -409,52 +410,37 @@ MULTIPLE discount / markup ITEMS
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (item.OverridePct == 0)
|
if (item.OverridePct == 0)
|
||||||
AddError(ApiErrorCode.VALIDATION_REQUIRED, $"ContractPartOverrideItems[{i}].OverridePct");
|
AddError(ApiErrorCode.VALIDATION_REQUIRED, $"ContractTravelRateOverrideItems[{i}].OverridePct");
|
||||||
if (item.OverrideType == ContractOverrideType.NotSet)
|
if (item.OverrideType == ContractOverrideType.NotSet)
|
||||||
AddError(ApiErrorCode.VALIDATION_REQUIRED, $"ContractPartOverrideItems[{i}].OverrideType");
|
AddError(ApiErrorCode.VALIDATION_REQUIRED, $"ContractTravelRateOverrideItems[{i}].OverrideType");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//VALIDATE CONTRACT RATE / PART ITEMS
|
//VALIDATE CONTRACT SERVICE AND TRAVEL RATE ITEMS
|
||||||
|
|
||||||
|
//Limit to list requires some to be set
|
||||||
if (proposedObj.ServiceRateItems.Count == 0)
|
if (proposedObj.ServiceRateItems.Count == 0)
|
||||||
{
|
{
|
||||||
if (proposedObj.ContractServiceRatesOnly)
|
if (proposedObj.ContractServiceRatesOnly)
|
||||||
{
|
AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "ContractServiceRatesOnly");
|
||||||
AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, $"ContractRatesOnly");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
//No duplicate rates
|
||||||
{
|
//just filter them out rather than setting an error
|
||||||
List<string> allTags = new List<string>();
|
proposedObj.ServiceRateItems = proposedObj.ServiceRateItems.GroupBy(x => x.ServiceRateId).Select(y => y.First()).ToList();
|
||||||
|
|
||||||
for (int i = 0; i < proposedObj.ContractPartOverrideItems.Count; i++)
|
|
||||||
{
|
//Limit to list requires some to be set
|
||||||
var item = proposedObj.ContractPartOverrideItems[i];
|
if (proposedObj.TravelRateItems.Count == 0)
|
||||||
if (item.Tags.Count < 1)
|
{
|
||||||
AddError(ApiErrorCode.VALIDATION_REQUIRED, $"ContractPartOverrideItems[{i}].Tags");
|
if (proposedObj.ContractTravelRatesOnly)
|
||||||
else
|
AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "ContractTravelRatesOnly");
|
||||||
{
|
|
||||||
//add to list, check for dupes
|
|
||||||
foreach (string s in item.Tags)
|
|
||||||
{
|
|
||||||
if (allTags.Contains(s))
|
|
||||||
{
|
|
||||||
AddError(ApiErrorCode.VALIDATION_NOT_UNIQUE, $"ContractPartOverrideItems[{i}].Tags");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
allTags.Add(s);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (item.OverridePct == 0)
|
|
||||||
AddError(ApiErrorCode.VALIDATION_REQUIRED, $"ContractPartOverrideItems[{i}].OverridePct");
|
|
||||||
if (item.OverrideType == ContractOverrideType.NotSet)
|
|
||||||
AddError(ApiErrorCode.VALIDATION_REQUIRED, $"ContractPartOverrideItems[{i}].OverrideType");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
//No duplicate rates
|
||||||
|
//just filter them out rather than setting an error
|
||||||
|
proposedObj.TravelRateItems = proposedObj.TravelRateItems.GroupBy(x => x.TravelRateId).Select(y => y.First()).ToList();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user