LebenshilfeWolfsburg/Validation/CustomServiceRecordValidator.cs - Gruppenbuchung nur noch mit Leistung Sonstiges möglich

SupportOID=169213
This commit is contained in:
2026-07-31 09:56:15 +02:00
parent cd7c156ccb
commit b7b48f7434
2 changed files with 40 additions and 0 deletions

View File

@@ -58,6 +58,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Export\CustomDataExporter.cs" />
<Compile Include="Validation\CustomServiceRecordValidator.cs" />
<Compile Include="Export\LohnExporter.cs" />
<Compile Include="Reporting\CustomMitarbeiterstundenkontoBerechnung.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />

View File

@@ -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<ServiceRecordValidationResultDC> ValidateServiceRecord(ServiceRecordDC newServiceRecord, SupportConceptStatisticsDC statistics, int maxDaysEditServiceRecordsAllowed, IList<long> employeeOids, IList<long> 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;
}
}
}