← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2: Select patients with ajax when clicking in the orgunit tree.

 

------------------------------------------------------------
revno: 2
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2011-05-04 12:39:48 +0700
message:
  Select patients with ajax when clicking in the orgunit tree.
added:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/VerifyOrganisationUnitHasParentAction.java
modified:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/SelectAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/struts.xml
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/patient.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/patient.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/selectPatient.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/SelectAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/SelectAction.java	2011-05-02 20:11:24 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/SelectAction.java	2011-05-04 05:39:48 +0000
@@ -39,8 +39,6 @@
 public class SelectAction
     implements Action
 {
-    private static final String PATIENT_FORM = "patientform";
-
     // -------------------------------------------------------------------------
     // Dependencies
     // -------------------------------------------------------------------------
@@ -53,45 +51,14 @@
     }
 
     // -------------------------------------------------------------------------
-    // Input/output
-    // -------------------------------------------------------------------------
-
-    private OrganisationUnit organisationUnit;
-
-    public OrganisationUnit getOrganisationUnit()
-    {
-        return organisationUnit;
-    }
-
-    private String message;
-
-    public String getMessage()
-    {
-        return message;
-    }
-
-    // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
 
     public String execute()
         throws Exception
     {
-        message = "";
-        
-        organisationUnit = selectionManager.getSelectedOrganisationUnit();
-
-        if ( organisationUnit == null )
-        {
-            return SUCCESS;
-        }
-
-        if ( !organisationUnit.isHasPatients() )
-        {
-            message = "can_not_register_patient_for_orgunit";
-            return SUCCESS;
-        }
-
-        return PATIENT_FORM;
+        selectionManager.clearSelectedOrganisationUnits();
+
+        return SUCCESS;
     }
 }

=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/VerifyOrganisationUnitHasParentAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/VerifyOrganisationUnitHasParentAction.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/VerifyOrganisationUnitHasParentAction.java	2011-05-04 05:39:48 +0000
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2004-2010, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ *   list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ *   be used to endorse or promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.hisp.dhis.patient.action.patient;
+
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Chau Thu Tran
+ * @version $ID : VerifyOrganisationUnitHasParentAction.java May 4, 2011
+ *          10:19:48 AM $
+ */
+public class VerifyOrganisationUnitHasParentAction
+    implements Action
+{
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private OrganisationUnitService organisationUnitService;
+
+    public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
+    {
+        this.organisationUnitService = organisationUnitService;
+    }
+
+    // -------------------------------------------------------------------------
+    // Input/output
+    // -------------------------------------------------------------------------
+
+    private Integer orgunitId;
+
+    public void setOrgunitId( Integer orgunitId )
+    {
+        this.orgunitId = orgunitId;
+    }
+
+    private String message;
+
+    public String getMessage()
+    {
+        return message;
+    }
+
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+
+    public String execute()
+        throws Exception
+    {
+        message = "";
+
+        OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( orgunitId );
+
+        if ( organisationUnit == null )
+        {
+            return INPUT;
+        }
+
+        if ( !organisationUnit.isHasPatients() )
+        {
+            message = "can_not_register_patient_for_orgunit";
+            return INPUT;
+        }
+
+        return SUCCESS;
+    }
+}

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml	2011-05-02 20:00:07 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml	2011-05-04 05:39:48 +0000
@@ -357,9 +357,17 @@
 	</bean>
 
 	<bean id="org.hisp.dhis.patient.action.patient.SelectAction"
-		class="org.hisp.dhis.patient.action.patient.SelectAction" scope="prototype">
-		<property name="selectionManager"
-			ref="org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager" />
+		class="org.hisp.dhis.patient.action.patient.SelectAction"
+		scope="prototype"> <property name="selectionManager"
+		ref="org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager" />
+	</bean>
+		
+	<bean
+		id="org.hisp.dhis.patient.action.patient.VerifyOrganisationUnitHasParentAction"
+		class="org.hisp.dhis.patient.action.patient.VerifyOrganisationUnitHasParentAction"
+		scope="prototype">
+		<property name="organisationUnitService"
+			ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
 	</bean>
 
 	<bean id="org.hisp.dhis.patient.action.patient.SearchPatientFormAction"
@@ -369,8 +377,7 @@
 			ref="org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager" />
 		<property name="patientAttributeService"
 			ref="org.hisp.dhis.patient.PatientAttributeService" />
-		<property name="programService"
-			ref="org.hisp.dhis.program.ProgramService" />
+		<property name="programService" ref="org.hisp.dhis.program.ProgramService" />
 	</bean>
 
 	<bean
@@ -393,8 +400,7 @@
 			ref="org.hisp.dhis.patientattributevalue.PatientAttributeValueService" />
 		<property name="patientAttributeService"
 			ref="org.hisp.dhis.patient.PatientAttributeService" />
-		<property name="programService"
-			ref="org.hisp.dhis.program.ProgramService" />
+		<property name="programService" ref="org.hisp.dhis.program.ProgramService" />
 	</bean>
 
 	<bean id="org.hisp.dhis.patient.action.patient.GetPatientAction"
@@ -513,14 +519,15 @@
 		<property name="patientIdentifierTypeService"
 			ref="org.hisp.dhis.patient.PatientIdentifierTypeService" />
 	</bean>
-	
+
 	<bean id="org.hisp.dhis.patient.action.patient.GetPatientsByNameAction"
 		class="org.hisp.dhis.patient.action.patient.GetPatientsByNameAction"
 		scope="prototype">
 		<property name="patientService" ref="org.hisp.dhis.patient.PatientService" />
 	</bean>
-	
-	<bean id="org.hisp.dhis.patient.action.patient.GetPatientOrgnunitRegistrationAction"
+
+	<bean
+		id="org.hisp.dhis.patient.action.patient.GetPatientOrgnunitRegistrationAction"
 		class="org.hisp.dhis.patient.action.patient.GetPatientOrgnunitRegistrationAction"
 		scope="prototype">
 		<property name="selectionTreeManager"
@@ -528,7 +535,7 @@
 		<property name="organisationUnitService"
 			ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
 	</bean>
-	
+
 	<bean
 		id="org.hisp.dhis.patient.action.patient.DefinePatientOrgnunitRegistrationAction"
 		class="org.hisp.dhis.patient.action.patient.DefinePatientOrgnunitRegistrationAction"
@@ -538,7 +545,7 @@
 		<property name="organisationUnitService"
 			ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
 	</bean>
-	
+
 	<!-- Patient-Program Enrollment -->
 
 	<bean
@@ -579,19 +586,17 @@
 			ref="org.hisp.dhis.program.ProgramStageInstanceService" />
 	</bean>
 
-	<bean id="org.hisp.dhis.patient.action.patient.RemoveEnrollmentSelectAction"
+	<bean
+		id="org.hisp.dhis.patient.action.patient.RemoveEnrollmentSelectAction"
 		class="org.hisp.dhis.patient.action.patient.RemoveEnrollmentSelectAction"
 		scope="prototype">
 		<property name="programAttributeService"
 			ref="org.hisp.dhis.program.ProgramAttributeService" />
