public static boolean getGrantAccess() { final User user = Authenticate.getUser(); if (user != null) { final int year = Year.now().getValue(); final CgdCard card = findCardFor(user, year, false); return card != null && card.getAllowSendDetails(); } return false; }
@Atomic public static CgdCard setGrantAccess(final boolean allowAccess) { final User user = Authenticate.getUser(); if (user != null) { final int year = Year.now().getValue(); final CgdCard card = findCardFor(user, year, allowAccess); if (card != null) { card.setAllowSendDetails(allowAccess); if (allowAccess) { return card; } } } return null; }
@Atomic private void doit() { final CgdCard card = FenixFramework.getDomainObject(cardId); final Person person = card.getUser().getPerson(); if (person != null) { final Student student = person.getStudent(); if (student != null) { for (final Registration registration : student.getRegistrationsSet()) { if (registration.isActive()) { new CgdForm43Sender().sendForm43For(registration); } } } } }