← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20087: data model property name change: program.dateOfEnrollmentDescription -> program.enrollmentDateLab...

 

------------------------------------------------------------
revno: 20087
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2015-09-11 13:54:53 +0200
message:
  data model property name change: program.dateOfEnrollmentDescription -> program.enrollmentDateLabel, program.dateOfIncidentDescription -> program.incidentDateLable, programInstance.dateOfIncident -> programInstance.incidentDate; TableAlteror: make sure column exists before it is being dropped or renamed
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/ProgramInstance.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramInstanceService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultProgramIndicatorService.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/DefaultProgramStageInstanceService.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/java/org/hisp/dhis/trackedentity/DefaultTrackedEntityInstanceReminderService.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/main/resources/org/hisp/dhis/program/hibernate/ProgramInstance.hbm.xml
  dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/program/ProgramInstanceServiceTest.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/enrollment/Enrollment.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-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/EnrollmentController.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/utils/FormUtils.java
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonProgram.vm
  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/UpdateProgramAction.java
  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/caseAggregationForm.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/viewProgramEntryForm.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-09-01 14:28:36 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/Program.java	2015-09-11 11:54:53 +0000
@@ -75,9 +75,9 @@
 
     private int version;
 
-    private String dateOfEnrollmentDescription; //TODO rename to enrollmentDateDescription
+    private String enrollmentDateLabel;
 
-    private String dateOfIncidentDescription; //TODO rename to incidentDateDescription
+    private String incidentDateLabel;
 
     @Scanned
     private Set<OrganisationUnit> organisationUnits = new HashSet<>();
@@ -334,28 +334,28 @@
     @JsonView( { DetailedView.class, ExportView.class } )
     @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
     @PropertyRange( min = 2 )
-    public String getDateOfEnrollmentDescription()
+    public String getEnrollmentDateLabel()
     {
-        return dateOfEnrollmentDescription;
+        return enrollmentDateLabel;
     }
 
-    public void setDateOfEnrollmentDescription( String dateOfEnrollmentDescription )
+    public void setEnrollmentDateLabel( String enrollmentDateLabel )
     {
-        this.dateOfEnrollmentDescription = dateOfEnrollmentDescription;
+        this.enrollmentDateLabel = enrollmentDateLabel;
     }
 
     @JsonProperty
     @JsonView( { DetailedView.class, ExportView.class } )
     @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
     @PropertyRange( min = 2 )
-    public String getDateOfIncidentDescription()
+    public String getIncidentDateLabel()
     {
-        return dateOfIncidentDescription;
+        return incidentDateLabel;
     }
 
-    public void setDateOfIncidentDescription( String dateOfIncidentDescription )
+    public void setIncidentDateLabel( String incidentDateLabel )
     {
-        this.dateOfIncidentDescription = dateOfIncidentDescription;
+        this.incidentDateLabel = incidentDateLabel;
     }
 
     //TODO remove
