From b7b48f743486a7a1ed9e29090525cbf0985a447f Mon Sep 17 00:00:00 2001 From: Alexandra Date: Fri, 31 Jul 2026 09:56:15 +0200 Subject: [PATCH] =?UTF-8?q?LebenshilfeWolfsburg/Validation/CustomServiceRe?= =?UTF-8?q?cordValidator.cs=20-=20Gruppenbuchung=20nur=20noch=20mit=20Leis?= =?UTF-8?q?tung=20Sonstiges=20m=C3=B6glich=20SupportOID=3D169213?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../LebenshilfeWolfsburg.csproj | 1 + .../CustomServiceRecordValidator.cs | 39 +++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 ReportImp/LebenshilfeWolfsburg/Validation/CustomServiceRecordValidator.cs diff --git a/ReportImp/LebenshilfeWolfsburg/LebenshilfeWolfsburg.csproj b/ReportImp/LebenshilfeWolfsburg/LebenshilfeWolfsburg.csproj index e1aa3278f..d3d2006df 100644 --- a/ReportImp/LebenshilfeWolfsburg/LebenshilfeWolfsburg.csproj +++ b/ReportImp/LebenshilfeWolfsburg/LebenshilfeWolfsburg.csproj @@ -58,6 +58,7 @@ + diff --git a/ReportImp/LebenshilfeWolfsburg/Validation/CustomServiceRecordValidator.cs b/ReportImp/LebenshilfeWolfsburg/Validation/CustomServiceRecordValidator.cs new file mode 100644 index 000000000..76759c596 --- /dev/null +++ b/ReportImp/LebenshilfeWolfsburg/Validation/CustomServiceRecordValidator.cs @@ -0,0 +1,39 @@ +using BeWo.Service.Plugins; +using BS.Shared; +using BS.Shared.DataContracts; +using System; +using System.Collections.Generic; + +namespace LebenshilfeWolfsburg.Validation +{ + public class CustomServiceRecordValidator : ServiceRecordValidator + { + // Bei einer Gruppenbuchung ist ausschließlich die Leistung "Sonstiges" zulässig, um keine Wegepauschalen auszulösen + private const string ErlaubteLeistungBeiGruppenbuchung = "Sonstiges"; + + public override List ValidateServiceRecord(ServiceRecordDC newServiceRecord, SupportConceptStatisticsDC statistics, int maxDaysEditServiceRecordsAllowed, IList employeeOids, IList cb2scOids) + { + var validation = base.ValidateServiceRecord(newServiceRecord, statistics, maxDaysEditServiceRecordsAllowed, employeeOids, cb2scOids); + + bool istGruppenbuchung = (cb2scOids != null && cb2scOids.Count > 1) || (employeeOids != null && employeeOids.Count > 1) + || newServiceRecord.GroupOid.HasValue || (newServiceRecord.GroupPersonCount.HasValue && newServiceRecord.GroupPersonCount.Value > 1); + + if (istGruppenbuchung && newServiceRecord.ServiceDescription.Category.ServiceCategoryOid == 8) + { + var leistung = newServiceRecord.ServiceDescription?.Name; + + if (!string.Equals(leistung, ErlaubteLeistungBeiGruppenbuchung, StringComparison.OrdinalIgnoreCase)) + { + validation.Add(new ServiceRecordValidationResultDC + { + ResultType = ServiceRecordValidationResult.Custom, + Allow = false, + Message = "Bei einer Gruppenbuchung ist ausschließlich die Leistung \"Sonstiges\" zulässig." + }); + } + } + + return validation; + } + } +} \ No newline at end of file