This commit is contained in:
@@ -6211,7 +6211,7 @@ namespace AyaNova.Biz
|
||||
var existingUnitInfo = await ct.Unit.AsNoTracking().Where(x => x.Id == wiu.UnitId).Select(x => new { x.ContractExpires, x.ContractId }).FirstOrDefaultAsync();
|
||||
if (existingUnitInfo != null)
|
||||
{
|
||||
if (existingUnitInfo.ContractId != null && existingUnitInfo.ContractId != proposedUnitInfo.ContractId && existingUnitInfo.ContractExpires > DateTime.UtcNow)
|
||||
if (existingUnitInfo.ContractId != null && existingUnitInfo.ContractExpires > DateTime.UtcNow)
|
||||
{
|
||||
//Ok, we have a pre-existing contract, is it active?
|
||||
if (await ct.Contract.AsNoTracking().Where(x => x.Id == existingUnitInfo.ContractId).Select(x => x.Active).FirstOrDefaultAsync())
|
||||
@@ -6226,7 +6226,7 @@ namespace AyaNova.Biz
|
||||
}
|
||||
if (AlreadyHasAContractedUnit)
|
||||
{
|
||||
AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "UnitId", await Translate("ErrorOneContractedUnitPerWorkOrderOnly"));
|
||||
AddError(ApiErrorCode.VALIDATION_WO_MULTIPLE_CONTRACTED_UNITS, "UnitId");
|
||||
return;//this is a completely disqualifying error
|
||||
}
|
||||
}
|
||||
@@ -6234,7 +6234,7 @@ namespace AyaNova.Biz
|
||||
{
|
||||
currentUnitContract = null;//just in case it's non active but present so later biz actions don't process it
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user