-		<property name="programInstanceService" 
-			ref="org.hisp.dhis.program.ProgramInstanceService" />
-		<property name="patientService" 
-			ref="org.hisp.dhis.patient.PatientService" />
-		<property name="programService" 
-			ref="org.hisp.dhis.program.ProgramService" />
+		<property name="programInstanceService" ref="org.hisp.dhis.program.ProgramInstanceService" />
+		<property name="patientService" ref="org.hisp.dhis.patient.PatientService" />
+		<property name="programService" ref="org.hisp.dhis.program.ProgramService" />
 	</bean>
-	
+
 	<bean id="org.hisp.dhis.patient.action.patient.RemoveEnrollmentAction"
 		class="org.hisp.dhis.patient.action.patient.RemoveEnrollmentAction"
 		scope="prototype">
@@ -718,7 +723,7 @@
 			ref="org.hisp.dhis.oust.manager.SelectionTreeManager" />
 		<property name="programService" ref="org.hisp.dhis.program.ProgramService" />
 	</bean>
-	
+
 	<!-- ProgramStage -->
 
 	<bean id="org.hisp.dhis.patient.action.programstage.AddProgramStageAction"
@@ -992,9 +997,9 @@
 			<ref bean="org.hisp.dhis.patient.PatientIdentifierTypeService" />
 		</property>
 	</bean>
-	
+
 	<!-- Case Aggregation Mapping -->
-	
+
 	<bean
 		id="org.hisp.dhis.patient.action.caseaggregation.AddCaseAggregationConditionAction"
 		class="org.hisp.dhis.patient.action.caseaggregation.AddCaseAggregationConditionAction"
@@ -1009,7 +1014,7 @@
 			<ref bean="org.hisp.dhis.dataelement.DataElementCategoryService" />
 		</property>
 	</bean>
-	
+
 	<bean
 		id="org.hisp.dhis.patient.action.caseaggregation.GetAggDataElementsAction"
 		class="org.hisp.dhis.patient.action.caseaggregation.GetAggDataElementsAction"
@@ -1018,7 +1023,7 @@
 			<ref bean="org.hisp.dhis.dataelement.DataElementService" />
 		</property>
 	</bean>
-	
+
 	<bean
 		id="org.hisp.dhis.patient.action.caseaggregation.GetCaseAggregationConditionAction"
 		class="org.hisp.dhis.patient.action.caseaggregation.GetCaseAggregationConditionAction"
@@ -1027,7 +1032,7 @@
 			<ref bean="org.hisp.dhis.caseaggregation.CaseAggregationConditionService" />
 		</property>
 	</bean>
-	
+
 	<bean
 		id="org.hisp.dhis.patient.action.caseaggregation.GetAllCaseAggregationConditionAction"
 		class="org.hisp.dhis.patient.action.caseaggregation.GetAllCaseAggregationConditionAction"
@@ -1036,7 +1041,7 @@
 			<ref bean="org.hisp.dhis.caseaggregation.CaseAggregationConditionService" />
 		</property>
 	</bean>
-	
+
 	<bean
 		id="org.hisp.dhis.patient.action.caseaggregation.GetProgramStagesAction"
 		class="org.hisp.dhis.patient.action.caseaggregation.GetProgramStagesAction"
@@ -1056,7 +1061,7 @@
 		<property name="programStageDataElementService"
 			ref="org.hisp.dhis.program.ProgramStageDataElementService" />
 	</bean>
-	
+
 	<bean
 		id="org.hisp.dhis.patient.action.caseaggregation.RemoveCaseAggregationConditionAction"
 		class="org.hisp.dhis.patient.action.caseaggregation.RemoveCaseAggregationConditionAction"
@@ -1065,7 +1070,7 @@
 			<ref bean="org.hisp.dhis.caseaggregation.CaseAggregationConditionService" />
 		</property>
 	</bean>
-	
+
 	<bean
 		id="org.hisp.dhis.patient.action.caseaggregation.ShowCaseAggregationConditionFormAction"
 		class="org.hisp.dhis.patient.action.caseaggregation.ShowCaseAggregationConditionFormAction"
@@ -1080,7 +1085,7 @@
 			<ref bean="org.hisp.dhis.patient.PatientAttributeService" />
 		</property>
 	</bean>
-	
+
 	<bean
 		id="org.hisp.dhis.patient.action.caseaggregation.UpdateCaseAggregationConditionAction"
 		class="org.hisp.dhis.patient.action.caseaggregation.UpdateCaseAggregationConditionAction"
@@ -1095,7 +1100,7 @@
 			<ref bean="org.hisp.dhis.dataelement.DataElementCategoryService" />
 		</property>
 	</bean>
-	
+
 	<bean
 		id="org.hisp.dhis.patient.action.caseaggregation.GetAggConditionDescriptionAction"
 		class="org.hisp.dhis.patient.action.caseaggregation.GetAggConditionDescriptionAction"
@@ -1104,7 +1109,7 @@
 			<ref bean="org.hisp.dhis.caseaggregation.CaseAggregationConditionService" />
 		</property>
 	</bean>
-	
+
 	<!-- Validation - PatientValidationCriteria -->
 
 	<bean
@@ -1200,7 +1205,7 @@
 			<ref bean="org.hisp.dhis.program.ProgramService" />
 		</property>
 	</bean>
-	
+
 	<bean
 		id="org.hisp.dhis.patient.action.validation.GetProgramValidationAction"
 		class="org.hisp.dhis.patient.action.validation.GetProgramValidationAction"
@@ -1209,7 +1214,7 @@
 			<ref bean="org.hisp.dhis.program.ProgramValidationService" />
 		</property>
 	</bean>
-	
+
 	<bean
 		id="org.hisp.dhis.patient.action.validation.GetProgramValidationListAction"
 		class="org.hisp.dhis.patient.action.validation.GetProgramValidationListAction"
@@ -1221,7 +1226,7 @@
 			<ref bean="org.hisp.dhis.program.ProgramService" />
 		</property>
 	</bean>
-	
+
 	<bean
 		id="org.hisp.dhis.patient.action.validation.RemoveProgramValidationAction"
 		class="org.hisp.dhis.patient.action.validation.RemoveProgramValidationAction"
@@ -1230,7 +1235,7 @@
 			<ref bean="org.hisp.dhis.program.ProgramValidationService" />
 		</property>
 	</bean>
-	
+
 	<bean
 		id="org.hisp.dhis.patient.action.validation.UpdateProgramValidationAction"
 		class="org.hisp.dhis.patient.action.validation.UpdateProgramValidationAction"
@@ -1239,7 +1244,7 @@
 			<ref bean="org.hisp.dhis.program.ProgramValidationService" />
 		</property>
 	</bean>
-	
+
 	<!-- Configuration -->
 
 	<bean
@@ -1318,10 +1323,11 @@
 
 		</property>
 		<property name="patientAttributeValueService">
-			<ref bean="org.hisp.dhis.patientattributevalue.PatientAttributeValueService" />
+			<ref
+				bean="org.hisp.dhis.patientattributevalue.PatientAttributeValueService" />
 		</property>
 	</bean>
