This commit is contained in:
2021-07-14 17:53:30 +00:00
parent ab0c648869
commit a6c234f4ab

View File

@@ -2616,7 +2616,7 @@ namespace AyaNova.Biz
// to edit or delete only where they are the selected user and only edit fields // to edit or delete only where they are the selected user and only edit fields
//Summary, Cost, Tax paid, Description //Summary, Cost, Tax paid, Description
//note that UI will prevent this, this rule is only backup for 3rd party api users //note that UI will prevent this, this rule is only backup for 3rd party api users
if (currentObj.ChargeAmount != proposedObj.ChargeAmount) AddError(ApiErrorCode.VALIDATION_NOT_CHANGEABLE, "ChargeAmount"); if (currentObj.ChargeAmount != proposedObj.ChargeAmount) AddError(ApiErrorCode.VALIDATION_NOT_CHANGEABLE, "ChargeAmount");
if (currentObj.TaxPaid != proposedObj.TaxPaid) AddError(ApiErrorCode.VALIDATION_NOT_CHANGEABLE, "TaxPaid"); if (currentObj.TaxPaid != proposedObj.TaxPaid) AddError(ApiErrorCode.VALIDATION_NOT_CHANGEABLE, "TaxPaid");
if (currentObj.ChargeTaxCodeId != proposedObj.ChargeTaxCodeId) AddError(ApiErrorCode.VALIDATION_NOT_CHANGEABLE, "ChargeTaxCodeId"); if (currentObj.ChargeTaxCodeId != proposedObj.ChargeTaxCodeId) AddError(ApiErrorCode.VALIDATION_NOT_CHANGEABLE, "ChargeTaxCodeId");
@@ -2624,26 +2624,31 @@ namespace AyaNova.Biz
if (currentObj.ChargeToCustomer != proposedObj.ChargeToCustomer) AddError(ApiErrorCode.VALIDATION_NOT_CHANGEABLE, "ChargeToCustomer"); if (currentObj.ChargeToCustomer != proposedObj.ChargeToCustomer) AddError(ApiErrorCode.VALIDATION_NOT_CHANGEABLE, "ChargeToCustomer");
} }
if (isNew && UserIsTechRestricted) if (isNew && UserIsTechRestricted)
{ {
//NEW record, they are not allowed to set several fields so make sure they are still at their defaults //NEW record, they are not allowed to set several fields so make sure they are still at their defaults
/* /* from client new expense record:
concurrency: 0, concurrency: 0,
description: null, description: null,
name: null, name: null,
totalCost: 0, totalCost: 0,
chargeAmount: 0, chargeAmount: 0,
taxPaid: 0, taxPaid: 0,
chargeTaxCodeId: null, chargeTaxCodeId: null,
taxCodeViz: null, taxCodeViz: null,
reimburseUser: false, reimburseUser: false,
userId: null, userId: null,
userViz: null, userViz: null,
chargeToCustomer: false, chargeToCustomer: false,
isDirty: true, isDirty: true,
workOrderItemId: this.value.items[this.activeWoItemIndex].id, workOrderItemId: this.value.items[this.activeWoItemIndex].id,
uid: Date.now() //used for uid: Date.now() //used for
*/ */
if (currentObj.ChargeAmount != 0) AddError(ApiErrorCode.VALIDATION_NOT_CHANGEABLE, "ChargeAmount");
if (currentObj.TaxPaid != 0) AddError(ApiErrorCode.VALIDATION_NOT_CHANGEABLE, "TaxPaid");
if (currentObj.ChargeTaxCodeId != null) AddError(ApiErrorCode.VALIDATION_NOT_CHANGEABLE, "ChargeTaxCodeId");
if (currentObj.ReimburseUser != false) AddError(ApiErrorCode.VALIDATION_NOT_CHANGEABLE, "ReimburseUser");
if (currentObj.ChargeToCustomer != false) AddError(ApiErrorCode.VALIDATION_NOT_CHANGEABLE, "ChargeToCustomer");
} }
@@ -5490,17 +5495,10 @@ namespace AyaNova.Biz
if (currentObj.Sequence != proposedObj.Sequence) AddError(ApiErrorCode.VALIDATION_NOT_CHANGEABLE, "Sequence"); if (currentObj.Sequence != proposedObj.Sequence) AddError(ApiErrorCode.VALIDATION_NOT_CHANGEABLE, "Sequence");
} }
if (isNew && UserIsTechRestricted)
{
//NEW record, they are not allowed to set several fields so make sure they are still at their defaults
todo
}
if (string.IsNullOrWhiteSpace(proposedObj.Task)) if (string.IsNullOrWhiteSpace(proposedObj.Task))
AddError(ApiErrorCode.VALIDATION_REQUIRED, "Task"); AddError(ApiErrorCode.VALIDATION_REQUIRED, "Task");
//Any form customizations to validate? //Any form customizations to validate?
var FormCustomization = await ct.FormCustom.AsNoTracking().SingleOrDefaultAsync(z => z.FormKey == AyaType.WorkOrderItemTask.ToString()); var FormCustomization = await ct.FormCustom.AsNoTracking().SingleOrDefaultAsync(z => z.FormKey == AyaType.WorkOrderItemTask.ToString());
if (FormCustomization != null) if (FormCustomization != null)