This commit is contained in:
2021-06-11 23:49:53 +00:00
parent ebee084c29
commit 4a3cb3d778

View File

@@ -5294,10 +5294,14 @@ namespace AyaNova.Biz
bool isNew = currentObj == null;
if (proposedObj.WorkOrderItemId == 0)
{
AddError(ApiErrorCode.VALIDATION_REQUIRED, "WorkOrderItemId");
return;//this is a completely disqualifying error
}
else if (!await ItemExistsAsync(proposedObj.WorkOrderItemId))
{
AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "WorkOrderItemId");
return;//this is a completely disqualifying error
}
//Check state if updatable right now
if (!isNew)
@@ -5551,10 +5555,14 @@ namespace AyaNova.Biz
bool isNew = currentObj == null;
if (proposedObj.WorkOrderItemId == 0)
{
AddError(ApiErrorCode.VALIDATION_REQUIRED, "WorkOrderItemId");
return;//this is a completely disqualifying error
}
else if (!await ItemExistsAsync(proposedObj.WorkOrderItemId))
{
AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "WorkOrderItemId");
return;//this is a completely disqualifying error
}
//Check state if updatable right now
if (!isNew)
@@ -5567,9 +5575,14 @@ namespace AyaNova.Biz
AddError(ApiErrorCode.VALIDATION_NOT_CHANGEABLE, "generalerror", await Translate("WorkOrderErrorLocked"));
return;//this is a completely disqualifying error
}
}
if (proposedObj.UnitId<1 || !await ct.Unit.AnyAsync(x => x.Id == proposedObj.UnitId))
AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "UnitId");
//Any form customizations to validate?
var FormCustomization = await ct.FormCustom.AsNoTracking().SingleOrDefaultAsync(z => z.FormKey == AyaType.WorkOrderItemUnit.ToString());
if (FormCustomization != null)