← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8806: improve single event form web-light

 

------------------------------------------------------------
revno: 8806
committer: Lai <lai.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2012-11-01 09:34:16 +0700
message:
  improve single event form web-light
modified:
  dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevent/action/GetSingleEventFormAction.java
  dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/singleevent/singleEventForm.vm
  dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/singleevent/singleEventOptionSetFindForm.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-light/src/main/java/org/hisp/dhis/light/singleevent/action/GetSingleEventFormAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevent/action/GetSingleEventFormAction.java	2012-10-24 09:02:06 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevent/action/GetSingleEventFormAction.java	2012-11-01 02:34:16 +0000
@@ -221,13 +221,20 @@
     {
         this.programStageInstanceId = programStageInstanceId;
     }
+    
+    private Patient patient;
+    
+    public Patient getPatient()
+    {
+        return patient;
+    }
 
     @Override
     public String execute()
         throws Exception
-    {
-
+    {        
         Program program = programService.getProgram( programId );
+        this.patient = patientService.getPatient( this.patientId );
         eventName = program.getName();
         ProgramStage programStage = program.getProgramStages().iterator().next();
         programStageDataElements = new ArrayList<ProgramStageDataElement>( programStage.getProgramStageDataElements() );
@@ -237,19 +244,17 @@
         {
             this.prevDataValues = (Map<String, String>) SessionUtils.getSessionVar( "prevDataValues" );
         }
-        if ( searchResult != null )
+        if ( searchResult != null && !searchResult.equals( "0" ))
         {
             this.prevDataValues.put( "DE" + this.dataElementIdForSearching, searchResult );
         }
-        else
+        else if ( searchResult == null)
         {
             // For editing if user finished the form
-            Patient patient = patientService.getPatient( this.patientId );
-
-            if ( programInstanceService.getProgramInstances( patient, program ).size() != 0 )
+            if ( programInstanceService.getProgramInstances( this.patient, program ).size() != 0 )
             {
                 List<ProgramInstance> proInstanceList = (List<ProgramInstance>) programInstanceService
-                    .getProgramInstances( patient, program );
+                    .getProgramInstances( this.patient, program );
 
                 ProgramInstance proInstance = null;
 

=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/singleevent/singleEventForm.vm'
--- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/singleevent/singleEventForm.vm	2012-10-03 07:43:08 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/singleevent/singleEventForm.vm	2012-11-01 02:34:16 +0000
@@ -64,6 +64,7 @@
 <h2>$i18n.getString( "navigate_to" )</h2>
 <ul>
 	<li><a href="selectSingleEventBeneficiary.action?organisationUnitId=$organisationUnitId&programId=$programId">$i18n.getString("beneficiary_list")</a></li>
+	<li><a href="showPatientProgramList.action?patientId=$patientId">$!encoder.htmlEncode( ${patient.getFullName()} )</a></li>
 	<li><a href="index.action">$i18n.getString("home")</a></li>
 </ul>
 </div>

=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/singleevent/singleEventOptionSetFindForm.vm'
--- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/singleevent/singleEventOptionSetFindForm.vm	2012-10-26 07:11:07 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/singleevent/singleEventOptionSetFindForm.vm	2012-11-01 02:34:16 +0000
@@ -14,7 +14,7 @@
 <div id="footer">
 	<h2>$i18n.getString( "navigate_to" )</h2>
 	<ul>
-		<li><a href="showSingleEventForm.action?dataElementIdForSearching=$dataElementIdForSearching&organisationUnitId=$organisationUnitId&patientId=$patientId&programId=$programId&isEditing=$!isEditing">$i18n.getString("back_single_event_form")</a></li>
+		<li><a href="showSingleEventForm.action?searchResult=0&dataElementIdForSearching=$dataElementIdForSearching&organisationUnitId=$organisationUnitId&patientId=$patientId&programId=$programId&programStageInstanceId=$programStageInstanceId&isEditing=$!isEditing">$i18n.getString("back_single_event_form")</a></li>
 		<li><a href="index.action">$i18n.getString("home")</a></li>
 	</ul>
 </div>
\ No newline at end of file