-	
+
 	<!-- Patient Mobile Setting -->
 	<bean
 		id="org.hisp.dhis.patient.action.mobilesetting.ShowMobileSettingFormAction"
@@ -1334,8 +1340,9 @@
 			<ref bean="org.hisp.dhis.patient.PatientAttributeService" />
 		</property>
 	</bean>
-	
-	<bean id="org.hisp.dhis.patient.action.mobilesetting.UpdateMobileSettingAction"
+
+	<bean
+		id="org.hisp.dhis.patient.action.mobilesetting.UpdateMobileSettingAction"
 		class="org.hisp.dhis.patient.action.mobilesetting.UpdateMobileSettingAction"
 		scope="prototype">
 		<property name="patientMobileSettingService">

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/struts.xml	2011-04-29 10:05:04 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/struts.xml	2011-05-04 05:39:48 +0000
@@ -34,7 +34,8 @@
 
 		<action name="removeRelationshipType"
 			class="org.hisp.dhis.patient.action.relationship.RemoveRelationshipTypeAction">
-			<result name="success" type="velocity-json">/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
+			<result name="success" type="velocity-json">
+				/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
 			<param name="requiredAuthorities">F_RELATIONSHIPTYPE_DELETE</param>
 		</action>
 
@@ -71,9 +72,12 @@
 
 		<action name="validateRelationshipType"
 			class="org.hisp.dhis.patient.action.relationship.ValidateRelationshipTypeAction">
-			<result name="success" type="velocity-json">/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
-	  		<result name="error" type="velocity-json">/dhis-web-commons/ajax/jsonResponseError.vm</result>
-      		<result name="input" type="velocity-json">/dhis-web-commons/ajax/jsonResponseInput.vm</result>
+			<result name="success" type="velocity-json">
+				/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
+			<result name="error" type="velocity-json">
+				/dhis-web-commons/ajax/jsonResponseError.vm</result>
+			<result name="input" type="velocity-json">
+				/dhis-web-commons/ajax/jsonResponseInput.vm</result>
 			<param name="onExceptionReturn">plainTextError</param>
 		</action>
 
@@ -188,7 +192,8 @@
 			</param>
 			<param name="stylesheets">
 				../dhis-web-commons/javascripts/jquery/ui/css/theme/thickbox.css
-				, style/basic.css
+				,
+				style/basic.css
 			</param>
 			<param name="requiredAuthorities">F_PATIENT_ADD</param>
 		</action>
@@ -233,10 +238,11 @@
 
 		<action name="removePatientAttribute"
 			class="org.hisp.dhis.patient.action.patientattribute.RemovePatientAttributeAction">
-			<result name="success" type="velocity-json">/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
+			<result name="success" type="velocity-json">
+				/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
 			<param name="requiredAuthorities">F_PATIENTATTRIBUTE_DELETE</param>
 		</action>
-		
+
 		<action name="addPatientAttribute"
 			class="org.hisp.dhis.patient.action.patientattribute.AddPatientAttributeAction">
 			<result name="success" type="redirect">patientAttribute.action
@@ -274,17 +280,22 @@
 
 		<action name="validatePatientAttribute"
 			class="org.hisp.dhis.patient.action.patientattribute.ValidatePatientAttributeAction">
-			 <result name="success" type="velocity-json">/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
-	         <result name="input" type="velocity-json">/dhis-web-commons/ajax/jsonResponseInput.vm</result>
-	         <param name="onExceptionReturn">plainTextError</param>
+			<result name="success" type="velocity-json">
+				/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
+			<result name="input" type="velocity-json">
+				/dhis-web-commons/ajax/jsonResponseInput.vm</result>
+			<param name="onExceptionReturn">plainTextError</param>
 		</action>
 
 		<action name="removePatientAttributeOption"
 			class="org.hisp.dhis.patient.action.patientattribute.RemovePatientAttributeOptionAction">
-			 <result name="success" type="velocity-json">/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
-	  		 <result name="error" type="velocity-json">/dhis-web-commons/ajax/jsonResponseError.vm</result>
-      		 <result name="input" type="velocity-json">/dhis-web-commons/ajax/jsonResponseInput.vm</result>
-			 <param name="requiredAuthorities">F_PATIENTATTRIBUTE_DELETE</param>
+			<result name="success" type="velocity-json">
+				/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
+			<result name="error" type="velocity-json">
+				/dhis-web-commons/ajax/jsonResponseError.vm</result>
+			<result name="input" type="velocity-json">
+				/dhis-web-commons/ajax/jsonResponseInput.vm</result>
+			<param name="requiredAuthorities">F_PATIENTATTRIBUTE_DELETE</param>
 		</action>
 
 		<!-- PatientAttributeValue -->
@@ -318,29 +329,28 @@
 
 		<!-- Patient -->
 
-		<action name="patient"
-			class="org.hisp.dhis.patient.action.patient.SelectAction">
+		<action name="patient" class="org.hisp.dhis.patient.action.patient.SelectAction">
 			<interceptor-ref name="organisationUnitTreeStack" />
-			<result name="patientform" type="chain">patientform
-			</result>
 			<result name="success" type="velocity">/main.vm</result>
 			<param name="page">/dhis-web-maintenance-patient/selectPatient.vm</param>
 			<param name="menu">/dhis-web-maintenance-patient/patientAndProgramMenuWithTree.vm</param>
 			<param name="menuTreeHeight">285</param>
-			<param name="javascripts">
-				../dhis-web-commons/ouwt/ouwt.js,javascript/patient.js</param>
-			<param name="stylesheets">style/basic.css</param>
-		</action>
-
+			<param name="javascripts">../dhis-web-commons/ouwt/ouwt.js,javascript/patient.js</param>
+		</action>
+		
+		<action name="organisationUnitHasPatients"
+			class="org.hisp.dhis.patient.action.patient.VerifyOrganisationUnitHasParentAction">
+			<result name="success" type="velocity-json">
+				/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
+			<result name="input" type="velocity-json">
+				/dhis-web-commons/ajax/jsonResponseInput.vm</result>
+		</action>
+		
 		<action name="patientform"
 			class="org.hisp.dhis.patient.action.patient.SearchPatientFormAction">
-			<interceptor-ref name="organisationUnitTreeStack" />
-			<result name="success" type="velocity">/main.vm</result>
+			<result name="success" type="velocity">/content.vm</result>
 			<param name="page">/dhis-web-maintenance-patient/patient.vm</param>
-			<param name="menu">/dhis-web-maintenance-patient/patientAndProgramMenuWithTree.vm</param>
-			<param name="menuTreeHeight">285</param>
-			<param name="javascripts">
-				../dhis-web-commons/ouwt/ouwt.js,javascript/patient.js</param>
+			<param name="javascripts">javascript/patient.js</param>
 			<param name="stylesheets">style/basic.css</param>
 		</action>
 
@@ -354,13 +364,13 @@
 				/dhis-web-maintenance-patient/responseInput.vm</result>
 			<param name="onExceptionReturn">plainTextError</param>
 		</action>
