← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3173: Fix bug: DHIS 2 crashes when adding/updating data elements to a Program Stage.

 

------------------------------------------------------------
revno: 3173
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2011-03-28 11:11:31 +0700
message:
  Fix bug: DHIS 2 crashes when adding/updating data elements to a Program Stage.
modified:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/GetPatientAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramStageForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/programStage.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramStageForm.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-patient/src/main/java/org/hisp/dhis/patient/action/patient/GetPatientAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/GetPatientAction.java	2011-03-25 04:52:13 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/GetPatientAction.java	2011-03-28 04:11:31 +0000
@@ -115,10 +115,6 @@
     public String execute()
         throws Exception
     { 
-        try
-    {
-
-            
         patient = patientService.getPatient( id );
         
         patientIdentifier = patientIdentifierService.getPatientIdentifier( patient );
@@ -188,15 +184,11 @@
         }
 
         programs = programService.getAllPrograms();
-System.out.println("\n programs : " + programs);
+
         noGroupAttributes = patientAttributeService.getPatientAttributesNotGroup();
-System.out.println("\n noGroupAttributes : " + noGroupAttributes);
+
         attributeGroups = patientAttributeGroupService.getAllPatientAttributeGroups();
-System.out.println("\n attributeGroups : " + attributeGroups);
-
-        }catch(Exception ex){
-            ex.printStackTrace();
-        }
+        
         return SUCCESS;
 
     }

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramStageForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramStageForm.vm	2011-03-24 06:04:40 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramStageForm.vm	2011-03-28 04:11:31 +0000
@@ -100,8 +100,8 @@
 					<tbody id="selectedList"></tbody>
 				</table>
 			</div>
-			<select id="selectedDataElementsValidator" name="selectedList" multiple="multiple" class="{validate:{required:true}}" style="display:none"/>
-			<select id="compulsories" name="compulsories" multiple="multiple" style="display:none"/>
+			<select id="selectedDataElementsValidator" name="selectedList" multiple="multiple" class="{validate:{required:true}}" style="display:none"></select>
+			<select id="compulsories" name="compulsories" multiple="multiple" style="display:none"></select>
         </td>
         
       </tr>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/programStage.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/programStage.js	2010-10-22 09:23:05 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/programStage.js	2011-03-28 04:11:31 +0000
@@ -8,7 +8,7 @@
 	jQuery("#availableList").children().each(function(i, item){
 		if( item.selected ){
 			html = "<tr class='selected' id='" + item.value + "' ondblclick='unSelectDataElement( this )'><td onclick='select(this)'>" + item.text + "</td>";
-			html += "<td><input type='checkbox' name='compulsory' value='" + item.value + "'</td>";
+			html += "<td><input type='checkbox' name='compulsory' value='" + item.value + "'></td>";
 			html += "</tr>";
 			selectedList.append( html );
 			jQuery( item ).remove();

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramStageForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramStageForm.vm	2011-03-24 06:04:40 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramStageForm.vm	2011-03-28 04:11:31 +0000
@@ -9,16 +9,19 @@
 </style>
 <script>
 jQuery( function(){
-	validation( 'updateProgramStageForm', function( form ){ form.submit() }, function(){
+	validation( 'updateProgramStageForm', function( form ){ 
+		form.submit() ;
+	}, function(){
 		selectedDataElementsValidator = jQuery( "#selectedDataElementsValidator" );
 		compulsories = jQuery( "#compulsories" );
 		selectedDataElementsValidator.empty();
 		compulsories.empty();
-		jQuery("#selectedList").find("tr").each( function( i, item ){				
+		jQuery("#selectedList").find("tr").each( function( i, item ){ 
 			selectedDataElementsValidator.append( "<option value='" + item.id + "' selected='true'>" + item.id + "</option>" );
-			compulsory = jQuery( item ).find( "input[name='compulsory']:first");
+			var compulsory = jQuery( item ).find( "input[name='compulsory']:first");
 			compulsories.append( "<option value='" + compulsory.attr('checked') + "' selected='true'>" + compulsory.attr('checked') + "</option>" );
 		});
+
 	});
 	
 	checkValueIsExist( "name", "validateProgramStage.action", {id:$programStage.id});	
@@ -106,19 +109,18 @@
 						#foreach ( $programStageDataElement in $programStageDataElements )
 							<tr ondblclick="unSelectDataElement( this )" id="$programStageDataElement.dataElement.id" class="selected">
 								<td onclick="select(this)">$encoder.htmlEncode( $programStageDataElement.dataElement.name )</td>
-								<td><input type="checkbox" #if( $programStageDataElement.compulsory ) checked="checked" #end  value="$programStageDataElement.dataElement.id" name="compulsory"></td>
+								<td><input type="checkbox" name="compulsory" value="$programStageDataElement.dataElement.id"></td>
 							</tr>
 						#end
 					</tbody>
 				</table>
 			</div>
-			<select id="selectedDataElementsValidator" name="selectedList" multiple="multiple" class="{validate:{required:true}}" style="display:none"/>
-			<select id="compulsories" name="compulsories" multiple="multiple" style="display:none"/>
         </td>
       </tr>
     </tbody>
   </table>
-
+<select id="selectedDataElementsValidator" name="selectedList" multiple="multiple" class="{validate:{required:true}}" style="display:none"> </select>
+<select id="compulsories" name="compulsories" multiple="multiple" style="display:none"></select>
 <p>
 	<input type="submit" value="$i18n.getString( "update" )" style="width:10em">
 	<input type="button" value="$i18n.getString( "cancel" )" onclick="window.location.href='programStage.action'" style="width:10em">