File tree Expand file tree Collapse file tree 2 files changed +10
-5
lines changed
Accounting/Entity/Repository
Controller/Admin/Accounting/Journal Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Original file line number Diff line number Diff 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 }
Original file line number Diff line number Diff 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 ]);
You can’t perform that action at this time.
0 commit comments