=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientdatavalue/PatientDataValue.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientdatavalue/PatientDataValue.java 2012-03-05 04:22:57 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientdatavalue/PatientDataValue.java 2012-05-23 15:02:50 +0000 @@ -53,6 +53,8 @@ private String value; + //private boolean providedElsewhere; + // ------------------------------------------------------------------------- // Constructors // ------------------------------------------------------------------------- === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/Program.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/Program.java 2012-03-27 07:20:28 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/Program.java 2012-05-23 15:02:50 +0000 @@ -47,6 +47,13 @@ */ private static final long serialVersionUID = -2581751965520009382L; + public static final int MULTIPLE_EVENTS_WITH_REGISTRATION = 1; + + public static final int SINGLE_EVENT_WITH_REGISTRATION = 2; + + public static final int SINGLE_EVENT_WITHOUT_REGISTRATION = 3; + + private String description; private Integer version; @@ -73,14 +80,10 @@ private Integer maxDaysAllowedInputData; - private Boolean singleEvent; - - private Boolean anonymous; + private Integer type; private Boolean displayProvidedOtherFacility; - private Boolean hideDateOfIncident; - // ------------------------------------------------------------------------- // Constructors // ------------------------------------------------------------------------- @@ -212,16 +215,6 @@ this.maxDaysAllowedInputData = maxDaysAllowedInputData; } - public Boolean getSingleEvent() - { - return singleEvent; - } - - public void setSingleEvent( Boolean singleEvent ) - { - this.singleEvent = singleEvent; - } - public String getDateOfIncidentDescription() { return dateOfIncidentDescription; @@ -232,14 +225,14 @@ this.dateOfIncidentDescription = dateOfIncidentDescription; } - public Boolean getHideDateOfIncident() + public Integer getType() { - return hideDateOfIncident; + return type; } - public void setHideDateOfIncident( Boolean hideDateOfIncident ) + public void setType( Integer type ) { - this.hideDateOfIncident = hideDateOfIncident; + this.type = type; } public Set getPatientValidationCriteria() @@ -252,16 +245,6 @@ this.patientValidationCriteria = patientValidationCriteria; } - public Boolean getAnonymous() - { - return anonymous; - } - - public void setAnonymous( Boolean anonymous ) - { - this.anonymous = anonymous; - } - // ------------------------------------------------------------------------- // Logic methods // ------------------------------------------------------------------------- === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramService.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramService.java 2011-12-15 02:50:32 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramService.java 2012-05-23 15:02:50 +0000 @@ -56,10 +56,14 @@ Collection getPrograms( ValidationCriteria validationCriteria ); - Collection getPrograms( boolean singleEvent ); - - Collection getPrograms( boolean singleEvent, boolean anonymous ); - - Collection getPrograms( boolean singleEvent, boolean anonymous, OrganisationUnit orgunit ); + Collection getPrograms( int type ); + + Collection getPrograms( int type, OrganisationUnit orgunit ); + +// Collection getPrograms( boolean singleEvent ); +// +// Collection getPrograms( boolean singleEvent, boolean anonymous ); +// +// Collection getPrograms( boolean singleEvent, boolean anonymous, OrganisationUnit orgunit ); } === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageDataElement.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageDataElement.java 2012-03-07 02:40:08 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageDataElement.java 2012-05-23 15:02:50 +0000 @@ -58,6 +58,8 @@ * programStage */ private boolean compulsory = false; + + //private boolean allowProvidedElsewhere; private Integer sortOrder; === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStore.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStore.java 2012-01-06 04:56:54 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStore.java 2012-05-23 15:02:50 +0000 @@ -34,16 +34,22 @@ /** * @author Chau Thu Tran - * + * * @version $Id: ProgramStore.java Dec 14, 2011 9:22:17 AM $ */ -public interface ProgramStore extends GenericNameableObjectStore -{ +public interface ProgramStore + extends GenericNameableObjectStore +{ String ID = ProgramStore.class.getName(); - Collection get( boolean singleEvent ); - - Collection get( boolean singleEvent, boolean anonymous ); - - Collection get( boolean singleEvent, boolean anonymous, OrganisationUnit orgunit ); + Collection getByType( int type ); + + Collection get( int type, OrganisationUnit orgunit ); + + // Collection get( boolean singleEvent ); + // + // Collection get( boolean singleEvent, boolean anonymous ); + // + // Collection get( boolean singleEvent, boolean anonymous, + // OrganisationUnit orgunit ); } === modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/activityplan/DefaultActivityPlanService.java' --- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/activityplan/DefaultActivityPlanService.java 2012-02-28 08:07:22 +0000 +++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/activityplan/DefaultActivityPlanService.java 2012-05-23 15:02:50 +0000 @@ -62,7 +62,7 @@ // ------------------------------------------------------------------------- private ActivityPlanStore activityPlanStore; - + public void setActivityPlanStore( ActivityPlanStore activityPlanStore ) { this.activityPlanStore = activityPlanStore; @@ -116,7 +116,8 @@ List programInstances = new ArrayList(); - Collection programs = programService.getPrograms( false, false, organisationUnit ); + Collection programs = programService.getPrograms( Program.MULTIPLE_EVENTS_WITH_REGISTRATION, + organisationUnit ); for ( Program program : programs ) { @@ -155,7 +156,7 @@ { Collection activities = new ArrayList(); - Collection programs = programService.getPrograms( false, false, organisationUnit ); + Collection programs = programService.getPrograms( Program.MULTIPLE_EVENTS_WITH_REGISTRATION, organisationUnit ); if ( programs.size() > 0 ) { @@ -181,7 +182,7 @@ Collection activities = new ArrayList(); - if ( programService.getPrograms( false, false, organisationUnit ).containsAll( programs ) ) + if ( programService.getPrograms( Program.MULTIPLE_EVENTS_WITH_REGISTRATION, organisationUnit ).containsAll( programs ) ) { Collection programInstances = programInstanceService.getProgramInstances( programs, false ); @@ -284,14 +285,14 @@ } - public Collection getActivitiesByProvider( OrganisationUnit organisationUnit, int min, int max ) { - Collection programStageInstanceIds = activityPlanStore.getActivitiesByProvider ( organisationUnit.getId(), min, max); + Collection programStageInstanceIds = activityPlanStore.getActivitiesByProvider( organisationUnit + .getId(), min, max ); Collection activities = new ArrayList(); - for( Integer id : programStageInstanceIds ) + for ( Integer id : programStageInstanceIds ) { ProgramStageInstance instance = programStageInstanceService.getProgramStageInstance( id ); Activity activity = new Activity(); @@ -300,15 +301,15 @@ activity.setDueDate( instance.getDueDate() ); activities.add( activity ); } - + return activities; } - public int countActivitiesByProvider ( OrganisationUnit organisationUnit ) + public int countActivitiesByProvider( OrganisationUnit organisationUnit ) { return activityPlanStore.countActivitiesByProvider( organisationUnit.getId() ); } - + // ------------------------------------------------------------------------- // Supportive methods // ------------------------------------------------------------------------- === modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java' --- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java 2012-04-23 16:21:44 +0000 +++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java 2012-05-23 15:02:50 +0000 @@ -81,8 +81,13 @@ executeSql( "ALTER TABLE patientdatavaluearchive DROP COLUMN storedby" ); executeSql( "DROP TABLE patientchart" ); - executeSql( "UPDATE program set hideDateOfIncident=false WHERE hideDateOfIncident is null" ); - + executeSql( "ALTER TABLE program DROP COLUMN hidedateofincident" ); + + executeSql( "UPDATE program SET type=2 where singleevent=true" ); + executeSql( "UPDATE program SET type=3 where anonymous=true" ); + executeSql( "ALTER TABLE program DROP COLUMN singleevent" ); + executeSql( "ALTER TABLE program DROP COLUMN anonymous" ); + executeSql( "UPDATE program SET type=1 where type is null" ); } // ------------------------------------------------------------------------- === modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramService.java' --- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramService.java 2011-12-15 02:50:32 +0000 +++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramService.java 2012-05-23 15:02:50 +0000 @@ -117,20 +117,30 @@ return programs; } - - public Collection getPrograms( boolean singleEvent ) - { - return programStore.get( singleEvent ); - } - - public Collection getPrograms( boolean singleEvent, boolean anonymous ) - { - return programStore.get( singleEvent, anonymous ); - } - - public Collection getPrograms( boolean singleEvent, boolean anonymous, OrganisationUnit orgunit ) - { - return programStore.get( singleEvent, anonymous, orgunit ); - } + + public Collection getPrograms( int type ) + { + return programStore.getByType( type ); + } + + public Collection getPrograms( int type, OrganisationUnit orgunit ) + { + return programStore.get( type, orgunit ); + } + +// public Collection getPrograms( boolean singleEvent ) +// { +// return programStore.get( singleEvent ); +// } +// +// public Collection getPrograms( boolean singleEvent, boolean anonymous ) +// { +// return programStore.get( singleEvent, anonymous ); +// } +// +// public Collection getPrograms( boolean singleEvent, boolean anonymous, OrganisationUnit orgunit ) +// { +// return programStore.get( singleEvent, anonymous, orgunit ); +// } } === modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStore.java' --- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStore.java 2012-01-11 05:31:53 +0000 +++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStore.java 2012-05-23 15:02:50 +0000 @@ -46,26 +46,44 @@ { @SuppressWarnings( "unchecked" ) @Override - public Collection get( boolean singleEvent ) - { - return getCriteria( Restrictions.eq( "singleEvent", singleEvent )).list(); - } - - @SuppressWarnings( "unchecked" ) - @Override - public Collection get( boolean singleEvent, boolean anonymous ) - { - return getCriteria( Restrictions.eq( "singleEvent", singleEvent ), - Restrictions.eq( "anonymous", anonymous ) ).list(); - } - - @SuppressWarnings( "unchecked" ) - @Override - public Collection get( boolean singleEvent, boolean anonymous, OrganisationUnit orgunit ) - { - return getCriteria( Restrictions.eq( "singleEvent", singleEvent ), - Restrictions.eq( "anonymous", anonymous ) ).createAlias( "organisationUnits", "orgunit" ).add( + public Collection getByType( int type ) + { + return getCriteria( Restrictions.eq( "type", type ) ).list(); + } + + @SuppressWarnings( "unchecked" ) + @Override + public Collection get( int type, OrganisationUnit orgunit ) + { + return getCriteria( Restrictions.eq( "type", type ) ).createAlias( "organisationUnits", "orgunit" ).add( Restrictions.eq( "orgunit.id", orgunit.getId() ) ).list(); } + // @SuppressWarnings( "unchecked" ) + // @Override + // public Collection get( boolean singleEvent ) + // { + // return getCriteria( Restrictions.eq( "singleEvent", singleEvent + // )).list(); + // } + // + // @SuppressWarnings( "unchecked" ) + // @Override + // public Collection get( boolean singleEvent, boolean anonymous ) + // { + // return getCriteria( Restrictions.eq( "singleEvent", singleEvent ), + // Restrictions.eq( "anonymous", anonymous ) ).list(); + // } + // + // @SuppressWarnings( "unchecked" ) + // @Override + // public Collection get( boolean singleEvent, boolean anonymous, + // OrganisationUnit orgunit ) + // { + // return getCriteria( Restrictions.eq( "singleEvent", singleEvent ), + // Restrictions.eq( "anonymous", anonymous ) ).createAlias( + // "organisationUnits", "orgunit" ).add( + // Restrictions.eq( "orgunit.id", orgunit.getId() ) ).list(); + // } + } === modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patientreport/hibernate/PatientTabularReport.hbm.xml' --- dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patientreport/hibernate/PatientTabularReport.hbm.xml 2012-05-10 01:21:56 +0000 +++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patientreport/hibernate/PatientTabularReport.hbm.xml 2012-05-23 15:02:50 +0000 @@ -22,7 +22,7 @@ - @@ -30,7 +30,7 @@ column="patientidentifiertypeid" foreign-key="patienttabularreport_indentifierid" /> - + - === modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/Program.hbm.xml' --- dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/Program.hbm.xml 2012-03-27 07:20:28 +0000 +++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/Program.hbm.xml 2012-05-23 15:02:50 +0000 @@ -39,13 +39,9 @@ - - - + - - - + === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/CompleteDataEntryAction.java' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/CompleteDataEntryAction.java 2012-03-27 08:30:45 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/CompleteDataEntryAction.java 2012-05-23 15:02:50 +0000 @@ -29,6 +29,7 @@ import java.util.Date; import java.util.Set; +import org.hisp.dhis.program.Program; import org.hisp.dhis.program.ProgramInstance; import org.hisp.dhis.program.ProgramInstanceService; import org.hisp.dhis.program.ProgramStageInstance; @@ -112,7 +113,7 @@ // ProgramInstance // ---------------------------------------------------------------------- - if ( !programStageInstance.getProgramInstance().getProgram().getAnonymous() ) + if ( !programStageInstance.getProgramInstance().getProgram().getType().equals( Program.SINGLE_EVENT_WITHOUT_REGISTRATION ) ) { ProgramInstance programInstance = programStageInstance.getProgramInstance(); === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/DataRecordingSelectAction.java' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/DataRecordingSelectAction.java 2012-03-10 05:06:47 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/DataRecordingSelectAction.java 2012-05-23 15:02:50 +0000 @@ -119,14 +119,14 @@ // Get single programs with un-completed program-instances // --------------------------------------------------------------------- - Collection programInstances = programInstanceService - .getProgramInstances( patient, true ); + Collection programInstances = programInstanceService.getProgramInstances( patient, true ); Collection completedPrograms = new HashSet(); for ( ProgramInstance programInstance : programInstances ) { - if( programInstance.getProgram().getSingleEvent() ) + if ( programInstance.getProgram().getType() == Program.SINGLE_EVENT_WITH_REGISTRATION + || programInstance.getProgram().getType() == Program.SINGLE_EVENT_WITHOUT_REGISTRATION ) { completedPrograms.add( programInstance.getProgram() ); } @@ -139,8 +139,8 @@ programs = programService.getPrograms( orgunit ); programs.retainAll( patient.getPrograms() ); - - programs.addAll( programService.getPrograms( true, false, orgunit ) ); + + programs.addAll( programService.getPrograms( Program.SINGLE_EVENT_WITH_REGISTRATION, orgunit ) ); programs.removeAll( completedPrograms ); === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/GetProgramsByOrgunitAction.java' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/GetProgramsByOrgunitAction.java 2011-12-21 07:16:29 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/GetProgramsByOrgunitAction.java 2012-05-23 15:02:50 +0000 @@ -93,7 +93,7 @@ if ( organisationUnit != null ) { programs = programService.getPrograms( organisationUnit ); - Collection anonymousPrograms = programService.getPrograms( true, true, organisationUnit ); + Collection anonymousPrograms = programService.getPrograms( Program.SINGLE_EVENT_WITHOUT_REGISTRATION, organisationUnit ); programs.removeAll( anonymousPrograms ); } === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/LoadAnonymousProgramsAction.java' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/LoadAnonymousProgramsAction.java 2011-12-26 10:07:59 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/LoadAnonymousProgramsAction.java 2012-05-23 15:02:50 +0000 @@ -94,7 +94,7 @@ if ( orgunit != null ) { - Collection programs = programService.getPrograms( true, true, orgunit ); + Collection programs = programService.getPrograms( Program.SINGLE_EVENT_WITHOUT_REGISTRATION, orgunit ); if ( programs != null && programs.size() > 0 ) { === 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 2012-02-13 02:41:24 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/LoadDataEntryAction.java 2012-05-23 15:02:50 +0000 @@ -127,7 +127,7 @@ { this.patientDataValueService = patientDataValueService; } - + public OrganisationUnit getOrganisationUnit() { return organisationUnit; @@ -188,18 +188,20 @@ if ( programStageInstance != null ) { - if( program.getAnonymous() && programStageInstance.isCompleted() ) + if ( program.getType() == Program.SINGLE_EVENT_WITHOUT_REGISTRATION + && programStageInstance.isCompleted() ) { return SUCCESS; } - + selectedStateManager.setSelectedProgramStageInstance( programStageInstance ); - + // --------------------------------------------------------------------- // Get data values // --------------------------------------------------------------------- - - programStageDataElements = new ArrayList( programStage.getProgramStageDataElements() ); + + programStageDataElements = new ArrayList( programStage + .getProgramStageDataElements() ); Collections.sort( programStageDataElements, new ProgramStageDataElementSortOrderComparator() ); @@ -210,7 +212,7 @@ for ( PatientDataValue patientDataValue : patientDataValues ) { - int key = patientDataValue.getDataElement().getId() ; + int key = patientDataValue.getDataElement().getId(); patientDataValueMap.put( key, patientDataValue ); } @@ -223,8 +225,8 @@ if ( dataEntryForm != null ) { customDataEntryFormCode = programDataEntryService.prepareDataEntryFormForEntry( dataEntryForm - .getHtmlCode(), patientDataValues, program.getDisplayProvidedOtherFacility().toString(), i18n, programStage, programStageInstance, - organisationUnit ); + .getHtmlCode(), patientDataValues, program.getDisplayProvidedOtherFacility().toString(), i18n, + programStage, programStageInstance, organisationUnit ); } } } === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/LoadProgramStagesAction.java' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/LoadProgramStagesAction.java 2012-04-11 06:25:02 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/LoadProgramStagesAction.java 2012-05-23 15:02:50 +0000 @@ -147,7 +147,7 @@ List programInstances = new ArrayList(); - if ( program.getAnonymous() ) + if ( program.getType() == Program.SINGLE_EVENT_WITHOUT_REGISTRATION ) { programInstances = new ArrayList( programInstanceService.getProgramInstances( program, false ) ); @@ -173,5 +173,4 @@ return SUCCESS; } - } === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/MultiDataEntrySelectAction.java' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/MultiDataEntrySelectAction.java 2011-12-21 07:16:29 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/MultiDataEntrySelectAction.java 2012-05-23 15:02:50 +0000 @@ -118,7 +118,7 @@ if ( organisationUnit != null ) { programs = programService.getPrograms( organisationUnit ); - Collection anonymousPrograms = programService.getPrograms( true, true, organisationUnit ); + Collection anonymousPrograms = programService.getPrograms( Program.SINGLE_EVENT_WITHOUT_REGISTRATION, organisationUnit ); programs.removeAll( anonymousPrograms ); } === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/SaveExecutionDateAction.java' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/SaveExecutionDateAction.java 2012-03-28 12:29:54 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/SaveExecutionDateAction.java 2012-05-23 15:02:50 +0000 @@ -156,8 +156,9 @@ Patient patient = selectedStateManager.getSelectedPatient(); ProgramStage programStage = programStageService.getProgramStage( programStageId ); Program program = programStage.getProgram(); + int type = program.getType(); - if ( programStage.getProgram().getSingleEvent() && !programStage.getProgram().getAnonymous() ) + if ( type == Program.SINGLE_EVENT_WITH_REGISTRATION ) { // Add a new program-instance ProgramInstance programInstance = new ProgramInstance(); @@ -186,7 +187,7 @@ programStageInstanceService.addProgramStageInstance( programStageInstance ); selectedStateManager.setSelectedProgramInstance( programInstance ); } - else if ( !programStage.getProgram().getSingleEvent() && !programStage.getProgram().getAnonymous() ) + else if ( type == Program.SINGLE_EVENT_WITH_REGISTRATION ) { ProgramInstance programInstance = programInstanceService.getProgramInstances( patient, program ).iterator().next(); @@ -213,7 +214,8 @@ programStageInstance.setStoredBy( storedBy ); programStageInstance.setOrganisationUnit( selectedStateManager.getSelectedOrganisationUnit() ); - if ( programStageInstance.getProgramInstance().getProgram().getSingleEvent() ) + if ( programStageInstance.getProgramInstance().getProgram().getType() == Program.SINGLE_EVENT_WITH_REGISTRATION || + programStageInstance.getProgramInstance().getProgram().getType() == Program.SINGLE_EVENT_WITHOUT_REGISTRATION ) { programStageInstance.setDueDate( dateValue ); } === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ProgramEnrollmentAction.java' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ProgramEnrollmentAction.java 2012-03-28 07:10:48 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ProgramEnrollmentAction.java 2012-05-23 15:02:50 +0000 @@ -342,7 +342,7 @@ { return false; } - else if ( !program.getSingleEvent() && programInstance == null ) + else if ( program.getType() == Program.MULTIPLE_EVENTS_WITH_REGISTRATION && programInstance == null ) { return false; } === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ProgramEnrollmentSelectAction.java' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ProgramEnrollmentSelectAction.java 2012-03-28 08:26:44 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ProgramEnrollmentSelectAction.java 2012-05-23 15:02:50 +0000 @@ -117,10 +117,10 @@ patient = patientService.getPatient( id ); // Get all programs - programs = programService.getPrograms( false ); + programs = programService.getPrograms( Program.MULTIPLE_EVENTS_WITH_REGISTRATION ); // Except anonymous program - programs.removeAll( programService.getPrograms( true, true ) ); + programs.removeAll( programService.getPrograms( Program.SINGLE_EVENT_WITHOUT_REGISTRATION ) ); // Get single-event if patient no have any single event // OR have un-completed single-event @@ -130,14 +130,15 @@ for ( ProgramInstance programInstance : programInstances ) { - if ( programInstance.getProgram().getSingleEvent() ) + int type = programInstance.getProgram().getType(); + if ( type == Program.SINGLE_EVENT_WITH_REGISTRATION || type == Program.SINGLE_EVENT_WITHOUT_REGISTRATION ) { completedPrograms.add( programInstance.getProgram() ); } } - + // Get single-event programs by the selected orgunit - Collection singleProgramsByOrgunit = programService.getPrograms( true, false, orgunit ); + Collection singleProgramsByOrgunit = programService.getPrograms( Program.SINGLE_EVENT_WITH_REGISTRATION, orgunit ); singleProgramsByOrgunit.remove( completedPrograms ); programs.addAll( singleProgramsByOrgunit ); === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/ReportSelectAction.java' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/ReportSelectAction.java 2012-04-27 08:48:27 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/ReportSelectAction.java 2012-05-23 15:02:50 +0000 @@ -89,8 +89,9 @@ programs = programService.getPrograms( orgunit ); - programs.removeAll( programService.getPrograms( true ) ); - + programs.removeAll( programService.getPrograms( Program.SINGLE_EVENT_WITH_REGISTRATION ) ); + programs.removeAll( programService.getPrograms( Program.SINGLE_EVENT_WITHOUT_REGISTRATION ) ); + return SUCCESS; } } === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/anonymousRegistration.vm' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/anonymousRegistration.vm 2012-04-26 20:44:26 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/anonymousRegistration.vm 2012-05-23 15:02:50 +0000 @@ -16,7 +16,7 @@ === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js 2012-05-15 02:36:43 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js 2012-05-23 15:02:50 +0000 @@ -7,7 +7,7 @@ for (var program in r.programs) { obj.system.program = []; for (var i = 0; i < r.programs.length; i++) { - obj.system.program.push({id: r.programs[i].id, name: r.programs[i].name, anonymous: r.programs[i].anonymous }); + obj.system.program.push({id: r.programs[i].id, name: r.programs[i].name, type: r.programs[i].type }); } } @@ -521,7 +521,7 @@ // IDENTIFIER TYPE TR.store.identifierType.selected.removeAll(); - if (f.identifiers && f.anonymous == "false" ) { + if (f.identifiers && f.type != "3" ) { for (var i = 0; i < f.identifiers.length; i++) { TR.cmp.params.identifierType.objects.push({id: f.identifiers[i].id, name: TR.util.string.getEncodedString(f.identifiers[i].name)}); } @@ -540,7 +540,7 @@ // PATIENT ATTRIBUTE TR.store.patientAttribute.selected.removeAll(); - if (f.attributes && f.anonymous == "false") { + if (f.attributes && f.type != "3") { for (var i = 0; i < f.attributes.length; i++) { TR.cmp.params.patientAttribute.objects.push({id: f.attributes[i].id, name: TR.util.string.getEncodedString(f.attributes[i].name)}); } @@ -559,7 +559,7 @@ // FIXED ATTRIBUTES TR.util.setEnabledFixedAttr(); - if (f.fixedAttributes && f.anonymous == "false") { + if (f.fixedAttributes && f.type != "3") { var fixedAttributes = TR.cmp.params.fixedAttributes.checkbox; Ext.Array.each(fixedAttributes, function(item) { for (var i = 0; i < f.fixedAttributes.length; i++) { @@ -613,7 +613,7 @@ TR.store = { program: Ext.create('Ext.data.Store', { - fields: ['id', 'name', 'anonymous'], + fields: ['id', 'name', 'type'], data:TR.init.system.program }), identifierType: { @@ -1386,7 +1386,7 @@ }, select: function(cb) { var pId = cb.getValue(); - if( cb.displayTplData[0].anonymous=='false' ) + if( cb.displayTplData[0].type !='3' ) { // IDENTIFIER TYPE var storeIdentifierType = TR.store.identifierType.available; === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.vm' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.vm 2012-04-26 19:43:21 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.vm 2012-05-23 15:02:50 +0000 @@ -3,12 +3,12 @@