← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2510: Merging Firstname Middle name Last name on GUI.

 

------------------------------------------------------------
revno: 2510
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2011-01-11 08:56:03 +0700
message:
  Merging Firstname Middle name Last name on GUI.
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/Patient.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientStore.java
  dhis-2/dhis-services/dhis-service-patient/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patient/hibernate/Patient.hbm.xml
  dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/StatementBuilder.java
  dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/DerbyStatementBuilder.java
  dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/H2StatementBuilder.java
  dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/MySQLStatementBuilder.java
  dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/PostgreSQLStatementBuilder.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/AddPatientAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/AddRepresentativeAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/GetPatientsByNameAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/SearchPatientAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/ShowAddPatientFormAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/UpdatePatientAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/ValidatePatientAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/relationship/AddRelationshipPatientAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/relationship/ValidateAddRelationshipPatientAction.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/resources/struts.xml
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addRelationshipPatientForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/commons.js
  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/relationshipPatient.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/underage.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/resultSearchPatients.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/style/basic.css
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/underAgeForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientForm.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-api/src/main/java/org/hisp/dhis/patient/Patient.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/Patient.java	2010-12-28 03:11:15 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/Patient.java	2011-01-11 01:56:03 +0000
@@ -62,8 +62,6 @@
 
     private String lastName;
 
-    private String fullName;
-
     private String gender;
 
     private Date birthDate;
@@ -452,14 +450,9 @@
     // Getter && Setter
     // -------------------------------------------------------------------------
 
-    public void setFullName( String fullName )
-    {
-        this.fullName = fullName;
-    }
-
     public String getFullName()
     {
-        return fullName;
+        return firstName + " " + middleName + " " + lastName;
     }
 
     public String getBloodGroup()

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientStore.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientStore.java	2010-12-27 07:59:27 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientStore.java	2011-01-11 01:56:03 +0000
@@ -27,9 +27,15 @@
 
 package org.hisp.dhis.patient.hibernate;
 
+import java.sql.ResultSet;
+import java.sql.Statement;
 import java.util.Collection;
 import java.util.Date;
+import java.util.HashSet;
+import java.util.Set;
 
+import org.amplecode.quick.StatementHolder;
+import org.amplecode.quick.StatementManager;
 import org.apache.commons.lang.StringUtils;
 import org.hibernate.Criteria;
 import org.hibernate.Query;
@@ -38,6 +44,7 @@
 import org.hibernate.criterion.Projections;
 import org.hibernate.criterion.Restrictions;
 import org.hisp.dhis.hibernate.HibernateGenericStore;
+import org.hisp.dhis.jdbc.StatementBuilder;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.patient.Patient;
 import org.hisp.dhis.patient.PatientStore;
@@ -53,6 +60,29 @@
     extends HibernateGenericStore<Patient>
     implements PatientStore
 {
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private StatementBuilder statementBuilder;
+
+    public void setStatementBuilder( StatementBuilder statementBuilder )
+    {
+        this.statementBuilder = statementBuilder;
+    }
+
+    private StatementManager statementManager;
+
+    public void setStatementManager( StatementManager statementManager )
+    {
+        this.statementManager = statementManager;
+    }
+    
+    // -------------------------------------------------------------------------
+    // Implementation methods
+    // -------------------------------------------------------------------------
+
+
     @SuppressWarnings( "unchecked" )
     public Collection<Patient> get( Boolean isDead )
     {
@@ -71,16 +101,40 @@
         return getCriteria( Restrictions.eq( "birthDate", birthDate ) ).list();
     }
 
-    @SuppressWarnings( "unchecked" )
     public Collection<Patient> getByNames( String name )
     {
-//        String hql = "From Patient p where lower( p.firstName + ' ' + p.middleName + ' ' + p.lastName ) like :name order by p.id";
-//
-//        return getQuery( hql ).setString( "name", "%" + name + "%" ).list();
+        String sql = statementBuilder.getPatientsByFullName( name );
+
+        StatementHolder holder = statementManager.getHolder();
+
+        Set<Patient> patients = new HashSet<Patient>();
+
+        try
+        {
+            Statement statement = holder.getStatement();
+
+            ResultSet resultSet = statement.executeQuery( sql );
+
+            while ( resultSet.next() )
+            {
+                Patient p = get( resultSet.getInt( 1 ) ) ;
+                patients.add( p );
+            }
+        }
+        catch ( Exception ex )
+        {
+            ex.printStackTrace();
+        }
+        finally
+        {
+            holder.close();
+        }
+
+        return patients;
         
-         return getCriteria(
-            Restrictions.disjunction().add( Restrictions.ilike( "fullName", "%" + name + "%") ) ).addOrder(
-            Order.asc( "firstName" ) ).list();
+//         return getCriteria(
+//            Restrictions.disjunction().add( Restrictions.ilike( "fullName", "%" + name + "%") ) ).addOrder(
+//            Order.asc( "firstName" ) ).list();
     }
 
     @SuppressWarnings( "unchecked" )
@@ -146,11 +200,30 @@
 
     public int countGetPatientsByName( String name )
     {
-        Number rs = (Number) getCriteria(
-            Restrictions.ilike( "fullName", "%" + name + "%") ).setProjection( Projections.rowCount() )
-            .uniqueResult();
-
-        return rs != null ? rs.intValue() : 0;
+        String sql = statementBuilder.countPatientsByFullName( name );
+        StatementHolder holder = statementManager.getHolder();
+        
+        try
+        {
+            Statement statement = holder.getStatement();
+
+            ResultSet resultSet = statement.executeQuery( sql );
+
+            if ( resultSet.next() )
+            {
+                return resultSet.getInt( 1 );
+            }
+        }
+        catch ( Exception ex )
+        {
+            ex.printStackTrace();
+        }
+        finally
+        {
+            holder.close();
+        }
+
+        return 0;
     }
 
     @Override

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-patient/src/main/resources/META-INF/dhis/beans.xml	2010-12-01 08:10:28 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/META-INF/dhis/beans.xml	2011-01-11 01:56:03 +0000
@@ -52,6 +52,8 @@
 	<bean id="org.hisp.dhis.patient.PatientStore" class="org.hisp.dhis.patient.hibernate.HibernatePatientStore">
 		<property name="clazz" value="org.hisp.dhis.patient.Patient" />
 		<property name="sessionFactory" ref="sessionFactory" />
+		<property name="statementManager" ref="statementManager"/>
+		<property name="statementBuilder" ref="statementBuilder"/>
 	</bean>
 
 	<bean id="org.hisp.dhis.patient.PatientIdentifierStore"

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patient/hibernate/Patient.hbm.xml'
--- dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patient/hibernate/Patient.hbm.xml	2011-01-07 11:37:47 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patient/hibernate/Patient.hbm.xml	2011-01-11 01:56:03 +0000
@@ -15,8 +15,6 @@
 		<property name="middleName" column="middlename" length="50" />
 
 		<property name="lastName" column="lastname" length="50" />
-		
-		<property name="fullName" formula="concat(firstname, lastname)"/>
 
 		<property name="birthDate" column="birthdate" not-null="true"/>
 		

=== modified file 'dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/StatementBuilder.java'
--- dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/StatementBuilder.java	2010-11-30 09:29:57 +0000
+++ dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/StatementBuilder.java	2011-01-11 01:56:03 +0000
@@ -143,4 +143,8 @@
     String deleteOldestOverlappingPatientDataValue();
     
     String deleteOldestOverlappingPatientArchiveData();
+    
+    String getPatientsByFullName( String fullName );
+    
+    String countPatientsByFullName( String fullName );
 }

=== modified file 'dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/DerbyStatementBuilder.java'
--- dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/DerbyStatementBuilder.java	2010-11-30 09:29:57 +0000
+++ dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/DerbyStatementBuilder.java	2011-01-11 01:56:03 +0000
@@ -344,4 +344,18 @@
                "AND d.categoryoptioncomboid=a.categoryoptioncomboid " +
                "AND a.timestamp<=d.timestamp;";
    }
+   
+   public String getPatientsByFullName( String fullName )
+   {
+       return "SELECT patientid FROM patient " +
+               "where lower( firstname || ' ' || middleName || ' ' || lastname) " +
+               "like lower('%" + fullName + "%') ";
+   }
+   
+   public String countPatientsByFullName( String fullName )
+   {
+       return "SELECT count(patientid) FROM patient " +
+       "where lower( firstname || ' ' || middleName || ' ' || lastname) " +
+       "like lower('%" + fullName + "%')";
+   }
 }

