=== 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 2011-01-12 02:35:14 +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-19 11:13:53 +0000 @@ -166,25 +166,46 @@ int startIndex = fullName.indexOf( ' ' ); int endIndex = fullName.lastIndexOf( ' ' ); - String name = fullName.substring( 0, startIndex ); - patient.setFirstName( name ); - + String firstName = fullName.toString(); + String middleName = ""; + String lastName = ""; + + if( fullName.indexOf( ' ' ) != -1 ) + { + firstName = fullName.substring( 0, startIndex ); + if ( startIndex == endIndex ) + { + middleName = ""; + lastName = fullName.substring( startIndex, fullName.length() ); + } + else + { + middleName = fullName.substring( startIndex + 1, endIndex ); + lastName = fullName.substring( endIndex, fullName.length() ); + } + } + + patient.setFirstName( firstName ); + patient.setMiddleName( middleName ); + patient.setLastName( lastName ); + + /* if ( startIndex == endIndex ) { patient.setMiddleName( "" ); - name = fullName.substring( startIndex, fullName.length() ); - patient.setLastName( name ); + lastName = fullName.substring( startIndex, fullName.length() ); + patient.setLastName( lastName ); } else { - name = fullName.substring( startIndex + 1, endIndex ); - patient.setMiddleName( name ); + middleName = fullName.substring( startIndex + 1, endIndex ); + patient.setMiddleName( middleName ); - name = fullName.substring( endIndex, fullName.length() ); - patient.setLastName( name ); + lastName = fullName.substring( endIndex, fullName.length() ); + patient.setLastName( lastName ); } - + */ // --------------------------------------------------------------------- // Set Other information for patient === 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 2011-01-12 02:35:14 +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-19 11:13:53 +0000 @@ -156,26 +156,47 @@ int startIndex = fullName.indexOf( ' ' ); int endIndex = fullName.lastIndexOf( ' ' ); - String name = fullName.substring( 0, startIndex ); - patient.setFirstName( name ); + String firstName = fullName.toString(); + String middleName = ""; + String lastName = ""; + if( fullName.indexOf( ' ' ) != -1 ) + { + firstName = fullName.substring( 0, startIndex ); + if ( startIndex == endIndex ) + { + middleName = ""; + lastName = fullName.substring( startIndex, fullName.length() ); + } + else + { + middleName = fullName.substring( startIndex + 1, endIndex ); + lastName = fullName.substring( endIndex, fullName.length() ); + } + } + + patient.setFirstName( firstName ); + patient.setMiddleName( middleName ); + patient.setLastName( lastName ); + + /* if ( startIndex == endIndex ) { patient.setMiddleName( "" ); - name = fullName.substring( startIndex, fullName.length() ); - patient.setLastName( name ); + lastName = fullName.substring( startIndex, fullName.length() ); + patient.setLastName( lastName ); } else { - name = fullName.substring( startIndex + 1, endIndex ); - patient.setMiddleName( name ); + middleName = fullName.substring( startIndex + 1, endIndex ); + patient.setMiddleName( middleName ); - name = fullName.substring( endIndex, fullName.length() ); - patient.setLastName( name ); + lastName = fullName.substring( endIndex, fullName.length() ); + patient.setLastName( lastName ); } - - patient.setLastName( fullName.substring( endIndex, fullName.length() ) ); + */ + //patient.setLastName( fullName.substring( endIndex, fullName.length() ) ); // --------------------------------------------------------------------- // Set Other information for patient === 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 2011-01-11 01:56:03 +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-19 11:13:53 +0000 @@ -155,13 +155,14 @@ } 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 // --------------------------------------------------------------------- @@ -169,19 +170,23 @@ int startIndex = fullName.indexOf( ' ' ); int endIndex = fullName.lastIndexOf( ' ' ); - String firstName = fullName.substring( 0, startIndex ); + String firstName = fullName.toString(); 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( fullName.indexOf( ' ' ) != -1 ) + { + firstName = fullName.substring( 0, startIndex ); + 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 ) === modified file 'dhis-2/dhis-web/pom.xml' --- dhis-2/dhis-web/pom.xml 2011-01-17 16:26:18 +0000 +++ dhis-2/dhis-web/pom.xml 2011-01-19 11:13:53 +0000 @@ -24,7 +24,7 @@ dhis-web-dashboard-integration dhis-web-caseentry dhis-web-api - dhis-web-portal +