diff --git a/server/AyaNova/biz/WorkOrderBiz.cs b/server/AyaNova/biz/WorkOrderBiz.cs index e73bd290..53d0b158 100644 --- a/server/AyaNova/biz/WorkOrderBiz.cs +++ b/server/AyaNova/biz/WorkOrderBiz.cs @@ -2616,7 +2616,7 @@ namespace AyaNova.Biz // to edit or delete only where they are the selected user and only edit fields //Summary, Cost, Tax paid, Description //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.TaxPaid != proposedObj.TaxPaid) AddError(ApiErrorCode.VALIDATION_NOT_CHANGEABLE, "TaxPaid"); 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 (isNew && UserIsTechRestricted) + if (isNew && UserIsTechRestricted) { //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, - description: null, - name: null, - totalCost: 0, - chargeAmount: 0, - taxPaid: 0, - chargeTaxCodeId: null, - taxCodeViz: null, - reimburseUser: false, - userId: null, - userViz: null, - chargeToCustomer: false, - isDirty: true, - workOrderItemId: this.value.items[this.activeWoItemIndex].id, - uid: Date.now() //used for + description: null, + name: null, + totalCost: 0, + chargeAmount: 0, + taxPaid: 0, + chargeTaxCodeId: null, + taxCodeViz: null, + reimburseUser: false, + userId: null, + userViz: null, + chargeToCustomer: false, + isDirty: true, + workOrderItemId: this.value.items[this.activeWoItemIndex].id, + 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 (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)) AddError(ApiErrorCode.VALIDATION_REQUIRED, "Task"); - - //Any form customizations to validate? var FormCustomization = await ct.FormCustom.AsNoTracking().SingleOrDefaultAsync(z => z.FormKey == AyaType.WorkOrderItemTask.ToString()); if (FormCustomization != null)