← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5162: Exception thrown when selecting single-event program in case-entry form.

 

------------------------------------------------------------
revno: 5162
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2011-11-15 15:44:02 +0700
message:
  Exception thrown when selecting single-event program in case-entry form.
modified:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/LoadDataEntryAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataentryRecords.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-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/LoadDataEntryAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/LoadDataEntryAction.java	2011-09-29 05:59:35 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/LoadDataEntryAction.java	2011-11-15 08:44:02 +0000
@@ -199,53 +199,56 @@
 
         programStageDataElements = new ArrayList<ProgramStageDataElement>( programStage.getProgramStageDataElements() );
 
+        Collections.sort( programStageDataElements, new ProgramStageDataElementSortOrderComparator() );
+
         ProgramInstance programInstance = selectedStateManager.getSelectedProgramInstance();
 
-        Collections.sort( programStageDataElements, new ProgramStageDataElementSortOrderComparator() );
-
-        programStageInstance = programStageInstanceService.getProgramStageInstance( programInstance, programStage );
-
-        if ( programStageInstance != null )
+        if ( programInstance != null )
         {
-            selectedStateManager.setSelectedProgramStageInstance( programStageInstance );
-
-            // ---------------------------------------------------------------------
-            // Get CategoryOptions
-            // ---------------------------------------------------------------------
-
-            Collection<DataElement> dataElements = programStageDataElementService.getListDataElement( programStage );
-
-            for ( DataElement dataElement : dataElements )
-            {
-                optionMap.put( dataElement.getId(), dataElement.getCategoryCombo().getOptionCombos() );
-            }
-
-            // ---------------------------------------------------------------------
-            // Get data values
-            // ---------------------------------------------------------------------
-
-            Collection<PatientDataValue> patientDataValues = patientDataValueService
-                .getPatientDataValues( programStageInstance );
-
-            patientDataValueMap = new HashMap<Integer, PatientDataValue>( patientDataValues.size() );
-
-            for ( PatientDataValue patientDataValue : patientDataValues )
-            {
-                patientDataValueMap.put( patientDataValue.getDataElement().getId(), patientDataValue );
-            }
-
-            // ---------------------------------------------------------------------
-            // Get data-entry-form
-            // ---------------------------------------------------------------------
-
-            DataEntryForm dataEntryForm = programStage.getDataEntryForm();
-
-            if ( dataEntryForm != null )
-            {
-                customDataEntryFormCode = programDataEntryService.prepareDataEntryFormForEntry( dataEntryForm
-                    .getHtmlCode(), patientDataValues, "", i18n, programStage, programStageInstance, organisationUnit );
-            }
-
+            programStageInstance = programStageInstanceService.getProgramStageInstance( programInstance, programStage );
+
+            if ( programStageInstance != null )
+            {
+                selectedStateManager.setSelectedProgramStageInstance( programStageInstance );
+
+                // ---------------------------------------------------------------------
+                // Get CategoryOptions
+                // ---------------------------------------------------------------------
+
+                Collection<DataElement> dataElements = programStageDataElementService.getListDataElement( programStage );
+
+                for ( DataElement dataElement : dataElements )
+                {
+                    optionMap.put( dataElement.getId(), dataElement.getCategoryCombo().getOptionCombos() );
+                }
+
+                // ---------------------------------------------------------------------
+                // Get data values
+                // ---------------------------------------------------------------------
+
+                Collection<PatientDataValue> patientDataValues = patientDataValueService
+                    .getPatientDataValues( programStageInstance );
+
+                patientDataValueMap = new HashMap<Integer, PatientDataValue>( patientDataValues.size() );
+
+                for ( PatientDataValue patientDataValue : patientDataValues )
+                {
+                    patientDataValueMap.put( patientDataValue.getDataElement().getId(), patientDataValue );
+                }
+
+                // ---------------------------------------------------------------------
+                // Get data-entry-form
+                // ---------------------------------------------------------------------
+
+                DataEntryForm dataEntryForm = programStage.getDataEntryForm();
+
+                if ( dataEntryForm != null )
+                {
+                    customDataEntryFormCode = programDataEntryService.prepareDataEntryFormForEntry( dataEntryForm
+                        .getHtmlCode(), patientDataValues, "", i18n, programStage, programStageInstance,
+                        organisationUnit );
+                }
+            }
         }
 
         return SUCCESS;

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataentryRecords.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataentryRecords.vm	2011-09-29 06:28:35 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataentryRecords.vm	2011-11-15 08:44:02 +0000
@@ -34,7 +34,7 @@
 						#if( $sortPatientAttribute )
 							<td>$!patientAttributeValueMap.get( $patient.id ).value</td>
 						#end
-                        <td><a href="javascript:showPatientDetails( '$programInstance.patient.id' )" title="$i18n.getString( 'show_details' )">$patient.getFullName()</a></td>                    
+                        <td><a href="javascript:showPatientDetails( '$patient.id' )" title="$i18n.getString( 'show_details' )">$patient.getFullName()</a></td>                    
                         #foreach( $programStageInstance in $programStageInstanceMap.get( $programInstance ) )
                             #if( $programStageInstance.executionDate )
                                 <td style="text-align:center" bgcolor="$colorMap.get( $programStageInstance.id )">