dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #09718
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2632: Fixed Bug While Creating Patient without MiddleName and LastName
------------------------------------------------------------
revno: 2632
committer: Bharath <chbharathk@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2011-01-19 16:43:53 +0530
message:
Fixed Bug While Creating Patient without MiddleName and LastName
modified:
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/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/pom.xml
--
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/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 @@
<module>dhis-web-dashboard-integration</module>
<module>dhis-web-caseentry</module>
<module>dhis-web-api</module>
- <module>dhis-web-portal</module>
+ <!-- <module>dhis-web-portal</module> -->
</modules>
<build>
<plugins>