-		
+
 		<action name="searchPatient"
 			class="org.hisp.dhis.patient.action.patient.SearchPatientAction">
 			<result name="success" type="velocity">/content.vm</result>
 			<param name="page">/dhis-web-maintenance-patient/listPatient.vm</param>
 			<param name="stylesheets">../dhis-web-commons/paging/paging.css</param>
-		</action> 
+		</action>
 
 		<action name="listAllPatients"
 			class="org.hisp.dhis.patient.action.patient.SearchPatientAction">
@@ -394,7 +404,8 @@
 
 		<action name="addPatient"
 			class="org.hisp.dhis.patient.action.patient.AddPatientAction">
-			<result name="success" type="redirect">showProgramEnrollmentForm.action?id=${id}
+			<result name="success" type="redirect">
+				showProgramEnrollmentForm.action?id=${id}
 			</result>
 			<param name="requiredAuthorities">F_PATIENT_ADD</param>
 		</action>
@@ -408,11 +419,11 @@
 			<param name="menuTreeHeight">285</param>
 			<param name="javascripts">
 				../dhis-web-commons/ouwt/ouwt.js
-				,../dhis-web-commons/javascripts/date.js				
+				,../dhis-web-commons/javascripts/date.js
 				,javascript/commons.js
 				,javascript/patient.js
-			</param>	
-			<param name="stylesheets">style/basic.css</param>		
+			</param>
+			<param name="stylesheets">style/basic.css</param>
 			<param name="requiredAuthorities">F_PATIENT_ADD</param>
 		</action>
 
@@ -426,7 +437,7 @@
 			<param name="menuTreeHeight">285</param>
 			<param name="javascripts">
 				../dhis-web-commons/ouwt/ouwt.js
-				,../dhis-web-commons/javascripts/date.js				
+				,../dhis-web-commons/javascripts/date.js
 				,../dhis-web-commons/javascripts/jquery/ui/jquery.cluetip.min.js
 				,javascript/patient.js
 				,javascript/commons.js						
@@ -463,7 +474,8 @@
 			class="org.hisp.dhis.patient.action.patient.ShowAddRepresentativeAction">
 			<result name="success" type="velocity">/popup.vm</result>
 			<param name="page">/dhis-web-maintenance-patient/underAgeForm.vm</param>
-			<param name="javascripts">javascript/underage.js, javascript/commons.js	</param>			
+			<param name="javascripts">javascript/underage.js,
+				javascript/commons.js	</param>
 		</action>
 
 		<action name="searchPerson"
@@ -478,27 +490,27 @@
 			</result>
 			<param name="requiredAuthorities">F_PATIENT_ADD</param>
 		</action>
-		
+
 		<action name="getPatientsByName"
 			class="org.hisp.dhis.patient.action.patient.GetPatientsByNameAction">
 			<result name="success" type="velocity">/popup.vm</result>
 			<param name="page">/dhis-web-maintenance-patient/resultSearchPatients.vm</param>
 			<param name="requiredAuthorities">F_PATIENT_ADD</param>
 		</action>
-		
+
 		<action name="defineOrgunitRegistrationForm"
 			class="org.hisp.dhis.patient.action.patient.GetPatientOrgnunitRegistrationAction">
 			<result name="success" type="velocity">/main.vm</result>
 			<param name="page">/dhis-web-maintenance-patient/orgunitRegistration.vm</param>
 			<param name="requiredAuthorities">F_PROGRAM_UPDATE</param>
 		</action>
-		
+
 		<action name="defineOrgunitRegistration"
 			class="org.hisp.dhis.patient.action.patient.DefinePatientOrgnunitRegistrationAction">
 			<result name="success" type="redirect">index.action</result>
 			<param name="requiredAuthorities">F_ORGANISATION_REGISTRATION</param>
 		</action>
-		
+
 		<!-- Patient-Program Enrollment -->
 
 		<action name="showProgramEnrollmentForm"
@@ -554,19 +566,20 @@
 				../dhis-web-commons/javascripts/date.js,
 				javascript/patient.js</param>
 		</action>
-		
-		<!--  <action name="showProgramUnEnrollmentForm"
+
+		<!--
+			<action name="showProgramUnEnrollmentForm"
 			class="org.hisp.dhis.patient.action.patient.ProgramEnrollmentSelectAction">
 			<result name="enrollmentform" type="chain">enrollChain</result>
 			<result name="success" type="chain">unEnrollmentFormChain</result>
-			<param name="requiredAuthorities">F_PATIENT_UPDATE</param>
-		</action>
-		
-		<action name="enrollChain"
+			<param name="requiredAuthorities">F_PATIENT_UPDATE</param> </action>
+
+			<action name="enrollChain"
 			class="org.hisp.dhis.patient.action.patient.ProgramEnrollmentAction">
 			<result name="success" type="chain">unEnrollmentFormChain</result>
-		</action>  -->
-		
+			</action>
+		-->
+
 		<action name="showProgramUnEnrollmentForm"
 			class="org.hisp.dhis.patient.action.patient.RemoveEnrollmentSelectAction">
 			<interceptor-ref name="organisationUnitTreeStack" />
@@ -580,10 +593,11 @@
 				javascript/patient.js</param>
 			<param name="requiredAuthorities">F_PATIENT_UPDATE</param>
 		</action>
-		
+
 		<action name="removeEnrollment"
 			class="org.hisp.dhis.patient.action.patient.RemoveEnrollmentAction">
-			<result name="success" type="redirect">showProgramUnEnrollmentForm.action?patientId=${patient.id}
+			<result name="success" type="redirect">
+				showProgramUnEnrollmentForm.action?patientId=${patient.id}
 			</result>
 			<param name="requiredAuthorities">F_PATIENT_DELETE</param>
 		</action>
@@ -606,13 +620,15 @@
 
 		<action name="getProgram"
 			class="org.hisp.dhis.patient.action.program.GetProgramAction">
-			<result name="success" type="velocity-json">/dhis-web-maintenance-patient/responseProgram.vm</result>
+			<result name="success" type="velocity-json">
+				/dhis-web-maintenance-patient/responseProgram.vm</result>
 			<param name="onExceptionReturn">plainTextError</param>
 		</action>
 
 		<action name="removeProgram"
 			class="org.hisp.dhis.patient.action.program.RemoveProgramAction">
-			<result name="success" type="velocity-json">/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
+			<result name="success" type="velocity-json">
+				/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
 			<param name="requiredAuthorities">F_PROGRAM_DELETE</param>
 		</action>
 
@@ -650,9 +666,12 @@
 
 		<action name="validateProgram"
 			class="org.hisp.dhis.patient.action.program.ValidateProgramAction">
-			<result name="success" type="velocity-json">/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
-	  		<result name="error" type="velocity-json">/dhis-web-commons/ajax/jsonResponseError.vm</result>
-      		<result name="input" type="velocity-json">/dhis-web-commons/ajax/jsonResponseInput.vm</result>
+			<result name="success" type="velocity-json">
+				/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
+			<result name="error" type="velocity-json">
+				/dhis-web-commons/ajax/jsonResponseError.vm</result>
+			<result name="input" type="velocity-json">
+				/dhis-web-commons/ajax/jsonResponseInput.vm</result>
 			<param name="onExceptionReturn">plainTextError</param>
 		</action>
 
