=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramDataEntryService.java' --- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramDataEntryService.java 2013-04-12 04:20:19 +0000 +++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramDataEntryService.java 2013-04-17 04:17:23 +0000 @@ -44,7 +44,6 @@ /** * @author Chau Thu Tran * @version $ DefaultProgramDataEntryService.java May 26, 2011 3:59:43 PM $ - * */ public class DefaultProgramDataEntryService implements ProgramDataEntryService @@ -198,7 +197,7 @@ { Collection patientDataValues = mapDataValue.get( programStageUid ); - if ( patientDataValues == null ) + if ( patientDataValues == null && programStageInstance != null ) { ProgramStage otherProgramStage = programStageService.getProgramStage( programStageUid ); ProgramStageInstance otherProgramStageInstance = programStageInstanceService @@ -723,6 +722,11 @@ */ private PatientDataValue getValue( Collection dataValues, String dataElementUid ) { + if ( dataValues == null ) + { + return null; + } + for ( PatientDataValue dataValue : dataValues ) { if ( dataValue.getDataElement().getUid().equals( dataElementUid ) ) @@ -760,7 +764,7 @@ * Replaces i18n string in the custom form code. * * @param dataEntryFormCode the data entry form html. - * @param i18n the I18n object. + * @param i18n the I18n object. * @return internationalized data entry form html. */ private String populateI18nStrings( String dataEntryFormCode, I18n i18n ) === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/LoadDataEntryAction.java' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/LoadDataEntryAction.java 2013-04-13 05:15:58 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/LoadDataEntryAction.java 2013-04-17 04:17:23 +0000 @@ -280,6 +280,9 @@ Collections.sort( programStageDataElements, new ProgramStageDataElementSortOrderComparator() ); + DataEntryForm dataEntryForm = programStage.getDataEntryForm(); + Boolean displayProvidedOtherFacility = program.getDisplayProvidedOtherFacility() == null || !program.getDisplayProvidedOtherFacility(); + if ( programStage.getDataEntryType().equals( ProgramStage.TYPE_SECTION ) ) { sections = new ArrayList( @@ -287,6 +290,12 @@ Collections.sort( sections, new ProgramStageSectionSortOrderComparator() ); } + else if ( programStage.getDataEntryType().equals( ProgramStage.TYPE_CUSTOM ) ) + { + customDataEntryFormCode = programDataEntryService.prepareDataEntryFormForEntry( + dataEntryForm.getHtmlCode(), null, displayProvidedOtherFacility.toString(), i18n, + programStage, null, organisationUnit ); + } if ( programStageInstance != null ) { @@ -310,12 +319,8 @@ if ( programStage.getDataEntryType().equals( ProgramStage.TYPE_CUSTOM ) ) { - DataEntryForm dataEntryForm = programStage.getDataEntryForm(); - - Boolean disabled = (program.getDisplayProvidedOtherFacility() == null) ? true : !program - .getDisplayProvidedOtherFacility(); customDataEntryFormCode = programDataEntryService.prepareDataEntryFormForEntry( - dataEntryForm.getHtmlCode(), patientDataValues, disabled.toString(), i18n, + dataEntryForm.getHtmlCode(), patientDataValues, displayProvidedOtherFacility.toString(), i18n, programStage, programStageInstance, organisationUnit ); }