← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 11247: Error when to export program history of person.

 

------------------------------------------------------------
revno: 11247
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2013-06-21 19:46:21 +0700
message:
  Error when to export program history of person.
modified:
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramInstanceService.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-patient/src/main/java/org/hisp/dhis/program/DefaultProgramInstanceService.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramInstanceService.java	2013-05-30 07:18:04 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramInstanceService.java	2013-06-21 12:46:21 +0000
@@ -209,7 +209,14 @@
 
         Grid attrGrid = new ListGrid();
 
-        attrGrid.setTitle( patient.getFullName() );
+        if ( patient.getFirstName() == null && patient.getMiddleName() == null && patient.getLastName() == null )
+        {
+            attrGrid.setTitle( "" );
+        }
+        else
+        {
+            attrGrid.setTitle( patient.getFullName() );
+        }
         attrGrid.setSubtitle( "" );
 
         attrGrid.addHeader( new GridHeader( i18n.getString( "name" ), false, true ) );
@@ -220,21 +227,30 @@
         // Add fixed attribues
         // ---------------------------------------------------------------------
 
-        attrGrid.addRow();
-        attrGrid.addValue( i18n.getString( "gender" ) );
-        attrGrid.addValue( i18n.getString( patient.getGender() ) );
-
-        attrGrid.addRow();
-        attrGrid.addValue( i18n.getString( "date_of_birth" ) );
-        attrGrid.addValue( format.formatDate( patient.getBirthDate() ) );
-
-        attrGrid.addRow();
-        attrGrid.addValue( i18n.getString( "age" ) );
-        attrGrid.addValue( patient.getAge() );
-
-        attrGrid.addRow();
-        attrGrid.addValue( i18n.getString( "dob_type" ) );
-        attrGrid.addValue( i18n.getString( patient.getDobType() + "" ) );
+        if ( patient.getGender() != null )
+        {
+            attrGrid.addRow();
+            attrGrid.addValue( i18n.getString( "gender" ) );
+            attrGrid.addValue( i18n.getString( patient.getGender() ) );
+        }
+
+        if ( patient.getBirthDate() != null )
+        {
+            attrGrid.addRow();
+            attrGrid.addValue( i18n.getString( "date_of_birth" ) );
+            attrGrid.addValue( format.formatDate( patient.getBirthDate() ) );
+
+            attrGrid.addRow();
+            attrGrid.addValue( i18n.getString( "age" ) );
+            attrGrid.addValue( patient.getAge() );
+        }
+
+        if ( patient.getDobType() != null )
+        {
+            attrGrid.addRow();
+            attrGrid.addValue( i18n.getString( "dob_type" ) );
+            attrGrid.addValue( i18n.getString( patient.getDobType() + "" ) );
+        }
 
         attrGrid.addRow();
         attrGrid.addValue( i18n.getString( "phoneNumber" ) );
@@ -332,12 +348,6 @@
                 {
                     Grid gridProgram = getProgramInstanceReport( programInstance, i18n, format );
 
-                    // ---------------------------------------------------------------------
-                    // Grids for program-stage-instance
-                    // ---------------------------------------------------------------------
-
-                    getProgramStageInstancesReport( gridProgram, programInstance, format, i18n );
-
                     grids.add( gridProgram );
                 }
             }
@@ -380,7 +390,7 @@
 
         Collection<PatientIdentifier> identifiers = patient.getIdentifiers();
 
-        if ( identifiers.size() > 0 )
+        if ( identifierTypes != null && identifiers.size() > 0 )
         {
             for ( PatientIdentifierType identifierType : identifierTypes )
             {