private void checkIfCheckBoxShouldBeDisplayedAnyway(DischargeReadyToLeaveVo voReady) { DischargeReportDetailVo voDischReport = domain.getDischargeReportDetailsForCareContext(form.getGlobalContext().Core.getCurrentCareContext()); form.getLocalContext().setCurrentDischargeReportDetailVo(voDischReport); boolean hasEmail = false; if (voDischReport != null && voDischReport.getGpRecipientsIsNotNull()) { for (int j = 0; j < voDischReport.getGpRecipients().size(); j++) { GPLiteWithCommChannelsVoCollection gps = voDischReport.getGpRecipients(); if (gps != null && gps.size() > 0) { for (int k = 0; k < gps.size() ; k++) { if (gps.get(k).getCommChannelsIsNotNull() && gps.get(k).getCommChannels().size() > 0) { for (int l = 0; l < gps.get(k).getCommChannels().size(); l++) { if (gps.get(k).getCommChannels().get(l).getChannelTypeIsNotNull() && gps.get(k).getCommChannels().get(l).getChannelType().equals(ChannelType.EMAIL)) { hasEmail = true; } } } } } } } DischargeDetailsVo volocalDD = domain.getDischargeDetails(form.getGlobalContext().Core.getCurrentCareContext()); form.getLocalContext().setCurrentDischargeDetailsVo(volocalDD); if ( !hasEmail && voDischReport != null && volocalDD != null && volocalDD.getDischargeLetterStatusIsNotNull() && volocalDD.getDischargeLetterStatus().equals(DischargeLetterStatus.GENERATED) && (voReady.getHasPatientReceivedCopyOfDischarge() == null || (voReady.getHasPatientReceivedCopyOfDischargeIsNotNull() && ! voReady.getHasPatientReceivedCopyOfDischarge()) ) ) { form.chkLetterGiven().setVisible(true); form.lblLetterGiven().setVisible(true); if (form.getMode().equals(FormMode.EDIT)) form.chkLetterGiven().setEnabled(true); } }