From c40030acf83e338a761fade8cb918f928fabdf3a Mon Sep 17 00:00:00 2001 From: Nathan Boiron Date: Sun, 15 Mar 2026 21:05:17 +0100 Subject: [PATCH] =?UTF-8?q?On=20masque=20les=20anciens=20events=20et=20cat?= =?UTF-8?q?=C3=A9gories=20dans=20le=20pointage=20du=20journal?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fixes #2161 --- .../Entity/Repository/CategoryRepository.php | 11 ++++++++--- .../Admin/Accounting/Journal/ListAction.php | 4 ++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/sources/AppBundle/Accounting/Entity/Repository/CategoryRepository.php b/sources/AppBundle/Accounting/Entity/Repository/CategoryRepository.php index 9952dbf72..753224948 100644 --- a/sources/AppBundle/Accounting/Entity/Repository/CategoryRepository.php +++ b/sources/AppBundle/Accounting/Entity/Repository/CategoryRepository.php @@ -21,10 +21,15 @@ public function __construct(ManagerRegistry $registry) /** * @return array */ - public function getAllSortedByName(): array + public function getAllSortedByName(bool $usedInAccountingJournal = false): array { - return $this->createQueryBuilder('c') - ->orderBy('c.name', 'asc') + $query = $this->createQueryBuilder('c'); + + if ($usedInAccountingJournal) { + $query->andWhere('c.hideInAccountingJournalAt IS NULL'); + } + + return $query->orderBy('c.name', 'asc') ->getQuery() ->execute(); } diff --git a/sources/AppBundle/Controller/Admin/Accounting/Journal/ListAction.php b/sources/AppBundle/Controller/Admin/Accounting/Journal/ListAction.php index 1561cf6e7..2a7810baa 100644 --- a/sources/AppBundle/Controller/Admin/Accounting/Journal/ListAction.php +++ b/sources/AppBundle/Controller/Admin/Accounting/Journal/ListAction.php @@ -42,8 +42,8 @@ public function __invoke(Request $request): Response 'formPeriod' => $formPeriod->createView(), 'withReconciled' => $withReconciled, 'type' => $type, - 'categories' => $this->categoryRepository->getAllSortedByName(), - 'events' => $this->eventRepository->getAllSortedByName(), + 'categories' => $this->categoryRepository->getAllSortedByName(true), + 'events' => $this->eventRepository->getAllSortedByName(true), 'paymentTypes' => $this->paymentRepository->getAllSortedByName(), 'transactions' => $transactions, ]);