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);

View File

@@ -226,7 +226,7 @@ namespace BeWo.Service.Plugins
return result;
}
public virtual List<ServiceRecordValidationResultDC> ValidateServiceRecord(ServiceRecordDC newServiceRecord, SupportConceptStatisticsDC statistics, int maxDaysEditServiceRecordsAllowed, IList<long> employeeOids, IList<long> cb2scOids)
public virtual List<ServiceRecordValidationResultDC> ValidateServiceRecord(ServiceRecordDC newServiceRecord, SupportConceptStatisticsDC statisticsXX, int maxDaysEditServiceRecordsAllowed, IList<long> employeeOids, IList<long> cb2scOids)
{
var result = new List<ServiceRecordValidationResultDC>();
@@ -1126,6 +1126,19 @@ namespace BeWo.Service.Plugins
rdc.EmployeeName = String.Format("{0} {1}", e.Person.FirstName, e.Person.LastName);
}
//CB, 19.03.2026: Prüfe ob ein Dopppler entstanden ist. Das ist mal im Mok passiert, konnte aber bisher nicht reproduziert werden.
if (overlappingRecord.Notice == newServiceRecord.Notice &&
overlappingRecord.Start == newServiceRecord.Start &&
overlappingRecord.End == newServiceRecord.End &&
overlappingRecord.InsTs > DateTime.Now.AddMinutes(-1) &&
overlappingRecord.IsCreatedInMobileClient &&
newServiceRecord.IsCreatedInMobileClient)
{
if (overlappingRecord.CostBearer2SupportConcept != null && newServiceRecord.CostBearer2SupportConceptOid.HasValue && overlappingRecord.CostBearer2SupportConcept.Oid == newServiceRecord.CostBearer2SupportConceptOid.Value)
{
rdc.ResultType = ServiceRecordValidationResult.DoppelterEintrag;
}
}
return rdc;
}
}

View File

@@ -953,7 +953,8 @@ namespace BS.Shared
SettlementInvoiceAlreadyExisting = 6,
FristAbgelaufen = 7,
Custom = 8,
SignatureExists = 9
SignatureExists = 9,
DoppelterEintrag = 10 // Für Mok, da es da mal zu doppelten Einträgen gekommen ist.
}
public enum ViewDestination