@@ -665,17 +684,18 @@
 			<param name="menu">/dhis-web-maintenance-patient/patientAndProgramMenu.vm</param>
 			<param name="javascripts">javascript/programAttribute.js</param>
 		</action>
-		
+
 		<action name="getProgramAttribute"
 			class="org.hisp.dhis.patient.action.program.GetProgramAttributeAction">
 			<result name="success" type="velocity-xml">
 				/dhis-web-maintenance-patient/responseProgramAttribute.vm</result>
 			<param name="onExceptionReturn">plainTextError</param>
 		</action>
-		
+
 		<action name="removeProgramAttribute"
 			class="org.hisp.dhis.patient.action.program.RemoveProgramAttributeAction">
-			<result name="success" type="velocity-json">/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
+			<result name="success" type="velocity-json">
+				/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
 			<param name="requiredAuthorities">F_PROGRAM_ATTRIBUTE_DELETE</param>
 		</action>
 
@@ -695,14 +715,16 @@
 
 		<action name="validateProgramAttribute"
 			class="org.hisp.dhis.patient.action.program.ValidateProgramAttributeAction">
-			<result name="success" type="velocity-json">/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
-	  		<result name="error" type="velocity-json">/dhis-web-commons/ajax/jsonResponseError.vm</result>
-      		<result name="input" type="velocity-json">/dhis-web-commons/ajax/jsonResponseInput.vm</result>
+			<result name="success" type="velocity-json">
+				/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
+			<result name="error" type="velocity-json">
+				/dhis-web-commons/ajax/jsonResponseError.vm</result>
+			<result name="input" type="velocity-json">
+				/dhis-web-commons/ajax/jsonResponseInput.vm</result>
 			<param name="onExceptionReturn">plainTextError</param>
 		</action>
-		
-		<action name="showAddProgramAttributeForm"
-			class="org.hisp.dhis.patient.action.NoAction">
+
+		<action name="showAddProgramAttributeForm" class="org.hisp.dhis.patient.action.NoAction">
 			<result name="success" type="velocity">/main.vm</result>
 			<param name="page">/dhis-web-maintenance-patient/addProgramAttributeForm.vm</param>
 			<param name="menu">/dhis-web-maintenance-patient/patientAndProgramMenu.vm</param>
@@ -718,18 +740,21 @@
 			<param name="javascripts">javascript/programAttribute.js</param>
 			<param name="requiredAuthorities">F_PROGRAM_ATTRIBUTE_UPDATE</param>
 		</action>
-		
-		
+
+
 		<action name="validateProgramAttribute"
 			class="org.hisp.dhis.patient.action.program.ValidateProgramAttributeAction">
-			<result name="success" type="velocity-json">/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
-	  		<result name="error" type="velocity-json">/dhis-web-commons/ajax/jsonResponseError.vm</result>
-      		<result name="input" type="velocity-json">/dhis-web-commons/ajax/jsonResponseInput.vm</result>
+			<result name="success" type="velocity-json">
+				/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
+			<result name="error" type="velocity-json">
+				/dhis-web-commons/ajax/jsonResponseError.vm</result>
+			<result name="input" type="velocity-json">
+				/dhis-web-commons/ajax/jsonResponseInput.vm</result>
 			<param name="onExceptionReturn">plainTextError</param>
 		</action>
-		
+
 		<!-- Program_OrganisationUnit Association -->
-		
+
 		<action name="defineProgramAssociationsForm"
 			class="org.hisp.dhis.patient.action.program.GetProgramAction">
 			<result name="success" type="velocity">/main.vm</result>
@@ -739,10 +764,11 @@
 
 		<action name="defineProgramAssociations"
 			class="org.hisp.dhis.patient.action.program.DefineProgramAssociationsAction">
-			<result name="success" type="redirect">program.action</result>
+			<result name="success" type="redirect">program.action
+			</result>
 			<param name="requiredAuthorities">F_PROGRAM_UPDATE</param>
 		</action>
-		
+
 		<!-- ProgramStage -->
 
 		<action name="programStage"
@@ -781,8 +807,10 @@
 
 		<action name="validateProgramStage"
 			class="org.hisp.dhis.patient.action.programstage.ValidateProgramStageAction">
-			<result name="success" type="velocity-json">../dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
-      		<result name="error" type="velocity-json">../dhis-web-commons/ajax/jsonResponseError.vm</result>
+			<result name="success" type="velocity-json">
+				../dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
+			<result name="error" type="velocity-json">
+				../dhis-web-commons/ajax/jsonResponseError.vm</result>
 			<param name="onExceptionReturn">plainTextError</param>
 		</action>
 
@@ -805,17 +833,19 @@
 
 		<action name="removeProgramStage"
 			class="org.hisp.dhis.patient.action.programstage.RemoveProgramStageAction">
-			<result name="success" type="velocity-json">../dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
-      		<result name="error" type="velocity-json">../dhis-web-commons/ajax/jsonResponseError.vm</result>
+			<result name="success" type="velocity-json">
+				../dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
+			<result name="error" type="velocity-json">
+				../dhis-web-commons/ajax/jsonResponseError.vm</result>
 			<param name="onExceptionReturn">plainTextError</param>
 			<param name="requiredAuthorities">F_PROGRAMSTAGE_DELETE</param>
 		</action>
 
 		<action name="showSortProgramStageForm"
-			class="org.hisp.dhis.patient.action.programstage.ShowSortProgramStageFormAction">			
+			class="org.hisp.dhis.patient.action.programstage.ShowSortProgramStageFormAction">
 			<result name="success" type="velocity">/main.vm</result>
 			<param name="page">/dhis-web-maintenance-patient/sortProgramStageForm.vm</param>
-			<param name="menu">/dhis-web-maintenance-patient/patientAndProgramMenu.vm</param>			
+			<param name="menu">/dhis-web-maintenance-patient/patientAndProgramMenu.vm</param>
 			<param name="requiredAuthorities">F_PROGRAMSTAGE_ADD</param>
 		</action>
 
@@ -831,33 +861,40 @@
 		<action name="viewDataEntryForm"
 			class="org.hisp.dhis.patient.action.dataentryform.ViewDataEntryFormAction">
 			<result name="success" type="velocity">/main.vm</result>
-			<param name="page">/dhis-web-maintenance-patient/viewDataEntryForm.vm</param>	
+			<param name="page">/dhis-web-maintenance-patient/viewDataEntryForm.vm</param>
 			<param name="javascripts">
-			      	../dhis-web-commons/ckeditor/ckeditor.js, ../dhis-web-commons/ckeditor/adapters/jquery.js, javascript/viewDataEntryForm.js
-			</param>		
+				../dhis-web-commons/ckeditor/ckeditor.js,
+				../dhis-web-commons/ckeditor/adapters/jquery.js,
+				javascript/viewDataEntryForm.js
+			</param>
 		</action>
 
 		<action name="saveDataEntryForm"
 			class="org.hisp.dhis.patient.action.dataentryform.SaveDataEntryFormAction">
