← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12713: Fixed bug - Exception thrown when to click on Validation button in case entry form.

 

------------------------------------------------------------
revno: 12713
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2013-10-16 17:03:02 +0700
message:
  Fixed bug - Exception thrown when to click on Validation button in case entry form.
modified:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/ValidateProgramInstanceAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js


--
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-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/ValidateProgramInstanceAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/ValidateProgramInstanceAction.java	2013-10-09 19:10:40 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/ValidateProgramInstanceAction.java	2013-10-16 10:03:02 +0000
@@ -28,19 +28,20 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import com.opensymphony.xwork2.Action;
-import org.hisp.dhis.caseentry.state.SelectedStateManager;
-import org.hisp.dhis.program.ProgramStageInstance;
-import org.hisp.dhis.program.ProgramValidation;
-import org.hisp.dhis.program.ProgramValidationResult;
-import org.hisp.dhis.program.ProgramValidationService;
-
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
+import org.hisp.dhis.program.ProgramStageInstance;
+import org.hisp.dhis.program.ProgramStageInstanceService;
+import org.hisp.dhis.program.ProgramValidation;
+import org.hisp.dhis.program.ProgramValidationResult;
+import org.hisp.dhis.program.ProgramValidationService;
+
+import com.opensymphony.xwork2.Action;
+
 /**
  * @author Chau Thu Tran
  * @version $ ValidateProgramInstanceAction.java Apr 28, 2011 10:56:10 AM $
@@ -52,11 +53,12 @@
     // Dependencies
     // -------------------------------------------------------------------------
 
-    private SelectedStateManager selectedStateManager;
-
-    public void setSelectedStateManager( SelectedStateManager selectedStateManager )
+    private ProgramStageInstanceService programStageInstanceService;
+
+
+    public void setProgramStageInstanceService( ProgramStageInstanceService programStageInstanceService )
     {
-        this.selectedStateManager = selectedStateManager;
+        this.programStageInstanceService = programStageInstanceService;
     }
 
     private ProgramValidationService programValidationService;
@@ -67,9 +69,11 @@
     }
 
     // -------------------------------------------------------------------------
-    // Output
+    // Input && Output
     // -------------------------------------------------------------------------
 
+    private Integer programStageInstanceId;
+
     private Collection<ProgramValidationResult> programValidationResults;
 
     private Map<Integer, String> leftsideFormulaMap = new HashMap<Integer, String>();
@@ -85,6 +89,11 @@
         return leftsideFormulaMap;
     }
 
+    public void setProgramStageInstanceId( Integer programStageInstanceId )
+    {
+        this.programStageInstanceId = programStageInstanceId;
+    }
+
     public Map<Integer, String> getRightsideFormulaMap()
     {
         return rightsideFormulaMap;
@@ -100,11 +109,12 @@
     // -------------------------------------------------------------------------
 
     @Override
-    public String execute() throws Exception
+    public String execute()
+        throws Exception
     {
         programValidationResults = new ArrayList<ProgramValidationResult>();
 
-        ProgramStageInstance programStageInstance = selectedStateManager.getSelectedProgramStageInstance();
+        ProgramStageInstance programStageInstance = programStageInstanceService.getProgramStageInstance( programStageInstanceId );
 
         List<ProgramValidation> validation = new ArrayList<ProgramValidation>(
             programValidationService.getProgramValidation( programStageInstance.getProgramStage() ) );

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml	2013-10-15 10:28:59 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml	2013-10-16 10:03:02 +0000
@@ -367,8 +367,8 @@
 		id="org.hisp.dhis.caseentry.action.caseentry.ValidateProgramInstanceAction"
 		class="org.hisp.dhis.caseentry.action.caseentry.ValidateProgramInstanceAction"
 		scope="prototype">
-		<property name="selectedStateManager"
-			ref="org.hisp.dhis.caseentry.state.SelectedStateManager" />
+		<property name="programStageInstanceService"
+			ref="org.hisp.dhis.program.ProgramStageInstanceService" />
 		<property name="programValidationService"
 			ref="org.hisp.dhis.program.ProgramValidationService" />
 	</bean>

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js	2013-10-16 08:56:30 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js	2013-10-16 10:03:02 +0000
@@ -433,7 +433,7 @@
 						autoScroll: true,
 						overflowX: 'hidden',
 						overflowY: 'auto',
-						width: TR.conf.layout.west_fieldset_width - 16
+						width: TR.conf.layout.west_fieldset_width - 15
 					};
 					Ext.getCmp(p).add(panel);
 					subPanel = Ext.getCmp(panelid);
@@ -449,7 +449,7 @@
 					id: 'filter_lb_' + fieldid,
 					text:name,
 					style: 'padding-left:2px',
-					width:(TR.conf.layout.west_fieldset_width - TR.conf.layout.west_width_subtractor) / 2 - 76
+					width:(TR.conf.layout.west_fieldset_width - TR.conf.layout.west_width_subtractor) / 2 - 93
 				};
 				
 				var opt = "";
@@ -556,7 +556,7 @@
 				params.cls = 'tr-textfield-alt1';
 				params.style = 'margin-bottom:2px';
 				params.emptyText = TR.i18n.filter_value;
-				params.width = (TR.conf.layout.west_fieldset_width - TR.conf.layout.west_width_subtractor) / 2 - 70;
+				params.width = (TR.conf.layout.west_fieldset_width - TR.conf.layout.west_width_subtractor) / 2 - 50;
 				xtype = xtype.toLowerCase();
 				if( valueType=='GENDER'){
 					params.xtype = 'combobox';

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js	2013-10-10 11:07:46 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js	2013-10-16 10:03:02 +0000
@@ -869,10 +869,11 @@
     hideById( 'listDiv' );
     hideById( 'offlineListDiv' );
     setFieldValue( 'programStageInstanceId', programStageInstanceId );
-    setInnerHTML( 'dataEntryFormDiv', '' );
+	setInnerHTML( 'dataEntryFormDiv', '' );
     showLoader();
 
     service.displayProgramStage( getFieldValue( 'programStageId' ), programStageInstanceId, getFieldValue( 'orgunitId' ) );
+	jQuery('.stage-object-selected').attr('id', 'ps_' + programStageInstanceId);
 }
 
 function backEventList() {
@@ -1021,10 +1022,8 @@
                 if ( json.response == 'success' ) {
                     $( "#executionDate" ).css( 'background-color', SUCCESS_COLOR );
                     setFieldValue( 'programStageInstanceId', json.message );
-
-                    if ( programStageInstanceId != json.message ) {
-                        showUpdateEvent( json.message );
-                    }
+					jQuery('.stage-object-selected').attr('id', json.message );
+                    showUpdateEvent( json.message );
                 }
                 else {
                     $( "#executionDate" ).css( 'background-color', ERROR_COLOR );

=== 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	2013-10-14 01:22:01 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js	2013-10-16 10:03:02 +0000
@@ -501,7 +501,10 @@
 
 		$("#loading-bar").siblings(".ui-dialog-titlebar").hide();
 
-		$.get( 'validateProgram.action').done(function(html){
+		$.get( 'validateProgram.action', 
+			{
+				programStageInstanceId: jQuery('.stage-object-selected').attr('id').split('_')[1]
+			}).done(function(html){
             $("#loading-bar").dialog("close");
             $('#validateProgramDiv').html(html);
             if( getFieldValue('violateValidation') == 'true' ) {
@@ -970,7 +973,11 @@
 	});
 	$("#loading-bar").siblings(".ui-dialog-titlebar").hide(); 
 	
+	var programStageInstanceId = jQuery('.stage-object-selected').attr('id').split('_')[1];
 	$('#validateProgramDiv' ).load( 'validateProgram.action',
+		{
+			programStageInstanceId: programStageInstanceId
+		},
 		function(){
 			$( "#loading-bar" ).dialog( "close" );