=== modified file 'dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/H2StatementBuilder.java'
--- dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/H2StatementBuilder.java	2010-11-30 09:29:57 +0000
+++ dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/H2StatementBuilder.java	2011-01-11 01:56:03 +0000
@@ -350,4 +350,19 @@
                 "AND d.categoryoptioncomboid=a.categoryoptioncomboid " +
                 "AND a.timestamp<=d.timestamp;";
     }
+    
+    public String getPatientsByFullName( String fullName )
+    {
+        return "SELECT patientid, birthdate, deathdate, registrationdate, isdead, bloodgroup, " +
+                "gender, dobType, firstname, middlename, lastname FROM patient " +
+                "where lower( firstname || ' ' || middleName || ' ' || lastname) " +
+                "like lower('%" + fullName + "%') ";
+    }
+    
+    public String countPatientsByFullName( String fullName )
+    {
+        return "SELECT count(patientid) FROM patient " +
+        "where lower( firstname || ' ' || middleName || ' ' || lastname) " +
+        "like lower('%" + fullName + "%')";
+    }
 }

=== modified file 'dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/MySQLStatementBuilder.java'
--- dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/MySQLStatementBuilder.java	2010-11-30 09:29:57 +0000
+++ dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/MySQLStatementBuilder.java	2011-01-11 01:56:03 +0000
@@ -344,4 +344,18 @@
                "AND d.categoryoptioncomboid=a.categoryoptioncomboid " +
                "AND a.timestamp<=d.timestamp;";
    }
+   
+   public String getPatientsByFullName( String fullName )
+   {
+       return "SELECT patientid FROM patient " +
+               "where lower(concat( firstname, \" \",middleName , \" \" , lastname) ) " +
+               "like lower('%" + fullName + "%')";
+   }
+   
+   public String countPatientsByFullName( String fullName )
+   {
+       return "SELECT count(patientid) FROM patient " +
+               "where lower(concat( firstname, \" \",middleName , \" \" , lastname) ) " +
+               "like lower('%" + fullName + "%')";
+   }
 }

=== modified file 'dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/PostgreSQLStatementBuilder.java'
--- dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/PostgreSQLStatementBuilder.java	2010-12-10 18:19:17 +0000
+++ dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/PostgreSQLStatementBuilder.java	2011-01-11 01:56:03 +0000
@@ -344,4 +344,18 @@
                 "AND d.categoryoptioncomboid=a.categoryoptioncomboid " +
                 "AND a.timestamp<=d.timestamp;";
     }
+    
+    public String getPatientsByFullName( String fullName )
+    {
+        return "SELECT patientid FROM patient " +
+                "where lower( firstname || ' ' || middleName || ' ' || lastname) " +
+                "like lower('%" + fullName + "%')";
+    }
+    
+    public String countPatientsByFullName( String fullName )
+    {
+        return "SELECT count(patientid) FROM patient " +
+        "where lower( firstname || ' ' || middleName || ' ' || lastname) " +
+        "like lower('%" + fullName + "%')";
+    }
 }

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/AddPatientAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/AddPatientAction.java	2010-12-28 03:11:15 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/AddPatientAction.java	2011-01-11 01:56:03 +0000
@@ -91,12 +91,8 @@
     // -------------------------------------------------------------------------
     // Input - name
     // -------------------------------------------------------------------------
-    
-    private String firstName;
-
-    private String middleName;
-
-    private String lastName;
+
+    private String fullName;
 
     // -------------------------------------------------------------------------
     // Input - demographics
@@ -105,11 +101,11 @@
     private String birthDate;
 
     private char ageType;
-    
+
     private Integer age;
 
     private Character dobType;
-    
+
     private String gender;
 
     private String bloodGroup;
@@ -161,24 +157,54 @@
 
         patient = new Patient();
 
-        patient.setFirstName( firstName.trim() );
-        patient.setMiddleName( middleName.trim() );
-        patient.setLastName( lastName.trim() );
+        // ---------------------------------------------------------------------
+        // Set FirstName, MiddleName, LastName by FullName
+        // ---------------------------------------------------------------------
+        
+        fullName = fullName.trim();
+        
+        int startIndex = fullName.indexOf( ' ' );
+        int endIndex = fullName.lastIndexOf( ' ' );
+
+        String name = fullName.substring( 0, startIndex );
+        patient.setFirstName( name );
+
+        if ( startIndex == endIndex )
+        {
+            patient.setMiddleName( "" );
+            
+            name = fullName.substring( startIndex, fullName.length() );
+            patient.setLastName( name );
+        }
+        else
+        {
+            name = fullName.substring( startIndex + 1, endIndex );
+            patient.setMiddleName( name );
+            
+            name = fullName.substring( endIndex, fullName.length() );
+            patient.setLastName( name );
+        }
+        
+       
+        // ---------------------------------------------------------------------
+        // Set Other information for patient
+        // ---------------------------------------------------------------------
+
         patient.setGender( gender );
         patient.setBloodGroup( bloodGroup );
         patient.setUnderAge( underAge );
         patient.setOrganisationUnit( organisationUnit );
 
-        if ( dobType == Patient.DOB_TYPE_VERIFIED || dobType == Patient.DOB_TYPE_DECLARED)
+        if ( dobType == Patient.DOB_TYPE_VERIFIED || dobType == Patient.DOB_TYPE_DECLARED )
         {
             birthDate = birthDate.trim();
             patient.setBirthDate( format.parseDate( birthDate ) );
         }
         else
         {
-           patient.setBirthDateFromAge( age.intValue(), ageType );
+            patient.setBirthDateFromAge( age.intValue(), ageType );
         }
-        
+
         patient.setDobType( dobType );
 
         patient.setRegistrationDate( new Date() );