-			<result name="success" type="redirect">programStage.action?id=${programId}</result>
+			<result name="success" type="redirect">
+				programStage.action?id=${programId}</result>
 		</action>
 
 		<action name="delDataEntryForm"
 			class="org.hisp.dhis.patient.action.dataentryform.DelDataEntryFormAction">
-			<result name="success" type="redirect">programStage.action?id=${programId}</result>			
+			<result name="success" type="redirect">
+				programStage.action?id=${programId}</result>
 		</action>
 
 		<action name="validateDataEntryForm"
 			class="org.hisp.dhis.patient.action.dataentryform.ValidateDataEntryFormAction">
-			<result name="success" type="velocity-json">../dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
-      		<result name="error" type="velocity-json">../dhis-web-commons/ajax/jsonResponseError.vm</result>
+			<result name="success" type="velocity-json">
+				../dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
+			<result name="error" type="velocity-json">
+				../dhis-web-commons/ajax/jsonResponseError.vm</result>
 			<param name="onExceptionReturn">plainTextError</param>
-		</action>		
+		</action>
 
 		<action name="getSelectedDataElements"
 			class="org.hisp.dhis.patient.action.dataentryform.GetSelectedDataElementsAction">
-			<result name="success" type="velocity-xml">/dhis-web-maintenance-patient/responseSelDataElementList.vm</result>
-		</action>		
+			<result name="success" type="velocity-xml">
+				/dhis-web-maintenance-patient/responseSelDataElementList.vm</result>
+		</action>
 
 		<action name="showDataEntryForm"
 			class="org.hisp.dhis.patient.action.dataentryform.ShowDataEntryFormAction">
@@ -886,7 +923,8 @@
 
 		<action name="removePatientAttributeGroup"
 			class="org.hisp.dhis.patient.action.patientattributegroup.RemovePatientAttributeGroupAction">
-			<result name="success" type="velocity-json">/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
+			<result name="success" type="velocity-json">
+				/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
 			<param name="requiredAuthorities">F_PATIENTATTRIBUTE_DELETE</param>
 		</action>
 
@@ -925,9 +963,12 @@
 
 		<action name="validatePatientAttributeGroup"
 			class="org.hisp.dhis.patient.action.patientattributegroup.ValidatePatientAttributeGroupAction">
-			<result name="success" type="velocity-json">/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
-	  		<result name="error" type="velocity-json">/dhis-web-commons/ajax/jsonResponseError.vm</result>
-      		<result name="input" type="velocity-json">/dhis-web-commons/ajax/jsonResponseInput.vm</result>
+			<result name="success" type="velocity-json">
+				/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
+			<result name="error" type="velocity-json">
+				/dhis-web-commons/ajax/jsonResponseError.vm</result>
+			<result name="input" type="velocity-json">
+				/dhis-web-commons/ajax/jsonResponseInput.vm</result>
 			<param name="onExceptionReturn">plainTextError</param>
 		</action>
 		<!-- Patient Identifier Type -->
@@ -943,9 +984,12 @@
 
 		<action name="validatePatientIdentifierType"
 			class="org.hisp.dhis.patient.action.patientidentifiertype.ValidatePatientIdentifierTypeAction">
- 			<result name="success" type="velocity-json">/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
-	 		<result name="error" type="velocity-json">/dhis-web-commons/ajax/jsonResponseError.vm</result>
-     		<result name="input" type="velocity-json">/dhis-web-commons/ajax/jsonResponseInput.vm</result>
+			<result name="success" type="velocity-json">
+				/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
+			<result name="error" type="velocity-json">
+				/dhis-web-commons/ajax/jsonResponseError.vm</result>
+			<result name="input" type="velocity-json">
+				/dhis-web-commons/ajax/jsonResponseInput.vm</result>
 			<param name="onExceptionReturn">plainTextError</param>
 		</action>
 
@@ -978,8 +1022,10 @@
 
 		<action name="removePatientIdentifierType"
 			class="org.hisp.dhis.patient.action.patientidentifiertype.RemovePatientIdentifierTypeAction">
-			<result name="success" type="velocity-json">/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
-			<result name="error" type="velocity-json">/dhis-web-commons/ajax/jsonResponseError.vm</result>
+			<result name="success" type="velocity-json">
+				/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
+			<result name="error" type="velocity-json">
+				/dhis-web-commons/ajax/jsonResponseError.vm</result>
 			<param name="requiredAuthorities">F_PATIENTIDENTIFIERTYPE_DELETE</param>
 		</action>
 
@@ -1006,43 +1052,49 @@
 			<param name="menu">/dhis-web-maintenance-patient/patientAndProgramMenu.vm</param>
 			<param name="javascripts">javascript/caseaggregation.js</param>
 		</action>
-		
+
 		<action name="showAddCaseAggregationForm"
 			class="org.hisp.dhis.patient.action.caseaggregation.ShowCaseAggregationConditionFormAction">
 			<result name="success" type="velocity">/main.vm</result>
 			<param name="page">/dhis-web-maintenance-patient/addCaseAggregation.vm</param>
 			<param name="menu">/dhis-web-maintenance-patient/patientAndProgramMenu.vm</param>
-			<param name="javascripts">javascript/commons.js, javascript/caseaggregation.js</param>
+			<param name="javascripts">javascript/commons.js,
+				javascript/caseaggregation.js</param>
 		</action>
-		
+
 		<action name="showUpdateCaseAggregationForm"
 			class="org.hisp.dhis.patient.action.caseaggregation.ShowCaseAggregationConditionFormAction">
-			<result name="success" type="chain">updateCaseAggregationFormChain</result>
+			<result name="success" type="chain">updateCaseAggregationFormChain
+			</result>
 		</action>
-		
+
 		<action name="updateCaseAggregationFormChain"
 			class="org.hisp.dhis.patient.action.caseaggregation.GetCaseAggregationConditionAction">
 			<result name="success" type="velocity">/main.vm</result>
 			<param name="page">/dhis-web-maintenance-patient/updateCaseAggregation.vm</param>
 			<param name="menu">/dhis-web-maintenance-patient/patientAndProgramMenu.vm</param>
-			<param name="javascripts">javascript/commons.js, javascript/caseaggregation.js</param>
+			<param name="javascripts">javascript/commons.js,
+				javascript/caseaggregation.js</param>
 		</action>
-		
+
 		<action name="addCaseAggregation"
 			class="org.hisp.dhis.patient.action.caseaggregation.AddCaseAggregationConditionAction">
-			<result name="success" type="redirect">caseAggregation.action</result>
+			<result name="success" type="redirect">caseAggregation.action
+			</result>
 		</action>
 
 		<action name="updateCaseAggregation"
 			class="org.hisp.dhis.patient.action.caseaggregation.UpdateCaseAggregationConditionAction">
-			<result name="success" type="redirect">caseAggregation.action</result>
+			<result name="success" type="redirect">caseAggregation.action
+			</result>
 		</action>
