From dc3465498499611267c9df15a693bb29be3f3554 Mon Sep 17 00:00:00 2001 From: Giuliano Mele Date: Mon, 24 Jul 2023 15:11:42 +0200 Subject: [PATCH] Add inherited vvt to descendent team dashboards Also adds all related entities to dashboard network: - DSFA - TOM - Kontakte - Datenweitergabe - Auftragsverarbeitung - Richtlinie - Software --- src/Controller/DashboardController.php | 19 ++++++++++--------- src/Repository/DatenweitergabeRepository.php | 16 ++++++++-------- src/Repository/KontakteRepository.php | 11 +++++++++++ src/Repository/PoliciesRepository.php | 6 +++--- src/Repository/VVTDsfaRepository.php | 13 +++++++++++++ src/Repository/VVTRepository.php | 6 +++--- 6 files changed, 48 insertions(+), 23 deletions(-) diff --git a/src/Controller/DashboardController.php b/src/Controller/DashboardController.php index ec0812cd..892cf42f 100644 --- a/src/Controller/DashboardController.php +++ b/src/Controller/DashboardController.php @@ -79,22 +79,23 @@ public function dashboard(Request $request, return $this->redirectToRoute('no_team'); } } + $teamPath = $teamRepository->getPath($currentTeam); $audit = $auditRepository->findAllByTeam($currentTeam); - $daten = $transferRepository->findActiveTransfersByTeam($currentTeam); - $av = $transferRepository->findActiveOrderProcessingsByTeam($currentTeam); - $vvt = $procedureRepository->findActiveByTeam($currentTeam); - $vvtDsfa = $impactAssessmentRepository->findActiveByTeam($currentTeam); - $kontakte = $contactRepository->findActiveByTeam($currentTeam); - $tom = $tomRepository->findActiveByTeam($currentTeam); + $daten = $transferRepository->findActiveTransfersByTeamPath($teamPath); + $av = $transferRepository->findActiveOrderProcessingsByTeamPath($teamPath); + $vvt = $procedureRepository->findActiveByTeamPath($teamPath); + $vvtDsfa = $impactAssessmentRepository->findActiveByTeamPath($teamPath); + $kontakte = $contactRepository->findActiveByTeamPath($teamPath); + $tom = $tomRepository->findActiveByTeamPath($teamPath); $forms = $formRepository->findPublicByTeam($currentTeam); - $policies = $policyRepository->findPublicByTeam($currentTeam); - $software = $softwareRepository->findActiveByTeam($currentTeam); + $policies = $policyRepository->findPublicByTeamPath($teamPath); + $software = $softwareRepository->findActiveByTeamPath($teamPath); $tasks = $taskRepository->findActiveAndOpenByTeam($currentTeam); $loeschkonzepte = $deletionConceptRepository->findByTeam($currentTeam); $vvtdatenkategorien = $dataCategoryRepository->findByTeam($currentTeam); $kritischeAudits = $auditRepository->findCriticalByTeam($currentTeam); - $kritischeVvts = $procedureRepository->findCriticalByTeam($currentTeam); + $kritischeVvts = $procedureRepository->findCriticalByTeamPath($teamPath); $openDsfa = $impactAssessmentRepository->findActiveAndOpenByTeam($currentTeam); $buchungen = $bookingRepository->findActiveByUser($user); diff --git a/src/Repository/DatenweitergabeRepository.php b/src/Repository/DatenweitergabeRepository.php index e0266ab9..6be9c8c2 100644 --- a/src/Repository/DatenweitergabeRepository.php +++ b/src/Repository/DatenweitergabeRepository.php @@ -42,34 +42,34 @@ public function findActiveByTeamPath(array $teamPath) } /** - * @param $value + * @param array $teamPath * @return int|mixed|string * find transfers of type Datenweitergabe */ - public function findActiveTransfersByTeam($value) + public function findActiveTransfersByTeamPath(array $teamPath): mixed { return $this->createQueryBuilder('a') - ->andWhere('a.team = :val') + ->andWhere('a.team IN (:teamPath)') ->andWhere('a.activ = 1') ->andWhere('a.art = 1') - ->setParameter('val', $value) + ->setParameter('teamPath', $teamPath) ->getQuery() ->getResult() ; } /** - * @param $value + * @param array $teamPath * @return int|mixed|string * find transfers of type Auftragsverarbeitung */ - public function findActiveOrderProcessingsByTeam($value) + public function findActiveOrderProcessingsByTeamPath(array $teamPath): mixed { return $this->createQueryBuilder('a') - ->andWhere('a.team = :val') + ->andWhere('a.team IN (:teamPath)') ->andWhere('a.activ = 1') ->andWhere('a.art = 2') - ->setParameter('val', $value) + ->setParameter('teamPath', $teamPath) ->getQuery() ->getResult() ; diff --git a/src/Repository/KontakteRepository.php b/src/Repository/KontakteRepository.php index 060a0cda..6f9b2191 100644 --- a/src/Repository/KontakteRepository.php +++ b/src/Repository/KontakteRepository.php @@ -58,4 +58,15 @@ public function findActiveByTeam($value) ->getResult() ; } + + public function findActiveByTeamPath(array $teamPath) + { + return $this->createQueryBuilder('a') + ->andWhere('a.team IN (:teamPath)') + ->andWhere('a.activ = 1') + ->setParameter('teamPath', $teamPath) + ->getQuery() + ->getResult() + ; + } } diff --git a/src/Repository/PoliciesRepository.php b/src/Repository/PoliciesRepository.php index ab88ce81..5828b403 100644 --- a/src/Repository/PoliciesRepository.php +++ b/src/Repository/PoliciesRepository.php @@ -29,13 +29,13 @@ public function findActiveByTeam($value) ->getResult(); } - public function findPublicByTeam($value) + public function findPublicByTeamPath(array $teamPath) { return $this->createQueryBuilder('a') - ->andWhere('a.team = :val') + ->andWhere('a.team IN (:teamPath)') ->andWhere('a.activ = 1') ->andWhere('a.status != 4') - ->setParameter('val', $value) + ->setParameter('teamPath', $teamPath) ->getQuery() ->getResult(); } diff --git a/src/Repository/VVTDsfaRepository.php b/src/Repository/VVTDsfaRepository.php index 05bad980..13f6b1cc 100644 --- a/src/Repository/VVTDsfaRepository.php +++ b/src/Repository/VVTDsfaRepository.php @@ -32,6 +32,19 @@ public function findActiveByTeam($value) ; } + public function findActiveByTeamPath(array $teamPath) + { + return $this->createQueryBuilder('a') + ->innerJoin('a.vvt', 'v') + ->andWhere('a.activ = 1') + ->andWhere('v.team IN (:teamPath)') + ->andWhere('v.activ = 1') + ->setParameter('teamPath', $teamPath) + ->getQuery() + ->getResult() + ; + } + public function findActiveAndOpenByTeam($team) { return $this->createQueryBuilder('dsfa') ->innerJoin('dsfa.vvt', 'vvt') diff --git a/src/Repository/VVTRepository.php b/src/Repository/VVTRepository.php index 6fe2824e..d4e8d9dd 100644 --- a/src/Repository/VVTRepository.php +++ b/src/Repository/VVTRepository.php @@ -44,13 +44,13 @@ public function findActiveByTeamPath(array $teamPath) ; } - public function findCriticalByTeam(Team $team) { + public function findCriticalByTeamPath(array $teamPath) { return $this->createQueryBuilder('vvt') - ->andWhere('vvt.team = :team') + ->andWhere('vvt.team IN (:teamPath)') ->andWhere('vvt.activ = 1') ->andWhere('vvt.status = 3') ->orderBy('vvt.CreatedAt', 'DESC') - ->setParameter('team', $team) + ->setParameter('teamPath', $teamPath) ->getQuery() ->getResult(); }