diff --git a/BeWoPlanerMobil/Controllers/MainController.cs b/BeWoPlanerMobil/Controllers/MainController.cs index 0494f2dfe..a862b29be 100644 --- a/BeWoPlanerMobil/Controllers/MainController.cs +++ b/BeWoPlanerMobil/Controllers/MainController.cs @@ -1510,20 +1510,32 @@ namespace BeWoPlanerMobil.Controllers if(!Model.IsInEditingMode) { - var oidList = OperationsService.InsertNewServiceRecords(new List { 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 { 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); diff --git a/Service/Plugins/ServiceRecordValidator.cs b/Service/Plugins/ServiceRecordValidator.cs index a675a2e62..9b00b6b33 100644 --- a/Service/Plugins/ServiceRecordValidator.cs +++ b/Service/Plugins/ServiceRecordValidator.cs @@ -226,7 +226,7 @@ namespace BeWo.Service.Plugins return result; } - public virtual List ValidateServiceRecord(ServiceRecordDC newServiceRecord, SupportConceptStatisticsDC statistics, int maxDaysEditServiceRecordsAllowed, IList employeeOids, IList cb2scOids) + public virtual List ValidateServiceRecord(ServiceRecordDC newServiceRecord, SupportConceptStatisticsDC statisticsXX, int maxDaysEditServiceRecordsAllowed, IList employeeOids, IList cb2scOids) { var result = new List(); @@ -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; } } diff --git a/Shared/BeWoEntityEnums.cs b/Shared/BeWoEntityEnums.cs index cef1066ee..7d55e38e1 100644 --- a/Shared/BeWoEntityEnums.cs +++ b/Shared/BeWoEntityEnums.cs @@ -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