-		
+
 		<action name="removeCaseAggregation"
 			class="org.hisp.dhis.patient.action.caseaggregation.RemoveCaseAggregationConditionAction">
-			<result name="success" type="velocity-json">/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
+			<result name="success" type="velocity-json">
+				/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
 		</action>
-		
+
 		<action name="getAggDataElements"
 			class="org.hisp.dhis.patient.action.caseaggregation.GetAggDataElementsAction">
 			<result name="success" type="velocity-xml">
@@ -1070,14 +1122,14 @@
 				/dhis-web-maintenance-patient/responseCaseAggregation.vm</result>
 			<param name="onExceptionReturn">plainTextError</param>
 		</action>
-		
+
 		<action name="getCaseAggregationDescription"
 			class="org.hisp.dhis.patient.action.caseaggregation.GetAggConditionDescriptionAction">
 			<result name="success" type="velocity">
 				/dhis-web-maintenance-patient/responseCaseAggDescription.vm</result>
 			<param name="onExceptionReturn">plainTextError</param>
 		</action>
-		
+
 		<!-- Validation - PatientValidationCriteria -->
 
 		<action name="validationCriteria"
@@ -1155,9 +1207,9 @@
 				validationCriteria.action</result>
 			<param name="requiredAuthorities">F_PROGRAM_UPDATE</param>
 		</action>
-		
+
 		<!-- Program Validation -->
-		
+
 		<action name="programValidation"
 			class="org.hisp.dhis.patient.action.validation.GetProgramValidationListAction">
 			<result name="success" type="velocity">/main.vm</result>
@@ -1166,7 +1218,7 @@
 			<param name="javascripts">javascript/programValidation.js</param>
 			<param name="requiredAuthorities">F_PROGRAM_VALIDATION</param>
 		</action>
-		
+
 		<action name="showAddProgramValidationForm"
 			class="org.hisp.dhis.patient.action.program.GetProgramAction">
 			<result name="success" type="velocity">/main.vm</result>
@@ -1175,13 +1227,14 @@
 			<param name="javascripts">javascript/programValidation.js</param>
 			<param name="requiredAuthorities">F_PROGRAM_VALIDATION</param>
 		</action>
-		
+
 		<action name="addProgramValidation"
 			class="org.hisp.dhis.patient.action.validation.AddProgramValidationAction">
-			<result name="success" type="redirect">programValidation.action?programId=${programId}</result>
+			<result name="success" type="redirect">
+				programValidation.action?programId=${programId}</result>
 			<param name="requiredAuthorities">F_PROGRAM_VALIDATION</param>
 		</action>
-		
+
 		<action name="showUpdateProgramValidationForm"
 			class="org.hisp.dhis.patient.action.validation.GetProgramValidationAction">
 			<result name="success" type="velocity">/main.vm</result>
@@ -1190,19 +1243,21 @@
 			<param name="javascripts">javascript/programValidation.js</param>
 			<param name="requiredAuthorities">F_PROGRAM_VALIDATION</param>
 		</action>
-		
+
 		<action name="updateProgramValidation"
 			class="org.hisp.dhis.patient.action.validation.UpdateProgramValidationAction">
-			<result name="success" type="redirect">programValidation.action?programId=${programId}</result>
+			<result name="success" type="redirect">
+				programValidation.action?programId=${programId}</result>
 			<param name="requiredAuthorities">F_PROGRAM_VALIDATION</param>
 		</action>
-		
+
 		<action name="removeProgramValidation"
 			class="org.hisp.dhis.patient.action.validation.RemoveProgramValidationAction">
-			<result name="success" type="velocity-json">/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
+			<result name="success" type="velocity-json">
+				/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
 			<param name="requiredAuthorities">F_PROGRAM_VALIDATION</param>
 		</action>
-		
+
 		<action name="getProgramValidation"
 			class="org.hisp.dhis.patient.action.validation.GetProgramValidationAction">
 			<result name="success" type="velocity-xml">
@@ -1211,7 +1266,7 @@
 		</action>
 
 		<!-- Configuration -->
-		
+
 		<action name="configuration"
 			class="org.hisp.dhis.patient.action.configuration.GetPatientExcelItemplateFileAction">
 			<result name="success" type="velocity">/main.vm</result>
@@ -1219,21 +1274,21 @@
 			<param name="menu">/dhis-web-maintenance-patient/importMenu.vm</param>
 			<param name="javascripts">javascript/import.js</param>
 		</action>
-		
+
 		<action name="saveConfiguration"
 			class="org.hisp.dhis.patient.action.configuration.SetPatientExcelItemplateFileAction">
 			<result name="success" type="velocity-json">
 				/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
 		</action>
-		
+
 		<!-- Import Action -->
-		
-		<action name="importPatientForm"
-			class="org.hisp.dhis.patient.action.NoAction">
+
+		<action name="importPatientForm" class="org.hisp.dhis.patient.action.NoAction">
 			<result name="success" type="velocity">/main.vm</result>
 			<param name="page">/dhis-web-maintenance-patient/importPatientParams.vm</param>
 			<param name="menu">/dhis-web-maintenance-patient/importMenu.vm</param>
-			<param name="javascripts">../dhis-web-commons/javascripts/ajaxfileupload.js, javascript/import.js</param>
+			<param name="javascripts">../dhis-web-commons/javascripts/ajaxfileupload.js,
+				javascript/import.js</param>
 		</action>
 
 		<action name="validateUploadExcelFile"
@@ -1247,38 +1302,43 @@
 
 		<action name="importPatient"
 			class="org.hisp.dhis.patient.action.patientimport.UploadExcelFileAction">
-			<result name="success" type="chain">importPatientChain</result>
-			<result name="error" type="redirect">importPatientForm.action</result>
+			<result name="success" type="chain">importPatientChain
+			</result>
+			<result name="error" type="redirect">importPatientForm.action
+			</result>
 			<interceptor-ref name="fileUploadStack" />
 		</action>
-		
+
 		<action name="importPatientChain"
 			class="org.hisp.dhis.patient.action.patientimport.ImportPatientAction">
-			<result name="success" type="chain">importPatientResult</result>
-			<result name="error" type="redirect">importPatientResult</result>
+			<result name="success" type="chain">importPatientResult
+			</result>
+			<result name="error" type="redirect">importPatientResult
+			</result>
 		</action>
-		
-		<action name="importPatientResult"
-			class="org.hisp.dhis.patient.action.NoAction">
+
+		<action name="importPatientResult" class="org.hisp.dhis.patient.action.NoAction">
 			<result name="success" type="velocity">/main.vm</result>
 			<param name="page">/dhis-web-maintenance-patient/importPatientResult.vm</param>
 			<param name="menu">/dhis-web-maintenance-patient/importMenu.vm</param>
-			<param name="javascripts">../dhis-web-commons/javascripts/ajaxfileupload.js, javascript/import.js</param>
+			<param name="javascripts">../dhis-web-commons/javascripts/ajaxfileupload.js,
+				javascript/import.js</param>
 		</action>
-		
+
 		<!-- Patient Mobile Setting Action -->
