Bugfix im Mok, potenzielle Doppelte Einträge verhindern.

This commit is contained in:
2026-03-24 14:32:47 +01:00
parent a6a2dbd4b3
commit 552d8f2180
3 changed files with 38 additions and 12 deletions

View File

@@ -1510,20 +1510,32 @@ namespace BeWoPlanerMobil.Controllers
if(!Model.IsInEditingMode)
{
var oidList = OperationsService.InsertNewServiceRecords(new List<ServiceRecordDC> { Model.NewServiceRecord });
Model.LastCreatedServiceRecordOid = oidList[0];
TempData[TempDataConstants.AfterInsertKey] = true;
if (Model.IsAllowedToCreateSignature(Model.NewServiceRecord))
var valRes = OperationsService.ValidateServiceRecord(Model.NewServiceRecord, null, 0, null, null);
bool doppelt = false;
if (valRes.Count > 0 && valRes.FirstOrDefault(v => v.ResultType == ServiceRecordValidationResult.DoppelterEintrag) != null)
{
if (Model.NewServiceRecord.CostBearer != null && Model.ShowSignature && (Model.NewServiceRecord.ServiceDescription.Category.IsBillable || Model.NewServiceRecord.ServiceDescription.Category.BillableAmount > 0m || Model.NewServiceRecord.ServiceDescription.BillableAmount > 0m))
doppelt = true;
}
if (!doppelt)
{
var oidList = OperationsService.InsertNewServiceRecords(new List<ServiceRecordDC> { Model.NewServiceRecord });
Model.LastCreatedServiceRecordOid = oidList[0];
if (Model.IsAllowedToCreateSignature(Model.NewServiceRecord))
{
TempData[TempDataConstants.ShowSignatureSuggestionPopup] = true;
if (Model.NewServiceRecord.CostBearer != null && Model.ShowSignature && (Model.NewServiceRecord.ServiceDescription.Category.IsBillable || Model.NewServiceRecord.ServiceDescription.Category.BillableAmount > 0m || Model.NewServiceRecord.ServiceDescription.BillableAmount > 0m))
{
TempData[TempDataConstants.ShowSignatureSuggestionPopup] = true;
}
}
}
if(appointmentPrototype is object)
TempData[TempDataConstants.AfterInsertKey] = true;
if (appointmentPrototype is object)
{
var isRecurring = !(appointmentPrototype.RecurrenceInfo is null);