@@ -199,7 +225,7 @@
         {
             for ( PatientIdentifierType identifierType : identifierTypes )
             {
-                if (  identifierType.getFormat()!= null && identifierType.getFormat().equals( "State Format" ) )
+                if ( identifierType.getFormat() != null && identifierType.getFormat().equals( "State Format" ) )
                 {
                     value = request.getParameter( "progcode" ) + request.getParameter( "yearcode" )
                         + request.getParameter( "benicode" );
@@ -347,19 +373,9 @@
         this.patientAttributeService = patientAttributeService;
     }
 
-    public void setFirstName( String firstName )
-    {
-        this.firstName = firstName;
-    }
-
-    public void setMiddleName( String middleName )
-    {
-        this.middleName = middleName;
-    }
-
-    public void setLastName( String lastName )
-    {
-        this.lastName = lastName;
+    public void setFullName( String fullName )
+    {
+        this.fullName = fullName;
     }
 
     public void setAge( Integer age )

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/AddRepresentativeAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/AddRepresentativeAction.java	2010-12-28 03:11:15 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/AddRepresentativeAction.java	2011-01-11 01:56:03 +0000
@@ -68,12 +68,8 @@
     // -------------------------------------------------------------------------
     // Input - name
     // -------------------------------------------------------------------------
-  
-    private String firstName;
-
-    private String middleName;
-
-    private String lastName;
+
+    private String fullName;
 
     // -------------------------------------------------------------------------
     // Input - demographics
@@ -114,9 +110,38 @@
 
         patient = new Patient();
 
-        patient.setFirstName( firstName.trim() );
-        patient.setMiddleName( middleName.trim() );
-        patient.setLastName( lastName.trim() );
+        // ---------------------------------------------------------------------
+        // Get FirstName, MiddleName, LastName by FullName
+        // ---------------------------------------------------------------------
+
+        int startIndex = fullName.indexOf( ' ' );
+        int endIndex = fullName.lastIndexOf( ' ' );
+
+        String name = fullName.substring( 0, startIndex );
+        patient.setFirstName( name );
+
+        if ( startIndex == endIndex )
+        {
+            patient.setMiddleName( "" );
+            
+            name = fullName.substring( startIndex, fullName.length() );
+            patient.setLastName( name );
+        }
+        else
+        {
+            name = fullName.substring( startIndex + 1, endIndex );
+            patient.setMiddleName( name );
+            
+            name = fullName.substring( endIndex, fullName.length() );
+            patient.setLastName( name );
+        }
+        
+        patient.setLastName( fullName.substring( endIndex, fullName.length() ) );
+
+        // ---------------------------------------------------------------------
+        // Get Other information for patient
+        // ---------------------------------------------------------------------
+
         patient.setGender( gender );
         patient.setBloodGroup( bloodGroup );
         patient.setOrganisationUnit( organisationUnit );
@@ -229,21 +254,11 @@
         this.selectionManager = selectionManager;
     }
 
-    public void setFirstName( String firstName )
-    {
-        this.firstName = firstName;
-    }
-
-    public void setMiddleName( String middleName )
-    {
-        this.middleName = middleName;
-    }
-
-    public void setLastName( String lastName )
-    {
-        this.lastName = lastName;
-    }
-
+    public void setFullName( String fullName )
+    {
+        this.fullName = fullName;
+    }
+    
     public void setAge( Integer age )
     {
         this.age = age;

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/GetPatientsByNameAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/GetPatientsByNameAction.java	2010-12-27 07:59:27 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/GetPatientsByNameAction.java	2011-01-11 01:56:03 +0000
@@ -52,11 +52,7 @@
     // Input/Output
     // -------------------------------------------------------------------------
 
-    private String firstName;
-
-    private String middleName;
-
-    private String lastName;
+    private String fullName;
 
     private List<Patient> patients;
 
@@ -69,21 +65,11 @@
         this.patientService = patientService;
     }
 
-    public void setFirstName( String firstName )
-    {
-        this.firstName = firstName;
-    }
-
-    public void setMiddleName( String middleName )
-    {
-        this.middleName = middleName;
-    }
-
-    public void setLastName( String lastName )
-    {
-        this.lastName = lastName;
-    }
-
+    public void setFullName( String fullName )
+    {
+        this.fullName = fullName;
+    }
+    
     public List<Patient> getPatients()
     {
         return patients;
@@ -95,8 +81,6 @@
 
     public String execute()
     {
-        String fullName = StringUtils.join( new String[] { firstName, middleName, lastName }, ' ' );
-        
         patients = new ArrayList<Patient>( patientService.getPatients( fullName ) );
 
         return SUCCESS;

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/SearchPatientAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/SearchPatientAction.java	2010-12-27 07:59:27 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/SearchPatientAction.java	2011-01-11 01:56:03 +0000
@@ -203,6 +203,9 @@
     public String execute()
         throws Exception
     {
+        System.out.println("\n\n ============ \n sortPatientAttributeId : " + sortPatientAttributeId);       
+        System.out.println("\n searchingAttributeId : " + searchingAttributeId);       
+
         // ---------------------------------------------------------------------
         // Get all of Patient-Attributes
         // ---------------------------------------------------------------------
@@ -214,7 +217,6 @@
         // ---------------------------------------------------------------------
 
         PatientAttribute sortingPatientAttribute = null;
-        
         if ( sortPatientAttributeId != null )
         {
             sortingPatientAttribute = patientAttributeService.getPatientAttribute( sortPatientAttributeId );
@@ -235,7 +237,7 @@
         // ---------------------------------------------------------------------
         
         if ( listAll || ( searchText != null && searchText.equalsIgnoreCase( LIST_ALL_PATIENT ) ) )
-        {
+        {System.out.println("\n 1");
             searchText = LIST_ALL_PATIENT;
             
             OrganisationUnit organisationUnit = selectionManager.getSelectedOrganisationUnit();
@@ -250,14 +252,14 @@
         // ---------------------------------------------------------------------
 
         else if ( searchingPatientAttribute != null && searchText != null )
-        {
+        {System.out.println("\n 2");
             searchPatientByAttribute( searchingPatientAttribute, searchText, sortingPatientAttribute );
         }
         else if ( searchingPatientAttribute == null && searchText != null )
-        {
+        {System.out.println("\n 3");
             searchPatientByAttribute( searchText, sortingPatientAttribute );
         }
-        
+        System.out.println("\n 4");
         return SUCCESS;
 
     }
@@ -341,10 +343,14 @@
 
     private void searchPatientByAttribute( String searchText, PatientAttribute sortingPatientAttribute )
     {
+System.out.println("\n\n *********** \n 1 ");
         total = patientService.countGetPatients( searchText );
+System.out.println("\n total : " + total );
         this.paging = createPaging( total );
+System.out.println("\n paging.getStartPos() : " + paging.getStartPos() );
+System.out.println("\n paging.getPageSize() : " + paging.getPageSize() );
         patients = patientService.getPatients( searchText, paging.getStartPos(), paging.getPageSize() );
-
+System.out.println("\n patients : " + patients );
         if ( patients != null && patients.size() > 0 )
         {
             if ( sortPatientAttributeId != null && sortingPatientAttribute != null )

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/ShowAddPatientFormAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/ShowAddPatientFormAction.java	2010-11-09 02:09:53 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/ShowAddPatientFormAction.java	2011-01-11 01:56:03 +0000
@@ -37,7 +37,6 @@
 import org.hisp.dhis.patient.PatientAttributeGroup;
 import org.hisp.dhis.patient.PatientAttributeGroupService;
 import org.hisp.dhis.patient.PatientAttributeService;
-import org.hisp.dhis.patient.PatientIdentifierService;
 import org.hisp.dhis.patient.PatientIdentifierType;
 import org.hisp.dhis.patient.PatientIdentifierTypeService;
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/UpdatePatientAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/UpdatePatientAction.java	2010-11-29 05:40:21 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/UpdatePatientAction.java	2011-01-11 01:56:03 +0000
@@ -88,11 +88,8 @@
     // -------------------------------------------------------------------------
     // Input - name
     // -------------------------------------------------------------------------
-    private String firstName;
-
-    private String middleName;
-
-    private String lastName;
+   
+    private String fullName;
 
     // -------------------------------------------------------------------------
     // Input - demographics
@@ -131,13 +128,43 @@
         OrganisationUnit organisationUnit = selectionManager.getSelectedOrganisationUnit();
 
         // ---------------------------------------------------------------------
-        // Update patient
+        // Get patient by Id
         // ---------------------------------------------------------------------
 
         patient = patientService.getPatient( id );
-        patient.setFirstName( firstName );
-        patient.setMiddleName( middleName );
-        patient.setLastName( lastName );
+     
+        // ---------------------------------------------------------------------
+        // Set FirstName, MiddleName, LastName by FullName
+        // ---------------------------------------------------------------------
+
+        int startIndex = fullName.indexOf( ' ' );
+        int endIndex = fullName.lastIndexOf( ' ' );
+        
+        String name = fullName.substring( 0, startIndex );
+        patient.setFirstName( name);
+        
+        if ( startIndex == endIndex )
+        {
+            patient.setMiddleName( "" );
+            
+            name = fullName.substring( startIndex, fullName.length() );
+            patient.setLastName( name );
+        }
+        else
+        {
+            name = fullName.substring( startIndex + 1, endIndex );
+            patient.setMiddleName( name );
+            
+            name = fullName.substring( endIndex, fullName.length() );
+            patient.setLastName( name );
+        }
+        
+        patient.setLastName( fullName.substring( endIndex, fullName.length() ) );
+    
+        // ---------------------------------------------------------------------
+        // Set Other information for patient
+        // ---------------------------------------------------------------------
+
         patient.setGender( gender );
         patient.setUnderAge( underAge );
         patient.setOrganisationUnit( organisationUnit );
@@ -341,19 +368,9 @@
         this.id = id;
     }
 
-    public void setFirstName( String firstName )
-    {
-        this.firstName = firstName;
-    }
-
-    public void setMiddleName( String middleName )
-    {
-        this.middleName = middleName;
-    }
-
-    public void setLastName( String lastName )
-    {
-        this.lastName = lastName;
+    public void setFullName( String fullName )
+    {
+        this.fullName = fullName;
     }
 
     public void setBirthDate( String birthDate )

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/ValidatePatientAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/ValidatePatientAction.java	2010-12-28 03:11:15 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/ValidatePatientAction.java	2011-01-11 01:56:03 +0000
@@ -79,11 +79,7 @@
     // Input
     // -------------------------------------------------------------------------
 
-    private String firstName;
-
-    private String middleName;
-
-    private String lastName;
+    private String fullName;
 
     private Character dobType;
 
@@ -137,34 +133,6 @@
             return INPUT;
         }
 
-        if ( firstName == null && middleName == null && lastName == null )
-        {
-            message = i18n.getString( "specfiy_name_s" );
-
-            return INPUT;
-        }
-
-        if ( firstName != null )
-        {
-            firstName = firstName.trim();
-        }
-
-        if ( middleName != null )
-        {
-            middleName = middleName.trim();
-        }
-
-        if ( lastName != null )
-        {
-            lastName = lastName.trim();
-        }
-        if ( firstName.length() == 0 && middleName.length() == 0 && lastName.length() == 0 )
-        {
-            message = i18n.getString( "specfiy_name_s" );
-
-            return INPUT;
-        }
-
         if ( age == null && birthDate == null )
         {
             message = i18n.getString( "specfiy_birth_date_or_age" );
@@ -186,6 +154,36 @@
             }
         }
 
+        fullName = fullName.trim();
+        
+        if( fullName.indexOf( ' ' )== -1 )
+        {
+            message = i18n.getString( "please_enter_a_valid_full_name" );
+
+            return INPUT;
+        }
+        // ---------------------------------------------------------------------
+        // Check duplicate by FirstName, MiddleName, LastName, Birthday, Gender
+        // ---------------------------------------------------------------------
+
+        int startIndex = fullName.indexOf( ' ' );
+        int endIndex = fullName.lastIndexOf( ' ' );
+        
+        String firstName = fullName.substring( 0, startIndex );        
+        String middleName = "";
+        String lastName = "";
+        
+        if ( startIndex == endIndex )
+        {
+            middleName = "";
+            lastName = fullName.substring( startIndex, fullName.length() );
+        }
+        else
+        {
+            middleName = fullName.substring( startIndex + 1, endIndex );
+            lastName = fullName.substring( endIndex, fullName.length() );
+        }
+        
         if ( !checkedDuplicate )
         {
             // Check duplication name, birthdate, gender
@@ -339,19 +337,9 @@
         this.patientAttributeValueService = patientAttributeValueService;
     }
 
-    public void setFirstName( String firstName )
-    {
-        this.firstName = firstName;
-    }
-
-    public void setMiddleName( String middleName )
-    {
-        this.middleName = middleName;
-    }
-
-    public void setLastName( String lastName )
-    {
-        this.lastName = lastName;
+    public void setFullName( String fullName )
+    {
+        this.fullName = fullName;
     }
 
     public void setBirthDate( String birthDate )

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/relationship/AddRelationshipPatientAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/relationship/AddRelationshipPatientAction.java	2010-12-28 03:11:15 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/relationship/AddRelationshipPatientAction.java	2011-01-11 01:56:03 +0000
@@ -68,11 +68,8 @@
     // -------------------------------------------------------------------------
     // Input - name
     // -------------------------------------------------------------------------
-    private String firstName;
-
-    private String middleName;
-
-    private String lastName;
+
+    private String fullName;
 
     // -------------------------------------------------------------------------
     // Input - demographics
@@ -83,7 +80,7 @@
     private char ageType;
 
     private Integer age;
-    
+
     private Character dobType;
 
     private String gender;
@@ -125,10 +122,38 @@
         OrganisationUnit organisationUnit = selectionManager.getSelectedOrganisationUnit();
 
         patient = new Patient();
-
-        patient.setFirstName( firstName.trim() );
-        patient.setMiddleName( middleName.trim() );
-        patient.setLastName( lastName.trim() );
+        // ---------------------------------------------------------------------
+        // Set FirstName, MiddleName, LastName by FullName
+        // ---------------------------------------------------------------------
+
+        int startIndex = fullName.indexOf( ' ' );
+        int endIndex = fullName.lastIndexOf( ' ' );
+
+        String name = fullName.substring( 0, startIndex );
+        patient.setFirstName( name );
+
+        if ( startIndex == endIndex )
+        {
+            patient.setMiddleName( "" );
+            
+            name = fullName.substring( startIndex, fullName.length() );
+            patient.setLastName( name );
+        }
+        else
+        {
+            name = fullName.substring( startIndex + 1, endIndex );
+            patient.setMiddleName( name );
+            
+            name = fullName.substring( endIndex, fullName.length() );
+            patient.setLastName( name );
+        }
+        
+        patient.setLastName( fullName.substring( endIndex, fullName.length() ) );
+
+        // ---------------------------------------------------------------------
+        // Set Other information for patient
+        // ---------------------------------------------------------------------
+
         patient.setGender( gender );
         patient.setBloodGroup( bloodGroup );
         patient.setUnderAge( underAge );
@@ -136,16 +161,16 @@
 
         if ( dobType == Patient.DOB_TYPE_VERIFIED || dobType == Patient.DOB_TYPE_DECLARED )
         {
-           birthDate = birthDate.trim();
-           patient.setBirthDate( format.parseDate( birthDate ) );
+            birthDate = birthDate.trim();
+            patient.setBirthDate( format.parseDate( birthDate ) );
         }
         else
         {
-           patient.setBirthDateFromAge( age.intValue(), ageType );
+            patient.setBirthDateFromAge( age.intValue(), ageType );
         }
 
         patient.setDobType( dobType );
-        
+
         patient.setRegistrationDate( new Date() );
 
         // --------------------------------------------------------------------------------
@@ -326,26 +351,16 @@
         this.patientAttributeValueService = patientAttributeValueService;
     }
 
-    public void setFirstName( String firstName )
-    {
-        this.firstName = firstName;
-    }
-
-    public void setMiddleName( String middleName )
-    {
-        this.middleName = middleName;
-    }
-
-    public void setLastName( String lastName )
-    {
-        this.lastName = lastName;
+    public void setFullName( String fullName )
+    {
+        this.fullName = fullName;
     }
 
     public void setAge( Integer age )
     {
         this.age = age;
     }
-    
+
     public void setGender( String gender )
     {
         this.gender = gender;
@@ -385,12 +400,12 @@
     {
         this.relationshipId = relationshipId;
     }
-    
+
     public void setDobType( Character dobType )
     {
         this.dobType = dobType;
     }
-    
+
     public void setAgeType( char ageType )
     {
         this.ageType = ageType;

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/relationship/ValidateAddRelationshipPatientAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/relationship/ValidateAddRelationshipPatientAction.java	2010-12-28 03:11:15 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/relationship/ValidateAddRelationshipPatientAction.java	2011-01-11 01:56:03 +0000
@@ -24,9 +24,8 @@
 
 import com.opensymphony.xwork2.Action;
 
-
 public class ValidateAddRelationshipPatientAction
-implements Action
+    implements Action
 {
     public static final String PATIENT_DUPLICATE = "duplicate";
 
@@ -50,12 +49,8 @@
     // Input
     // -------------------------------------------------------------------------
 
-    private String firstName;
-
-    private String middleName;
-
-    private String lastName;
-    
+    private String fullName;
+
     private Character dobType;
 
     private String birthDate;
@@ -69,11 +64,11 @@
     private Integer id;
 
     private boolean checkedDuplicate;
-    
+
     private boolean underAge;
-    
+
     private Integer relationshipId;
-    
+
     private Integer relationshipTypeId;
 
     // -------------------------------------------------------------------------
@@ -108,34 +103,6 @@
             return INPUT;
         }
 
-        if ( firstName == null && middleName == null && lastName == null )
-        {
-            message = i18n.getString( "specfiy_name_s" );
-
-            return INPUT;
-        }
-
-        if ( firstName != null )
-        {
-            firstName = firstName.trim();
-        }
-
-        if ( middleName != null )
-        {
-            middleName = middleName.trim();
-        }
-
-        if ( lastName != null )
-        {
-            lastName = lastName.trim();
-        }
-        if ( firstName.length() == 0 && middleName.length() == 0 && lastName.length() == 0 )
-        {
-            message = i18n.getString( "specfiy_name_s" );
-
-            return INPUT;
-        }
-
         if ( age == null && birthDate == null )
         {
             message = i18n.getString( "specfiy_birth_date_or_age" );
@@ -143,38 +110,71 @@
             return INPUT;
         }
 
-        if ( dobType == 'V' || dobType == 'D')
+        if ( dobType == 'V' || dobType == 'D' )
         {
             birthDate = birthDate.trim();
 
-               dateOfBirth = format.parseDate( birthDate );
-
-                if ( dateOfBirth == null || dateOfBirth.after( new Date() ) )
-                {
-                    message = i18n.getString( "please_enter_a_valid_birth_date" );
-
-                    return INPUT;
-                }
-        }
-        
+            dateOfBirth = format.parseDate( birthDate );
+
+            if ( dateOfBirth == null || dateOfBirth.after( new Date() ) )
+            {
+                message = i18n.getString( "please_enter_a_valid_birth_date" );
+
+                return INPUT;
+            }
+        }
+
+        fullName = fullName.trim();
+        
+        if( fullName.indexOf( ' ' ) == -1 )
+        {
+            message = i18n.getString( "please_enter_a_valid_full_name" );
+
+            return INPUT;
+        }
+        
+        // ---------------------------------------------------------------------
+        // Check duplicate by FirstName, MiddleName, LastName, Birthday, Gender
+        // ---------------------------------------------------------------------
+
+        int startIndex = fullName.indexOf( ' ' );
+        int endIndex = fullName.lastIndexOf( ' ' );
+
+        String firstName = fullName.substring( 0, startIndex );
+        String middleName = "";
+        String lastName = "";
+        
+        if ( startIndex == endIndex )
+        {
+            middleName = "";
+            lastName = fullName.substring( startIndex, fullName.length() );
+        }
+        else
+        {
+            middleName = fullName.substring( startIndex + 1, endIndex );
+            lastName = fullName.substring( endIndex, fullName.length() );
+        }
+
         if ( !checkedDuplicate )
         {
+
             // Check duplication name, birthdate, gender
-            patients = patientService.getPatient( firstName, middleName, lastName, format.parseDate( birthDate ), gender );
+            patients = patientService.getPatient( firstName, middleName, lastName, format.parseDate( birthDate ),
+                gender );
 
             if ( patients != null && patients.size() > 0 )
             {
                 message = i18n.getString( "patient_duplicate" );
-                
+
                 boolean flagDuplicate = false;
                 for ( Patient p : patients )
                 {
-                    if ( id == null ||  ( id != null &&  p.getId().intValue() != id.intValue() ) )
+                    if ( id == null || (id != null && p.getId().intValue() != id.intValue()) )
                     {
                         flagDuplicate = true;
                         Collection<PatientAttributeValue> patientAttributeValues = patientAttributeValueService
                             .getPatientAttributeValues( p );
-                        
+
                         for ( PatientAttributeValue patientAttributeValue : patientAttributeValues )
                         {
                             patientAttributeValueMap
@@ -183,12 +183,11 @@
                         }
                     }
                 }
-                if( flagDuplicate )
+                if ( flagDuplicate )
                     return PATIENT_DUPLICATE;
             }
         }
-        
-        
+
         // Check Identifiers duplicate
 
         Patient p = new Patient();
@@ -199,7 +198,7 @@
         }
         else
         {
-           p.setBirthDateFromAge( age.intValue(), ageType  );
+            p.setBirthDateFromAge( age.intValue(), ageType );
         }
 
         HttpServletRequest request = ServletActionContext.getRequest();
@@ -212,14 +211,16 @@
             String idDuplicate = "";
             for ( PatientIdentifierType idType : identifiers )
             {
-                // If underAge is TRUE : Only check duplicate on PatientIdentifierType which related is FALSE
-                if(  !underAge ||  ( underAge && !idType.isRelated() )   )
+                // If underAge is TRUE : Only check duplicate on
+                // PatientIdentifierType which related is FALSE
+                if ( !underAge || (underAge && !idType.isRelated()) )
                 {
                     value = request.getParameter( AddPatientAction.PREFIX_IDENTIFIER + idType.getId() );
                     if ( StringUtils.isNotBlank( value ) )
                     {
                         PatientIdentifier identifier = patientIdentifierService.get( idType, value );
-                        if ( identifier != null && (id == null || identifier.getPatient().getId().intValue() != id.intValue()) )
+                        if ( identifier != null
+                            && (id == null || identifier.getPatient().getId().intValue() != id.intValue()) )
                         {
                             idDuplicate += idType.getName() + ", ";
                         }
@@ -283,21 +284,11 @@
         this.patientAttributeValueService = patientAttributeValueService;
     }
 
-    public void setFirstName( String firstName )
-    {
-        this.firstName = firstName;
-    }
-
-    public void setMiddleName( String middleName )
-    {
-        this.middleName = middleName;
-    }
-
-    public void setLastName( String lastName )
-    {
-        this.lastName = lastName;
-    }
-
+    public void setFullName( String fullName )
+    {
+        this.fullName = fullName;
+    }
+    
     public void setBirthDate( String birthDate )
     {
         this.birthDate = birthDate;
@@ -362,7 +353,7 @@
     {
         this.relationshipId = relationshipId;
     }
-    
+
     public void setAgeType( char ageType )
     {
         this.ageType = ageType;

=== 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	2010-12-27 07:59:27 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties	2011-01-11 01:56:03 +0000
@@ -458,4 +458,5 @@
 hierachy_orgunit = Hierachy Organisation Unit
 no_patients_found = No Patients Found
 similar_patients = Similar patients
-orgunit = Organisation Unit
\ No newline at end of file
+orgunit = Organisation Unit
+please_enter_a_valid_full_name = Please enter a valid full name.
\ No newline at end of file

=== 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	2010-12-27 07:59:27 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/struts.xml	2011-01-11 01:56:03 +0000
@@ -186,7 +186,7 @@
 				,javascript/relationshipPatient.js
 				,javascript/commons.js
 			</param>
-			<param name="stylesheets">javascript/jquery/thickbox/thickbox.css</param>
+			<param name="stylesheets">javascript/jquery/thickbox/thickbox.css, style/basic.css</param>
 			<param name="requiredAuthorities">F_PATIENT_ADD</param>
 		</action>
 
@@ -409,8 +409,8 @@
 			<param name="javascripts">
 				../dhis-web-commons/ouwt/ouwt.js
 				,../dhis-web-commons/javascripts/date.js				
+				,javascript/commons.js
 				,javascript/patient.js
-				,javascript/commons.js				
 			</param>	
 			<param name="stylesheets">style/basic.css</param>		
 			<param name="requiredAuthorities">F_PATIENT_ADD</param>
@@ -459,7 +459,7 @@
 			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"

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientForm.vm	2010-12-27 07:59:27 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientForm.vm	2011-01-11 01:56:03 +0000
@@ -1,11 +1,3 @@
-
-<style>
-.heading-column { width : 30.5em;}
-td.input-column { width : 30.5em;}
-td.input-column input, td.input-column select { width: 28.5em;}
-td.error {padding-left:1em}
-</style>
-
 ## Macro for generating the jQuery validation rules 
 #macro( validate $type $require )
   #if( $type == "NUMBER" )
@@ -66,16 +58,11 @@
 		<th colspan="2" class="heading-column">$i18n.getString( "name" )<em title="$i18n.getString( "required" )" class="required">*</em></th>
 	</tr>
 	<tr>
-		<td><label for="firstName">$i18n.getString( "first_name" )</label></td>
-		<td class="input-column" ><input type="text" id="firstName" name="firstName"  maxlength="30" class="required_group {validate:{required_group:true, unicodechars:true, rangelength:[2,30]}}" onkeyup="startSearch(event)"></td>
-	</tr>
-	<tr>
-		<td><label for="middleName">$i18n.getString( "middle_name" ) </label></td>
-		<td class="input-column"> <input type="text" id="middleName" name="middleName" maxlength="30" class="required_group {validate:{required_group:true, unicodechars:true, rangelength:[2,30]}}"></td>
-	</tr>
-	<tr>
-		<td><label for="lastName">$i18n.getString( "last_name" )</label></td>
-		<td class="input-column"><input type="text" id="lastName" name="lastName" maxlength="30" class="required_group {validate:{required_group:true, unicodechars:true, rangelength:[2,30]}}"></td>
+		<td><label for="fullName">$i18n.getString( "full_name" )</label></td>
+		<td class="input-column" >
+			<input type="text" id="fullName" name="fullName" style="width:28em" class="{validate:{required:true, unicodechars:true, rangelength:[2,30]}}" onkeyup="startSearch(event)">
+			<span id='searchIcon' style="display:none"><img src="../images/loader.gif"></span>
+		</td>
 	</tr>
 	<tr>
         <td id="similarPatients" style="display:none" colspan='2'> $i18n.getString( "similar_patients" ): <span id="patientCount"></span> <a href="javascript:showSearchPatients();">(show/hide)</a></td>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addRelationshipPatientForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addRelationshipPatientForm.vm	2010-10-28 09:17:13 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addRelationshipPatientForm.vm	2011-01-11 01:56:03 +0000
@@ -1,11 +1,3 @@
-
-<style>
-.heading-column { width : 30.5em;}
-td.input-column { width : 30.5em;}
-td.input-column input, td.input-column select { width: 28.5em;}
-td.error {padding-left:1em}
-</style>
-
 ## Macro for generating the jQuery validation rules 
 #macro( validate $type $require )
   #if( $type == "NUMBER" )
@@ -49,7 +41,7 @@
 <table>	
 	<tr>
 		<td ><strong>$i18n.getString("relationship_type")</strong></td>
-		<td >
+		<td  class="input-column">
 			<select name="relationshipTypeId" id="relationshipTypeId" class="{validate:{required:true}}" >
 				<option value="">[$i18n.getString( "please_select" )]</option>        
 				#foreach ($relationship in $relationshipTypes)
@@ -60,23 +52,21 @@
 	</tr>
 	<tr><td>&nbsp;</td></tr>
 	<tr>
-		<th colspan="2">$i18n.getString( "name" )<em title="$i18n.getString( "required" )" class="required">*</em></th>
-	</tr>
-	<tr>
-		<td><label for="firstName">$i18n.getString( "first_name" )</label></td>
-		<td class="input-column"><input type="text" id="firstName" name="firstName"  maxlength="30" class="required_group {validate:{required_group:true,rangelength:[2,30]}}" ></td>
-	</tr>
-	<tr>
-		<td><label for="middleName">$i18n.getString( "middle_name" ) </label></td>
-		<td class="input-column"><input type="text" id="middleName" name="middleName" maxlength="30"    class="required_group {validate:{required_group:true,rangelength:[2,30]}}"></td>
-	</tr>
-	<tr>
-		<td><label for="lastName">$i18n.getString( "last_name" )</label></td>
-		<td class="input-column"><input type="text" id="lastName" name="lastName" maxlength="30"   class="required_group {validate:{required_group:true,rangelength:[2,30]}}"></td>
-	</tr>	
+		<th colspan="2" class="heading-column">$i18n.getString( "name" )<em title="$i18n.getString( "required" )" class="required">*</em></th>
+	</tr>
+	<tr>
+		<td><label for="fullName">$i18n.getString( "full_name" )</label></td>
+		<td class="input-column" >
+			<input type="text" id="fullName" name="fullName" style="width:28em" class="{validate:{required:true, unicodechars:true, rangelength:[2,30]}}" onkeyup="startSearch(event)">
+			<span id='searchIcon' style="display:none"><img src="../images/loader.gif"></span>
+		</td>
+	</tr>
+	<tr>
+        <td id="similarPatients" style="display:none" colspan='2'> $i18n.getString( "similar_patients" ): <span id="patientCount"></span> <a href="javascript:showSearchPatients();">(show/hide)</a></td>
+    </tr>
 	<tr><td>&nbsp;</td></tr>	
 	<tr>
-		<th colspan="2">$i18n.getString( "demographics" )</th>
+		<th colspan="2" class="heading-column">$i18n.getString( "demographics" )</th>
 	</tr>
 		
 	<tr>
@@ -106,7 +96,7 @@
 	
 	<tr id='birthdaySpan' style="display:none" >
 		<td><label for="birthDate">$i18n.getString( "date_of_birth" )<em title="$i18n.getString( "required" )" class="required">*</em> </label></td>
-		<td>			
+		<td class="input-column">			
 			<input type="text" id="birthDate" name="birthDate" style="width:26.5em" onchange="bdOnchange()" >
 		</td>
 		<td></td>
@@ -114,7 +104,7 @@
 	
 	<tr id='ageSpan' style="display:none" >
 		<td><label for="age">$i18n.getString( "age" ) </label><em title="$i18n.getString( "required" )" class="required">*</em> </label></td>
-		<td>
+		<td class="input-column">
 			<select id="ageType" name="ageType" style="width:18em" >
 				<option value="D"> $i18n.getString('day')</option>
 				<option value="M"> $i18n.getString('month')</option>
@@ -154,7 +144,7 @@
 	
 	<tr>
 		<td>$i18n.getString("is_underage")</td>
-		<td>
+		<td class="input-column">
 			<input type="checkbox" name="underAge" id="underAge" onclick="toggleUnderage(this);" value="true"/>
 		</td>
 	</tr>
@@ -162,7 +152,7 @@
 	<!--IDENTIFIERS -->
 	
 	<tr><td colspan="2">&nbsp;</td></tr>	
-	<tr><th colspan="2">$i18n.getString( "patient_identifiers" )</th></tr>
+	<tr><th colspan="2" class="heading-column">$i18n.getString( "patient_identifiers" )</th></tr>
 	#foreach ($identifierType in $identifierTypes)
 		#set( $identifier = "" )
 		#set( $identifier = $identiferMap.get( $identifierType.id ) )
@@ -176,7 +166,7 @@
 	
 	#foreach ($attributeGroup in $attributeGroups )
 		<tr><td>&nbsp;</td></tr>
-		<tr><th colspan="2">$attributeGroup.name</th></tr>
+		<tr><th colspan="2" class="heading-column">$attributeGroup.name</th></tr>
 		#foreach($attribute in $attributeGroup.attributes )
 		#set( $attributeValue = "" ) 
 		#set( $attributeValue = $attributeMap.get( $attribute.id ) ) 
@@ -213,7 +203,7 @@
 	
 	<tr><td>&nbsp;</td></tr>
 	#if ( $noGroupAttributes.size() > 0) 	
-		<tr><th colspan="2">$i18n.getString( "other_details" )</th></tr>
+		<tr><th colspan="2" class="heading-column">$i18n.getString( "other_details" )</th></tr>
 		#foreach($attribute in $noGroupAttributes )
 		#set( $attributeValue = "" ) 
 		#set( $attributeValue = $attributeMap.get( $attribute.id ) ) 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/commons.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/commons.js	2010-10-28 09:25:22 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/commons.js	2011-01-11 01:56:03 +0000
@@ -12,4 +12,47 @@
 		hideById('birthdaySpan');
 		hideById('ageSpan');
 	}
+}
+
+// ----------------------------------------------------------------------------
+// Search patients by name
+// ----------------------------------------------------------------------------
+
+var prename = "";
+function startSearch( e )
+{	
+	var fullName = getFieldValue('fullName');
+	
+	if ( prename == fullName){
+		return;
+	}
+	prename = fullName;
+	
+	if ( fullName.length < 3){
+		$("#similarPatients").hide();
+		return;
+	}
+	
+	byId('searchIcon').style.display = 'block';
+	$.post("getPatientsByName.action",
+		{
+			fullName: fullName
+		},
+		function (html)
+		{
+			jQuery("#similarPatients").show();
+			var patientCount = $('<div/>').html(html).find('#matchCount');
+			jQuery('#patientCount').html( patientCount );
+			jQuery('#searchResults').html( html );
+			byId('searchIcon').style.display = 'none';
+		},'html');
+}
+
+// ----------------------------------------------------------------------------
+// Show patients
+// ----------------------------------------------------------------------------
+
+function showSearchPatients()
+{
+	tb_show( i18n_child_representative, "#TB_inline?height=350&width=580&inlineId=searchResults",null);	
 }
\ 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/patient.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/patient.js	2010-12-27 07:59:27 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/patient.js	2011-01-11 01:56:03 +0000
@@ -273,7 +273,7 @@
 
 function disableForm()
 {
-    $('#firstName').attr("disabled", true);
+    $('#fullName').attr("disabled", true);
 }
 // -----------------------------------------------------------------------------
 // Add Patient
@@ -296,9 +296,7 @@
 	}
 
 	var params = '&checkedDuplicate='+checkedDuplicate 
-				+'&firstName=' + getFieldValue( 'firstName' ) 
-				+'&middleName=' + getFieldValue( 'middleName' ) 
-				+'&lastName=' + getFieldValue( 'lastName' ) 
+				+'&fullName=' + getFieldValue( 'fullName' ) 
 				+'&gender=' + getFieldValue( 'gender' ) 
 				+'&dobType=' + getFieldValue( 'dobType' ) 
 				+'&birthDate=' + getFieldValue( 'birthDate' ) 
@@ -353,14 +351,9 @@
 function validateUpdatePatient()
 {
     var params = 'id=' + getFieldValue( 'id' ) 
-				+'&firstName=' + getFieldValue( 'firstName' ) 
-				+'&middleName=' + getFieldValue( 'middleName' ) 
-				+'&lastName=' + getFieldValue( 'lastName' ) 
+				+'&fullName=' + getFieldValue( 'fullName' )
 				+'&gender=' + getFieldValue( 'gender' ) 
 				+'&birthDate=' + getFieldValue( 'birthDate' ) 
-//				+'&underAge=' + jQuery("#underAge").is(":checked")
-//				+'&representativeId=' + getFieldValue('representativeId')
-//				+'&relationshipTypeId=' + getFieldValue('relationshipTypeId')
 				+ getIdParams();
 	
 	var request = new Request();
@@ -499,9 +492,7 @@
 function checkDuplicate()
 {
 	var params = 
-				'&firstName=' + getFieldValue( 'firstName' ) +
-				'&middleName=' + getFieldValue( 'middleName' ) +
-				'&lastName=' + getFieldValue( 'lastName' ) +
+				'&fullName=' + getFieldValue( 'fullName' ) +
 				'&dobType=' + getFieldValue( 'dobType' ) +
 				'&gender=' + getFieldValue( 'gender' ) +
 				'&birthDate=' + getFieldValue( 'birthDate' ) +	        
@@ -695,45 +686,4 @@
 function removeEnrollment(){
 	byId('programEnrollmentForm').action = "removeEnrollment.action";
 	byId('programEnrollmentForm').submit();
-}
-
-// ----------------------------------------------------------------------------
-// Search patients by name
-// ----------------------------------------------------------------------------
-
-function startSearch()
-{	
-	var firstName = getFieldValue('firstName');
-	var middleName = getFieldValue('middleName');
-	var lastName = getFieldValue('lastName');
-	
-	var fullName = firstName + middleName + lastName; 
-	if( fullName.length < 3 ){
-		$("#similarPatients").hide();
-		return;
-	}
-	
-	$.post("getPatientsByName.action",
-		{
-			firstName: firstName,
-			middleName: middleName,
-			lastName: lastName
-		},
-		function (html)
-		{
-			jQuery("#similarPatients").show();
-			var patientCount = $('<div/>').html(html).find('#matchCount');
-			jQuery('#patientCount').html( patientCount );
-			jQuery('#searchResults').html( html );
-		},'html');
-}
-
-// ----------------------------------------------------------------------------
-// Show patients
-// ----------------------------------------------------------------------------
-
-function showSearchPatients(){
-	// tb_show(i18n_child_representative,'getPatientsByName.action?firstName='+ firstName +'&middleName=' + middleName + '&lastName=' + lastName +'&height=450&width=600',null);
-	tb_show( i18n_child_representative, "#TB_inline?height=350&width=580&inlineId=searchResults",null);
-	
 }
\ 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/relationshipPatient.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/relationshipPatient.js	2010-10-28 09:17:13 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/relationshipPatient.js	2011-01-11 01:56:03 +0000
@@ -5,11 +5,8 @@
 
 function validateAddRelationshipPatient()
 {
-	
 	var params = '&checkedDuplicate='+checkedDuplicate 
-				+'&firstName=' + getFieldValue( 'firstName' ) 
-				+'&middleName=' + getFieldValue( 'middleName' ) 
-				+'&lastName=' + getFieldValue( 'lastName' ) 
+				+'&fullName=' + getFieldValue( 'fullName' ) 
 				+'&gender=' + getFieldValue( 'gender' ) 
 				+'&dobType=' + getFieldValue( 'dobType' ) 
 				+'&birthDate=' + getFieldValue( 'birthDate' ) 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/underage.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/underage.js	2010-10-28 09:17:13 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/underage.js	2011-01-11 01:56:03 +0000
@@ -6,15 +6,12 @@
 {	
 	$.post("validatePatient.action?" + getIdParams(),
 		{
-			firstName: getFieldValue( 'firstName' ),
-			middleName: getFieldValue( 'middleName' ),
-			lastName: getFieldValue( 'lastName' ),
+			fullName: getFieldValue( 'fullName' )
 			gender: getFieldValue( 'gender' ) ,
 			birthDate: getFieldValue( 'birthDate' ), 	        
 			age: getFieldValue( 'age' ) ,
 			dobType: getFieldValue( 'dobType' ) ,
-			ageType: getFieldValue( 'ageType' ) ,
-			genre: getFieldValue('gender') 
+			ageType: getFieldValue( 'ageType' )
 		},
 		function (data)
 		{

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/resultSearchPatients.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/resultSearchPatients.vm	2010-12-27 07:59:27 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/resultSearchPatients.vm	2011-01-11 01:56:03 +0000
@@ -19,7 +19,7 @@
 				<td>$!patient.gender</td>
 				<td>$!patient.dobType</td>
 				<td>$!patient.birthDate</td>
-				<td>$!patient.organisationUnit</td>
+				<td>$!patient.organisationUnit.name</td>
 			</tr>
 		#set($mark = !$mark)
 		#end

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/style/basic.css'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/style/basic.css	2010-12-10 04:02:52 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/style/basic.css	2011-01-11 01:56:03 +0000
@@ -10,4 +10,9 @@
 .stateformat {
 	color:red;
 	text-align:center;
-}
\ No newline at end of file
+}
+
+.heading-column { width : 30.5em;}
+td.input-column { width : 30.5em;}
+td.input-column input, td.input-column select { width: 28.5em;}
+td.error {padding-left:1em}
\ 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/underAgeForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/underAgeForm.vm	2010-11-29 08:15:17 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/underAgeForm.vm	2011-01-11 01:56:03 +0000
@@ -28,9 +28,7 @@
 						}
 		,rules : {
 			relationshipTypeId  : { required: true },
-			firstName : {required_group:true,rangelength:[2,30], unicodechars:true},
-			middleName : {required_group:true,rangelength:[2,30], unicodechars:true},
-			lastName : {required_group:true,rangelength:[2,30], unicodechars:true},
+			fullName : {required:true,rangelength:[3,30], unicodechars:true},
 			gender : { required: true },
 			birthDate :{required:false,dateISO:true,datelessthanequaltoday:true}
 		},beforeValidateHandler: function(form)
@@ -166,17 +164,15 @@
 		<th colspan="2">$i18n.getString( "name" )<em title="$i18n.getString( "required" )" class="required">*</em></th>
 	</tr>
 	<tr>
-		<td><label for="firstName">$i18n.getString( "first_name" )</label></td>
-		<td><input type="text" id="firstName" name="firstName" style="width:15em"  maxlength="30" class="required_group"></td>
-	</tr>
-	<tr>
-		<td><label for="middleName">$i18n.getString( "middle_name" ) </label></td>
-		<td><input type="text" id="middleName" name="middleName" maxlength="30" style="width:15em" class="required_group"></td>
-	</tr>
-	<tr>
-		<td><label for="lastName">$i18n.getString( "last_name" )</label></td>
-		<td><input type="text" id="lastName" name="lastName" maxlength="30" style="width:15em" class="required_group"></td>
-	</tr>	
+		<td><label for="required">$i18n.getString( "full_name" )</label></td>
+		<td class="input-column" >
+			<input type="text" id="fullName" name="fullName" style="width:15em" class="{validate:{required:true, unicodechars:true, rangelength:[2,30]}}" onkeyup="startSearch(event)">
+			<span id='searchIcon' style="display:none"><img src="../images/loader.gif"></span>
+		</td>
+	</tr>
+	<tr>
+        <td id="similarPatients" style="display:none" colspan='2'> $i18n.getString( "similar_patients" ): <span id="patientCount"></span> <a href="javascript:showSearchPatients();">(show/hide)</a></td>
+    </tr>
 	<tr><td>&nbsp;</td></tr>	
 	<tr>
 		<th colspan="2">$i18n.getString( "demographics" )</th>
@@ -185,7 +181,7 @@
 	<tr>
 		<td><label for="gender">$i18n.getString( "gender" )<em title="$i18n.getString( "required" )" class="required">*</em></label></td>
 		<td>
-			<select id="gender" name="gender" style="min-width:15em" class="{validate:{required:true}}">
+			<select id="gender" name="gender" style="min-width:15em">
 				<option value="" selected="selected">[$i18n.getString( "please_select" )]</option>
 				<option value="M" >$i18n.getString( "male" )</option>
 				<option value="F">$i18n.getString( "female" )</option>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientForm.vm	2010-12-28 03:11:15 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientForm.vm	2011-01-11 01:56:03 +0000
@@ -56,31 +56,23 @@
 </div>
 
 <table>
-	<tr><th colspan="2">$i18n.getString( "system_identifier" )</th></tr>
+	<tr><th colspan="2" class="heading-column">$i18n.getString( "system_identifier" )</th></tr>
 	<tr><td></td><td>$systemIdentifier</td></tr>
 	<tr><td>&nbsp;</td></tr>	
 	<tr>
-		<th colspan="2">$i18n.getString( "name" ) <em title="$i18n.getString( "required" )" class="required">*</em></th>
-	</tr>
-	<tr>
-		<td><label for="firstName">$i18n.getString( "first_name" )</label></td>
-		<td><input type="text" id="firstName" name="firstName" value="$encoder.htmlEncode( $patient.firstName )" style="width:30em" class="required_group {validate:{required_group:true, unicodechars:true, rangelength:[2,30]}}"></td>
-	</tr>
-	<tr>
-		<td><label for="middleName">$i18n.getString( "middle_name" )</label></td>
-		<td><input type="text" id="middleName" name="middleName" value="$encoder.htmlEncode( $patient.middleName )" style="width:30em" class="required_group {validate:{required_group:true, unicodechars:true, rangelength:[2,30]}}"></td>
-	</tr>
-	<tr>
-		<td><label for="lastName">$i18n.getString( "last_name" )</label></td>
-		<td><input type="text" id="lastName" name="lastName" value="$encoder.htmlEncode( $patient.lastName )" style="width:30em" class="required_group {validate:{required_group:true, unicodechars:true, rangelength:[2,30]}}"></td>
+		<th colspan="2" class="heading-column">$i18n.getString( "name" ) <em title="$i18n.getString( "required" )" class="required">*</em></th>
+	</tr>
+	<tr>
+		<td><label for="fullName">$i18n.getString( "full_name" )</label></td>
+		<td class="input-column" ><input type="text" id="fullName" name="fullName" value="$encoder.htmlEncode( $patient.getFullName() )" style="width:30em" class="required_group {validate:{required_group:true, unicodechars:true, rangelength:[2,30]}}"></td>
 	</tr>
 	<tr><td>&nbsp;</td></tr>	
 	<tr>
-		<th colspan="2">$i18n.getString( "demographics" )</th>
+		<th colspan="2" class="heading-column">$i18n.getString( "demographics" )</th>
 	</tr>
 	<tr>
 		<td><label for="gender">$i18n.getString( "gender" )<em title="$i18n.getString( "required" )" class="required">*</em></label></td>
-		<td>
+		<td class="input-column" >
 			<select id="gender" name="gender" style="min-width:30em">
 				<option value="M" #if( $patient.gender == 'M' ) selected="selected" #end>$i18n.getString( "male" )</option>
 				<option value="F" #if( $patient.gender == 'F' ) selected="selected" #end>$i18n.getString( "female" )</option>
@@ -91,7 +83,7 @@
 
 	<tr>
 		<td><label for="dobType">$i18n.getString( "dob_type" )<em title="$i18n.getString( "required" )" class="required">*</em></label></td>
-		<td>
+		<td class="input-column" >
 			<select id='dobType' name="dobType" style="min-width:30em" onchange="dobTypeOnChange();" class="{validate:{required:false}}">
 				<option value="" selected="selected">[$i18n.getString( "please_select" )]</option>
 				<option value="V" #if($patient.dobType=='V') selected #end>$i18n.getString( "verified" )</option>
@@ -104,7 +96,7 @@
 	
 	<tr id='birthdaySpan' style="display:none" >
 		<td><label for="birthDate">$i18n.getString( "date_of_birth" )<em title="$i18n.getString( "required" )" class="required">*</em> </label></td>
-		<td>			
+		<td class="input-column" >			
 			<input type="text" id="birthDate" name="birthDate" style="width:26.5em" onchange="bdOnchange()" value="$format.formatDate( $patient.birthDate )" >
 		</td>
 		<td></td>
@@ -112,7 +104,7 @@
 	
 	<tr id='ageSpan' style="display:none" >
 		<td><label for="age">$i18n.getString( "age" ) </label><em title="$i18n.getString( "required" )" class="required">*</em> </label></td>
-		<td>
+		<td class="input-column" >
 			<select id="ageType" name="ageType" style="width:15em" >
 				<option value="D" #if($patient.getAgeType()=='D') selected #end> $i18n.getString('day')</option>
 				<option value="M" #if($patient.getAgeType()=='M') selected #end> $i18n.getString('month')</option>
@@ -125,12 +117,12 @@
 	
 	<tr>
 		<td></td>
-		<td><input id="memberValidator" style="display:none" class="{validate:{required:true}}"/></td>
+		<td class="input-column" ><input id="memberValidator" style="display:none" class="{validate:{required:true}}"/></td>
 	</tr>
 	
 	<tr>
 		<td><label for="bloodGroup">$i18n.getString( "blood_group" )</label></td>
-		<td>
+		<td class="input-column" >
 			<select type="text" id="bloodGroup" name="bloodGroup" style="width:30em" >
 				 <option value="">[$i18n.getString( "please_select" )]</option>
 				<option value="A+"  #if($patient.bloodGroup == "A+") selected="selected" #end>A+</option>
@@ -150,7 +142,7 @@
 	
 	<tr>
 		<td>$i18n.getString("is_underage")</td>
-		<td>
+		<td class="input-column" >
 			<input type="checkbox" name="underAge" id="underAge" onclick="toggleUnderAge(this);" value="true" #if($patient.underAge) checked="checked" #end/>
 		</td>
 	</tr>
@@ -165,13 +157,13 @@
 	#end
 	
 	<!--IDENTIFIERS -->
-	<tr><th colspan="2">$i18n.getString("patient_identifiers")</th></tr>
+	<tr><th colspan="2" class="heading-column">$i18n.getString("patient_identifiers")</th></tr>
 	#foreach ($identifierType in $identifierTypes)
 	#set( $identifier = "" )
 	#set( $identifier = $identiferMap.get( $identifierType.id ) )
 	<tr>
 		<td><label for="bloodGroup">$identifierType.name #if($identifierType.mandatory)<em title="$i18n.getString( "required" )" class="required">*</em> #end</label></td>
-		<td><input type="text" id="iden$identifierType.id" name="iden$identifierType.id" value="$identifier" data="{related:$identifierType.related}" #if($identifierType.related && $patient.underAge) disabled="disabled" #end class="{validate:{required:$identifierType.mandatory, #if($!identifierType.noChars) maxlength:$identifierType.noChars, #end #if($identifierType.type=='number') number:true #elseif($!identifierType.type=='letter') lettersonly:true #end }}" style="width:30em" /></td>	
+		<td class="input-column" ><input type="text" id="iden$identifierType.id" name="iden$identifierType.id" value="$identifier" data="{related:$identifierType.related}" #if($identifierType.related && $patient.underAge) disabled="disabled" #end class="{validate:{required:$identifierType.mandatory, #if($!identifierType.noChars) maxlength:$identifierType.noChars, #end #if($identifierType.type=='number') number:true #elseif($!identifierType.type=='letter') lettersonly:true #end }}" style="width:30em" /></td>	
 	</tr>
 	#end
 	<tr><td>&nbsp;</td></tr>
@@ -181,14 +173,14 @@
 	
 	#foreach ($attributeGroup in $attributeGroups )
 		<tr><td>&nbsp;</td></tr>	
-		<tr><th colspan="2">$attributeGroup.name</th></tr>
+		<tr><th colspan="2" class="heading-column">$attributeGroup.name</th></tr>
 		#foreach($attribute in $attributeGroup.attributes)
 			#if($!attribute)
 				#set( $attributeValue = "" )
 				#set( $attributeValue = $patientAttributeValueMap.get( $attribute.id ) )
 				<tr>
 					<td><label>$attribute.name #if($attribute.mandatory)<em title="$i18n.getString( "required" )" class="required">*</em> #end</label></td>
-					<td>
+					<td class="input-column" >
 						#if( $attribute.valueType == "YES/NO" )
 							<select id="attr$attribute.id"  name="attr$attribute.id"  style="width:30em" >              
 								<option value="">[$i18n.getString( "please_select" )]</option>
@@ -220,13 +212,13 @@
 	<!-- ATTRIBUTES NOT IN GROUPS -->
 	
 	#if ( $noGroupAttributes.size() > 0) 	
-		<tr><th colspan="2">$i18n.getString( "Other details" )</th></tr>
+		<tr><th colspan="2" class="heading-column">$i18n.getString( "Other details" )</th></tr>
 		#foreach($attribute in $noGroupAttributes )
 		#set( $attributeValue = "" )
 		#set( $attributeValue = $patientAttributeValueMap.get( $attribute.id ) )
 			<tr>
 				<td><label>$attribute.name #if($attribute.mandatory)<em title="$i18n.getString( "required" )" class="required">*</em> #end</label></td>
-				<td>
+				<td class="input-column" >
 					#if( $attribute.valueType == "YES/NO" )
 		                <select id="attr$attribute.id"  name="attr$attribute.id"   style="width:30em" >              
 		                    <option value="">[$i18n.getString( "please_select" )]</option>