From 13d0798c1bd3c12a490d4d0ca6f20f443753a5af Mon Sep 17 00:00:00 2001 From: Christian Date: Wed, 18 Feb 2026 14:23:12 +0100 Subject: [PATCH] =?UTF-8?q?Verbesserung=20Perseh=20Import.=20Pr=C3=BCfe=20?= =?UTF-8?q?Anzahl=20neuer=20Bereiche=20vor=20dem=20Import.=20Wenn=20>=2010?= =?UTF-8?q?=20angelegt=20werden=20m=C3=BCssten,=20brich=20den=20Import=20a?= =?UTF-8?q?b?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Service/Plugins/CustomerService.cs | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/Service/Plugins/CustomerService.cs b/Service/Plugins/CustomerService.cs index 07a446825..e9342ddf5 100644 --- a/Service/Plugins/CustomerService.cs +++ b/Service/Plugins/CustomerService.cs @@ -1432,7 +1432,13 @@ namespace BeWo.Service.Plugins var scDC = MapperFactory.SupportConceptDC_SupportConcept.MapToNewDC(supportConcept); - MatchZiele(hidc, scDC); + var resultMessage = MatchZiele(hidc, scDC); + + if (!String.IsNullOrEmpty(resultMessage)) + { + result.ImportMessage = resultMessage; + return result; + } result.ImportedSupportConcept = scDC; //result.ImportMessage = "Import erfolgreich"; @@ -1440,7 +1446,7 @@ namespace BeWo.Service.Plugins return result; } - private void MatchZiele(HilfeplanImportDC hidc, SupportConceptDC supportConcept) + private String MatchZiele(HilfeplanImportDC hidc, SupportConceptDC supportConcept) { var types = new List(); types.Add(ValueListEntryType.SupportConceptGoalCategoryType); @@ -1451,6 +1457,24 @@ namespace BeWo.Service.Plugins { alleZiele = SortiereZieleNachHierarchie(alleZiele); + //Zähle neue Bereiche und importiere nur, wenn weniger als 11 gefunden wurden + int count = 0; + foreach (var importziel in hidc.Ziele) + { + if (!String.IsNullOrEmpty(importziel.Bereich) && importziel.DoImport) + { + if (SucheBereichsZiel(alleZiele, importziel.Bereich) == null) + { + count++; + } + + } + } + + if (count > 10) + { + return "Es wurden zu viele unbekannte Lebensbereiche gefunden. Bitte prüfen Sie, ob alle Bereiche korrekt angelegt sind."; + } foreach (var importziel in hidc.Ziele) { if (!String.IsNullOrEmpty(importziel.Bereich) && importziel.DoImport) @@ -1495,6 +1519,8 @@ namespace BeWo.Service.Plugins } } } + + return null; } private ValueListEntryDC ErstelleBereichsZiel(string bereich)