@@ -677,8 +677,8 @@
             if ( strategy.isReplace() )
             {
                 description = program.getDescription();
-                dateOfEnrollmentDescription = program.getDateOfEnrollmentDescription();
-                dateOfIncidentDescription = program.getDateOfIncidentDescription();
+                enrollmentDateLabel = program.getEnrollmentDateLabel();
+                incidentDateLabel = program.getIncidentDateLabel();
                 programType = program.getProgramType();
                 displayIncidentDate = program.getDisplayIncidentDate();
                 ignoreOverdueEvents = program.getIgnoreOverdueEvents();
@@ -695,8 +695,8 @@
             else if ( strategy.isMerge() )
             {
                 description = program.getDescription() == null ? description : program.getDescription();
-                dateOfEnrollmentDescription = program.getDateOfEnrollmentDescription() == null ? dateOfEnrollmentDescription : program.getDateOfEnrollmentDescription();
-                dateOfIncidentDescription = program.getDateOfIncidentDescription() == null ? dateOfIncidentDescription : program.getDateOfIncidentDescription();
+                enrollmentDateLabel = program.getEnrollmentDateLabel() == null ? enrollmentDateLabel : program.getEnrollmentDateLabel();
+                incidentDateLabel = program.getIncidentDateLabel() == null ? incidentDateLabel : program.getIncidentDateLabel();
                 programType = program.getProgramType() == null ? programType : program.getProgramType();
                 displayIncidentDate = program.getDisplayIncidentDate() == null ? displayIncidentDate : program.getDisplayIncidentDate();
                 ignoreOverdueEvents = program.getIgnoreOverdueEvents() == null ? ignoreOverdueEvents : program.getIgnoreOverdueEvents();

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramInstance.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramInstance.java	2015-08-25 09:48:55 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramInstance.java	2015-09-11 11:54:53 +0000
@@ -74,7 +74,7 @@
 
     private OrganisationUnit organisationUnit;
 
-    private Date dateOfIncident; // TODO rename to incidentDate
+    private Date incidentDate;
 
     private Date enrollmentDate;
 
@@ -102,10 +102,10 @@
     {
     }
 
-    public ProgramInstance( Date enrollmentDate, Date dateOfIncident, TrackedEntityInstance entityInstance, Program program )
+    public ProgramInstance( Date enrollmentDate, Date incidentDate, TrackedEntityInstance entityInstance, Program program )
     {
         this.enrollmentDate = enrollmentDate;
-        this.dateOfIncident = dateOfIncident;
+        this.incidentDate = incidentDate;
         this.entityInstance = entityInstance;
         this.program = program;
     }
@@ -183,7 +183,7 @@
         final int prime = 31;
         int result = super.hashCode();
 
-        result = prime * result + ((dateOfIncident == null) ? 0 : dateOfIncident.hashCode());
+        result = prime * result + ((incidentDate == null) ? 0 : incidentDate.hashCode());
         result = prime * result + ((enrollmentDate == null) ? 0 : enrollmentDate.hashCode());
         result = prime * result + ((entityInstance == null) ? 0 : entityInstance.hashCode());
         result = prime * result + ((program == null) ? 0 : program.hashCode());
@@ -211,14 +211,14 @@
 
         final ProgramInstance other = (ProgramInstance) object;
 
-        if ( dateOfIncident == null )
+        if ( incidentDate == null )
         {
-            if ( other.dateOfIncident != null )
+            if ( other.incidentDate != null )
             {
                 return false;
             }
         }
-        else if ( !dateOfIncident.equals( other.dateOfIncident ) )
+        else if ( !incidentDate.equals( other.incidentDate ) )
         {
             return false;
         }
@@ -282,14 +282,14 @@
 
     @JsonProperty
     @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
-    public Date getDateOfIncident()
+    public Date getIncidentDate()
     {
-        return dateOfIncident;
+        return incidentDate;
     }
 
-    public void setDateOfIncident( Date dateOfIncident )
+    public void setIncidentDate( Date incidentDate )
     {
-        this.dateOfIncident = dateOfIncident;
+        this.incidentDate = incidentDate;
     }
 
     @JsonProperty

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramInstanceService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramInstanceService.java	2015-09-10 10:42:10 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramInstanceService.java	2015-09-11 11:54:53 +0000
@@ -317,13 +317,13 @@
      * @param trackedEntityInstance TrackedEntityInstance
      * @param program               Program
      * @param enrollmentDate        The date of enrollment
-     * @param dateOfIncident        The date of incident
+     * @param incidentDate        The date of incident
      * @param orgunit               Organisation Unit
      * @param uid                   UID to use for new instance
      * @return ProgramInstance
      */
     ProgramInstance enrollTrackedEntityInstance( TrackedEntityInstance trackedEntityInstance, Program program, 
-        Date enrollmentDate, Date dateOfIncident, OrganisationUnit orgunit, String uid );
+        Date enrollmentDate, Date incidentDate, OrganisationUnit orgunit, String uid );
 
     /**
      * Enroll a TrackedEntityInstance into a program. Must be run inside a transaction.
@@ -331,11 +331,11 @@
      * @param trackedEntityInstance TrackedEntityInstance
      * @param program               Program
      * @param enrollmentDate        The date of enrollment
-     * @param dateOfIncident        The date of incident
+     * @param incidentDate        The date of incident
      * @param orgunit               Organisation Unit
      * @return ProgramInstance
      */
-    ProgramInstance enrollTrackedEntityInstance( TrackedEntityInstance trackedEntityInstance, Program program, Date enrollmentDate, Date dateOfIncident,
+    ProgramInstance enrollTrackedEntityInstance( TrackedEntityInstance trackedEntityInstance, Program program, Date enrollmentDate, Date incidentDate,
         OrganisationUnit orgunit );
 
     /**

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultProgramIndicatorService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultProgramIndicatorService.java	2015-09-11 11:45:33 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultProgramIndicatorService.java	2015-09-11 11:54:53 +0000
@@ -327,7 +327,7 @@
                 }
                 else if ( ProgramIndicator.VAR_INCIDENT_DATE.equals( uid ) )
                 {
-                    date = programInstance.getDateOfIncident();
+                    date = programInstance.getIncidentDate();
                 }
                 else if ( ProgramIndicator.VAR_CURRENT_DATE.equals( uid ) )
                 {

=== 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-09-10 10:42:10 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultProgramInstanceService.java	2015-09-11 11:54:53 +0000
@@ -462,15 +462,15 @@
 
     @Override
     public ProgramInstance enrollTrackedEntityInstance( TrackedEntityInstance trackedEntityInstance, Program program,
-        Date enrollmentDate, Date dateOfIncident, OrganisationUnit organisationUnit )
+        Date enrollmentDate, Date incidentDate, OrganisationUnit organisationUnit )
     {
         return enrollTrackedEntityInstance( trackedEntityInstance, program, enrollmentDate,
-            dateOfIncident, organisationUnit, CodeGenerator.generateCode() );
+            incidentDate, organisationUnit, CodeGenerator.generateCode() );
     }
 
     @Override
     public ProgramInstance enrollTrackedEntityInstance( TrackedEntityInstance trackedEntityInstance,
-        Program program, Date enrollmentDate, Date dateOfIncident, OrganisationUnit organisationUnit, String uid )
+        Program program, Date enrollmentDate, Date incidentDate, OrganisationUnit organisationUnit, String uid )
     {
         // ---------------------------------------------------------------------
         // Add program instance
@@ -490,13 +490,13 @@
             programInstance.setEnrollmentDate( new Date() );
         }
 
-        if ( dateOfIncident != null )
+        if ( incidentDate != null )
         {
-            programInstance.setDateOfIncident( dateOfIncident );
+            programInstance.setIncidentDate( incidentDate );
         }
         else
         {
-            programInstance.setDateOfIncident( new Date() );
+            programInstance.setIncidentDate( new Date() );
         }
 
         programInstance.setStatus( ProgramInstance.STATUS_ACTIVE );
@@ -510,7 +510,7 @@
         {
             ProgramStage programStage = program.getProgramStages().iterator().next();
             programStageInstanceService.createProgramStageInstance( programInstance, programStage, enrollmentDate,
-                dateOfIncident, organisationUnit );
+                incidentDate, organisationUnit );
         }
 
         // -----------------------------------------------------------------

=== 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-09-10 10:49:55 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultProgramStageInstanceService.java	2015-09-11 11:54:53 +0000
@@ -259,7 +259,7 @@
                 // Add a new program instance if it doesn't exist
                 programInstance = new ProgramInstance();
                 programInstance.setEnrollmentDate( executionDate );
-                programInstance.setDateOfIncident( executionDate );
+                programInstance.setIncidentDate( executionDate );
                 programInstance.setProgram( program );
                 programInstance.setStatus( ProgramInstance.STATUS_ACTIVE );
                 programInstanceService.addProgramInstance( programInstance );
@@ -285,7 +285,7 @@
 
     @Override
     public ProgramStageInstance createProgramStageInstance( ProgramInstance programInstance, ProgramStage programStage,
-        Date enrollmentDate, Date dateOfIncident, OrganisationUnit organisationUnit )
+        Date enrollmentDate, Date incidentDate, OrganisationUnit organisationUnit )
     {
         ProgramStageInstance programStageInstance = null;
         Date currentDate = new Date();
@@ -297,7 +297,7 @@
         }
         else
         {
-            dateCreatedEvent = dateOfIncident;
+            dateCreatedEvent = incidentDate;
         }
 
         Date dueDate = DateUtils.getDateAfterAddition( dateCreatedEvent, programStage.getMinDaysFromStart() );

=== 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-09-07 17:32:39 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/InitTableAlteror.java	2015-09-11 11:54:53 +0000
@@ -68,35 +68,65 @@
         executeSql( "UPDATE programstageinstance SET status='ACTIVE' WHERE status='0';" );
         executeSql( "UPDATE programstageinstance SET status='COMPLETED' WHERE status='1';" );
         executeSql( "UPDATE programstageinstance SET status='SKIPPED' WHERE status='5';" );
-        executeSql( "ALTER TABLE program DROP COLUMN displayonallorgunit" );
-
+        
+        if( columnExists( "program", "displayonallorgunit" ) )
+        {
+            executeSql( "ALTER TABLE program DROP COLUMN displayonallorgunit" );
+        }
+        
         upgradeProgramStageDataElements();
         updateValueTypes();
 
         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'" );
+
+        renameColumn( "program", "dateofenrollmentdescription", "enrollmentDateLabel" );
+        renameColumn( "program", "dateofincidentdescription", "incidentDateLabel" );
+        renameColumn( "programinstance", "dateofincident", "incidentDate" );
+
     }
 
     // -------------------------------------------------------------------------
     // Supportive methods
     // -------------------------------------------------------------------------
 
+    private void renameColumn( String table, String oldColumn, String newColumn )
+    {
+        if ( columnExists( table, oldColumn ) )
+        {
+            executeSql( "update " + table + " set " + newColumn + " = " + oldColumn );
+            executeSql( "alter table " + table + " drop column " + oldColumn );
+        }
+    }
+
     private void updateValueTypes()
     {
         executeSql( "alter table dataelement alter column valuetype type varchar(50)" );
 
-        executeSql( "update dataelement set valuetype='NUMBER' where valuetype='int' and numbertype='number'" );
-        executeSql( "update dataelement set valuetype='INTEGER' where valuetype='int' and numbertype='int'" );
-        executeSql( "update dataelement set valuetype='INTEGER_POSITIVE' where valuetype='int' and numbertype='posInt'" );
-        executeSql( "update dataelement set valuetype='INTEGER_NEGATIVE' where valuetype='int' and numbertype='negInt'" );
-        executeSql( "update dataelement set valuetype='INTEGER_ZERO_OR_POSITIVE' where valuetype='int' and numbertype='zeroPositiveInt'" );
-        executeSql( "update dataelement set valuetype='PERCENTAGE' where valuetype='int' and numbertype='percentage'" );
-        executeSql( "update dataelement set valuetype='UNIT_INTERVAL' where valuetype='int' and numbertype='unitInterval'" );
+        if ( columnExists( "dataelement", "numbertype" ) )
+        {
+            executeSql( "update dataelement set valuetype='NUMBER' where valuetype='int' and numbertype='number'" );
+            executeSql( "update dataelement set valuetype='INTEGER' where valuetype='int' and numbertype='int'" );
+            executeSql( "update dataelement set valuetype='INTEGER_POSITIVE' where valuetype='int' and numbertype='posInt'" );
+            executeSql( "update dataelement set valuetype='INTEGER_NEGATIVE' where valuetype='int' and numbertype='negInt'" );
+            executeSql( "update dataelement set valuetype='INTEGER_ZERO_OR_POSITIVE' where valuetype='int' and numbertype='zeroPositiveInt'" );
+            executeSql( "update dataelement set valuetype='PERCENTAGE' where valuetype='int' and numbertype='percentage'" );
+            executeSql( "update dataelement set valuetype='UNIT_INTERVAL' where valuetype='int' and numbertype='unitInterval'" );
+
+            executeSql( "alter table dataelement drop column numbertype" );
+        }
+
         executeSql( "update dataelement set valuetype='NUMBER' where valuetype='int'" );
 
-        executeSql( "update dataelement set valuetype='TEXT' where valuetype='string' and texttype='text'" );
-        executeSql( "update dataelement set valuetype='LONG_TEXT' where valuetype='string' and texttype='longText'" );
+        if ( columnExists( "dataelement", "texttype" ) )
+        {
+            executeSql( "update dataelement set valuetype='TEXT' where valuetype='string' and texttype='text'" );
+            executeSql( "update dataelement set valuetype='LONG_TEXT' where valuetype='string' and texttype='longText'" );
+
+            executeSql( "alter table dataelement drop column texttype" );
+        }
+
         executeSql( "update dataelement set valuetype='TEXT' where valuetype='string'" );
 
         executeSql( "update dataelement set valuetype='DATE' where valuetype='date'" );
@@ -105,9 +135,6 @@
         executeSql( "update dataelement set valuetype='TRUE_ONLY' where valuetype='trueOnly'" );
         executeSql( "update dataelement set valuetype='USERNAME' where valuetype='username'" );
 
-        executeSql( "alter table dataelement drop column numbertype" );
-        executeSql( "alter table dataelement drop column texttype" );
-
         executeSql( "update trackedentityattribute set valuetype='TEXT' where valuetype='string'" );
         executeSql( "update trackedentityattribute set valuetype='PHONE_NUMBER' where valuetype='phoneNumber'" );
         executeSql( "update trackedentityattribute set valuetype='EMAIL' where valuetype='email'" );
@@ -128,10 +155,11 @@
         {
             String autoIncr = statementBuilder.getAutoIncrementValue();
 
-            String insertSql =
-                "insert into programstagedataelement(programstagedataelementid,programstageid,dataelementid,compulsory,allowprovidedelsewhere,sort_order,displayinreports,programstagesectionid,allowfuturedate,section_sort_order) " +
-                    "select " + autoIncr + ",programstageid,dataelementid,compulsory,allowprovidedelsewhere,sort_order,displayinreports,programstagesectionid,allowfuturedate,section_sort_order " +
-                    "from programstage_dataelements";
+            String insertSql = "insert into programstagedataelement(programstagedataelementid,programstageid,dataelementid,compulsory,allowprovidedelsewhere,sort_order,displayinreports,programstagesectionid,allowfuturedate,section_sort_order) "
+                + "select "
+                + autoIncr
+                + ",programstageid,dataelementid,compulsory,allowprovidedelsewhere,sort_order,displayinreports,programstagesectionid,allowfuturedate,section_sort_order "
+                + "from programstage_dataelements";
 
             executeSql( insertSql );
 
@@ -151,6 +179,7 @@
         }
         catch ( Exception ex )
         {
+            ex.printStackTrace();
             log.debug( ex );
 
             return -1;
@@ -169,4 +198,18 @@
             return false;
         }
     }
+
+    private boolean columnExists( String table, String column )
+    {
+        try
+        {
+            return statementManager.getHolder().queryForString(
+                "select column_name from information_schema.columns where table_name='" + table + "' and column_name='"
+                    + column + "'" ) == null ? false : true;
+        }
+        catch ( Exception ex )
+        {
+            return false;
+        }
+    }
 }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/trackedentity/DefaultTrackedEntityInstanceReminderService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/trackedentity/DefaultTrackedEntityInstanceReminderService.java	2015-09-03 08:15:09 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/trackedentity/DefaultTrackedEntityInstanceReminderService.java	2015-09-11 11:54:53 +0000
@@ -100,8 +100,8 @@
         String organisationunitName = entityInstance.getOrganisationUnit().getName();
         String programName = programInstance.getProgram().getName();
         String daysSinceEnrollementDate = DateUtils.daysBetween( new Date(), programInstance.getEnrollmentDate() ) + "";
-        String daysSinceIncidentDate = DateUtils.daysBetween( new Date(), programInstance.getDateOfIncident() ) + "";
-        String incidentDate = format.formatDate( programInstance.getDateOfIncident() );
+        String daysSinceIncidentDate = DateUtils.daysBetween( new Date(), programInstance.getIncidentDate() ) + "";
+        String incidentDate = format.formatDate( programInstance.getIncidentDate() );
         String erollmentDate = format.formatDate( programInstance.getEnrollmentDate() );
 
         templateMessage = templateMessage.replace( TrackedEntityInstanceReminder.TEMPLATE_MESSSAGE_PROGRAM_NAME,

=== 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-09-09 20:18:52 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/program/hibernate/Program.hbm.xml	2015-09-11 11:54:53 +0000
@@ -21,9 +21,9 @@
 
     <property name="version" />
 
-    <property name="dateOfEnrollmentDescription" type="text" />
+    <property name="enrollmentDateLabel" type="text" />
 
-    <property name="dateOfIncidentDescription" type="text" />
+    <property name="incidentDateLabel" type="text" />
 
     <set name="programStages" order-by="sortOrder" cascade="all">
       <key column="programid" />

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/program/hibernate/ProgramInstance.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/program/hibernate/ProgramInstance.hbm.xml	2015-07-16 04:56:40 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/program/hibernate/ProgramInstance.hbm.xml	2015-09-11 11:54:53 +0000
@@ -16,7 +16,7 @@
 
     <property name="lastUpdated" type="timestamp" />
 
-    <property name="dateOfIncident" column="dateofincident" not-null="true" />
+    <property name="incidentDate" column="incidentDate" not-null="true" />
 
     <property name="enrollmentDate" column="enrollmentdate" not-null="true" />
 

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/program/ProgramInstanceServiceTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/program/ProgramInstanceServiceTest.java	2015-09-03 03:11:47 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/program/ProgramInstanceServiceTest.java	2015-09-11 11:54:53 +0000
@@ -232,10 +232,10 @@
 
         assertNotNull( programInstanceService.getProgramInstance( idA ) );
 
-        programInstanceA.setDateOfIncident( enrollmentDate );
+        programInstanceA.setIncidentDate( enrollmentDate );
         programInstanceService.updateProgramInstance( programInstanceA );
 
-        assertEquals( enrollmentDate, programInstanceService.getProgramInstance( idA ).getDateOfIncident() );
+        assertEquals( enrollmentDate, programInstanceService.getProgramInstance( idA ).getIncidentDate() );
     }
 
     @Test

=== 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-09-03 08:15:09 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/enrollment/AbstractEnrollmentService.java	2015-09-11 11:54:53 +0000
@@ -172,7 +172,7 @@
         enrollment.setProgram( programInstance.getProgram().getUid() );
         enrollment.setStatus( EnrollmentStatus.fromInt( programInstance.getStatus() ) );
         enrollment.setDateOfEnrollment( programInstance.getEnrollmentDate() );
-        enrollment.setDateOfIncident( programInstance.getDateOfIncident() );
+        enrollment.setIncidentDate( programInstance.getIncidentDate() );
         enrollment.setFollowup( programInstance.getFollowup() );
 
         List<TrackedEntityComment> comments = programInstance.getComments();
@@ -283,7 +283,7 @@
         OrganisationUnit organisationUnit = getOrganisationUnit( enrollment.getOrgUnit() );
 
         ProgramInstance programInstance = programInstanceService.enrollTrackedEntityInstance( entityInstance, program,
-            enrollment.getDateOfEnrollment(), enrollment.getDateOfIncident(), organisationUnit, enrollment.getEnrollment() );
+            enrollment.getDateOfEnrollment(), enrollment.getIncidentDate(), organisationUnit, enrollment.getEnrollment() );
 
         if ( programInstance == null )
         {
@@ -372,7 +372,7 @@
 
         programInstance.setProgram( program );
         programInstance.setEntityInstance( entityInstance );
-        programInstance.setDateOfIncident( enrollment.getDateOfIncident() );
+        programInstance.setIncidentDate( enrollment.getIncidentDate() );
         programInstance.setEnrollmentDate( enrollment.getDateOfEnrollment() );
         programInstance.setFollowup( enrollment.getFollowup() );
 

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/enrollment/Enrollment.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/enrollment/Enrollment.java	2015-07-07 06:11:54 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/enrollment/Enrollment.java	2015-09-11 11:54:53 +0000
@@ -63,7 +63,7 @@
 
     private Date dateOfEnrollment;
 
-    private Date dateOfIncident;
+    private Date incidentDate;
 
     private List<Attribute> attributes = new ArrayList<>();
 
@@ -185,14 +185,14 @@
 
     @JsonProperty( required = true )
     @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
-    public Date getDateOfIncident()
+    public Date getIncidentDate()
     {
-        return dateOfIncident;
+        return incidentDate;
     }
 
-    public void setDateOfIncident( Date dateOfIncident )
+    public void setIncidentDate( Date incidentDate )
     {
-        this.dateOfIncident = dateOfIncident;
+        this.incidentDate = incidentDate;
     }
 
     @JsonProperty
@@ -241,7 +241,7 @@
 
         if ( attributes != null ? !attributes.equals( that.attributes ) : that.attributes != null ) return false;
         if ( dateOfEnrollment != null ? !dateOfEnrollment.equals( that.dateOfEnrollment ) : that.dateOfEnrollment != null ) return false;
-        if ( dateOfIncident != null ? !dateOfIncident.equals( that.dateOfIncident ) : that.dateOfIncident != null ) return false;
+        if ( incidentDate != null ? !incidentDate.equals( that.incidentDate ) : that.incidentDate != null ) return false;
         if ( enrollment != null ? !enrollment.equals( that.enrollment ) : that.enrollment != null ) return false;
         if ( trackedEntityInstance != null ? !trackedEntityInstance.equals( that.trackedEntityInstance ) : that.trackedEntityInstance != null )
             return false;
@@ -260,7 +260,7 @@
         result = 31 * result + (program != null ? program.hashCode() : 0);
         result = 31 * result + (status != null ? status.hashCode() : 0);
         result = 31 * result + (dateOfEnrollment != null ? dateOfEnrollment.hashCode() : 0);
-        result = 31 * result + (dateOfIncident != null ? dateOfIncident.hashCode() : 0);
+        result = 31 * result + (incidentDate != null ? incidentDate.hashCode() : 0);
         result = 31 * result + (attributes != null ? attributes.hashCode() : 0);
         result = 31 * result + (notes != null ? notes.hashCode() : 0);
         return result;
@@ -275,7 +275,7 @@
             ", program='" + program + '\'' +
             ", status=" + status +
             ", dateOfEnrollment=" + dateOfEnrollment +
-            ", dateOfIncident=" + dateOfIncident +
+            ", incidentDate=" + incidentDate +
             ", attributes=" + attributes +
             ", notes=" + notes +
             '}';

=== 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-09-04 10:49:08 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/events/NoRegistrationSingleEventServiceTest.java	2015-09-11 11:54:53 +0000
@@ -119,7 +119,7 @@
 
         ProgramInstance programInstance = new ProgramInstance();
         programInstance.setProgram( programA );
-        programInstance.setDateOfIncident( new Date() );
+        programInstance.setIncidentDate( new Date() );
         programInstance.setEnrollmentDate( new Date() );
 
         programInstanceService.addProgramInstance( programInstance );

=== 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-09-04 10:49:08 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/events/RegistrationMultiEventsServiceTest.java	2015-09-11 11:54:53 +0000
@@ -330,7 +330,7 @@
         enrollment.setProgram( program );
         enrollment.setTrackedEntityInstance( person );
         enrollment.setDateOfEnrollment( new Date() );
-        enrollment.setDateOfIncident( new Date() );
+        enrollment.setIncidentDate( new Date() );
 
         return enrollment;
     }

=== 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-09-04 10:49:08 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/events/RegistrationSingleEventServiceTest.java	2015-09-11 11:54:53 +0000
@@ -217,7 +217,7 @@
         enrollment.setProgram( program );
         enrollment.setTrackedEntityInstance( person );
         enrollment.setDateOfEnrollment( new Date() );
-        enrollment.setDateOfIncident( new Date() );
+        enrollment.setIncidentDate( new Date() );
 
         return enrollment;
     }

=== 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-09-04 07:11:50 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java	2015-09-11 11:54:53 +0000
@@ -468,7 +468,7 @@
             // ---------------------------------------------------------------------
             ProgramInstance programInstance = new ProgramInstance();
             programInstance.setEnrollmentDate( new Date() );
-            programInstance.setDateOfIncident( new Date() );
+            programInstance.setIncidentDate( new Date() );
             programInstance.setProgram( programStage.getProgram() );
             programInstance.setStatus( ProgramInstance.STATUS_COMPLETED );
             programInstance.setEntityInstance( patient );
@@ -655,7 +655,7 @@
 
         ProgramInstance programInstance = new ProgramInstance();
         programInstance.setEnrollmentDate( new Date() );
-        programInstance.setDateOfIncident( incidentDate );
+        programInstance.setIncidentDate( incidentDate );
         programInstance.setProgram( program );
         programInstance.setEntityInstance( patient );
         programInstance.setStatus( ProgramInstance.STATUS_ACTIVE );
@@ -914,7 +914,7 @@
         mobileProgramInstance.setName( programInstance.getProgram().getName() );
         mobileProgramInstance.setStatus( programInstance.getStatus() );
         mobileProgramInstance.setDateOfEnrollment( PeriodUtil.dateToString( programInstance.getEnrollmentDate() ) );
-        mobileProgramInstance.setDateOfIncident( PeriodUtil.dateToString( programInstance.getDateOfIncident() ) );
+        mobileProgramInstance.setDateOfIncident( PeriodUtil.dateToString( programInstance.getIncidentDate() ) );
         mobileProgramInstance.setPatientId( programInstance.getEntityInstance().getId() );
         mobileProgramInstance.setProgramId( programInstance.getProgram().getId() );
         mobileProgramInstance.setProgramStageInstances( getMobileProgramStages( programInstance ) );
@@ -2027,7 +2027,7 @@
 
         programInstance.setEnrollmentDate( new Date() );
 
-        programInstance.setDateOfIncident( new Date() );
+        programInstance.setIncidentDate( new Date() );
 
         programInstance.setProgram( 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-09-04 07:11:50 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/DefaultProgramService.java	2015-09-11 11:54:53 +0000
@@ -200,8 +200,8 @@
         pr.setName( program.getName() );
         pr.setType( program.getProgramType().getValue() );
         pr.setVersion( program.getVersion() );
-        pr.setDateOfEnrollmentDescription( program.getDateOfEnrollmentDescription() );
-        pr.setDateOfIncidentDescription( program.getDateOfIncidentDescription() );
+        pr.setDateOfEnrollmentDescription( program.getEnrollmentDateLabel() );
+        pr.setDateOfIncidentDescription( program.getIncidentDateLabel() );
         if ( program.getTrackedEntity() != null && program.getTrackedEntity().getName() != null )
         {
             pr.setTrackedEntityName( program.getTrackedEntity().getName() );

=== 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-09-09 08:41:15 +0000
+++ dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisConvenienceTest.java	2015-09-11 11:54:53 +0000
@@ -1165,8 +1165,8 @@
 
         program.setName( "Program" + uniqueCharacter );
         program.setDescription( "Description" + uniqueCharacter );
-        program.setDateOfEnrollmentDescription( "DateOfEnrollmentDescription" );
-        program.setDateOfIncidentDescription( "DateOfIncidentDescription" );
+        program.setEnrollmentDateLabel( "DateOfEnrollmentDescription" );
+        program.setIncidentDateLabel( "DateOfIncidentDescription" );
         program.setProgramStages( programStages );
         program.setProgramType( ProgramType.WITH_REGISTRATION );
 

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/EnrollmentController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/EnrollmentController.java	2015-07-08 04:33:58 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/EnrollmentController.java	2015-09-11 11:54:53 +0000
@@ -121,7 +121,7 @@
 
         if ( fields.isEmpty() )
         {
-            fields.add( "enrollment,created,lastUpdated,trackedEntity,trackedEntityInstance,program,status,orgUnit,dateOfEnrollment,dateOfIncident,followup" );
+            fields.add( "enrollment,created,lastUpdated,trackedEntity,trackedEntityInstance,program,status,orgUnit,enrollmentDate,incidentDate,followup" );
         }
 
         Set<String> orgUnits = ContextUtils.getQueryParamValues( ou );

=== 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-07-13 08:35:30 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/ProgramController.java	2015-09-11 11:54:53 +0000
@@ -68,7 +68,7 @@
         {
             ProgramInstance programInstance = new ProgramInstance();
             programInstance.setEnrollmentDate( new Date() );
-            programInstance.setDateOfIncident( new Date() );
+            programInstance.setIncidentDate( new Date() );
             programInstance.setProgram( program );
             programInstance.setStatus( ProgramInstance.STATUS_ACTIVE );
 

=== 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-09-07 02:24:53 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/utils/FormUtils.java	2015-09-11 11:54:53 +0000
@@ -143,14 +143,14 @@
             form.getOptions().put( "description", program.getDescription() );
         }
 
-        if ( !StringUtils.isEmpty( program.getDateOfEnrollmentDescription() ) )
+        if ( !StringUtils.isEmpty( program.getEnrollmentDateLabel() ) )
         {
-            form.getOptions().put( "dateOfEnrollmentDescription", program.getDateOfEnrollmentDescription() );
+            form.getOptions().put( "dateOfEnrollmentDescription", program.getEnrollmentDateLabel() );
         }
 
-        if ( !StringUtils.isEmpty( program.getDateOfIncidentDescription() ) )
+        if ( !StringUtils.isEmpty( program.getIncidentDateLabel() ) )
         {
-            form.getOptions().put( "dateOfIncidentDescription", program.getDateOfIncidentDescription() );
+            form.getOptions().put( "dateOfIncidentDescription", program.getIncidentDateLabel() );
         }
 
         form.getOptions().put( "type", program.getProgramType().getValue() );

=== 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	2015-07-02 07:05:55 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonProgram.vm	2015-09-11 11:54:53 +0000
@@ -8,8 +8,8 @@
 	"dataEntryMethod": "$!program.dataEntryMethod",
 	"displayIncidentDate": "$!program.displayIncidentDate",
 	"ignoreOverdueEvents": "$!program.ignoreOverdueEvents",
-	"dateOfEnrollmentDescription": "$!encoder.jsEncode( ${program.dateOfEnrollmentDescription} )",
-	"dateOfIncidentDescription": "$!encoder.jsEncode( ${program.dateOfIncidentDescription} )",
+	"enrollmentDateLabel": "$!encoder.jsEncode( ${program.enrollmentDateLabel} )",
+	"incidentDateLabel": "$!encoder.jsEncode( ${program.incidentDateLabel} )",
 	"programStageCount": "${program.programStages.size()}",
 	"noAttributes": "$!program.attributes.size()",
 	"onlyEnrollOnce": "$!program.onlyEnrollOnce",

=== 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-09-02 21:39:01 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/program/AddProgramAction.java	2015-09-11 11:54:53 +0000
@@ -110,18 +110,18 @@
         this.description = description;
     }
 
-    private String dateOfEnrollmentDescription;
+    private String enrollmentDateLabel;
 
-    public void setDateOfEnrollmentDescription( String dateOfEnrollmentDescription )
+    public void setEnrollmentDateLabel( String enrollmentDateLabel )
     {
-        this.dateOfEnrollmentDescription = dateOfEnrollmentDescription;
+        this.enrollmentDateLabel = enrollmentDateLabel;
     }
 
-    private String dateOfIncidentDescription;
+    private String incidentDateLabel;
 
-    public void setDateOfIncidentDescription( String dateOfIncidentDescription )
+    public void setIncidentDateDescription( String incidentDateLabel )
     {
-        this.dateOfIncidentDescription = dateOfIncidentDescription;
+        this.incidentDateLabel = incidentDateLabel;
     }
 
     private ProgramType programType;
@@ -270,8 +270,8 @@
         program.setName( StringUtils.trimToNull( name ) );
         program.setDescription( StringUtils.trimToNull( description ) );
         program.setVersion( 1 );
-        program.setDateOfEnrollmentDescription( StringUtils.trimToNull( dateOfEnrollmentDescription ) );
-        program.setDateOfIncidentDescription( StringUtils.trimToNull( dateOfIncidentDescription ) );
+        program.setEnrollmentDateLabel( StringUtils.trimToNull( enrollmentDateLabel ) );
+        program.setIncidentDateLabel( StringUtils.trimToNull( incidentDateLabel ) );
         program.setProgramType( programType );
         program.setDisplayIncidentDate( displayIncidentDate );
         program.setOnlyEnrollOnce( onlyEnrollOnce );
@@ -368,7 +368,7 @@
             // Add a new program-instance
             ProgramInstance programInstance = new ProgramInstance();
             programInstance.setEnrollmentDate( new Date() );
-            programInstance.setDateOfIncident( new Date() );
+            programInstance.setIncidentDate( new Date() );
             programInstance.setProgram( program );
             programInstance.setStatus( ProgramInstance.STATUS_ACTIVE );
 

=== 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-09-02 21:39:01 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/program/UpdateProgramAction.java	2015-09-11 11:54:53 +0000
@@ -104,18 +104,18 @@
         this.description = description;
     }
 
-    private String dateOfEnrollmentDescription;
+    private String enrollmentDateLabel;
 
-    public void setDateOfEnrollmentDescription( String dateOfEnrollmentDescription )
+    public void setEnrollmentDateLabel( String enrollmentDateLabel )
     {
-        this.dateOfEnrollmentDescription = dateOfEnrollmentDescription;
+        this.enrollmentDateLabel = enrollmentDateLabel;
     }
 
-    private String dateOfIncidentDescription;
+    private String incidentDateLabel;
 
-    public void setDateOfIncidentDescription( String dateOfIncidentDescription )
+    public void setIncidentDateLabel( String incidentDateLabel )
     {
-        this.dateOfIncidentDescription = dateOfIncidentDescription;
+        this.incidentDateLabel = incidentDateLabel;
     }
 
     private ProgramType programType;
@@ -293,8 +293,8 @@
         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.setEnrollmentDateLabel( StringUtils.trimToNull( enrollmentDateLabel ) );
+        program.setIncidentDateLabel( StringUtils.trimToNull( incidentDateLabel ) );
         program.setProgramType( programType );
         program.setDisplayIncidentDate( displayIncidentDate );
         program.setOnlyEnrollOnce( onlyEnrollOnce );

=== 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-09-02 21:39:01 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addProgramForm.vm	2015-09-11 11:54:53 +0000
@@ -5,8 +5,8 @@
 	{	
 		validation2( 'addProgramForm', function( form )
 		{
-			enable('dateOfEnrollmentDescription');
-			enable('dateOfIncidentDescription');
+			enable('enrollmentDateLabel');
+			enable('incidentDateLabel');
 			form.submit();
 		},{
 			'beforeValidateHandler' : function()
@@ -160,14 +160,14 @@
         </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="$i18n.getString('incident_date')"></td>
+			<td><label for="incidentDateLabel">$i18n.getString( "date_of_incident_description" ) <em title="$i18n.getString( "required" )" class="required">*</em></label></td>
+			<td><input type="text" id="incidentDateLabel" name="incidentDateLabel" value="$i18n.getString('incident_date')"></td>
 			<td></td>
 		</tr>
 		
 		<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="$i18n.getString('enrollment_date')"></td>
+			<td><label for="enrollmentDateLabel">$i18n.getString( "date_of_enrollment_description" ) <em title="$i18n.getString( "required" )" class="required">*</em></label></td>
+			<td><input type="text" id="enrollmentDateLabel" name="enrollmentDateLabel" value="$i18n.getString('enrollment_date')"></td>
 			<td></td>
 		</tr>
 		

=== 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-07-02 07:05:55 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addProgramStageForm.vm	2015-09-11 11:54:53 +0000
@@ -189,7 +189,7 @@
 			<td>
 				<select id="reportDateToUse" name="reportDateToUse" disabled>
 					<option value=''>[$i18n.getString('please_select')]</option>
-					<option value='dateOfIncident'>$i18n.getString("date_of_incident")</option>
+					<option value='incidentDate'>$i18n.getString("date_of_incident")</option>
 					<option value='enrollmentDate'>$i18n.getString("date_of_enrollment")</option>
 				</select>
 			</td>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/caseAggregationForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/caseAggregationForm.vm	2014-11-03 13:35:42 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/caseAggregationForm.vm	2015-09-11 11:54:53 +0000
@@ -135,7 +135,7 @@
 				<td>
 					<select id="programProperty" name="programProperty" size="10" ondblclick="insertInfo(this, false);" disabled>
 						<option value="enrollmentDate">$i18n.getString( "date_of_enrollment" )</option>
-						<option value="dateOfIncident">$i18n.getString( "date_of_incident" )</option>
+						<option value="incidentDate">$i18n.getString( "date_of_incident" )</option>
 						<option value="[PG:*]">$i18n.getString( "program_enrollment" )</option>
 					</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-09-02 21:39:01 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateProgramForm.vm	2015-09-11 11:54:53 +0000
@@ -3,8 +3,8 @@
 	{
 		validation2( 'updateProgramForm', function( form )
 		{	
-			enable('dateOfEnrollmentDescription');
-			enable('dateOfIncidentDescription');
+			enable('enrollmentDateLabel');
+			enable('incidentDateLabel');
 			form.submit();
 		},{
 			'beforeValidateHandler' : function()
@@ -170,14 +170,14 @@
 		</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.programType.value=="without_registration") disabled #end ></td>
+			<td><label for="incidentDateLabel">$i18n.getString( "date_of_incident_description" ) <em title="$i18n.getString( "required" )" class="required">*</em></label></td>
+			<td><input type="text" id="incidentDateLabel" name="incidentDateLabel" value="$!program.incidentDateLabel" 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.programType.value=="without_registration" ) disabled #end></td>
+			<td><label for="enrollmentDateLabel">$i18n.getString( "date_of_enrollment_description" ) <em title="$i18n.getString( "required" )" class="required">*</em></label></td>
+			<td><input type="text" id="enrollmentDateLabel" name="enrollmentDateLabel"  value="$!program.enrollmentDateLabel" class="{validate:{required:true,minlength:4}}" #if( $program.programType.value=="without_registration" ) disabled #end></td>
 			<td></td>
 		</tr>
 

=== 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-09-07 03:11:39 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateProgramStageForm.vm	2015-09-11 11:54:53 +0000
@@ -218,7 +218,7 @@
 						<select id="reportDateToUse" name="reportDateToUse"  
 							#if($openAfterEnrollment!='' || $programStage.autoGenerateEvent=='false' ) disabled #elseif($programStage.openAfterEnrollment=='false') disabled #end >
 							<option value=''>[$i18n.getString('please_select')]</option>
-							<option value='dateOfIncident' #if($programStage.reportDateToUse=='dateOfIncident') selected #end >$i18n.getString("date_of_incident")</option>
+							<option value='incidentDate' #if($programStage.reportDateToUse=='incidentDate') selected #end >$i18n.getString("date_of_incident")</option>
 							<option value='enrollmentDate' #if($programStage.reportDateToUse=='enrollmentDate') selected #end >$i18n.getString("date_of_enrollment")</option>
 						</select>
 					</td>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/viewProgramEntryForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/viewProgramEntryForm.vm	2015-07-19 19:20:06 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/viewProgramEntryForm.vm	2015-09-11 11:54:53 +0000
@@ -147,9 +147,9 @@
 		<tr>
 			<td>
 				<select id="programAttrSelector" multiple="multiple" style="height:200px;width:100%;" ondblclick="insertElement( 'prg' )">
-					<option value="enrollmentDate" >$encoder.htmlEncode($program.dateOfEnrollmentDescription)</option>
+					<option value="enrollmentDate" >$encoder.htmlEncode($program.enrollmentDateLabel)</option>
 					#if($program.displayIncidentDate=='true')
-					<option value="dateOfIncident" >$encoder.htmlEncode($program.dateOfIncidentDescription)</option>
+					<option value="incidentDate" >$encoder.htmlEncode($program.incidentDateLabel)</option>
 					#end
 				</select>
 			</td>