File tree Expand file tree Collapse file tree 1 file changed +17
-3
lines changed
module/FakBundle/Controller/Admin Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -14,18 +14,32 @@ public function manageAction()
14
14
->getRepository ('FakBundle\Entity\Scanner ' )
15
15
->findBy (array (), array ('amount ' => 'DESC ' ));
16
16
17
- // Set EntityManager for each checkin so getFullName() works
17
+ $ filteredCheckins = array ();
18
+ $ currentAcademicYear = $ this ->getCurrentAcademicYear ();
19
+
18
20
foreach ($ allCheckins as $ checkin ) {
19
21
$ checkin ->setEntityManager ($ this ->getEntityManager ());
22
+ $ person = $ this ->getEntityManager ()
23
+ ->getRepository ('CommonBundle\Entity\User\Person ' )
24
+ ->findOneByUsername ($ checkin ->getUserName ());
25
+
26
+ // Only filter if person is an Academic
27
+ if ($ person instanceof \CommonBundle \Entity \User \Person \Academic) {
28
+ $ unit = $ person ->getUnit ($ currentAcademicYear );
29
+ if ($ unit && strtolower ($ unit ->getName ()) === 'fakbar ' ) {
30
+ continue ; // Skip this checkin
31
+ }
32
+ }
33
+ $ filteredCheckins [] = $ checkin ;
20
34
}
21
35
22
36
$ paginator = $ this ->paginator ()->createFromArray (
23
- $ allCheckins ,
37
+ $ filteredCheckins ,
24
38
$ this ->getParam ('page ' )
25
39
);
26
40
27
41
$ totalAmount = 0 ;
28
- foreach ($ allCheckins as $ checkin ) {
42
+ foreach ($ filteredCheckins as $ checkin ) {
29
43
$ totalAmount += $ checkin ->getAmount ();
30
44
}
31
45
You can’t perform that action at this time.
0 commit comments