← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12217: display 'unknown' when patient's name or DOB is null, fix for J2me

 

------------------------------------------------------------
revno: 12217
committer: Lai <lai.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2013-09-24 11:07:07 +0700
message:
  display 'unknown' when patient's name or DOB is null, fix for J2me
modified:
  dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java


--
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-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java	2013-09-23 08:00:15 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java	2013-09-24 04:07:07 +0000
@@ -870,7 +870,7 @@
             {
                 patientModel.setDobType( patient.getDobType() );
             }
-            if ( setting.getBirthdate() )
+            if ( setting.getBirthdate() && patient.getBirthDate()!=null )
             {
                 DateFormat dateFormat = new SimpleDateFormat( "dd-MM-yyyy" );
                 patientModel.setBirthDate( dateFormat.format( patient.getBirthDate() ) );
@@ -1924,21 +1924,32 @@
             DateFormat dateFormat = new SimpleDateFormat( "dd-MM-yyyy" );
 
             int i = 1;
+            String name = "";
+            String DOB = "";
             for ( Patient each : patients )
             {
                 if ( i > 10 )
                 {
                     break;
                 }
+                
+                if ( each.getName() != null )
+                {
+                    name = each.getName();
+                }
+                else
+                {
+                    name = "unknown";
+                }
                 if ( each.getBirthDate() != null )
                 {
-                    patientsInfo += each.getId() + "/" + each.getName() + "/" + dateFormat.format( each.getBirthDate() )
-                        + "$";
+                    DOB = dateFormat.format( each.getBirthDate() );
                 }
                 else
                 {
-                    patientsInfo += each.getId() + "/" + each.getName() + "/DOB$";
+                    DOB = "unknown";
                 }
+                patientsInfo += each.getId() + "/" + name + "/" + DOB + "$";
                 i++;
             }