Subversion Repositories SmartDukaan

Rev

Rev 37037 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 37037 Rev 37057
Line 1392... Line 1392...
1392
            endDate = startDate.plusMonths(1);
1392
            endDate = startDate.plusMonths(1);
1393
        }
1393
        }
1394
 
1394
 
1395
        // Scope: an admin may target a partner (blank fofoId = all partners); a non-admin
1395
        // Scope: an admin may target a partner (blank fofoId = all partners); a non-admin
1396
        // is always restricted to their own store, whatever fofoId the client sends.
1396
        // is always restricted to their own store, whatever fofoId the client sends.
-
 
1397
        // Kept as an if/else, not a ternary: mixing Integer (fofoId) and int (getFofoId)
-
 
1398
        // in a conditional unboxes the whole expression and would NPE on a blank admin fofoId.
1397
        LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
1399
        LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
1398
        boolean isAdmin = roleManager.isAdmin(loginDetails.getRoleIds());
1400
        boolean isAdmin = roleManager.isAdmin(loginDetails.getRoleIds());
-
 
1401
        Integer scopedFofoId;
-
 
1402
        if (isAdmin) {
-
 
1403
            scopedFofoId = fofoId;
-
 
1404
        } else {
1399
        Integer scopedFofoId = isAdmin ? fofoId : loginDetails.getFofoId();
1405
            scopedFofoId = loginDetails.getFofoId();
-
 
1406
        }
1400
 
1407
 
1401
        List<com.spice.profitmandi.dao.entity.transaction.Order> orders =
1408
        List<com.spice.profitmandi.dao.entity.transaction.Order> orders =
1402
                scopedFofoId == null
1409
                scopedFofoId == null
1403
                        ? orderRepository.selectAllByDatesBetween(startDate.atStartOfDay(), endDate.atTime(LocalTime.MAX))
1410
                        ? orderRepository.selectAllByDatesBetween(startDate.atStartOfDay(), endDate.atTime(LocalTime.MAX))
1404
                        : orderRepository.selectAllByDatesBetween(scopedFofoId, startDate.atStartOfDay(), endDate.atTime(LocalTime.MAX));
1411
                        : orderRepository.selectAllByDatesBetween(scopedFofoId, startDate.atStartOfDay(), endDate.atTime(LocalTime.MAX));