diff --git a/BeWo/BeWo.csproj b/BeWo/BeWo.csproj
index 854da3dc2..b454c051b 100644
--- a/BeWo/BeWo.csproj
+++ b/BeWo/BeWo.csproj
@@ -2712,6 +2712,7 @@
+
diff --git a/BeWo/Validation/AttributeValidator.cs b/BeWo/Validation/AttributeValidator.cs
index 569a2e18c..995be5c68 100644
--- a/BeWo/Validation/AttributeValidator.cs
+++ b/BeWo/Validation/AttributeValidator.cs
@@ -19,10 +19,19 @@ namespace BeWo.Validation
{
PropertyInfo lPropInfo = null;
object lCurrentObject = this.ExpressionToValidate.DataItem;
+
+ // Claude: DataItem des Bindings und Eltern-Objekt des Ziel-Propertys festhalten,
+ // damit kontextabhaengige Regeln den Klientenbezug auswerten koennen.
+ // Bei "PrototypeVM.Notice" ist das DataItem die ServiceRecordListVM (kennt
+ // WithoutClient), bei "Notice" in den EditViews die ServiceRecordVM selbst.
+ object lDataItem = lCurrentObject;
+ object lOwner = lCurrentObject;
+
if (lCurrentObject != null)
{
foreach (var iPropName in this.ExpressionToValidate.ParentBinding.Path.Path.Split("."))
{
+ lOwner = lCurrentObject; // Claude: vor dem GetValue merken
lPropInfo = lCurrentObject.GetType().GetProperty(iPropName);
lCurrentObject = lPropInfo.GetValue(lCurrentObject, null);
}
@@ -33,7 +42,12 @@ namespace BeWo.Validation
var lAttributes = lPropInfo.GetCustomAttributes(typeof(ValidationAttribute), true);
if (lAttributes.Length > 0)
{
- lValid = ((ValidationAttribute) lAttributes[0]).Validate(pValue);
+ // Claude: DataItem hat Vorrang, weil dort der View-Zustand liegt
+ // (ServiceRecordListVM.WithoutClient); sonst greift das Eltern-Objekt.
+ var lContext = (lDataItem as ICustomerRelatedContext)
+ ?? (lOwner as ICustomerRelatedContext);
+
+ lValid = ((ValidationAttribute) lAttributes[0]).Validate(pValue, lContext);
}
}
}
diff --git a/BeWo/Validation/ICustomerRelatedContext.cs b/BeWo/Validation/ICustomerRelatedContext.cs
new file mode 100644
index 000000000..0b0dc304b
--- /dev/null
+++ b/BeWo/Validation/ICustomerRelatedContext.cs
@@ -0,0 +1,12 @@
+namespace BeWo.Validation
+{
+ // Claude: Kontext fuer klientenabhaengige Validierungsregeln.
+ // Wird von ValidationRules.EmptyNoticeInNewServiceRecordsAllowed ausgewertet: die
+ // Dokumentationspflicht (Mandanten-Setting IsServiceRecordNoticeMandatory) gilt nur fuer
+ // klientenbezogene Zeiterfassungen, also fuer Eintraege mit Customer/Hilfeplan.
+ public interface ICustomerRelatedContext
+ {
+ // Claude: true, wenn der Eintrag zu einem Customer/SupportConcept gehoert.
+ bool IsCustomerRelated { get; }
+ }
+}
diff --git a/BeWo/Validation/ValidationAttribute.cs b/BeWo/Validation/ValidationAttribute.cs
index 675b82155..d9e810845 100644
--- a/BeWo/Validation/ValidationAttribute.cs
+++ b/BeWo/Validation/ValidationAttribute.cs
@@ -15,7 +15,9 @@ namespace BeWo.Validation
public ValidationRules ValidationRule { get; set; }
- public bool Validate(object pValue)
+ // Claude: pContext liefert den Klientenbezug fuer EmptyNoticeInNewServiceRecordsAllowed.
+ // null bedeutet "unbekannt" -> bisheriges Verhalten (Pflichtfeld bleibt).
+ public bool Validate(object pValue, ICustomerRelatedContext pContext = null)
{
bool lResult = true;
switch (ValidationRule)
@@ -73,7 +75,12 @@ namespace BeWo.Validation
break;
case ValidationRules.EmptyNoticeInNewServiceRecordsAllowed:
- if (BeWoApp.AppSettings.IsServiceRecordNoticeMandatory)
+ // Claude: Dokumentationspflicht greift nur noch bei klientenbezogenen
+ // Eintraegen (Customer/Hilfeplan). Ohne Klientenbezug - in
+ // ServiceRecordView2 also bei abgewaehlter CheckBox "chkWithClient" -
+ // ist die Dokumentation niemals Pflicht.
+ if (BeWoApp.AppSettings.IsServiceRecordNoticeMandatory
+ && (pContext == null || pContext.IsCustomerRelated))
{
if (pValue is string)
{
diff --git a/BeWo/View/Detail/MandatorView.xaml b/BeWo/View/Detail/MandatorView.xaml
index f2423ba08..f884c427f 100644
--- a/BeWo/View/Detail/MandatorView.xaml
+++ b/BeWo/View/Detail/MandatorView.xaml
@@ -370,7 +370,7 @@
Grid.Row="0"
Grid.ColumnSpan="2"
Margin="3,5,3,5"
- Content="{markup:Translate Dokumentationstext in der Zeiterfassung Pflichtfeld}"
+ Content="{markup:Translate Klientenbezogener Dokumentationstext in der Zeiterfassung Pflichtfeld}"
IsChecked="{Binding Path=IsServiceRecordNoticeMandatory}" />
, ITextProvider
+ // Claude: ICustomerRelatedContext -> steuert die Dokumentationspflicht bei der Neuerfassung
+ public class ServiceRecordListVM : AbstractDCListMapperVM, ITextProvider, ICustomerRelatedContext
{
public static string PropertyName_CustomerNodes = "CustomerNodes";
public static string PropertyName_Information = "Information";
@@ -666,6 +668,14 @@ namespace BeWo.ViewModel.ListViewModel
public bool WithoutClient { get; set; }
+ // Claude: Klientenbezug fuer die Dokumentationspflicht. In ServiceRecordView2 steuert das
+ // die CheckBox "chkWithClient" ueber WithoutClient. In Views ohne diese CheckBox
+ // (z.B. AdditionalServiceView) bleibt WithoutClient false -> Verhalten wie bisher.
+ public bool IsCustomerRelated
+ {
+ get { return !WithoutClient; }
+ }
+
protected override Comparison Comparison
{
get { return (x, y) => y.StartDate.CompareTo(x.StartDate); }
diff --git a/BeWo/ViewModel/ServiceRecordVM.cs b/BeWo/ViewModel/ServiceRecordVM.cs
index 39f878883..d38160f0d 100644
--- a/BeWo/ViewModel/ServiceRecordVM.cs
+++ b/BeWo/ViewModel/ServiceRecordVM.cs
@@ -21,7 +21,8 @@ using Color = System.Windows.Media.Color;
namespace BeWo.ViewModel
{
- public class ServiceRecordVM : AbstractDCMapperVM
+ // Claude: ICustomerRelatedContext -> steuert die Dokumentationspflicht beim Bearbeiten
+ public class ServiceRecordVM : AbstractDCMapperVM, ICustomerRelatedContext
{
public String ATEST { get; set; }
#region Constants and Fields
@@ -1339,6 +1340,18 @@ namespace BeWo.ViewModel
}
}
+ // Claude: Klientenbezug fuer die Dokumentationspflicht beim Bearbeiten eines bestehenden
+ // Eintrags (ServiceRecordEditView / ServiceRecordGroupEditView binden direkt an dieses VM).
+ // Beim Laden aus dem DataContract ist Customer gesetzt, wenn der Eintrag zu einem
+ // Klienten gehoert - kundenlose Eintraege haben Customer == null.
+ // Achtung: Am PrototypeVM der Neuerfassung ist Customer immer null; dort liefert
+ // ServiceRecordListVM.IsCustomerRelated den Kontext (DataItem hat im AttributeValidator
+ // Vorrang), weil der Kunde erst nach der Validierung an den Klon geschrieben wird.
+ public bool IsCustomerRelated
+ {
+ get { return Customer != null; }
+ }
+
[Validation(ValidationRule = ValidationRules.EmptyNoticeInNewServiceRecordsAllowed)]
public string Notice
{
diff --git a/Service/Plugins/PluginLoader.cs b/Service/Plugins/PluginLoader.cs
index 72db47fd8..4e7d23ebc 100644
--- a/Service/Plugins/PluginLoader.cs
+++ b/Service/Plugins/PluginLoader.cs
@@ -53,7 +53,7 @@ namespace BeWo.Service.Plugins
//t = "7375324044"; // Diakonie KK Kleve
//t = "1441747891"; // BeWo Mobil Köln
//t = "5120047701"; // Trialog
- t = "3629696651"; // Soziale Dienste Niederrhein (SDN)
+ //t = "3629696651"; // Soziale Dienste Niederrhein (SDN)
//t = "9893557471"; // Caritas Frankfurt
//t = "2918696314"; // Caritas Frankfurt 2
//t = "6923790936"; // Integra e.V.