-		
+
 		<action name="patientMobileSetting"
 			class="org.hisp.dhis.patient.action.mobilesetting.ShowMobileSettingFormAction">
 			<result name="success" type="velocity">/main.vm</result>
 			<param name="page">/dhis-web-maintenance-patient/showPatientMobileSetting.vm</param>
 			<param name="menu">/dhis-web-maintenance-patient/patientAndProgramMenu.vm</param>
 		</action>
-		
+
 		<action name="editPatientMobileSetting"
 			class="org.hisp.dhis.patient.action.mobilesetting.UpdateMobileSettingAction">
-			<result name="success" type="redirect">patientMobileSetting.action</result>
+			<result name="success" type="redirect">patientMobileSetting.action
+			</result>
 		</action>
-		
+
 	</package>
 </struts>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/patient.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/patient.js	2011-04-26 02:06:38 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/patient.js	2011-05-04 05:39:48 +0000
@@ -1,7 +1,28 @@
 
 function organisationUnitSelected( orgUnits )
 {		
-    window.location.href = 'patient.action';    
+	$.getJSON( 'organisationUnitHasPatients.action?orgunitId=' + orgUnits[0], function( json ) 
+	{
+		var type = json.response;
+		
+		if( type == 'success' )
+		{
+			showLoader();
+			
+			var url = 'patientform.action';
+			$('#patientListDiv').load(url);
+			hideById('selectPatientDiv');
+			showById('patientListDiv');
+			
+			hideLoader();
+		}
+		else if( type == 'input' )
+		{
+			setInnerHTML('warnmessage', i18n_can_not_register_patient_for_orgunit);
+			showById('selectPatientDiv');
+			hideById('patientListDiv');
+		}
+	} );
 }
 
 selection.setListenerFunction( organisationUnitSelected );

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/patient.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/patient.vm	2011-04-26 02:06:38 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/patient.vm	2011-05-04 05:39:48 +0000
@@ -1,26 +1,31 @@
-<h3>$i18n.getString( "patient_management" )</h3>
+<table>
+		
+	<tr>
+		<td><label>$i18n.getString( "registering_unit" )</label></td>
+		<td><input type="text" readonly="readonly" value="$encoder.htmlEncode( $organisationUnit.name )" style="min-width:22em"></td>
+		<td>&nbsp;</td>
+		<td><input type="button" id='listAllPatientsBtn' value="$i18n.getString( 'list_all_patients' )" onclick="loadAllPatients();"></td>
+	</tr>
+	
+	<tr>
+		<td></td>
+		<td><i><span id='warnmessage' style='color: red;'></span></i> </td>
+	</tr>
 
-<table>    
-    <tr>
-        <td><label>$i18n.getString( "registering_unit" )</label></td>
-        <td><input type="text" readonly="readonly" #if( $organisationUnit ) value="$encoder.htmlEncode( $organisationUnit.name )" #else value="[$i18n.getString( "please_select_village" )]" #end style="min-width:22em"></td>
-        <td>&nbsp;</td>
-        <td><input type="button" value="$i18n.getString( "list_all_patients" )" onclick="loadAllPatients();"></td>
-    </tr>
 </table>
 
 <hr style="clear:both">
-
+	
 <table>	
 	<tr>	       
 		<td>
 		  <select id="searchingAttributeId" name="searchingAttributeId" style="min-width:20.2em"  #if( $patientAttributes.size() == 0 ) disabled="disabled" #end onchange="searchingAttributeOnChange()">
-            <option value="">$i18n.getString( "search_by_name_identifier" )</option>
+			<option value="">$i18n.getString( "search_by_name_identifier" )</option>
 			<option value="0" #if( $!searchingAttributeId && $!searchingAttributeId=='0' ) selected="selected" #end>$i18n.getString( "search_by_program" )</option>
-                #foreach( $attribute in $patientAttributes )
-                    <option value="$attribute.id" #if( $!searchingAttributeId && $!attribute.id == $!searchingAttributeId ) selected="selected" #end>$encoder.htmlEncode( $attribute.name )</option>
-                #end
-          </select> 
+				#foreach( $attribute in $patientAttributes )
+					<option value="$attribute.id" #if( $!searchingAttributeId && $!attribute.id == $!searchingAttributeId ) selected="selected" #end>$encoder.htmlEncode( $attribute.name )</option>
+				#end
+		  </select> 
 		  <em title="$i18n.getString( "required" )" class="required">*</em></label>
 		</td>		
 		<td>
@@ -42,7 +47,7 @@
 	
 	<tr>
 		<td></td>
-        <td>
+		<td>
 		<select id="sortPatientAttributeId" name="sortPatientAttributeId" maxlength="30" style="width:20.2em" onchange="validateSearchPatient()">
 				<option value="">[ $i18n.getString( "sort_by" ) ]</option>
 				#foreach( $patientAttribute in $patientAttributes )
@@ -50,7 +55,7 @@
 				#end
 			</select>
 		</td>
-    </tr>
+	</tr>
 	
 </table>
 
@@ -63,9 +68,5 @@
 <div id='contentDiv'></div>
 
 <script type="text/javascript">
-
 	var i18n_none = '$encoder.jsEscape( $i18n.getString( "none" ) , "'")';
-
-	searchPatientsbyBackBtn();
-	
 </script>
\ 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/selectPatient.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/selectPatient.vm	2011-02-16 02:55:58 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/selectPatient.vm	2011-05-04 05:39:48 +0000
@@ -2,20 +2,30 @@
 
 <form id="selectPatient" name="selectPatient" method="post" action="patient.action">
 
-<table>
-	
-	<tr>
-		<td><label>$i18n.getString( "registering_unit" )</label></td>
-		<td><input type="text" readonly="readonly" #if( $organisationUnit ) value="$encoder.htmlEncode( $organisationUnit.name )" #else value="[$i18n.getString( "please_select_village" )]" #end style="min-width:350px"> </td>
-	</tr>
-	
-	<tr>
-		<td></td>
-		<td> <span class='warnmessage'> $i18n.getString( $!message ) </span> </td>
-	</tr>
-
-</table>
+	<div id='selectPatientDiv'>
+		<table>
+			
+			<tr>
+				<td><label>$i18n.getString( "registering_unit" )</label></td>
+				<td><input type="text" readonly="readonly" value="[$i18n.getString( 'please_select_village' )]" style="min-width:22em"></td>
+				<td>&nbsp;</td>
+				<td><input type="button" value="$i18n.getString( 'list_all_patients' )" disabled></td>
+			</tr>
+			
+			<tr>
+				<td></td>
+				<td><i><span id='warnmessage' style='color: red;'></span></i> </td>
+			</tr>
+
+		</table>
+
+		<hr style="clear:both">
+	</div>
+
+	<div id='patientListDiv'></div>
 
 </form>
 
-<hr style="clear:both">
+<script>
+	var i18n_can_not_register_patient_for_orgunit = '$encoder.jsEscape( $i18n.getString( "can_not_register_patient_for_orgunit" ), "'")';	
+</script>
\ No newline at end of file