dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #38329
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 19528: applying patch from Tran - enum programType
------------------------------------------------------------
revno: 19528
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2015-07-02 09:05:55 +0200
message:
applying patch from Tran - enum programType
added:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramType.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/ProgramTypeUserType.java
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/Program.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramService.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStore.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultProgramInstanceService.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultProgramService.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultProgramStageInstanceService.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultProgramValidationService.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStore.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/InitTableAlteror.java
dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/program/hibernate/Program.hbm.xml
dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/program/ProgramServiceTest.java
dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/program/ProgramStageInstanceServiceTest.java
dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/program/ProgramStoreTest.java
dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/enrollment/AbstractEnrollmentService.java
dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/AbstractEventService.java
dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/JdbcEventStore.java
dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/events/EnrollmentServiceTest.java
dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/events/NoRegistrationSingleEventServiceTest.java
dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/events/RegistrationMultiEventsServiceTest.java
dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/events/RegistrationSingleEventServiceTest.java
dhis-2/dhis-services/dhis-service-eventreporting/src/main/java/org/hisp/dhis/caseaggregation/hibernate/HibernateCaseAggregationConditionStore.java
dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/LWUITmodel/Program.java
dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java
dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/DefaultProgramService.java
dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisConvenienceTest.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/ProgramController.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/user/CurrentUserController.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/utils/FormUtils.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/GetProgramMetaDataAction.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/GetAllProgramsAction.java
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/GetSingleEventProgramListAction.java
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/report/ReportSelectAction.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/ProgramEnrollmentAction.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/ProgramEnrollmentSelectAction.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/SelectAction.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/ShowActivityPlanFormAction.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/ShowAddTrackedEntityInstanceFormAction.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/TrackedEntityInstanceDashboardAction.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/activityPlanSelect.vm
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/singleEvent.js
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/smsReminder.js
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/trackedEntityInstance.js
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonProgramMetaData.vm
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonProgramStageDataElements.vm
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonProgramStageInstance.vm
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonSingleEventPrograms.vm
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentForm.vm
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentSelectForm.vm
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageCompletenessSelect.vm
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageInstanceFlow.vm
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programTrackingSelect.vm
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/searchTrackedEntityInstanceCriteria.vm
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleEventSelect.vm
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/trackedEntityInstanceDashboard.vm
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonProgram.vm
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonPrograms.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/smscommand/SMSCommandAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/dataentryform/ViewProgramEntryFormAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/program/AddProgramAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/program/GetUnAnonymousProgramAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/program/ShowAddProgramFormAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/program/ShowUpdateProgramFormAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/program/UpdateProgramAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/AddProgramStageAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/ShowAddProgramStageFormAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/UpdateProgramStageAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattribute/ShowAddUpdateAttributeAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/resources/org/hisp/dhis/trackedentity/i18n_module.properties
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addCaseAggregation.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addProgramForm.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addProgramStageForm.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/program.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/programIndicatorForm.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/programList.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/programStage.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateCaseAggregation.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateProgramForm.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateProgramStageForm.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/viewDataEntryForm.vm
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== 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 2015-06-19 07:35:50 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/Program.java 2015-07-02 07:05:55 +0000
@@ -28,12 +28,10 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonView;
-import com.fasterxml.jackson.databind.annotation.JsonSerialize;
-import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
-import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
-import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
import org.hisp.dhis.attribute.AttributeValue;
import org.hisp.dhis.common.BaseIdentifiableObject;
@@ -55,11 +53,12 @@
import org.hisp.dhis.user.UserAuthorityGroup;
import org.hisp.dhis.validation.ValidationCriteria;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonView;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
/**
* @author Abyot Asalefew
@@ -70,14 +69,7 @@
implements VersionedObject
{
private static final long serialVersionUID = -2807997671779497354L;
-
- public static final List<String> TYPE_LOOKUP = Arrays.asList( "", "MULTIPLE_EVENTS_WITH_REGISTRATION",
- "SINGLE_EVENT_WITH_REGISTRATION", "SINGLE_EVENT_WITHOUT_REGISTRATION" );
-
- 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 int version;
@@ -95,7 +87,7 @@
@Scanned
private Set<ValidationCriteria> validationCriteria = new HashSet<>();
- private Integer type;
+ private ProgramType programType;
private Boolean displayIncidentDate = true;
@@ -357,21 +349,22 @@
@JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
public String getKind()
{
- return TYPE_LOOKUP.get( type );
+ return programType.name();
}
-
+
@JsonProperty
+ @JsonView( { DetailedView.class, ExportView.class } )
@JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
- public Integer getType()
- {
- return type;
- }
-
- public void setType( Integer type )
- {
- this.type = type;
- }
-
+ public ProgramType getProgramType()
+ {
+ return programType;
+ }
+
+ public void setProgramType( ProgramType programType )
+ {
+ this.programType = programType;
+ }
+
@JsonProperty( "validationCriterias" )
@JsonSerialize( contentAs = BaseIdentifiableObject.class )
@JsonView( { DetailedView.class, ExportView.class } )
@@ -416,20 +409,20 @@
@JsonProperty
@JsonView( { DetailedView.class, ExportView.class } )
@JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
- public boolean isSingleEvent()
- {
- return type != null && (SINGLE_EVENT_WITH_REGISTRATION == type || SINGLE_EVENT_WITHOUT_REGISTRATION == type);
- }
-
- @JsonProperty
- @JsonView( { DetailedView.class, ExportView.class } )
- @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
public boolean isRegistration()
{
- return type != null && (SINGLE_EVENT_WITH_REGISTRATION == type || MULTIPLE_EVENTS_WITH_REGISTRATION == type);
+ return programType.equals( ProgramType.WITH_REGISTRATION );
}
@JsonProperty
+ @JsonView( { DetailedView.class, ExportView.class } )
+ @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
+ public boolean isWithoutRegistration()
+ {
+ return programType.equals( ProgramType.WITHOUT_REGISTRATION );
+ }
+
+ @JsonProperty
@JsonSerialize( contentAs = BaseIdentifiableObject.class )
@JsonView( { DetailedView.class, ExportView.class } )
@JacksonXmlElementWrapper( localName = "userRoles", namespace = DxfNamespaces.DXF_2_0 )
@@ -649,7 +642,7 @@
description = program.getDescription();
dateOfEnrollmentDescription = program.getDateOfEnrollmentDescription();
dateOfIncidentDescription = program.getDateOfIncidentDescription();
- type = program.getType();
+ programType = program.getProgramType();
displayIncidentDate = program.getDisplayIncidentDate();
ignoreOverdueEvents = program.getIgnoreOverdueEvents();
onlyEnrollOnce = program.getOnlyEnrollOnce();
@@ -667,7 +660,7 @@
description = program.getDescription() == null ? description : program.getDescription();
dateOfEnrollmentDescription = program.getDateOfEnrollmentDescription() == null ? dateOfEnrollmentDescription : program.getDateOfEnrollmentDescription();
dateOfIncidentDescription = program.getDateOfIncidentDescription() == null ? dateOfIncidentDescription : program.getDateOfIncidentDescription();
- type = program.getType() == null ? type : program.getType();
+ programType = program.getProgramType() == null ? programType : program.getProgramType();
displayIncidentDate = program.getDisplayIncidentDate() == null ? displayIncidentDate : program.getDisplayIncidentDate();
ignoreOverdueEvents = program.getIgnoreOverdueEvents() == null ? ignoreOverdueEvents : program.getIgnoreOverdueEvents();
onlyEnrollOnce = program.getOnlyEnrollOnce() == null ? onlyEnrollOnce : program.getOnlyEnrollOnce();
=== 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 2015-06-19 07:35:50 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramService.java 2015-07-02 07:05:55 +0000
@@ -143,7 +143,7 @@
* Single event without registration.
* @return Program list by a type specified
*/
- List<Program> getProgramsByCurrentUser( int type );
+ List<Program> getProgramsByCurrentUser( ProgramType type );
/**
* Get {@link Program} included in the expression of a
@@ -162,7 +162,7 @@
* Single event without registration
* @return Program list by a type specified
*/
- List<Program> getPrograms( int type );
+ List<Program> getPrograms( ProgramType type );
/**
* Get {@link Program} assigned to an {@link OrganisationUnit} by a type
@@ -173,7 +173,7 @@
* @param orgunit Where programs assigned
* @return Program list by a type specified
*/
- List<Program> getPrograms( int type, OrganisationUnit orgunit );
+ List<Program> getPrograms( ProgramType type, OrganisationUnit orgunit );
/**
* Returns the {@link Program} with the given UID.
@@ -245,7 +245,7 @@
* Single event without registration.
* @return Program list by a type specified
*/
- List<Program> getByCurrentUser( int type );
+ List<Program> getByCurrentUser( ProgramType type );
/**
* @param htmlCode
=== 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 2015-06-16 13:17:59 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStore.java 2015-07-02 07:05:55 +0000
@@ -51,7 +51,7 @@
* Single event without registration
* @return Program list by a type specified
*/
- List<Program> getByType( int type );
+ List<Program> getByType( ProgramType type );
/**
* Get {@link Program} assigned to an {@link OrganisationUnit} by a type
@@ -70,7 +70,7 @@
* @param orgunit Where programs assigned
* @return Program list by a type specified
*/
- List<Program> get( int type, OrganisationUnit orgunit );
+ List<Program> get( ProgramType type, OrganisationUnit orgunit );
/**
* Get {@link Program} by TrackedEntity
=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramType.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramType.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramType.java 2015-07-02 07:05:55 +0000
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2004-2014, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.hisp.dhis.program;
+
+/**
+ * @author Chau Thu Tran
+ *
+ * @version $ ProgramType.java Jul 1, 2015 3:09:12 PM $
+ */
+public enum ProgramType
+{
+ WITH_REGISTRATION("with_registration"),
+ WITHOUT_REGISTRATION("without_registration");
+
+ private final String value;
+
+ private ProgramType( String value )
+ {
+ this.value = value;
+ }
+
+ public static ProgramType fromValue( String value )
+ {
+ for ( ProgramType programType : ProgramType.values() )
+ {
+ if ( programType.value.equalsIgnoreCase( value ) )
+ {
+ return programType;
+ }
+ }
+
+ return null;
+ }
+
+ public String getValue()
+ {
+ return value;
+ }
+
+}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultProgramInstanceService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultProgramInstanceService.java 2015-06-23 15:59:19 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultProgramInstanceService.java 2015-07-02 07:05:55 +0000
@@ -276,8 +276,8 @@
// ---------------------------------------------------------------------
Collection<Program> programs = programService
- .getProgramsByCurrentUser( Program.MULTIPLE_EVENTS_WITH_REGISTRATION );
- programs.addAll( programService.getProgramsByCurrentUser( Program.SINGLE_EVENT_WITH_REGISTRATION ) );
+ .getProgramsByCurrentUser( ProgramType.WITH_REGISTRATION );
+ programs.addAll( programService.getProgramsByCurrentUser( ProgramType.WITH_REGISTRATION ) );
Collection<TrackedEntityAttributeValue> attributeValues = attributeValueService
.getTrackedEntityAttributeValues( instance );
@@ -514,7 +514,7 @@
// At some point, programs of type single event should be removed.
// ---------------------------------------------------------------------
- if ( program.isSingleEvent() && program.getProgramStages().size() == 1 )
+ if ( program.isRegistration() && program.getProgramStages().size() == 1 )
{
ProgramStage programStage = program.getProgramStages().iterator().next();
programStageInstanceService.createProgramStageInstance( programInstance, programStage, enrollmentDate,
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultProgramService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultProgramService.java 2015-06-23 15:59:19 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultProgramService.java 2015-07-02 07:05:55 +0000
@@ -177,13 +177,13 @@
}
@Override
- public List<Program> getPrograms( int type )
+ public List<Program> getPrograms( ProgramType type)
{
return i18n( i18nService, programStore.getByType( type ) );
}
@Override
- public List<Program> getPrograms( int type, OrganisationUnit orgunit )
+ public List<Program> getPrograms( ProgramType type, OrganisationUnit orgunit )
{
return i18n( i18nService, programStore.get( type, orgunit ) );
}
@@ -201,7 +201,7 @@
}
@Override
- public List<Program> getProgramsByCurrentUser( int type )
+ public List<Program> getProgramsByCurrentUser( ProgramType type)
{
return i18n( i18nService, getByCurrentUser( type ) );
}
@@ -283,7 +283,7 @@
}
@Override
- public List<Program> getByCurrentUser( int type )
+ public List<Program> getByCurrentUser( ProgramType type)
{
List<Program> programs = new ArrayList<>();
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultProgramStageInstanceService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultProgramStageInstanceService.java 2015-06-23 15:59:19 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultProgramStageInstanceService.java 2015-07-02 07:05:55 +0000
@@ -368,8 +368,7 @@
// ProgramInstance
// ---------------------------------------------------------------------
- if ( !programStageInstance.getProgramInstance().getProgram().getType()
- .equals( Program.SINGLE_EVENT_WITHOUT_REGISTRATION ) )
+ if ( programStageInstance.getProgramInstance().getProgram().isRegistration() )
{
boolean canCompleted = programInstanceService.canAutoCompleteProgramInstanceStatus( programStageInstance
.getProgramInstance() );
@@ -388,7 +387,7 @@
programStageInstance.setExecutionDate( executionDate );
programStageInstance.setOrganisationUnit( organisationUnit );
- if ( programStageInstance.getProgramInstance().getProgram().isSingleEvent() )
+ if ( programStageInstance.getProgramInstance().getProgram().isWithoutRegistration() )
{
programStageInstance.setDueDate( executionDate );
}
@@ -412,23 +411,10 @@
{
programStage = program.getProgramStages().iterator().next();
}
-
- int type = program.getType();
+
ProgramInstance programInstance = null;
-
- if ( type == Program.SINGLE_EVENT_WITH_REGISTRATION )
- {
- // Add a new program instance
- programInstance = new ProgramInstance();
- programInstance.setEnrollmentDate( executionDate );
- programInstance.setDateOfIncident( executionDate );
- programInstance.setProgram( program );
- programInstance.setStatus( ProgramInstance.STATUS_ACTIVE );
- programInstance.setEntityInstance( instance );
-
- programInstanceService.addProgramInstance( programInstance );
- }
- else if ( type == Program.SINGLE_EVENT_WITHOUT_REGISTRATION )
+
+ if ( program.isWithoutRegistration() )
{
Collection<ProgramInstance> programInstances = programInstanceService.getProgramInstances( program );
if ( programInstances == null || programInstances.size() == 0 )
@@ -487,7 +473,7 @@
programStageInstance.setDueDate( dueDate );
programStageInstance.setStatus( EventStatus.SCHEDULE );
- if ( programStage.getOpenAfterEnrollment() || programInstance.getProgram().isSingleEvent()
+ if ( programStage.getOpenAfterEnrollment() || programInstance.getProgram().isWithoutRegistration()
|| programStage.getPeriodType() != null )
{
programStageInstance.setExecutionDate( dueDate );
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultProgramValidationService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultProgramValidationService.java 2015-06-23 15:59:19 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultProgramValidationService.java 2015-07-02 07:05:55 +0000
@@ -123,7 +123,7 @@
Program program = programStageInstance.getProgramInstance().getProgram();
Collection<TrackedEntityDataValue> entityInstanceDataValues = null;
- if ( program.isSingleEvent() )
+ if ( program.isWithoutRegistration() )
{
entityInstanceDataValues = dataValueService.getTrackedEntityDataValues( programStageInstance );
}
=== added file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/ProgramTypeUserType.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/ProgramTypeUserType.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/ProgramTypeUserType.java 2015-07-02 07:05:55 +0000
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2004-2014, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.hisp.dhis.program;
+
+import org.hisp.dhis.hibernate.EnumUserType;
+import org.hisp.dhis.program.ProgramType;
+
+/**
+ * @author Chau Thu Tran
+ *
+ * @version $ ProgramTypeUserType.java Jul 1, 2015 3:32:02 PM $
+ */
+public class ProgramTypeUserType
+ extends EnumUserType<ProgramType>
+{
+ public ProgramTypeUserType()
+ {
+ super( ProgramType.class );
+ }
+}
\ No newline at end of file
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStore.java 2015-06-23 15:59:19 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStore.java 2015-07-02 07:05:55 +0000
@@ -36,6 +36,7 @@
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.program.Program;
import org.hisp.dhis.program.ProgramStore;
+import org.hisp.dhis.program.ProgramType;
import org.hisp.dhis.trackedentity.TrackedEntity;
/**
@@ -51,9 +52,9 @@
@SuppressWarnings( "unchecked" )
@Override
- public List<Program> getByType( int type )
+ public List<Program> getByType( ProgramType type )
{
- return getCriteria( Restrictions.eq( "type", type ) ).list();
+ return getCriteria( Restrictions.eq( "programType", type ) ).list();
}
@SuppressWarnings( "unchecked" )
@@ -68,11 +69,11 @@
@SuppressWarnings( "unchecked" )
@Override
- public List<Program> get( int type, OrganisationUnit organisationUnit )
+ public List<Program> get( ProgramType type, OrganisationUnit organisationUnit )
{
Criteria criteria1 = getCriteria();
criteria1.createAlias( "organisationUnits", "orgunit" );
- criteria1.add( Restrictions.eq( "type", type ) );
+ criteria1.add( Restrictions.eq( "programType", type ) );
criteria1.add( Restrictions.eq( "orgunit.id", organisationUnit.getId() ) );
return criteria1.list();
}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/InitTableAlteror.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/InitTableAlteror.java 2015-06-19 09:57:16 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/InitTableAlteror.java 2015-07-02 07:05:55 +0000
@@ -71,6 +71,10 @@
executeSql( "ALTER TABLE program DROP COLUMN displayonallorgunit" );
upgradeProgramStageDataElements();
+
+ executeSql( "ALTER TABLE program ALTER COLUMN \"type\" TYPE varchar(255);");
+ executeSql( "update program set \"type\"='WITH_REGISTRATION' where type='1' or type='2'");
+ executeSql( "update program set \"type\"='WITHOUT_REGISTRATION' where type='3'");
}
// -------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/program/hibernate/Program.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/program/hibernate/Program.hbm.xml 2015-06-23 15:59:19 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/program/hibernate/Program.hbm.xml 2015-07-02 07:05:55 +0000
@@ -42,7 +42,7 @@
class="org.hisp.dhis.validation.ValidationCriteria" foreign-key="fk_program_criteria_validationcriteriaid" />
</set>
- <property name="type" />
+ <property name="programType" column="type" type="org.hisp.dhis.program.ProgramTypeUserType" not-null="true" />
<property name="displayIncidentDate" />
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/program/ProgramServiceTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/program/ProgramServiceTest.java 2015-06-23 15:59:19 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/program/ProgramServiceTest.java 2015-07-02 07:05:55 +0000
@@ -200,13 +200,13 @@
programService.addProgram( programA );
programService.addProgram( programB );
- programC.setType( Program.SINGLE_EVENT_WITH_REGISTRATION );
+ programC.setProgramType( ProgramType.WITHOUT_REGISTRATION );
programService.addProgram( programC );
- List<Program> programs = programService.getPrograms( Program.MULTIPLE_EVENTS_WITH_REGISTRATION );
+ List<Program> programs = programService.getPrograms( ProgramType.WITH_REGISTRATION );
assertTrue( equals( programs, programA, programB ) );
- programs = programService.getPrograms( Program.SINGLE_EVENT_WITH_REGISTRATION );
+ programs = programService.getPrograms( ProgramType.WITHOUT_REGISTRATION );
assertTrue( equals( programs, programC ) );
}
@@ -215,9 +215,11 @@
{
programService.addProgram( programA );
programService.addProgram( programB );
+
+ programC.setProgramType( ProgramType.WITHOUT_REGISTRATION );
programService.addProgram( programC );
- List<Program> programs = programService.getPrograms( Program.MULTIPLE_EVENTS_WITH_REGISTRATION,
+ List<Program> programs = programService.getPrograms( ProgramType.WITH_REGISTRATION,
organisationUnitA );
assertTrue( equals( programs, programA, programB ) );
}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/program/ProgramStageInstanceServiceTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/program/ProgramStageInstanceServiceTest.java 2015-06-23 15:59:19 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/program/ProgramStageInstanceServiceTest.java 2015-07-02 07:05:55 +0000
@@ -460,7 +460,7 @@
@Test
public void testCreateProgramStageInstance()
{
- programA.setType( Program.SINGLE_EVENT_WITHOUT_REGISTRATION );
+ programA.setProgramType( ProgramType.WITHOUT_REGISTRATION );
programService.updateProgram( programA );
ProgramStageInstance programStageInstance = programStageInstanceService.createProgramStageInstance( entityInstanceA,
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/program/ProgramStoreTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/program/ProgramStoreTest.java 2015-06-23 15:59:19 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/program/ProgramStoreTest.java 2015-07-02 07:05:55 +0000
@@ -90,13 +90,13 @@
programStore.save( programA );
programStore.save( programB );
- programC.setType( Program.SINGLE_EVENT_WITH_REGISTRATION );
+ programC.setProgramType( ProgramType.WITHOUT_REGISTRATION );
programStore.save( programC );
- List<Program> programs = programStore.getByType( Program.MULTIPLE_EVENTS_WITH_REGISTRATION );
+ List<Program> programs = programStore.getByType( ProgramType.WITH_REGISTRATION );
assertTrue( equals( programs, programA, programB ) );
- programs = programStore.getByType( Program.SINGLE_EVENT_WITH_REGISTRATION );
+ programs = programStore.getByType( ProgramType.WITHOUT_REGISTRATION );
assertTrue( equals( programs, programC ) );
}
@@ -107,7 +107,8 @@
programStore.save( programB );
programStore.save( programC );
- List<Program> programs = programStore.get( Program.MULTIPLE_EVENTS_WITH_REGISTRATION, organisationUnitA );
+ List<Program> programs = programStore.get( ProgramType.WITH_REGISTRATION, organisationUnitA );
+
assertTrue( equals( programs, programA, programB ) );
}
}
\ No newline at end of file
=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/enrollment/AbstractEnrollmentService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/enrollment/AbstractEnrollmentService.java 2015-06-15 13:44:20 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/enrollment/AbstractEnrollmentService.java 2015-07-02 07:05:55 +0000
@@ -30,6 +30,7 @@
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
+
import org.hisp.dhis.common.Grid;
import org.hisp.dhis.common.IdentifiableObjectManager;
import org.hisp.dhis.common.IdentifiableObjectUtils;
@@ -52,6 +53,7 @@
import org.hisp.dhis.program.ProgramInstanceService;
import org.hisp.dhis.program.ProgramService;
import org.hisp.dhis.program.ProgramTrackedEntityAttribute;
+import org.hisp.dhis.program.ProgramType;
import org.hisp.dhis.system.callable.IdentifiableObjectSearchCallable;
import org.hisp.dhis.system.util.DateUtils;
import org.hisp.dhis.system.util.MathUtils;
@@ -731,9 +733,7 @@
private List<Program> getProgramsWithRegistration()
{
- List<Program> programs = new ArrayList<>();
- programs.addAll( programService.getPrograms( Program.SINGLE_EVENT_WITH_REGISTRATION ) );
- programs.addAll( programService.getPrograms( Program.MULTIPLE_EVENTS_WITH_REGISTRATION ) );
+ List<Program> programs = programService.getPrograms( ProgramType.WITH_REGISTRATION );
return programs;
}
=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/AbstractEventService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/AbstractEventService.java 2015-06-15 13:44:20 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/AbstractEventService.java 2015-07-02 07:05:55 +0000
@@ -253,7 +253,7 @@
return new ImportSummary( ImportStatus.ERROR, "Event.program does not point to a valid program" );
}
- if ( programStage == null && !program.isSingleEvent() )
+ if ( programStage == null && program.isRegistration() )
{
return new ImportSummary( ImportStatus.ERROR,
"Event.programStage does not point to a valid programStage, and program is multi stage" );
@@ -305,7 +305,7 @@
programInstance = programInstances.get( 0 );
- if ( program.isSingleEvent() )
+ if ( program.isWithoutRegistration() )
{
List<ProgramStageInstance> programStageInstances = new ArrayList<>(
programStageInstanceService.getProgramStageInstances( programInstances, EventStatus.ACTIVE ) );
=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/JdbcEventStore.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/JdbcEventStore.java 2015-06-15 13:44:20 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/JdbcEventStore.java 2015-07-02 07:05:55 +0000
@@ -28,32 +28,33 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import com.fasterxml.jackson.core.type.TypeReference;
-import com.fasterxml.jackson.databind.ObjectMapper;
+import static org.hisp.dhis.common.IdentifiableObjectUtils.getIdList;
+import static org.hisp.dhis.commons.util.TextUtils.getCommaDelimitedString;
+import static org.hisp.dhis.system.util.DateUtils.getMediumDateString;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.hisp.dhis.commons.util.SqlHelper;
import org.hisp.dhis.dxf2.common.IdSchemes;
import org.hisp.dhis.dxf2.events.report.EventRow;
import org.hisp.dhis.dxf2.events.trackedentity.Attribute;
import org.hisp.dhis.event.EventStatus;
import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.program.Program;
+import org.hisp.dhis.program.ProgramType;
import org.hisp.dhis.system.util.DateUtils;
import org.hisp.dhis.util.ObjectUtils;
-import org.hisp.dhis.commons.util.SqlHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.support.rowset.SqlRowSet;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import static org.hisp.dhis.common.IdentifiableObjectUtils.getIdList;
-import static org.hisp.dhis.system.util.DateUtils.getMediumDateString;
-import static org.hisp.dhis.commons.util.TextUtils.getCommaDelimitedString;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.ObjectMapper;
/**
* @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
@@ -105,8 +106,9 @@
event.setProgram( IdSchemes.getValue( rowSet.getString( "p_uid" ), rowSet.getString( "p_code" ), idSchemes.getProgramIdScheme() ) );
event.setProgramStage( IdSchemes.getValue( rowSet.getString( "ps_uid" ), rowSet.getString( "ps_code" ), idSchemes.getProgramStageIdScheme() ) );
event.setOrgUnit( IdSchemes.getValue( rowSet.getString( "ou_uid" ), rowSet.getString( "ou_code" ), idSchemes.getOrgUnitIdScheme() ) );
-
- if ( rowSet.getInt( "p_type" ) != Program.SINGLE_EVENT_WITHOUT_REGISTRATION )
+ ProgramType programTye = ProgramType.fromValue(rowSet.getString( "p_type" ) );
+
+ if ( programTye != ProgramType.WITHOUT_REGISTRATION )
{
event.setEnrollment( rowSet.getString( "pi_uid" ) );
event.setEnrollmentStatus( EventStatus.fromInt( rowSet.getInt( "pi_status" ) ) );
@@ -222,7 +224,8 @@
eventRow.setOrgUnit( IdSchemes.getValue( rowSet.getString( "ou_uid" ), rowSet.getString( "ou_code" ),
idSchemes.getOrgUnitIdScheme() ) );
- if ( rowSet.getInt( "p_type" ) != Program.SINGLE_EVENT_WITHOUT_REGISTRATION )
+ ProgramType programType = ProgramType.fromValue( rowSet.getString( "p_type" ) );
+ if ( programType == ProgramType.WITHOUT_REGISTRATION )
{
eventRow.setEnrollment( rowSet.getString( "pi_uid" ) );
eventRow.setFollowup( rowSet.getBoolean( "pi_followup" ) );
=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/events/EnrollmentServiceTest.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/events/EnrollmentServiceTest.java 2015-05-18 17:05:23 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/events/EnrollmentServiceTest.java 2015-07-02 07:05:55 +0000
@@ -50,6 +50,7 @@
import org.hisp.dhis.program.ProgramInstance;
import org.hisp.dhis.program.ProgramInstanceService;
import org.hisp.dhis.program.ProgramStage;
+import org.hisp.dhis.program.ProgramType;
import org.hisp.dhis.trackedentity.TrackedEntity;
import org.hisp.dhis.trackedentity.TrackedEntityService;
import org.joda.time.DateTime;
@@ -123,7 +124,7 @@
manager.save( programStage );
programA = createProgram( 'A', new HashSet<ProgramStage>(), organisationUnitA );
- programA.setType( Program.SINGLE_EVENT_WITH_REGISTRATION );
+ programA.setProgramType( ProgramType.WITH_REGISTRATION );
manager.save( programA );
programA.getProgramStages().add( programStage );
=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/events/NoRegistrationSingleEventServiceTest.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/events/NoRegistrationSingleEventServiceTest.java 2015-04-15 20:26:30 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/events/NoRegistrationSingleEventServiceTest.java 2015-07-02 07:05:55 +0000
@@ -45,6 +45,7 @@
import org.hisp.dhis.program.ProgramStageDataElementService;
import org.hisp.dhis.program.ProgramStageInstance;
import org.hisp.dhis.program.ProgramStageInstanceService;
+import org.hisp.dhis.program.ProgramType;
import org.hisp.dhis.user.UserService;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
@@ -100,7 +101,7 @@
identifiableObjectManager.save( programStageA );
programA = createProgram( 'A', new HashSet<ProgramStage>(), organisationUnitA );
- programA.setType( Program.SINGLE_EVENT_WITHOUT_REGISTRATION );
+ programA.setProgramType( ProgramType.WITHOUT_REGISTRATION );
identifiableObjectManager.save( programA );
ProgramStageDataElement programStageDataElement = new ProgramStageDataElement();
=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/events/RegistrationMultiEventsServiceTest.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/events/RegistrationMultiEventsServiceTest.java 2015-05-18 17:05:23 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/events/RegistrationMultiEventsServiceTest.java 2015-07-02 07:05:55 +0000
@@ -55,6 +55,7 @@
import org.hisp.dhis.program.ProgramStage;
import org.hisp.dhis.program.ProgramStageDataElement;
import org.hisp.dhis.program.ProgramStageDataElementService;
+import org.hisp.dhis.program.ProgramType;
import org.hisp.dhis.trackedentity.TrackedEntity;
import org.hisp.dhis.trackedentity.TrackedEntityService;
import org.hisp.dhis.user.UserService;
@@ -162,7 +163,7 @@
identifiableObjectManager.save( programStageB );
programA = createProgram( 'A', new HashSet<ProgramStage>(), organisationUnitA );
- programA.setType( Program.MULTIPLE_EVENTS_WITH_REGISTRATION );
+ programA.setProgramType( ProgramType.WITH_REGISTRATION );
identifiableObjectManager.save( programA );
ProgramStageDataElement programStageDataElement = new ProgramStageDataElement();
=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/events/RegistrationSingleEventServiceTest.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/events/RegistrationSingleEventServiceTest.java 2015-05-18 17:05:23 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/events/RegistrationSingleEventServiceTest.java 2015-07-02 07:05:55 +0000
@@ -56,6 +56,7 @@
import org.hisp.dhis.program.ProgramStage;
import org.hisp.dhis.program.ProgramStageDataElement;
import org.hisp.dhis.program.ProgramStageDataElementService;
+import org.hisp.dhis.program.ProgramType;
import org.hisp.dhis.trackedentity.TrackedEntity;
import org.hisp.dhis.trackedentity.TrackedEntityService;
import org.hisp.dhis.user.UserService;
@@ -139,8 +140,8 @@
programStageA = createProgramStage( 'A', 0 );
identifiableObjectManager.save( programStageA );
- programA = createProgram( 'A', new HashSet<ProgramStage>(), organisationUnitA );
- programA.setType( Program.SINGLE_EVENT_WITH_REGISTRATION );
+ programA = createProgram( 'A', new HashSet<ProgramStage>(), organisationUnitA );
+ programA.setProgramType( ProgramType.WITH_REGISTRATION );
identifiableObjectManager.save( programA );
ProgramStageDataElement programStageDataElement = new ProgramStageDataElement();
@@ -161,7 +162,7 @@
@Test
public void testSaveWithoutEnrollmentShouldFail()
{
- Event event = createEvent( programA.getUid(), organisationUnitA.getUid(), trackedEntityInstanceMaleA.getTrackedEntityInstance() );
+ Event event = createEvent( programA.getUid(), programStageA.getUid(), organisationUnitA.getUid(), trackedEntityInstanceMaleA.getTrackedEntityInstance() );
ImportSummary importSummary = eventService.addEvent( event );
assertEquals( ImportStatus.ERROR, importSummary.getStatus() );
assertThat( importSummary.getDescription(), CoreMatchers.containsString( "is not enrolled in program" ) );
@@ -174,7 +175,7 @@
ImportSummary importSummary = enrollmentService.addEnrollment( enrollment );
assertEquals( ImportStatus.SUCCESS, importSummary.getStatus() );
- Event event = createEvent( programA.getUid(), organisationUnitA.getUid(), trackedEntityInstanceMaleA.getTrackedEntityInstance() );
+ Event event = createEvent( programA.getUid(), programStageA.getUid(), organisationUnitA.getUid(), trackedEntityInstanceMaleA.getTrackedEntityInstance() );
importSummary = eventService.addEvent( event );
assertEquals( ImportStatus.SUCCESS, importSummary.getStatus() );
}
@@ -186,7 +187,7 @@
ImportSummary importSummary = enrollmentService.addEnrollment( enrollment );
assertEquals( ImportStatus.SUCCESS, importSummary.getStatus() );
- Event event = createEvent( programA.getUid(), organisationUnitA.getUid(), trackedEntityInstanceMaleA.getTrackedEntityInstance() );
+ Event event = createEvent( programA.getUid(), programStageA.getUid(), organisationUnitA.getUid(), trackedEntityInstanceMaleA.getTrackedEntityInstance() );
importSummary = eventService.addEvent( event );
assertEquals( ImportStatus.SUCCESS, importSummary.getStatus() );
@@ -197,13 +198,13 @@
assertEquals( 1, eventService.getEvents( params ).getEvents().size() );
- event = createEvent( programA.getUid(), organisationUnitA.getUid(), trackedEntityInstanceMaleA.getTrackedEntityInstance() );
+ event = createEvent( programA.getUid(), programStageA.getUid(), organisationUnitA.getUid(), trackedEntityInstanceMaleA.getTrackedEntityInstance() );
importSummary = eventService.addEvent( event );
assertEquals( ImportStatus.SUCCESS, importSummary.getStatus() );
assertEquals( 1, eventService.getEvents( params ).getEvents().size() );
- event = createEvent( programA.getUid(), organisationUnitA.getUid(), trackedEntityInstanceMaleA.getTrackedEntityInstance() );
+ event = createEvent( programA.getUid(), programStageA.getUid(), organisationUnitA.getUid(), trackedEntityInstanceMaleA.getTrackedEntityInstance() );
importSummary = eventService.addEvent( event );
assertEquals( ImportStatus.SUCCESS, importSummary.getStatus() );
@@ -216,7 +217,7 @@
Enrollment enrollment = createEnrollment( programA.getUid(), trackedEntityInstanceMaleA.getTrackedEntityInstance() );
enrollmentService.addEnrollment( enrollment );
- Event event = createEvent( programA.getUid(), organisationUnitA.getUid(), trackedEntityInstanceMaleA.getTrackedEntityInstance() );
+ Event event = createEvent( programA.getUid(), programStageA.getUid(), organisationUnitA.getUid(), trackedEntityInstanceMaleA.getTrackedEntityInstance() );
event.setStatus( EventStatus.COMPLETED );
ImportSummary importSummary1 = eventService.addEvent( event );
assertEquals( ImportStatus.SUCCESS, importSummary1.getStatus() );
@@ -226,7 +227,7 @@
enrollment = createEnrollment( programA.getUid(), trackedEntityInstanceMaleA.getTrackedEntityInstance() );
enrollmentService.addEnrollment( enrollment );
- event = createEvent( programA.getUid(), organisationUnitA.getUid(), trackedEntityInstanceMaleA.getTrackedEntityInstance() );
+ event = createEvent( programA.getUid(), programStageA.getUid(), organisationUnitA.getUid(), trackedEntityInstanceMaleA.getTrackedEntityInstance() );
event.setStatus( EventStatus.COMPLETED );
ImportSummary importSummary2 = eventService.addEvent( event );
assertEquals( ImportStatus.SUCCESS, importSummary2.getStatus() );
@@ -248,10 +249,11 @@
return enrollment;
}
- private Event createEvent( String program, String orgUnit, String person )
+ private Event createEvent( String program, String programStage, String orgUnit, String person )
{
Event event = new Event();
event.setProgram( program );
+ event.setProgramStage( programStage );
event.setOrgUnit( orgUnit );
event.setTrackedEntityInstance( person );
event.setEventDate( "2013-01-01" );
=== modified file 'dhis-2/dhis-services/dhis-service-eventreporting/src/main/java/org/hisp/dhis/caseaggregation/hibernate/HibernateCaseAggregationConditionStore.java'
--- dhis-2/dhis-services/dhis-service-eventreporting/src/main/java/org/hisp/dhis/caseaggregation/hibernate/HibernateCaseAggregationConditionStore.java 2015-06-15 13:44:20 +0000
+++ dhis-2/dhis-services/dhis-service-eventreporting/src/main/java/org/hisp/dhis/caseaggregation/hibernate/HibernateCaseAggregationConditionStore.java 2015-07-02 07:05:55 +0000
@@ -451,7 +451,7 @@
sql += "GROUP BY ou.organisationunitid ) from organisationunit ou where ou.organisationunitid in ( " + TextUtils.getCommaDelimitedString( orgunitIds ) + " ) ";
}
-System.out.println("\n\n " + sql + "\n\n");
+
return sql;
}
=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/LWUITmodel/Program.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/LWUITmodel/Program.java 2015-01-28 10:50:56 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/LWUITmodel/Program.java 2015-07-02 07:05:55 +0000
@@ -52,7 +52,7 @@
// single event with registration: 2
// single event without registration: 3
- private Integer type;
+ private String type;
private String dateOfEnrollmentDescription = "Date of Enrollment";
@@ -102,12 +102,12 @@
this.clientVersion = clientVersion;
}
- public Integer getType()
+ public String getType()
{
return type;
}
- public void setType( Integer type )
+ public void setType( String type )
{
this.type = type;
}
@@ -188,7 +188,7 @@
{
super.serialize( dout );
dout.writeInt( getVersion() );
- dout.writeInt( this.getType() );
+ dout.writeUTF( this.getType() );
dout.writeUTF( getDateOfEnrollmentDescription() );
dout.writeUTF( getDateOfIncidentDescription() );
dout.writeUTF( getTrackedEntityName() );
@@ -227,7 +227,7 @@
{
super.deSerialize( dataInputStream );
this.setVersion( dataInputStream.readInt() );
- this.setType( dataInputStream.readInt() );
+ this.setType( dataInputStream.readUTF() );
this.setDateOfEnrollmentDescription( dataInputStream.readUTF() );
this.setDateOfIncidentDescription( dataInputStream.readUTF() );
this.setTrackedEntityName( dataInputStream.readUTF() );
=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java 2015-06-16 17:43:23 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java 2015-07-02 07:05:55 +0000
@@ -91,6 +91,7 @@
import org.hisp.dhis.program.ProgramStageSection;
import org.hisp.dhis.program.ProgramStageSectionService;
import org.hisp.dhis.program.ProgramStageService;
+import org.hisp.dhis.program.ProgramType;
import org.hisp.dhis.program.comparator.ProgramStageInstanceVisitDateComparator;
import org.hisp.dhis.relationship.Relationship;
import org.hisp.dhis.relationship.RelationshipService;
@@ -684,7 +685,7 @@
programStageInstance.setDueDate( dueDate );
- if ( program.isSingleEvent() )
+ if ( program.isWithoutRegistration() )
{
programStageInstance.setExecutionDate( dueDate );
}
@@ -995,7 +996,7 @@
mobileProgramStage.setCompleted( eachProgramStageInstance.isCompleted() );
// is single event
- mobileProgramStage.setSingleEvent( programInstance.getProgram().isSingleEvent() );
+ mobileProgramStage.setSingleEvent( programInstance.getProgram().isWithoutRegistration() );
// Set all data elements
mobileProgramStage.setDataElements( getDataElementsForMobile( programStage, eachProgramStageInstance ) );
@@ -1165,26 +1166,25 @@
}
@Override
- public org.hisp.dhis.api.mobile.model.LWUITmodel.Program getAllProgramByOrgUnit( int orgUnitId, String programType )
+ public org.hisp.dhis.api.mobile.model.LWUITmodel.Program getAllProgramByOrgUnit( int orgUnitId, String type )
throws NotAllowedException
{
String programsInfo = "";
- int programTypeInt = Integer.valueOf( programType );
-
OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( orgUnitId );
List<Program> tempPrograms = null;
-
- if ( programTypeInt == Program.SINGLE_EVENT_WITHOUT_REGISTRATION )
+ ProgramType programType = ProgramType.fromValue( type );
+
+ if ( programType == ProgramType.WITHOUT_REGISTRATION )
{
tempPrograms = new ArrayList<>(
- programService.getProgramsByCurrentUser( Program.SINGLE_EVENT_WITHOUT_REGISTRATION ) );
+ programService.getProgramsByCurrentUser( ProgramType.WITHOUT_REGISTRATION ) );
}
- else if ( programTypeInt == Program.MULTIPLE_EVENTS_WITH_REGISTRATION )
+ else if ( programType == ProgramType.WITH_REGISTRATION )
{
tempPrograms = new ArrayList<>(
- programService.getProgramsByCurrentUser( Program.MULTIPLE_EVENTS_WITH_REGISTRATION ) );
+ programService.getProgramsByCurrentUser( ProgramType.WITH_REGISTRATION ) );
}
List<Program> programs = new ArrayList<>();
@@ -1235,7 +1235,7 @@
else
{
Program program = programService.getProgram( Integer.parseInt( programInfo ) );
- if ( program.isSingleEvent() )
+ if ( program.isWithoutRegistration() )
{
return getMobileProgramWithoutData( program );
}
=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/DefaultProgramService.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/DefaultProgramService.java 2015-01-28 10:50:56 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/DefaultProgramService.java 2015-07-02 07:05:55 +0000
@@ -197,7 +197,7 @@
pr.setId( program.getId() );
pr.setName( program.getName() );
- pr.setType( program.getType() );
+ pr.setType( program.getProgramType().getValue() );
pr.setVersion( program.getVersion() );
pr.setDateOfEnrollmentDescription( program.getDateOfEnrollmentDescription() );
pr.setDateOfIncidentDescription( program.getDateOfIncidentDescription() );
@@ -239,7 +239,7 @@
prStg.setCompleted( false );
- prStg.setSingleEvent( program.isSingleEvent() );
+ prStg.setSingleEvent( program.isWithoutRegistration() );
List<org.hisp.dhis.api.mobile.model.LWUITmodel.ProgramStageDataElement> des = new ArrayList<>();
=== modified file 'dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisConvenienceTest.java'
--- dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisConvenienceTest.java 2015-06-10 11:55:41 +0000
+++ dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisConvenienceTest.java 2015-07-02 07:05:55 +0000
@@ -89,6 +89,7 @@
import org.hisp.dhis.program.ProgramStageDataElement;
import org.hisp.dhis.program.ProgramStageInstance;
import org.hisp.dhis.program.ProgramTrackedEntityAttribute;
+import org.hisp.dhis.program.ProgramType;
import org.hisp.dhis.programrule.ProgramRule;
import org.hisp.dhis.programrule.ProgramRuleAction;
import org.hisp.dhis.programrule.ProgramRuleActionType;
@@ -1148,7 +1149,7 @@
program.setDateOfEnrollmentDescription( "DateOfEnrollmentDescription" );
program.setDateOfIncidentDescription( "DateOfIncidentDescription" );
program.setProgramStages( programStages );
- program.setType( Program.MULTIPLE_EVENTS_WITH_REGISTRATION );
+ program.setProgramType( ProgramType.WITH_REGISTRATION );
if ( programStages != null )
{
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/ProgramController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/ProgramController.java 2015-02-20 09:14:02 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/ProgramController.java 2015-07-02 07:05:55 +0000
@@ -43,6 +43,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
+import org.hisp.dhis.program.ProgramType;
import java.util.ArrayList;
import java.util.Date;
@@ -66,7 +67,7 @@
@Override
protected void postCreateEntity( Program program )
{
- if ( program.isSingleEvent() && !program.isRegistration() )
+ if ( program.isWithoutRegistration() )
{
ProgramInstance programInstance = new ProgramInstance();
programInstance.setEnrollmentDate( new Date() );
@@ -120,7 +121,7 @@
{
try
{
- int programType = Integer.parseInt( type );
+ ProgramType programType = ProgramType.fromValue( type );
Iterator<Program> iterator = entityList.iterator();
@@ -128,7 +129,7 @@
{
Program program = iterator.next();
- if ( program.getType() != programType )
+ if ( program.getProgramType() != programType )
{
iterator.remove();
}
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/user/CurrentUserController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/user/CurrentUserController.java 2015-06-15 13:44:20 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/user/CurrentUserController.java 2015-07-02 07:05:55 +0000
@@ -84,6 +84,8 @@
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
+import org.hisp.dhis.program.ProgramType;
+
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -499,7 +501,7 @@
@RequestMapping( value = { "/assignedPrograms", "/programs" }, produces = { "application/json", "text/*" } )
public void getPrograms( HttpServletResponse response, @RequestParam Map<String, String> parameters,
- @RequestParam( required = false ) Integer type )
+ @RequestParam( required = false ) String type )
throws IOException, NotAuthenticatedException
{
User currentUser = currentUserService.getCurrentUser();
@@ -521,7 +523,7 @@
}
else
{
- userPrograms = new ArrayList<>( programService.getProgramsByCurrentUser( type ) );
+ userPrograms = new ArrayList<>( programService.getProgramsByCurrentUser( ProgramType.fromValue( type ) ) );
}
if ( currentUserService.currentUserIsSuper() && currentUser.getOrganisationUnits().isEmpty() )
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/utils/FormUtils.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/utils/FormUtils.java 2015-06-10 20:22:17 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/utils/FormUtils.java 2015-07-02 07:05:55 +0000
@@ -48,6 +48,7 @@
import org.hisp.dhis.program.ProgramStage;
import org.hisp.dhis.program.ProgramStageDataElement;
import org.hisp.dhis.program.ProgramStageSection;
+import org.hisp.dhis.program.ProgramType;
import org.hisp.dhis.webapi.webdomain.form.Field;
import org.hisp.dhis.webapi.webdomain.form.Form;
import org.hisp.dhis.webapi.webdomain.form.Group;
@@ -61,10 +62,15 @@
public class FormUtils
{
private static final String KEY_PERIOD_TYPE = "periodType";
+
private static final String KEY_OPEN_FUTURE_PERIODS = "openFuturePeriods";
+
private static final String KEY_DATA_ELEMENTS = "dataElements";
+
private static final String KEY_INDICATORS = "indicators";
+
private static final String KEY_EXPIRY_DAYS = "expiryDays";
+
private static final String SEP = "-";
public static Form fromDataSet( DataSet dataSet, boolean metaData )
@@ -81,23 +87,26 @@
{
List<Section> sections = new ArrayList<>( dataSet.getSections() );
Collections.sort( sections, SectionOrderComparator.INSTANCE );
-
+
for ( Section section : sections )
{
- List<Field> fields = inputFromDataElements( new ArrayList<>( section.getDataElements() ), new ArrayList<>( section.getGreyedFields() ) );
+ List<Field> fields = inputFromDataElements( new ArrayList<>( section.getDataElements() ),
+ new ArrayList<>( section.getGreyedFields() ) );
Group group = new Group();
group.setLabel( section.getDisplayName() );
group.setDescription( section.getDescription() );
group.setDataElementCount( section.getDataElements().size() );
group.setFields( fields );
-
+
if ( metaData )
{
- group.getMetaData().put( KEY_DATA_ELEMENTS, NameableObjectUtils.getAsNameableObjects( section.getDataElements() ) );
- group.getMetaData().put( KEY_INDICATORS, NameableObjectUtils.getAsNameableObjects( section.getIndicators() ) );
+ group.getMetaData().put( KEY_DATA_ELEMENTS,
+ NameableObjectUtils.getAsNameableObjects( section.getDataElements() ) );
+ group.getMetaData().put( KEY_INDICATORS,
+ NameableObjectUtils.getAsNameableObjects( section.getIndicators() ) );
}
-
+
form.getGroups().add( group );
}
}
@@ -113,9 +122,10 @@
if ( metaData )
{
- group.getMetaData().put( KEY_DATA_ELEMENTS, NameableObjectUtils.getAsNameableObjects( new ArrayList<>( dataSet.getDataElements() ) ) );
+ group.getMetaData().put( KEY_DATA_ELEMENTS,
+ NameableObjectUtils.getAsNameableObjects( new ArrayList<>( dataSet.getDataElements() ) ) );
}
-
+
form.getGroups().add( group );
}
@@ -144,14 +154,13 @@
form.getOptions().put( "dateOfIncidentDescription", program.getDateOfIncidentDescription() );
}
- form.getOptions().put( "type", Program.TYPE_LOOKUP.get( program.getType() ) );
+ form.getOptions().put( "type", program.getProgramType().getValue() );
ProgramStage programStage = program.getProgramStageByStage( 1 );
if ( programStage == null )
{
- if ( (Program.SINGLE_EVENT_WITHOUT_REGISTRATION == program.getType()
- || Program.SINGLE_EVENT_WITH_REGISTRATION == program.getType()) )
+ if ( program.isWithoutRegistration() )
{
throw new NullPointerException();
}
@@ -178,8 +187,8 @@
}
else
{
- List<Field> fields = inputFromProgramStageDataElements(
- new ArrayList<>( programStage.getProgramStageDataElements() ) );
+ List<Field> fields = inputFromProgramStageDataElements( new ArrayList<>(
+ programStage.getProgramStageDataElements() ) );
Group group = new Group();
group.setLabel( "default" );
@@ -208,13 +217,15 @@
return inputFromDataElements( dataElements, new ArrayList<DataElementOperand>() );
}
- private static List<Field> inputFromDataElements( List<DataElement> dataElements, final List<DataElementOperand> greyedFields )
+ private static List<Field> inputFromDataElements( List<DataElement> dataElements,
+ final List<DataElementOperand> greyedFields )
{
List<Field> fields = new ArrayList<>();
for ( DataElement dataElement : dataElements )
{
- for ( DataElementCategoryOptionCombo categoryOptionCombo : dataElement.getCategoryCombo().getSortedOptionCombos() )
+ for ( DataElementCategoryOptionCombo categoryOptionCombo : dataElement.getCategoryCombo()
+ .getSortedOptionCombos() )
{
if ( !isDisabled( dataElement, categoryOptionCombo, greyedFields ) )
{
@@ -246,7 +257,8 @@
return fields;
}
- private static boolean isDisabled( DataElement dataElement, DataElementCategoryOptionCombo dataElementCategoryOptionCombo, List<DataElementOperand> greyedFields )
+ private static boolean isDisabled( DataElement dataElement,
+ DataElementCategoryOptionCombo dataElementCategoryOptionCombo, List<DataElementOperand> greyedFields )
{
for ( DataElementOperand operand : greyedFields )
{
@@ -262,8 +274,8 @@
private static InputType inputTypeFromDataElement( DataElement dataElement )
{
- //TODO harmonize / use map
-
+ // TODO harmonize / use map
+
if ( DataElement.VALUE_TYPE_STRING.equals( dataElement.getType() ) )
{
if ( DataElement.VALUE_TYPE_TEXT.equals( dataElement.getTextType() ) )
@@ -332,7 +344,7 @@
DataElementCategoryOptionCombo categoryOptionCombo = dataValue.getCategoryOptionCombo();
Field field = operandFieldMap.get( dataElement.getUid() + SEP + categoryOptionCombo.getUid() );
-
+
field.setValue( dataValue.getValue() );
field.setComment( dataValue.getComment() );
}
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/GetProgramMetaDataAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/GetProgramMetaDataAction.java 2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/GetProgramMetaDataAction.java 2015-07-02 07:05:55 +0000
@@ -36,6 +36,7 @@
import org.hisp.dhis.program.ProgramService;
import org.hisp.dhis.program.ProgramStage;
import org.hisp.dhis.program.ProgramStageDataElement;
+import org.hisp.dhis.program.ProgramType;
import java.util.ArrayList;
import java.util.HashMap;
@@ -64,14 +65,14 @@
// Input & Output
// -------------------------------------------------------------------------
- private Integer programType = Program.SINGLE_EVENT_WITHOUT_REGISTRATION;
+ private ProgramType programType = ProgramType.WITHOUT_REGISTRATION;
- public void setProgramType( Integer programType )
+ public void setProgramType( ProgramType programType )
{
this.programType = programType;
}
- public Integer getProgramType()
+ public ProgramType getProgramType()
{
return programType;
}
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/GetAllProgramsAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/GetAllProgramsAction.java 2015-06-16 13:17:59 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/GetAllProgramsAction.java 2015-07-02 07:05:55 +0000
@@ -36,6 +36,7 @@
import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
import org.hisp.dhis.program.Program;
import org.hisp.dhis.program.ProgramService;
+import org.hisp.dhis.program.ProgramType;
import com.opensymphony.xwork2.Action;
@@ -86,7 +87,7 @@
OrganisationUnit organisationUnit = selectionManager.getSelectedOrganisationUnit();
programs = programService.getProgramsByCurrentUser( organisationUnit );
- programs.removeAll( programService.getPrograms( Program.SINGLE_EVENT_WITHOUT_REGISTRATION ) );
+ programs.removeAll( programService.getPrograms( ProgramType.WITHOUT_REGISTRATION ) );
Collections.sort( programs, IdentifiableObjectNameComparator.INSTANCE );
=== 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 2015-06-16 13:17:59 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/GetProgramsByOrgunitAction.java 2015-07-02 07:05:55 +0000
@@ -36,6 +36,7 @@
import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
import org.hisp.dhis.program.Program;
import org.hisp.dhis.program.ProgramService;
+import org.hisp.dhis.program.ProgramType;
import com.opensymphony.xwork2.Action;
@@ -96,8 +97,7 @@
if ( organisationUnit != null )
{
programs = programService.getProgramsByCurrentUser( organisationUnit );
- programs.removeAll( programService.getProgramsByCurrentUser( Program.SINGLE_EVENT_WITH_REGISTRATION ) );
- programs.removeAll( programService.getProgramsByCurrentUser( Program.SINGLE_EVENT_WITHOUT_REGISTRATION ) );
+ programs.removeAll( programService.getProgramsByCurrentUser( ProgramType.WITHOUT_REGISTRATION ) );
}
return SUCCESS;
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/GetSingleEventProgramListAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/GetSingleEventProgramListAction.java 2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/GetSingleEventProgramListAction.java 2015-07-02 07:05:55 +0000
@@ -34,6 +34,7 @@
import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
import org.hisp.dhis.program.Program;
import org.hisp.dhis.program.ProgramService;
+import org.hisp.dhis.program.ProgramType;
import com.opensymphony.xwork2.Action;
@@ -87,8 +88,7 @@
if ( orgunit != null )
{
programs = programService.getProgramsByCurrentUser( orgunit );
- programs.removeAll( programService.getPrograms( Program.MULTIPLE_EVENTS_WITH_REGISTRATION) );
- programs.removeAll( programService.getPrograms( Program.SINGLE_EVENT_WITHOUT_REGISTRATION) );
+ programs.removeAll( programService.getPrograms( ProgramType.WITHOUT_REGISTRATION) );
}
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 2015-06-16 13:17:59 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/MultiDataEntrySelectAction.java 2015-07-02 07:05:55 +0000
@@ -38,6 +38,7 @@
import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
import org.hisp.dhis.program.Program;
import org.hisp.dhis.program.ProgramService;
+import org.hisp.dhis.program.ProgramType;
import org.hisp.dhis.trackedentity.TrackedEntity;
import org.hisp.dhis.trackedentity.TrackedEntityAttribute;
import org.hisp.dhis.trackedentity.TrackedEntityAttributeService;
@@ -141,7 +142,7 @@
{
programs = programService.getProgramsByCurrentUser( organisationUnit );
programs.removeAll( programService
- .getPrograms( Program.SINGLE_EVENT_WITHOUT_REGISTRATION, organisationUnit ) );
+ .getPrograms( ProgramType.WITHOUT_REGISTRATION, organisationUnit ) );
}
return SUCCESS;
=== 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 2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/ReportSelectAction.java 2015-07-02 07:05:55 +0000
@@ -34,6 +34,7 @@
import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
import org.hisp.dhis.program.Program;
import org.hisp.dhis.program.ProgramService;
+import org.hisp.dhis.program.ProgramType;
import com.opensymphony.xwork2.Action;
@@ -89,7 +90,7 @@
{
orgunit = selectionManager.getSelectedOrganisationUnit();
- programs = programService.getPrograms( Program.MULTIPLE_EVENTS_WITH_REGISTRATION );
+ programs = programService.getPrograms( ProgramType.WITH_REGISTRATION );
programs.retainAll( programService.getProgramsByCurrentUser());
return SUCCESS;
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/ProgramEnrollmentAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/ProgramEnrollmentAction.java 2015-06-16 13:17:59 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/ProgramEnrollmentAction.java 2015-07-02 07:05:55 +0000
@@ -205,7 +205,7 @@
return false;
}
- if ( !program.isSingleEvent() && programInstance == null )
+ if ( program.isRegistration() && programInstance == null )
{
return false;
}
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/ProgramEnrollmentSelectAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/ProgramEnrollmentSelectAction.java 2015-06-16 17:43:23 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/ProgramEnrollmentSelectAction.java 2015-07-02 07:05:55 +0000
@@ -36,6 +36,7 @@
import org.hisp.dhis.program.Program;
import org.hisp.dhis.program.ProgramInstance;
import org.hisp.dhis.program.ProgramService;
+import org.hisp.dhis.program.ProgramType;
import org.hisp.dhis.trackedentity.TrackedEntityInstance;
import org.hisp.dhis.trackedentity.TrackedEntityInstanceService;
@@ -113,8 +114,8 @@
programs = programService.getProgramsByCurrentUser( orgunit );
programs.retainAll( programService.getProgramsByTrackedEntity( entityInstance.getTrackedEntity() ) );
- programs.removeAll( programService.getPrograms( Program.SINGLE_EVENT_WITHOUT_REGISTRATION ) );
-
+ programs.removeAll( programService.getPrograms( ProgramType.WITHOUT_REGISTRATION ) );
+
Iterator<Program> iterProgram = programs.iterator();
while ( iterProgram.hasNext() )
{
@@ -125,7 +126,7 @@
{
if (programInstance.getStatus() == ProgramInstance.STATUS_ACTIVE
|| program.getOnlyEnrollOnce()
- || ((programInstance.getStatus() == ProgramInstance.STATUS_COMPLETED && program.isSingleEvent() )))
+ || ((programInstance.getStatus() == ProgramInstance.STATUS_COMPLETED && program.isWithoutRegistration() )))
{
iterProgram.remove();
}
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/SelectAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/SelectAction.java 2015-06-16 13:17:59 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/SelectAction.java 2015-07-02 07:05:55 +0000
@@ -37,6 +37,7 @@
import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
import org.hisp.dhis.program.Program;
import org.hisp.dhis.program.ProgramService;
+import org.hisp.dhis.program.ProgramType;
import org.hisp.dhis.trackedentity.TrackedEntity;
import org.hisp.dhis.trackedentity.TrackedEntityAttribute;
import org.hisp.dhis.trackedentity.TrackedEntityAttributeService;
@@ -138,7 +139,7 @@
if ( organisationUnit != null )
{
programs = programService.getProgramsByCurrentUser( organisationUnit );
- programs.removeAll( programService.getPrograms( Program.SINGLE_EVENT_WITHOUT_REGISTRATION ) );
+ programs.removeAll( programService.getPrograms( ProgramType.WITHOUT_REGISTRATION ) );
Collections.sort( programs, IdentifiableObjectNameComparator.INSTANCE );
}
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/ShowActivityPlanFormAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/ShowActivityPlanFormAction.java 2015-06-16 17:43:23 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/ShowActivityPlanFormAction.java 2015-07-02 07:05:55 +0000
@@ -36,6 +36,7 @@
import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
import org.hisp.dhis.program.Program;
import org.hisp.dhis.program.ProgramService;
+import org.hisp.dhis.program.ProgramType;
import com.opensymphony.xwork2.Action;
@@ -95,7 +96,7 @@
programs = programService.getAllPrograms();
programs.retainAll( programService.getProgramsByCurrentUser() );
- programs.removeAll( programService.getPrograms( Program.SINGLE_EVENT_WITHOUT_REGISTRATION ) );
+ programs.removeAll( programService.getPrograms( ProgramType.WITHOUT_REGISTRATION ) );
Collections.sort( programs, IdentifiableObjectNameComparator.INSTANCE );
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/ShowAddTrackedEntityInstanceFormAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/ShowAddTrackedEntityInstanceFormAction.java 2015-06-19 07:35:50 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/ShowAddTrackedEntityInstanceFormAction.java 2015-07-02 07:05:55 +0000
@@ -317,7 +317,7 @@
organisationUnit = selectionManager.getSelectedOrganisationUnit();
healthWorkers = organisationUnit.getUsers();
- if ( programId != null )
+ if ( programId != null && !programId.isEmpty() )
{
program = programService.getProgram( programId );
trackedEntityForm = program.getDataEntryForm();
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/TrackedEntityInstanceDashboardAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/TrackedEntityInstanceDashboardAction.java 2015-06-16 13:17:59 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/TrackedEntityInstanceDashboardAction.java 2015-07-02 07:05:55 +0000
@@ -43,6 +43,7 @@
import org.hisp.dhis.program.ProgramIndicatorService;
import org.hisp.dhis.program.ProgramInstance;
import org.hisp.dhis.program.ProgramService;
+import org.hisp.dhis.program.ProgramType;
import org.hisp.dhis.relationship.Relationship;
import org.hisp.dhis.relationship.RelationshipService;
import org.hisp.dhis.trackedentity.TrackedEntityAttribute;
@@ -203,8 +204,8 @@
entityInstance = entityInstanceService.getTrackedEntityInstance( entityInstanceId );
Collection<Program> programs = programService
- .getProgramsByCurrentUser( Program.MULTIPLE_EVENTS_WITH_REGISTRATION );
- programs.addAll( programService.getProgramsByCurrentUser( Program.SINGLE_EVENT_WITH_REGISTRATION ) );
+ .getProgramsByCurrentUser( ProgramType.WITH_REGISTRATION );
+ programs.addAll( programService.getProgramsByCurrentUser( ProgramType.WITH_REGISTRATION ) );
// ---------------------------------------------------------------------
// Get relationship
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/activityPlanSelect.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/activityPlanSelect.vm 2014-07-11 05:28:48 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/activityPlanSelect.vm 2015-07-02 07:05:55 +0000
@@ -55,8 +55,8 @@
<option value="">[$i18n.getString( "please_select" )]</option>
#end
#foreach($program in $programs)
- #if($program.type=='1')
- <option value="$program.uid" type='$program.type'>$program.displayName</option>
+ #if($program.programType=='WITH_REGISTRATION')
+ <option value="$program.uid" type='$program.programType'>$program.displayName</option>
#end
#end
</select>
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js 2014-10-17 03:31:13 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js 2015-07-02 07:05:55 +0000
@@ -876,12 +876,12 @@
$( "#commentTB" ).append(tr);
}
- if ( data.program.type != '1' ) {
+ if ( data.program.programType = 'WITH_REGISTRATION' ) {
hideById( 'newEncounterBtn' );
}
- if ( data.program.type == '1' && data.programInstance.status == '1' ) {
- var blockEntry = getFieldValue('blockEntryForm');
+ if ( data.program.programType = 'WITH_REGISTRATION' && data.programInstance.status == '1' ) {
+ var blockEntry = getFieldValue('blockEntryForm');
if( blockEntry == 'true' ){
blockEntryForm();
}
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/singleEvent.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/singleEvent.js 2014-06-10 07:56:21 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/singleEvent.js 2015-07-02 07:05:55 +0000
@@ -15,8 +15,8 @@
{
var count = 0;
for ( i in json.programs ) {
- if( json.programs[i].type==2){
- jQuery( '#program').append( '<option value="' + json.programs[i].id +'" programStageId="' + json.programs[i].programStageId + '" type="' + json.programs[i].type + '">' + json.programs[i].name + '</option>' );
+ if( json.programs[i].programType=='WITH_REGISTRATION'){
+ jQuery( '#program').append( '<option value="' + json.programs[i].id +'" programStageId="' + json.programs[i].programStageId + '" type="' + json.programs[i].programType + '">' + json.programs[i].name + '</option>' );
count++;
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/smsReminder.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/smsReminder.js 2014-07-08 08:27:29 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/smsReminder.js 2015-07-02 07:05:55 +0000
@@ -31,9 +31,9 @@
{
var count = 0;
for ( i in json.programs ) {
- if(json.programs[i].type==1){
+ if(json.programs[i].programType=='WITH_REGISTRATION'){
count++;
- jQuery( '#program').append( '<option value="' + json.programs[i].uid +'" type="' + json.programs[i].type + '">' + json.programs[i].name + '</option>' );
+ jQuery( '#program').append( '<option value="' + json.programs[i].uid +'" type="' + json.programs[i].programType + '">' + json.programs[i].name + '</option>' );
}
}
if(count==0){
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/trackedEntityInstance.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/trackedEntityInstance.js 2015-02-26 13:29:03 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/trackedEntityInstance.js 2015-07-02 07:05:55 +0000
@@ -26,10 +26,10 @@
jQuery('#program').append(
'<option value="">' + i18n_view_all + '</option>');
for (i in json.programs) {
- if (json.programs[i].type == 1 || json.programs[i].type == 2) {
+ if (json.programs[i].programType=='WITH_REGISTRATION') {
jQuery('#program').append(
'<option value="' + json.programs[i].uid + '" type="'
- + json.programs[i].type + '" >' + json.programs[i].name + '</option>');
+ + json.programs[i].programType + '" >' + json.programs[i].name + '</option>');
}
}
enableBtn();
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonProgramMetaData.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonProgramMetaData.vm 2013-12-17 01:29:04 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonProgramMetaData.vm 2015-07-02 07:05:55 +0000
@@ -11,7 +11,7 @@
"description":"$encoder.jsonEncode( ${program.description} )",
"enrollmentDescription":"$encoder.jsonEncode( ${program.dateOfEnrollmentDescription} )",
"incidentDescription":"$encoder.jsonEncode( ${program.dateOfIncidentDescription} )",
- "type": "$!program.type",
+ "programType": "$!program.programType",
"programStages":[#set( $pssize = $program.programStages.size() )
#foreach( $ps in $program.programStages )
{
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonProgramStageDataElements.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonProgramStageDataElements.vm 2013-04-22 06:06:16 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonProgramStageDataElements.vm 2015-07-02 07:05:55 +0000
@@ -5,7 +5,7 @@
"id": "${programStageDataElement.dataElement.id}",
"uid": "${programStageDataElement.dataElement.uid}",
"name": "$!encoder.jsonEncode( ${programStageDataElement.dataElement.getFormNameFallback()} )",
- "type":
+ "programType":
#if( $!programStageDataElement.dataElement.optionSet )
"optionset",
#else
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonProgramStageInstance.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonProgramStageInstance.vm 2014-07-08 06:30:54 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonProgramStageInstance.vm 2015-07-02 07:05:55 +0000
@@ -33,7 +33,7 @@
"program": {
"id": "$!programStageInstance.programInstance.program.id",
"uid": "$encoder.jsonEncode( $!programStageInstance.programInstance.program.uid )",
- "type": "$!programStageInstance.programInstance.program.type"
+ "programType": "$!programStageInstance.programInstance.program.programType"
},
"programStage": {
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonSingleEventPrograms.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonSingleEventPrograms.vm 2014-04-21 14:30:25 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonSingleEventPrograms.vm 2015-07-02 07:05:55 +0000
@@ -5,11 +5,15 @@
{
"id": "${program.uid}",
"name": "$!encoder.jsonEncode( ${program.displayName} )",
- "type": "$program.type",
- #foreach( $programStage in $program.programStages )
- "reportDateDescription": "$programStage.reportDateDescription",
- "programStageId": "$programStage.id"
- #end
+ "programType": "$program.programType",
+ "programStage":[
+ #foreach( $programStage in $program.programStages )
+ {
+ "reportDateDescription": "$programStage.reportDateDescription",
+ "programStageId": "$programStage.id"
+ }#if( $velocityCount < $program.programStages.size() ),#end
+ #end
+ ]
}#if( $velocityCount < $size ),#end
#end]
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentForm.vm 2014-08-04 15:58:47 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentForm.vm 2015-07-02 07:05:55 +0000
@@ -18,7 +18,7 @@
($attributes && $attributes.size() > 0) )
<li><a href="#tab-2">$i18n.getString("attributes")</a></li>
#end
- #if( $programInstance.program.type=='1' )
+ #if( $programInstance.program.programType=='WITH_REGISTRATION' )
<li><a href="#tab-3">$i18n.getString("reschedule_and_set_status")</a></li>
<li><a href="#tab-4">$i18n.getString("comments_and_sms_message")</a></li>
#end
@@ -122,7 +122,7 @@
</div>
#end
- #if( $programInstance.program.type=='1' )
+ #if( $programInstance.program.programType=='WITH_REGISTRATION' )
<!-- Program-stage-instance TAB -->
<div id="tab-3">
#parse("/dhis-web-caseentry/visitSchedule.vm")
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentSelectForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentSelectForm.vm 2014-05-26 11:48:26 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentSelectForm.vm 2015-07-02 07:05:55 +0000
@@ -28,7 +28,7 @@
<option value="">[$i18n.getString( "please_select" )]</option>
#end
#foreach( $program in $programs )
- <option value="$program.uid" programType='$program.type'
+ <option value="$program.uid" programType='$program.programType'
displayIncidentDate='$!program.displayIncidentDate'
dateOfEnrollmentDescription='$!program.dateOfEnrollmentDescription'
dateOfIncidentDescription='$!program.dateOfIncidentDescription'
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageCompletenessSelect.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageCompletenessSelect.vm 2014-02-07 20:25:49 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageCompletenessSelect.vm 2015-07-02 07:05:55 +0000
@@ -29,7 +29,7 @@
<option value=''>[$i18n.getString('please_select')]</option>
#end
#foreach($program in $programs)
- <option value="$program.id" type='$program.type'>$program.displayName</option>
+ <option value="$program.id" type='$program.programType'>$program.displayName</option>
#end
</select>
</td>
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageInstanceFlow.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageInstanceFlow.vm 2014-06-20 13:08:17 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageInstanceFlow.vm 2015-07-02 07:05:55 +0000
@@ -1,4 +1,4 @@
-<table id='tb_$!programInstance.id' class="stage-container" programType='$!programInstance.program.type'>
+<table id='tb_$!programInstance.id' class="stage-container" programType='$!programInstance.program.programType'>
<tr>
<td>
<div class="arrow-left" onclick="moveLeft('flow_$!programInstance.id')"> </div>
@@ -35,7 +35,7 @@
psuid="$programStageInstance.programStage.uid"
psname="$programStageInstance.programStage.displayName"
status="$programStageInstance.getEventStatus().getValue()"
- programType='$programInstance.program.type'
+ programType='$programInstance.program.programType'
reportDate="$!format.formatDate( $!programStageInstance.executionDate )"
reportDateDes="$programStageInstance.programStage.reportDateDescription"
dueDate="$format.formatDate( $programStageInstance.dueDate )"
@@ -101,7 +101,7 @@
standardInterval='$standardInterval'
selected repeatable="true"
allowGenerateNextVisit='$allowGenerateNextVisit'
- programType = '$programStage.program.type'
+ programType = '$programStage.program.programType'
reportDateDes='$!programStage.reportDateDescription'
repeatable="false"
openAfterEnrollment="$!programStage.openAfterEnrollment"
@@ -124,7 +124,7 @@
prevStageId='$prevStageId'
standardInterval='$programStage.minDaysFromStart'
allowGenerateNextVisit='$allowGenerateNextVisit'
- programType = '$programStage.program.type'
+ programType = '$programStage.program.programType'
reportDateDes='$programStage.reportDateDescription'
repeatable="false"
openAfterEnrollment="$programStage.openAfterEnrollment"
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programTrackingSelect.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programTrackingSelect.vm 2014-06-10 07:41:19 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programTrackingSelect.vm 2015-07-02 07:05:55 +0000
@@ -2,12 +2,6 @@
jQuery(document).ready(function() {
showById('programStageAddEntityInstanceTR');
showById('sendSmsToListBtn');
- jQuery("#program option").each(function() {
- var item = jQuery(this);
- if( item.val() != '' && item.attr('type') != 1 ) {
- item.remove();
- }
- });
hideById('addAdvancedSearchBtn');
jQuery("#program option[value='']").text(i18n_please_select);
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/searchTrackedEntityInstanceCriteria.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/searchTrackedEntityInstanceCriteria.vm 2014-06-24 14:23:58 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/searchTrackedEntityInstanceCriteria.vm 2015-07-02 07:05:55 +0000
@@ -28,7 +28,7 @@
<select id='program' name='program' onchange='enableBtn();'>
<option value="" type=''>[$i18n.getString( "view_all" )]</option>
#foreach($program in $programs)
- <option value="$program.uid" type='$program.type'>$program.displayName</option>
+ <option value="$program.uid" type='$program.programType'>$program.displayName</option>
#end
</select>
<span id="programLoader" style="display:none;" ><img src="../images/ajax-loader-bar.gif" /></span>
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleEventSelect.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleEventSelect.vm 2014-06-10 07:41:19 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleEventSelect.vm 2015-07-02 07:05:55 +0000
@@ -1,12 +1,6 @@
<script>
jQuery(document).ready( function(){
- jQuery("#program option").each(function() {
- var item = jQuery(this);
- if( item.attr('type') != 2 ) {
- item.remove();
- }
- });
-
+
if(jQuery("#program option").length==0)
{
jQuery( '#program').append( '<option value="" type="">' + i18n_none_program + '</option>' );
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/trackedEntityInstanceDashboard.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/trackedEntityInstanceDashboard.vm 2014-07-12 02:34:23 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/trackedEntityInstanceDashboard.vm 2015-07-02 07:05:55 +0000
@@ -90,7 +90,7 @@
#end
#if( $!programStageInstance!='')
#set( $status = $programStageInstance.getEventStatus().getValue() )
- <tr id='tr1_$programInstance.id' type='$programInstance.program.type'
+ <tr id='tr1_$programInstance.id' type='$programInstance.program.programType'
programStageInstanceId='$programStageInstance.id'
relationshipText='$!programInstance.program.relationshipText'
relationshipType='$!programInstance.program.relationshipType.id'
@@ -104,7 +104,7 @@
<img id='followup_$programInstance.id' src='images/risk_small.png' #if($programInstance.followup=='true') #else class='hidden' #end >
</td>
</tr>
- #if($programInstance.program.type==1 && $programStageInstance)
+ #if($programInstance.program.programType=='WITH_REGISTRATION' && $programStageInstance)
<tr>
<td id='tr2_$programInstance.id' style='cursor:pointer;'>
• $programStageInstance.programStage.displayName ($format.formatDate($programStageInstance.dueDate))
@@ -112,7 +112,7 @@
</tr>
#end
#else
- <tr id='tr1_$programInstance.id' type='$programInstance.program.type'
+ <tr id='tr1_$programInstance.id' type='$programInstance.program.programType'
programStageInstanceId='$programStageInstance.id'
relationshipText='$!programInstance.program.relationshipText'
relationshipType='$!programInstance.program.relationshipType.id'
@@ -145,12 +145,7 @@
<div class="contentProviderTable">
<table id='completedTB' name='completedTB' style='cursor:pointer;'>
#foreach($programInstance in $completedProgramInstances)
- #set($programStageInstanceId = '')
- #if($programInstance.program.type==2)
- #foreach( $programStageInstance in $programInstance.programStageInstances)
- #set($programStageInstanceId = $programStageInstance.id)
- #end
- #end
+
<tr onclick='javascript:setFieldValue("programIdAddTrackedEntityInstance",$programInstance.program.id);loadActiveProgramStageRecords($programInstance.id);' >
<td>
<a><span id='infor_$programInstance.id'>$programInstance.program.displayName ($format.formatDate($programInstance.enrollmentDate))</span></a>
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonProgram.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonProgram.vm 2014-08-26 12:43:04 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonProgram.vm 2015-07-02 07:05:55 +0000
@@ -4,7 +4,7 @@
"uid": "$!program.uid",
"name": "$!encoder.jsEncode( ${program.name} )",
"description": "$!encoder.jsEncode( ${program.description} )",
- "type": "$!program.type",
+ "programType": "$!program.programType",
"dataEntryMethod": "$!program.dataEntryMethod",
"displayIncidentDate": "$!program.displayIncidentDate",
"ignoreOverdueEvents": "$!program.ignoreOverdueEvents",
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonPrograms.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonPrograms.vm 2014-03-31 07:46:14 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonPrograms.vm 2015-07-02 07:05:55 +0000
@@ -6,7 +6,7 @@
"id" : ${program.id} ,
"uid" : "${program.uid}" ,
"name": "$!encoder.jsonEncode( ${program.name} )",
- "type": "$program.type"
+ "programType": "$program.programType"
}#if( $velocityCount < $size ),#end
#end]
}
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/smscommand/SMSCommandAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/smscommand/SMSCommandAction.java 2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/smscommand/SMSCommandAction.java 2015-07-02 07:05:55 +0000
@@ -39,6 +39,7 @@
import org.hisp.dhis.dataset.DataSetService;
import org.hisp.dhis.program.Program;
import org.hisp.dhis.program.ProgramService;
+import org.hisp.dhis.program.ProgramType;
import org.hisp.dhis.program.ProgramTrackedEntityAttribute;
import org.hisp.dhis.sms.parse.ParserType;
import org.hisp.dhis.sms.command.code.SMSCode;
@@ -190,7 +191,7 @@
}
}
userGroupList = new ArrayList<>( userGroupService.getAllUserGroups() );
- programList = new ArrayList<>( programService.getPrograms( Program.MULTIPLE_EVENTS_WITH_REGISTRATION ) );
+ programList = new ArrayList<>( programService.getPrograms( ProgramType.WITH_REGISTRATION ) );
return SUCCESS;
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/dataentryform/ViewProgramEntryFormAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/dataentryform/ViewProgramEntryFormAction.java 2015-06-19 09:42:38 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/dataentryform/ViewProgramEntryFormAction.java 2015-07-02 07:05:55 +0000
@@ -37,6 +37,7 @@
import org.hisp.dhis.program.Program;
import org.hisp.dhis.program.ProgramService;
import org.hisp.dhis.program.ProgramTrackedEntityAttribute;
+import org.hisp.dhis.program.ProgramType;
import org.hisp.dhis.setting.SystemSettingManager;
import org.hisp.dhis.trackedentity.TrackedEntityAttribute;
import org.hisp.dhis.user.UserSettingService;
@@ -139,7 +140,7 @@
{
List<Program> programs = programService.getAllPrograms();
- programs.removeAll( programService.getPrograms( Program.SINGLE_EVENT_WITHOUT_REGISTRATION ) );
+ programs.removeAll( programService.getPrograms( ProgramType.WITHOUT_REGISTRATION ) );
program = programService.getProgram( programId );
programAttributes = program.getProgramAttributes();
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/program/AddProgramAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/program/AddProgramAction.java 2015-06-07 12:18:59 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/program/AddProgramAction.java 2015-07-02 07:05:55 +0000
@@ -38,6 +38,7 @@
import org.hisp.dhis.program.ProgramService;
import org.hisp.dhis.program.ProgramStage;
import org.hisp.dhis.program.ProgramStageService;
+import org.hisp.dhis.program.ProgramType;
import org.hisp.dhis.program.ProgramTrackedEntityAttribute;
import org.hisp.dhis.relationship.RelationshipType;
import org.hisp.dhis.relationship.RelationshipTypeService;
@@ -119,9 +120,9 @@
this.dateOfIncidentDescription = dateOfIncidentDescription;
}
- private Integer type;
+ private String type;
- public void setType( Integer type )
+ public void setType( String type )
{
this.type = type;
}
@@ -252,7 +253,8 @@
selectEnrollmentDatesInFuture = (selectEnrollmentDatesInFuture == null) ? false : selectEnrollmentDatesInFuture;
selectIncidentDatesInFuture = (selectIncidentDatesInFuture == null) ? false : selectIncidentDatesInFuture;
dataEntryMethod = (dataEntryMethod == null) ? false : dataEntryMethod;
-
+ ProgramType programType = ProgramType.fromValue( type );
+
Program program = new Program();
program.setName( StringUtils.trimToNull( name ) );
@@ -260,14 +262,14 @@
program.setVersion( 1 );
program.setDateOfEnrollmentDescription( StringUtils.trimToNull( dateOfEnrollmentDescription ) );
program.setDateOfIncidentDescription( StringUtils.trimToNull( dateOfIncidentDescription ) );
- program.setType( type );
+ program.setProgramType( programType );
program.setDisplayIncidentDate( displayIncidentDate );
program.setOnlyEnrollOnce( onlyEnrollOnce );
program.setSelectEnrollmentDatesInFuture( selectEnrollmentDatesInFuture );
program.setSelectIncidentDatesInFuture( selectIncidentDatesInFuture );
program.setDataEntryMethod( dataEntryMethod );
- if ( type == Program.MULTIPLE_EVENTS_WITH_REGISTRATION )
+ if ( programType == ProgramType.WITH_REGISTRATION )
{
program.setIgnoreOverdueEvents( ignoreOverdueEvents );
}
@@ -328,8 +330,7 @@
programService.updateProgram( program );
- if ( program.getType().equals( Program.SINGLE_EVENT_WITH_REGISTRATION )
- || program.getType().equals( Program.SINGLE_EVENT_WITHOUT_REGISTRATION ) )
+ if ( program.isWithoutRegistration() )
{
ProgramStage programStage = new ProgramStage();
@@ -347,7 +348,7 @@
// create program-instance for anonymous program
// ---------------------------------------------------------------------
- if ( program.getType().equals( Program.SINGLE_EVENT_WITHOUT_REGISTRATION ) )
+ if ( program.isWithoutRegistration() )
{
// Add a new program-instance
ProgramInstance programInstance = new ProgramInstance();
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/program/GetUnAnonymousProgramAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/program/GetUnAnonymousProgramAction.java 2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/program/GetUnAnonymousProgramAction.java 2015-07-02 07:05:55 +0000
@@ -33,6 +33,7 @@
import org.hisp.dhis.program.Program;
import org.hisp.dhis.program.ProgramService;
+import org.hisp.dhis.program.ProgramType;
import com.opensymphony.xwork2.Action;
@@ -81,8 +82,7 @@
throws Exception
{
programs = programService.getAllPrograms();
-
- programs.removeAll( programService.getPrograms( Program.SINGLE_EVENT_WITHOUT_REGISTRATION ) );
+ programs.removeAll( programService.getPrograms( ProgramType.WITHOUT_REGISTRATION ) );
return SUCCESS;
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/program/ShowAddProgramFormAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/program/ShowAddProgramFormAction.java 2015-06-16 13:17:59 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/program/ShowAddProgramFormAction.java 2015-07-02 07:05:55 +0000
@@ -38,6 +38,7 @@
import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator;
import org.hisp.dhis.program.Program;
import org.hisp.dhis.program.ProgramService;
+import org.hisp.dhis.program.ProgramType;
import org.hisp.dhis.relationship.RelationshipType;
import org.hisp.dhis.relationship.RelationshipTypeService;
import org.hisp.dhis.trackedentity.TrackedEntity;
@@ -156,7 +157,7 @@
{
programs = programService.getAllPrograms();
- programs.removeAll( programService.getPrograms( Program.SINGLE_EVENT_WITHOUT_REGISTRATION ) );
+ programs.removeAll( programService.getPrograms( ProgramType.WITHOUT_REGISTRATION ) );
Collections.sort( programs, IdentifiableObjectNameComparator.INSTANCE );
availableAttributes = trackedEntityAttributeService.getAllTrackedEntityAttributes();
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/program/ShowUpdateProgramFormAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/program/ShowUpdateProgramFormAction.java 2015-06-16 13:17:59 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/program/ShowUpdateProgramFormAction.java 2015-07-02 07:05:55 +0000
@@ -40,6 +40,7 @@
import org.hisp.dhis.organisationunit.OrganisationUnitLevel;
import org.hisp.dhis.program.Program;
import org.hisp.dhis.program.ProgramService;
+import org.hisp.dhis.program.ProgramType;
import org.hisp.dhis.program.ProgramTrackedEntityAttribute;
import org.hisp.dhis.relationship.RelationshipType;
import org.hisp.dhis.relationship.RelationshipTypeService;
@@ -231,7 +232,7 @@
Collections.sort( availableAttributes, IdentifiableObjectNameComparator.INSTANCE );
programs = programService.getAllPrograms();
- programs.removeAll( programService.getPrograms( Program.SINGLE_EVENT_WITHOUT_REGISTRATION ) );
+ programs.removeAll( programService.getPrograms( ProgramType.WITHOUT_REGISTRATION ) );
programs.remove( program );
Collections.sort( programs, IdentifiableObjectNameComparator.INSTANCE );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/program/UpdateProgramAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/program/UpdateProgramAction.java 2015-06-07 12:18:59 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/program/UpdateProgramAction.java 2015-07-02 07:05:55 +0000
@@ -35,6 +35,7 @@
import org.hisp.dhis.program.Program;
import org.hisp.dhis.program.ProgramService;
import org.hisp.dhis.program.ProgramTrackedEntityAttribute;
+import org.hisp.dhis.program.ProgramType;
import org.hisp.dhis.relationship.RelationshipType;
import org.hisp.dhis.relationship.RelationshipTypeService;
import org.hisp.dhis.system.util.AttributeUtils;
@@ -113,9 +114,9 @@
this.dateOfIncidentDescription = dateOfIncidentDescription;
}
- private Integer type;
+ private String type;
- public void setType( Integer type )
+ public void setType( String type )
{
this.type = type;
}
@@ -277,20 +278,21 @@
selectEnrollmentDatesInFuture = (selectEnrollmentDatesInFuture == null) ? false : selectEnrollmentDatesInFuture;
selectIncidentDatesInFuture = (selectIncidentDatesInFuture == null) ? false : selectIncidentDatesInFuture;
dataEntryMethod = (dataEntryMethod == null) ? false : dataEntryMethod;
-
+ ProgramType programType = ProgramType.fromValue( type );
+
Program program = programService.getProgram( id );
program.setName( StringUtils.trimToNull( name ) );
program.setDescription( StringUtils.trimToNull( description ) );
program.setDateOfEnrollmentDescription( StringUtils.trimToNull( dateOfEnrollmentDescription ) );
program.setDateOfIncidentDescription( StringUtils.trimToNull( dateOfIncidentDescription ) );
- program.setType( type );
+ program.setProgramType( programType );
program.setDisplayIncidentDate( displayIncidentDate );
program.setOnlyEnrollOnce( onlyEnrollOnce );
program.setSelectEnrollmentDatesInFuture( selectEnrollmentDatesInFuture );
program.setSelectIncidentDatesInFuture( selectIncidentDatesInFuture );
program.setDataEntryMethod( dataEntryMethod );
- if ( type == Program.MULTIPLE_EVENTS_WITH_REGISTRATION )
+ if ( program.isRegistration() )
{
program.setIgnoreOverdueEvents( ignoreOverdueEvents );
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/AddProgramStageAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/AddProgramStageAction.java 2015-06-10 10:20:38 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/AddProgramStageAction.java 2015-07-02 07:05:55 +0000
@@ -389,7 +389,7 @@
programStage.setPeriodType( null );
}
- if ( program.isSingleEvent() )
+ if ( program.isWithoutRegistration() )
{
programStage.setAutoGenerateEvent( true );
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/ShowAddProgramStageFormAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/ShowAddProgramStageFormAction.java 2015-06-16 13:17:59 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/ShowAddProgramStageFormAction.java 2015-07-02 07:05:55 +0000
@@ -35,6 +35,7 @@
import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator;
import org.hisp.dhis.program.Program;
import org.hisp.dhis.program.ProgramService;
+import org.hisp.dhis.program.ProgramType;
import org.hisp.dhis.relationship.RelationshipType;
import org.hisp.dhis.relationship.RelationshipTypeService;
import org.hisp.dhis.trackedentity.TrackedEntity;
@@ -136,7 +137,7 @@
public String execute()
{
programs = programService.getAllPrograms();
- programs.removeAll( programService.getPrograms( Program.SINGLE_EVENT_WITHOUT_REGISTRATION ) );
+ programs.removeAll( programService.getPrograms( ProgramType.WITHOUT_REGISTRATION ) );
Collections.sort( programs, IdentifiableObjectNameComparator.INSTANCE );
availableAttributes = attributeService.getAllTrackedEntityAttributes();
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/UpdateProgramStageAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/UpdateProgramStageAction.java 2015-06-10 10:20:38 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/UpdateProgramStageAction.java 2015-07-02 07:05:55 +0000
@@ -385,7 +385,7 @@
programStage.setPeriodType( null );
}
- if ( programStage.getProgram().isSingleEvent() )
+ if ( programStage.getProgram().isWithoutRegistration() )
{
programStage.setAutoGenerateEvent( true );
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattribute/ShowAddUpdateAttributeAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattribute/ShowAddUpdateAttributeAction.java 2015-06-16 17:43:23 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattribute/ShowAddUpdateAttributeAction.java 2015-07-02 07:05:55 +0000
@@ -43,6 +43,7 @@
import org.hisp.dhis.period.PeriodType;
import org.hisp.dhis.program.Program;
import org.hisp.dhis.program.ProgramService;
+import org.hisp.dhis.program.ProgramType;
import org.hisp.dhis.system.util.AttributeUtils;
import org.hisp.dhis.trackedentity.TrackedEntity;
import org.hisp.dhis.trackedentity.TrackedEntityAttribute;
@@ -164,7 +165,7 @@
attributeValues = AttributeUtils.getAttributeValueMap( attribute.getAttributeValues() );
programs = programService.getAllPrograms();
- programs.removeAll( programService.getPrograms( Program.SINGLE_EVENT_WITHOUT_REGISTRATION ) );
+ programs.removeAll( programService.getPrograms( ProgramType.WITHOUT_REGISTRATION ) );
Collections.sort( programs );
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/resources/org/hisp/dhis/trackedentity/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/resources/org/hisp/dhis/trackedentity/i18n_module.properties 2015-06-23 09:02:05 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/resources/org/hisp/dhis/trackedentity/i18n_module.properties 2015-07-02 07:05:55 +0000
@@ -217,9 +217,8 @@
dataset=Data set
filter_by_data_set=Filter by data set
show_all_item=Show all items
-multiple_events_with_registration=Multiple events with registration
-single_event_with_registration=Single event with registration
-single_event_without_registration=Single event without registration
+with_registration=With registration
+without_registration=Without registration
for=for
standard_interval_days=Standard interval days
program_enrollment=Program enrollment
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addCaseAggregation.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addCaseAggregation.vm 2014-08-11 13:54:43 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addCaseAggregation.vm 2015-07-02 07:05:55 +0000
@@ -69,7 +69,7 @@
<select id="programId" name="programId" onChange="getParams();">
<option value="">[$i18n.getString('please_select')]</option>
#foreach( $program in $programs )
- <option value="$program.id" title='$program.displayName' programType='$program.type'>$encoder.htmlEncode( $program.displayName )</option>
+ <option value="$program.id" title='$program.displayName' programType='$program.programType.value'>$encoder.htmlEncode( $program.displayName )</option></option>
#end
</select>
</td>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addProgramForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addProgramForm.vm 2015-05-21 16:37:34 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addProgramForm.vm 2015-07-02 07:05:55 +0000
@@ -89,9 +89,8 @@
<td><label for="type">$i18n.getString( "type" ) </label></td>
<td>
<select id="type" name="type" onchange='programOnChange();' >
- <option value='1'>$i18n.getString('multiple_events_with_registration')</option>
- <option value='2'>$i18n.getString('single_event_with_registration')</option>
- <option value='3'>$i18n.getString('single_event_without_registration')</option>
+ <option value='with_registration'>$i18n.getString('with_registration')</option>
+ <option value='without_registration'>$i18n.getString('without_registration')</option>
</select>
</td>
<td></td>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addProgramStageForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addProgramStageForm.vm 2015-04-19 11:38:17 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addProgramStageForm.vm 2015-07-02 07:05:55 +0000
@@ -115,7 +115,7 @@
<td><textarea id="description" name="description"></textarea></td>
</tr>
- #if( $program.type == 1 )
+ #if( $program.programType.value=="with_registration" )
<tr>
<td><label for="minDaysFromStart">$i18n.getString( "scheduled_days_from_start" )</label></td>
<td><input type="text" id="minDaysFromStart" name="minDaysFromStart" value="0" /></td>
@@ -166,7 +166,7 @@
<td><input type="checkbox" id="autoGenerateEvent" name="autoGenerateEvent" value='true' checked onchange='autoGenerateEventOnChange("$openAfterEnrollment")' /></td>
</tr>
- #if($program.type!=3)
+ #if($program.programType.value=="with_registration")
#if($openAfterEnrollment!='' )
<tr>
@@ -215,7 +215,7 @@
<td></td>
</tr>
- #if($program.type==1)
+ #if($program.programType.value=="with_registration")
<tr>
<td><label for="generatedByEnrollmentDate">$i18n.getString( "generate_events_based_on_enrollment_date" ) <span class="tipText">($i18n.getString( "not_incident_date" ))</label></td>
<td><input type="checkbox" id="generatedByEnrollmentDate" name="generatedByEnrollmentDate" value='true'></td>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/program.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/program.js 2015-06-19 07:35:50 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/program.js 2015-07-02 07:05:55 +0000
@@ -53,12 +53,11 @@
setInnerHTML('descriptionField', json.program.description);
setInnerHTML('idField', json.program.uid);
- var type = i18n_multiple_events_with_registration;
- if( json.program.type == "2" )
- type = i18n_single_event_with_registration;
- else if( json.program.type == "3" )
- type = i18n_single_event_without_registration;
- setInnerHTML('typeField', type);
+ var type = i18n_with_registration;
+ if( json.program.programType == "without_registration" ){
+ type = i18n_without_registration;
+ }
+ setInnerHTML('typeField', type);
var displayIncidentDate = ( json.program.displayIncidentDate == 'true') ? i18n_yes : i18n_no;
setInnerHTML('displayIncidentDateField', displayIncidentDate);
@@ -127,7 +126,7 @@
var type = getFieldValue('type');
// anonymous
- if( type == "3" ) {
+ if( type == "without_registration" ) {
disable('onlyEnrollOnce');
disable('dateOfEnrollmentDescription');
disable("displayIncidentDate");
@@ -138,6 +137,7 @@
disable('trackedEntityId');
hideById('selectedList');
hideById('programMessageTB');
+ disable('compulsaryIdentifier');
jQuery("[name=displayed]").attr("disabled", true);
jQuery("[name=displayed]").removeAttr("checked");
@@ -156,14 +156,10 @@
enable('trackedEntityId');
showById('programMessageTB');
showById("selectedList");
+ enable('compulsaryIdentifier');
jQuery("[name=nonAnonymous]").show();
- if( type == 2 ) {
- disable('ignoreOverdueEvents');
- disable('onlyEnrollOnce');
- disable('generatedByEnrollmentDate');
- }
-
+
if( byId('displayIncidentDate').checked ) {
enable("dateOfIncidentDescription");
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/programIndicatorForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/programIndicatorForm.vm 2015-06-03 17:31:30 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/programIndicatorForm.vm 2015-07-02 07:05:55 +0000
@@ -13,7 +13,7 @@
<div id="expression-tabs" style="width:670px">
<ul>
<li><a href="#expression-tab1">$i18n.getString("data_elements")</a></li>
- #if($program.type!='3')
+ #if($program.proprgramType=='with_registration')
<li><a href="#expression-tab2">$i18n.getString("attributes")</a></li>
<li><a href="#expression-tab3">$i18n.getString("variables")</a></li>
#end
@@ -43,7 +43,7 @@
</table>
</div>
- #if($program.type!='3')
+ #if($program.proprgramType=='with_registration')
<div id="expression-tab2">
<table style="width:100%">
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/programList.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/programList.vm 2015-06-19 10:59:39 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/programList.vm 2015-07-02 07:05:55 +0000
@@ -49,10 +49,10 @@
data-can-manage="$security.canManage( $program )"
data-can-update="$security.canUpdate( $program )"
data-can-defined-program-entry-form="#if($program.type!=3)true#{else}false#end"
- data-can-manage-template-message="#if($program.type!=3)true#{else}false#end"
+ data-can-manage-template-message="#if($program.programType.value=="without_registration")true#{else}false#end"
data-can-manage-program-rule="#if( $auth.hasAccess( "dhis-web-maintenance-program", "programRule" ) ) true #{else}false#end"
data-can-delete="$security.canDelete( $program )"
- data-can-manage-form="#if( $auth.hasAccess( "dhis-web-maintenance-program", "programIndicator" ) && $program.type !='3' )true#{else}false#end">
+ data-can-manage-form="#if( $auth.hasAccess( "dhis-web-maintenance-program", "programIndicator" ) && $program.programType.value=="with_registration")true#{else}false#end">
<td>$encoder.htmlEncode( $!program.displayName )</td>
</tr>
#end
@@ -93,7 +93,6 @@
var i18n_none = '$encoder.jsEscape( $i18n.getString( "none" ), "'")';
var i18n_yes = '$encoder.jsEscape( $i18n.getString( "yes" ) , "'" )';
var i18n_no = '$encoder.jsEscape( $i18n.getString( "no" ), "'")';
- var i18n_multiple_events_with_registration = '$encoder.jsEscape( $i18n.getString( "multiple_events_with_registration" ) , "'")';
- var i18n_single_event_with_registration = '$encoder.jsEscape( $i18n.getString( "single_event_with_registration" ) , "'")';
- var i18n_single_event_without_registration = '$encoder.jsEscape( $i18n.getString( "single_event_without_registration" ) , "'")';
+ var i18n_with_registration = '$encoder.jsEscape( $i18n.getString( "with_registration" ) , "'")';
+ var i18n_without_registration = '$encoder.jsEscape( $i18n.getString( "without_registration" ) , "'")';
</script>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/programStage.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/programStage.vm 2015-06-10 08:33:22 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/programStage.vm 2015-07-02 07:05:55 +0000
@@ -19,7 +19,7 @@
<table class="mainPageTable">
<tr>
<td style="text-align:right">
- #if( $program.type=='1' )
+ #if( $program.programType.value=="with_registration" )
<input type="button" value="$i18n.getString( 'add_new' )" onclick="javascript:addProgramStage()" style="width:150px"><br>
#end
<input type="button" value="$i18n.getString( 'sort_order' )" onclick="window.location.href='sortProgramStagesForm.action?id=$program.id'" style="width:150px"><br>
@@ -43,8 +43,8 @@
data-can-manage="$security.canManage( $programStage )"
data-can-update="$security.canUpdate( $programStage )"
data-can-delete="$security.canDelete( $programStage )"
- data-can-manage-template-message="#if($programStage.program.type!=3)true#{else}false#end"
- data-can-remove="#if( $program.type=='1' )true#{else}false#end">
+ data-can-manage-template-message="#if($programStage.program.programType.value=="with_registration")true#{else}false#end"
+ data-can-remove="#if( $program.programType.value=="with_registration" )true#{else}false#end">
<td>$encoder.htmlEncode( $!programStage.displayName )</td>
</tr>
#end
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateCaseAggregation.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateCaseAggregation.vm 2014-12-02 05:31:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateCaseAggregation.vm 2015-07-02 07:05:55 +0000
@@ -66,7 +66,7 @@
<select id="programId" name="programId" onChange="getParams();">
<option value="">[$i18n.getString('please_select')]</option>
#foreach( $program in $programs )
- <option value="$program.id" title='$program.displayName' programType='$program.type'>$encoder.htmlEncode( $program.displayName )</option>
+ <option value="$program.id" title='$program.displayName' programType='$program.programType.value'>$encoder.htmlEncode( $program.displayName )</option>
#end
</select>
</td>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateProgramForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateProgramForm.vm 2015-06-03 14:51:44 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateProgramForm.vm 2015-07-02 07:05:55 +0000
@@ -92,9 +92,8 @@
<td><label for="type">$i18n.getString( "type" ) </label></td>
<td>
<select id="type" name="type" onchange='programOnChange();' class="{validate:{required:true}}">
- <option value='1' #if( $program.type=='1' ) selected #end>$i18n.getString('multiple_events_with_registration')</option>
- <option value='2' #if( $program.type=='2' ) selected #end>$i18n.getString('single_event_with_registration')</option>
- <option value='3' #if( $program.type=='3' ) selected #end>$i18n.getString('single_event_without_registration')</option>
+ <option value='with_registration' #if( $program.programType=="with_registration" ) selected #end>$i18n.getString('with_registration')</option>
+ <option value='without_registration' #if( $program.programType=="without_registration" ) selected #end>$i18n.getString('without_registration')</option>
</select>
</td>
<td></td>
@@ -150,25 +149,25 @@
<tr name='nonAnonymous'>
<td><label for="onlyEnrollOnce">$i18n.getString( "only_enroll_once" )</label></td>
- <td><input type="checkbox" id="onlyEnrollOnce" name="onlyEnrollOnce" value='true' onchange='programOnChange();' #if( $program.type!='1' ) disabled #end #if($program.onlyEnrollOnce=='true') checked #end></td>
+ <td><input type="checkbox" id="onlyEnrollOnce" name="onlyEnrollOnce" value='true' onchange='programOnChange();' #if( $program.programType.value=="without_registration" ) disabled #end #if($program.onlyEnrollOnce=='true') checked #end></td>
<td></td>
</tr>
<tr name='nonAnonymous'>
<td><label for="displayIncidentDate">$i18n.getString( "show_incident_date" )</label></td>
- <td><input type="checkbox" id="displayIncidentDate" name="displayIncidentDate" value='true' onchange='programOnChange();' #if( $program.type=='3' ) disabled #elseif($program.displayIncidentDate=='true') checked #end></td>
+ <td><input type="checkbox" id="displayIncidentDate" name="displayIncidentDate" value='true' onchange='programOnChange();' #if( $program.programType.value=="without_registration" ) disabled #elseif($program.displayIncidentDate=='true') checked #end></td>
<td></td>
</tr>
<tr name='nonAnonymous'>
<td><label for="dateOfIncidentDescription">$i18n.getString( "date_of_incident_description" ) <em title="$i18n.getString( "required" )" class="required">*</em></label></td>
- <td><input type="text" id="dateOfIncidentDescription" name="dateOfIncidentDescription" value="$!program.dateOfIncidentDescription" class="{validate:{required:true,minlength:4}}" #if( $program.type=='2' || $program.type=='3') disabled #end ></td>
+ <td><input type="text" id="dateOfIncidentDescription" name="dateOfIncidentDescription" value="$!program.dateOfIncidentDescription" class="{validate:{required:true,minlength:4}}" #if( $program.programType.value=="without_registration") disabled #end ></td>
<td></td>
</tr name='nonAnonymous'>
<tr name='nonAnonymous'>
<td><label for="dateOfEnrollmentDescription">$i18n.getString( "date_of_enrollment_description" ) <em title="$i18n.getString( "required" )" class="required">*</em></label></td>
- <td><input type="text" id="dateOfEnrollmentDescription" name="dateOfEnrollmentDescription" value="$!program.dateOfEnrollmentDescription" class="{validate:{required:true,minlength:4}}" #if( $program.type=='3' ) disabled #end></td>
+ <td><input type="text" id="dateOfEnrollmentDescription" name="dateOfEnrollmentDescription" value="$!program.dateOfEnrollmentDescription" class="{validate:{required:true,minlength:4}}" #if( $program.programType.value=="without_registration" ) disabled #end></td>
<td></td>
</tr>
@@ -227,7 +226,7 @@
</tr>
<tr name='nonAnonymous'>
<td><label for="ignoreOverdueEvents">$i18n.getString( "skip_to_generate_overdue_events" )</label></td>
- <td><input type="checkbox" id="ignoreOverdueEvents" name="ignoreOverdueEvents" value='true' #if($program.ignoreOverdueEvents=='true') checked #end #if( $program.type!='1' ) disabled #end ></td>
+ <td><input type="checkbox" id="ignoreOverdueEvents" name="ignoreOverdueEvents" value='true' #if($program.ignoreOverdueEvents=='true') checked #end #if( $program.programType.value=="without_registration" ) disabled #end ></td>
<td></td>
</tr>
</tbody>
@@ -259,7 +258,7 @@
<tr>
<td>
- <select size="15" style="width:100%;" multiple id="availablePropertyIds" name="availablePropertyIds" ondblclick="selectProperties();" #if( $program.type=='3' ) disabled #end>
+ <select size="15" style="width:100%;" multiple id="availablePropertyIds" name="availablePropertyIds" ondblclick="selectProperties();" #if( $program.programType.value=="without_registration" ) disabled #end>
#foreach( $attribute in $availableAttributes )
<option value="attr_$attribute.id" valuetype='$attribute.valueType'>$encoder.htmlEncode($attribute.displayName)</option>
#end
@@ -286,16 +285,16 @@
<th style="width:20px;">$i18n.getString( "date_in_future" )</th>
</tr>
</thead>
- <tbody id="selectedList" #if($program.type==3) style="display:none;" #end>
+ <tbody id="selectedList" #if($program.programType.value=="without_registration") style="display:none;" #end>
#foreach( $programAttribute in $program.programAttributes )
#set($attribute = $programAttribute.attribute)
<tr ondblclick="unSelectProperties( this )" id="attr_$programAttribute.attribute.id">
<td onmousedown="select(event, this)">$encoder.htmlEncode( $attribute.name )</td>
- <td align="center"><input type="checkbox" name="displayed" value="attr_$programAttribute.attribute.id" #if($programAttribute.displayInList == true ) checked #end #if($program.type==3) disabled #end /></td>
- <td align="center"><input type="checkbox" name="mandatory" #if($programAttribute.mandatory == "true" ) checked #end #if($program.type==3) disabled #end /></td>
+ <td align="center"><input type="checkbox" name="displayed" value="attr_$programAttribute.attribute.id" #if($programAttribute.displayInList == true ) checked #end #if($program.programType.value=="without_registration") disabled #end /></td>
+ <td align="center"><input type="checkbox" name="mandatory" #if($programAttribute.mandatory == "true" ) checked #end #if($program.tprogramType.value=="without_registration") disabled #end /></td>
<td align="center">
#if($attribute.valueType=='date')
- <input type="checkbox" name="allowFutureDate" #if($programAttribute.allowFutureDate == "true" ) checked #end #if($program.type==3) disabled #end />
+ <input type="checkbox" name="allowFutureDate" #if($programAttribute.allowFutureDate == "true" ) checked #end #if($program.programType.value=="without_registration") disabled #end />
#else
<input type="hidden" name="allowFutureDate" />
#end
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateProgramStageForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateProgramStageForm.vm 2015-04-19 11:38:17 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateProgramStageForm.vm 2015-07-02 07:05:55 +0000
@@ -142,7 +142,7 @@
<td><textarea id="description" name="description">$!encoder.htmlEncode( $programStage.description )</textarea></td>
</tr>
- #if($programStage.program.type==1)
+ #if($programStage.program.programType.value=="with_registration")
<tr>
<td><label for="minDaysFromStart">$i18n.getString( "scheduled_days_from_start" )</label></td>
<td><input type="text" id="minDaysFromStart" name="minDaysFromStart" value="$programStage.minDaysFromStart" /></td>
@@ -188,14 +188,14 @@
#end
#end
- #if($programStage.program.type!=3)
+ #if($programStage.program.programType.value=="with_registration")
<tr>
<td><label for="autoGenerateEvent">$i18n.getString( "auto_generate_event" )</label></td>
<td><input type="checkbox" id="autoGenerateEvent" name="autoGenerateEvent" value='true' onchange='autoGenerateEventOnChange("$openAfterEnrollment")' #if( $programStage.autoGenerateEvent && $programStage.autoGenerateEvent=='true' ) checked #end /></td>
</tr>
#end
- #if($programStage.program.type!=3)
+ #if($programStage.program.programType.value=="with_registration")
#if($openAfterEnrollment!='' )
<tr>
<td colspan='2' style="color:grey;font-style:italic">$i18n.getString('the_properties_to_open_data_entry_form_after_enrolment_is_active_in_the_stage'): $openAfterEnrollment</td>
@@ -244,10 +244,10 @@
<td></td>
</tr>
- #if($programStage.program.type==1)
+ #if($programStage.program.programType.value=="with_registration")
<tr>
<td><label for="generatedByEnrollmentDate">$i18n.getString( "generate_events_based_on_enrollment_date" ) <span class="tipText">($i18n.getString( "not_incident_date" ))</span></label></td>
- <td><input type="checkbox" id="generatedByEnrollmentDate" name="generatedByEnrollmentDate" value='true' #if($programStage.generatedByEnrollmentDate=='true') checked #end #if( $programStage.program.type!='1' ) disabled #end ></td>
+ <td><input type="checkbox" id="generatedByEnrollmentDate" name="generatedByEnrollmentDate" value='true' #if($programStage.generatedByEnrollmentDate=='true') checked #end #if( $programStage.program.programType.value=="without_registration" ) disabled #end ></td>
<td></td>
</tr>
#end
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/viewDataEntryForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/viewDataEntryForm.vm 2015-01-14 14:41:31 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/viewDataEntryForm.vm 2015-07-02 07:05:55 +0000
@@ -144,7 +144,7 @@
<select id="dataElementIds" name="dataElementIds" style="height:200px; width:100%;" multiple="multiple" size="10" ondblclick="insertDataElement( '#dataElementSelection', '$programStage.uid')">
- #if( $programStage.program.type=='3' )
+ #if( $programStage.program.programType.value=="WITHOUT_REGISTRATION" )
#set($name = "$encoder.htmlEncode($programStage.reportDateDescription)")
#set($deJSON = '{"uid":"executionDate","name":"executionDate","executionDate":"executionDate","type":"date"}' )
<option value='$deJSON' decode="executionDate" dename="executionDate" title="$name">$encoder.htmlEncode($programStage.reportDateDescription)</option>
@@ -156,7 +156,7 @@
#end
</select>
<select id="dataElementIdsStore" multiple="multiple" style="display:none">
- #if( $programStage.program.type=='3' )
+ #if( $programStage.program.programType.value=="WITHOUT_REGISTRATION" )
#set($name = "$encoder.htmlEncode($programStage.reportDateDescription)")#set($deJSON = '{"uid":"executionDate","name":"executionDate","executionDate":"executionDate","type":"date"}' )
<option value='$deJSON' decode="executionDate" dename="executionDate" title="$name">$encoder.htmlEncode($programStage.reportDateDescription)</option>
#end