← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9595: Fix bug when to run details of anonymous-programs-formulas with operator as number of persons.

 

------------------------------------------------------------
revno: 9595
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2013-01-24 13:03:12 +0700
message:
  Fix bug when to run details of anonymous-programs-formulas with operator as number of persons.
modified:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/caseaggregation/TestCaseAggregationConditionAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/caseaggregation.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-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/caseaggregation/TestCaseAggregationConditionAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/caseaggregation/TestCaseAggregationConditionAction.java	2012-10-26 03:26:57 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/caseaggregation/TestCaseAggregationConditionAction.java	2013-01-24 06:03:12 +0000
@@ -27,13 +27,16 @@
 
 package org.hisp.dhis.patient.action.caseaggregation;
 
+import java.util.Collection;
 import java.util.Date;
 
 import org.hisp.dhis.caseaggregation.CaseAggregationCondition;
 import static org.hisp.dhis.caseaggregation.CaseAggregationCondition.AGGRERATION_COUNT;
 import org.hisp.dhis.caseaggregation.CaseAggregationConditionService;
+import org.hisp.dhis.i18n.I18n;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.period.Period;
+import org.hisp.dhis.program.Program;
 
 import com.opensymphony.xwork2.Action;
 
@@ -58,6 +61,13 @@
         this.aggregationConditionService = aggregationConditionService;
     }
 
+    private I18n i18n;
+
+    public void setI18n( I18n i18n )
+    {
+        this.i18n = i18n;
+    }
+
     // -------------------------------------------------------------------------
     // Getters && Setters
     // -------------------------------------------------------------------------
@@ -69,6 +79,20 @@
         this.condition = condition;
     }
 
+    private String operator;
+
+    public void setOperator( String operator )
+    {
+        this.operator = operator;
+    }
+
+    private String message;
+
+    public String getMessage()
+    {
+        return message;
+    }
+
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
@@ -80,6 +104,20 @@
         CaseAggregationCondition aggCondition = new CaseAggregationCondition( "", AGGRERATION_COUNT, condition, null,
             null );
 
+        Collection<Program> programs = aggregationConditionService.getProgramsInCondition( condition );
+
+        if ( operator.equals( AGGRERATION_COUNT ) )
+        {
+            for ( Program program : programs )
+            {
+                if ( program.getType() == Program.SINGLE_EVENT_WITHOUT_REGISTRATION )
+                {
+                    message = i18n.getString( "select_operator_number_of_visits_for_this_condition" );
+                    return INPUT;
+                }
+            }
+        }
+
         OrganisationUnit orgunit = new OrganisationUnit();
         orgunit.setId( 1 );
 
@@ -96,5 +134,4 @@
 
         return SUCCESS;
     }
-
 }

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties	2013-01-23 04:48:39 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties	2013-01-24 06:03:12 +0000
@@ -325,4 +325,5 @@
 display_name = Display name
 code_and_name = Code and Name
 sort_by = Sort by
-block_entry_form_after_completed = Block entry form after completed
\ No newline at end of file
+block_entry_form_after_completed = Block entry form after completed
+select_operator_number_of_visits_for_this_condition = Please select operator number of visit for this condition
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/caseaggregation.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/caseaggregation.js	2012-10-30 04:24:52 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/caseaggregation.js	2013-01-24 06:03:12 +0000
@@ -291,16 +291,23 @@
 
 function testCaseAggregationCondition()
 {
+	var operator = jQuery('[name=operator]:checked').val();
 	$.postUTF8( 'testCaseAggregationCondition.action', 
 		{ 
-			condition:getFieldValue('aggregationCondition') 
+			condition: getFieldValue('aggregationCondition'),
+			operator: operator
 		},function (json)
 		{
 			var type = json.response;
 			
 			if ( type == "input" )
 			{
-				showWarningMessage( i18n_run_fail );
+				if( json.message == '' ){
+					showWarningMessage( i18n_run_fail );
+				}
+				else{
+					showWarningMessage( json.message );
+				}
 			}
 			else
 			{