Skip to content

Commit 70f7b99

Browse files
authored
On masque les anciens events et catégories dans le pointage du journal (#2164)
fixes #2161
1 parent 66f6660 commit 70f7b99

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

sources/AppBundle/Accounting/Entity/Repository/CategoryRepository.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,15 @@ public function __construct(ManagerRegistry $registry)
2121
/**
2222
* @return array<Category>
2323
*/
24-
public function getAllSortedByName(): array
24+
public function getAllSortedByName(bool $usedInAccountingJournal = false): array
2525
{
26-
return $this->createQueryBuilder('c')
27-
->orderBy('c.name', 'asc')
26+
$query = $this->createQueryBuilder('c');
27+
28+
if ($usedInAccountingJournal) {
29+
$query->andWhere('c.hideInAccountingJournalAt IS NULL');
30+
}
31+
32+
return $query->orderBy('c.name', 'asc')
2833
->getQuery()
2934
->execute();
3035
}

sources/AppBundle/Controller/Admin/Accounting/Journal/ListAction.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ public function __invoke(Request $request): Response
4242
'formPeriod' => $formPeriod->createView(),
4343
'withReconciled' => $withReconciled,
4444
'type' => $type,
45-
'categories' => $this->categoryRepository->getAllSortedByName(),
46-
'events' => $this->eventRepository->getAllSortedByName(),
45+
'categories' => $this->categoryRepository->getAllSortedByName(true),
46+
'events' => $this->eventRepository->getAllSortedByName(true),
4747
'paymentTypes' => $this->paymentRepository->getAllSortedByName(),
4848
'transactions' => $transactions,
4949
]);

0 commit comments

Comments
 (0)