← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 19944: Fixed bug with add/edit program/program type

 

------------------------------------------------------------
revno: 19944
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2015-09-02 23:39:01 +0200
message:
  Fixed bug with add/edit program/program type
modified:
  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/javascript/program.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateProgramForm.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-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-01 14:28:36 +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-02 21:39:01 +0000
@@ -124,11 +124,11 @@
         this.dateOfIncidentDescription = dateOfIncidentDescription;
     }
 
-    private String type;
+    private ProgramType programType;
 
-    public void setType( String type )
+    public void setProgramType( ProgramType programType )
     {
-        this.type = type;
+        this.programType = programType;
     }
 
     private Boolean displayIncidentDate;
@@ -264,7 +264,6 @@
         selectEnrollmentDatesInFuture = (selectEnrollmentDatesInFuture == null) ? false : selectEnrollmentDatesInFuture;
         selectIncidentDatesInFuture = (selectIncidentDatesInFuture == null) ? false : selectIncidentDatesInFuture;
         dataEntryMethod = (dataEntryMethod == null) ? false : dataEntryMethod;
-        ProgramType programType = ProgramType.fromValue( type );
         
         Program program = new Program();
 

=== 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-01 14:28:36 +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-02 21:39:01 +0000
@@ -118,11 +118,11 @@
         this.dateOfIncidentDescription = dateOfIncidentDescription;
     }
 
-    private String type;
+    private ProgramType programType;
 
-    public void setType( String type )
+    public void setProgramType( ProgramType programType )
     {
-        this.type = type;
+        this.programType = programType;
     }
 
     private Boolean displayProvidedOtherFacility;
@@ -289,7 +289,6 @@
         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 ) );

=== 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-01 14:28:36 +0000
+++ 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
@@ -88,9 +88,9 @@
 		<tr>
 			<td><label for="type">$i18n.getString( "type" ) </label></td>
 			<td>
-				<select id="type" name="type" onchange='programOnChange();' >
-					<option value='with_registration'>$i18n.getString('with_registration')</option>
-					<option value='without_registration'>$i18n.getString('without_registration')</option>
+				<select id="programType" name="programType" onchange='programOnChange();' >
+					<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/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-07-02 07:05:55 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/program.js	2015-09-02 21:39:01 +0000
@@ -54,7 +54,7 @@
     setInnerHTML('idField', json.program.uid);
 
     var type = i18n_with_registration;
-    if( json.program.programType == "without_registration" ){
+    if( json.program.programType == "WITHOUT_REGISTRATION" ){
 		type = i18n_without_registration;
 	}
 	setInnerHTML('typeField', type);
@@ -123,10 +123,10 @@
 }
 
 function programOnChange() {
-  var type = getFieldValue('type');
+  var type = getFieldValue('programType');
   
   // anonymous
-  if( type == "without_registration" ) {
+  if( type == "WITHOUT_REGISTRATION" ) {
     disable('onlyEnrollOnce');
     disable('dateOfEnrollmentDescription');
     disable("displayIncidentDate");

=== 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-01 14:28:36 +0000
+++ 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
@@ -91,9 +91,9 @@
 		<tr>
 			<td><label for="type">$i18n.getString( "type" ) </label></td>
 			<td>
-				<select id="type" name="type" onchange='programOnChange();' class="{validate:{required:true}}">
-					<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 id="programType" name="programType" onchange='programOnChange();' class="{validate:{required:true}}">
+					<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>