← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 11609: Load events linked into event flow in Dashboard.

 

------------------------------------------------------------
revno: 11609
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2013-08-08 13:20:51 +0700
message:
  Load events linked into event flow in Dashboard.
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstanceService.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstanceStore.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramStageInstanceService.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/AddPatientAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/PatientDashboardAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ProgramEnrollmentAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ShowAddRelationshipPatientAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addPatientForm.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patient.js
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageInstanceFlow.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-api/src/main/java/org/hisp/dhis/program/ProgramStageInstanceService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstanceService.java	2013-08-07 03:44:17 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstanceService.java	2013-08-08 06:20:51 +0000
@@ -134,7 +134,9 @@
 
     Grid getCompletenessProgramStageInstance( Collection<Integer> orgunits, Program program, String startDate,
         String endDate, I18n i18n );
-    
+
     Collection<OutboundSms> sendMessages( ProgramStageInstance programStageInstance, int status, I18nFormat format );
 
+    Collection<ProgramStageInstance> getProgramStageInstance( Patient patient );
+
 }

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstanceStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstanceStore.java	2013-07-23 04:16:21 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstanceStore.java	2013-08-08 06:20:51 +0000
@@ -124,5 +124,7 @@
     Collection<Integer> getOrgunitIds( Date startDate, Date endDate );
 
     Grid getCompleteness( Collection<Integer> orgunitIds, Program program, String startDate, String endDate, I18n i18n );
+    
+    Collection<ProgramStageInstance> get( Patient patient );
 
 }

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramStageInstanceService.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramStageInstanceService.java	2013-08-07 03:44:17 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramStageInstanceService.java	2013-08-08 06:20:51 +0000
@@ -581,6 +581,11 @@
         return outboundSmsList;
     }
 
+    public Collection<ProgramStageInstance> getProgramStageInstance( Patient patient )
+    {
+        return programStageInstanceStore.get( patient );
+    }
+    
     // -------------------------------------------------------------------------
     // Supportive methods
     // -------------------------------------------------------------------------

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.java	2013-07-25 02:32:32 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.java	2013-08-08 06:20:51 +0000
@@ -394,13 +394,13 @@
     public Collection<SchedulingProgramObject> getSendMesssageEvents()
     {
         String sql = " ( " + sendMessageToPatientSql() + " ) ";
-        
-        sql += " UNION ( " +  sendMessageToHealthWorkerSql() + " ) ";
+
+        sql += " UNION ( " + sendMessageToHealthWorkerSql() + " ) ";
 
         sql += " UNION ( " + sendMessageToOrgunitRegisteredSql() + " ) ";
-        
+
         sql += " UNION ( " + sendMessageToUsersSql() + " ) ";
-        
+
         sql += " UNION ( " + sendMessageToUserGroupsSql() + " ) ";
 
         SqlRowSet rs = jdbcTemplate.queryForRowSet( sql );
@@ -734,7 +734,8 @@
         return rs != null ? rs.intValue() : 0;
     }
 
-    public Grid getCompleteness( Collection<Integer> orgunitIds, Program program, String startDate, String endDate, I18n i18n )
+    public Grid getCompleteness( Collection<Integer> orgunitIds, Program program, String startDate, String endDate,
+        I18n i18n )
     {
         String sql = "SELECT ou.name as orgunit, ps.name as events, psi.completeduser as user_name, count(psi.programstageinstanceid) as number_of_events "
             + "         FROM programstageinstance psi INNER JOIN programstage ps "
@@ -777,6 +778,13 @@
         return grid;
     }
 
+    @SuppressWarnings( "unchecked" )
+    public Collection<ProgramStageInstance> get( Patient patient )
+    {
+        return getCriteria().createAlias( "patients", "patient" )
+            .add( Restrictions.eq( "patient.id", patient.getId() ) ).list();
+    }
+
     // -------------------------------------------------------------------------
     // Supportive methods
     // -------------------------------------------------------------------------
@@ -2461,7 +2469,8 @@
             + "               and pg.type=1 and prm.daysallowedsendmessage is not null "
             + "               and psi.executiondate is null "
             + "               and (  DATE(now()) - DATE(psi.duedate) ) = prm.daysallowedsendmessage "
-            + "               and prm.whentosend is null and prm.sendto = " +  + PatientReminder.SEND_TO_ORGUGNIT_REGISTERED;
+            + "               and prm.whentosend is null and prm.sendto = "
+            + +PatientReminder.SEND_TO_ORGUGNIT_REGISTERED;
     }
 
     private String sendMessageToUsersSql()
@@ -2492,9 +2501,10 @@
             + "       and pg.type=1 and prm.daysallowedsendmessage is not null "
             + "       and psi.executiondate is null "
             + "       and (  DATE(now()) - DATE(psi.duedate) ) = prm.daysallowedsendmessage "
-            + "       and prm.whentosend is null and prm.sendto = " +  PatientReminder.SEND_TO_ALL_USERS_IN_ORGUGNIT_REGISTERED;
+            + "       and prm.whentosend is null and prm.sendto = "
+            + PatientReminder.SEND_TO_ALL_USERS_IN_ORGUGNIT_REGISTERED;
     }
-    
+
     private String sendMessageToUserGroupsSql()
     {
         return "select psi.programstageinstanceid, uif.phonenumber,prm.templatemessage, p.firstname, p.middlename, p.lastname, org.name as orgunitName ,"
@@ -2523,7 +2533,6 @@
             + "       and pg.type=1 and prm.daysallowedsendmessage is not null "
             + "       and psi.executiondate is not null "
             + "       and (  DATE(now()) - DATE(psi.duedate) ) = prm.daysallowedsendmessage "
-            + "       and prm.whentosend is null "
-            + "       and prm.sendto = " +  PatientReminder.SEND_TO_USER_GROUP;
+            + "       and prm.whentosend is null " + "       and prm.sendto = " + PatientReminder.SEND_TO_USER_GROUP;
     }
 }

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/AddPatientAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/AddPatientAction.java	2013-07-12 04:32:20 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/AddPatientAction.java	2013-08-08 06:20:51 +0000
@@ -53,6 +53,10 @@
 import org.hisp.dhis.patient.PatientService;
 import org.hisp.dhis.patient.util.PatientIdentifierGenerator;
 import org.hisp.dhis.patientattributevalue.PatientAttributeValue;
+import org.hisp.dhis.relationship.Relationship;
+import org.hisp.dhis.relationship.RelationshipService;
+import org.hisp.dhis.relationship.RelationshipType;
+import org.hisp.dhis.relationship.RelationshipTypeService;
 import org.hisp.dhis.setting.SystemSettingManager;
 import org.hisp.dhis.user.UserService;
 
@@ -93,6 +97,10 @@
 
     private SystemSettingManager systemSettingManager;
 
+    private RelationshipTypeService relationshipTypeService;
+
+    private RelationshipService relationshipService;
+
     // -------------------------------------------------------------------------
     // Input
     // -------------------------------------------------------------------------
@@ -123,6 +131,10 @@
 
     private String deathDate;
 
+    private Integer relationshipId;
+
+    private boolean relationshipFromA;
+
     private String message;
 
     // -------------------------------------------------------------------------
@@ -364,6 +376,43 @@
         Integer id = patientService.createPatient( patient, representativeId, relationshipTypeId,
             patientAttributeValues );
 
+        // -------------------------------------------------------------------------
+        // Create relationship
+        // -------------------------------------------------------------------------
+
+        if ( relationshipId != null && relationshipTypeId != null )
+        {
+            Patient relationship = patientService.getPatient( relationshipId );
+            if ( relationship != null )
+            {
+                if ( underAge )
+                {
+                    patient.setRepresentative( relationship );
+                }
+
+                Relationship rel = new Relationship();
+                if ( relationshipFromA )
+                {
+                    rel.setPatientA( relationship );
+                    rel.setPatientB( patient );
+                }
+                else
+                {
+                    rel.setPatientA( patient );
+                    rel.setPatientB( relationship );
+                }
+                if ( relationshipTypeId != null )
+                {
+                    RelationshipType relType = relationshipTypeService.getRelationshipType( relationshipTypeId );
+                    if ( relType != null )
+                    {
+                        rel.setRelationshipType( relType );
+                        relationshipService.saveRelationship( rel );
+                    }
+                }
+            }
+        }
+
         message = id + "_" + systemGenerateIdentifier.getIdentifier();
 
         return SUCCESS;
@@ -378,6 +427,26 @@
         this.userService = userService;
     }
 
+    public void setRelationshipTypeService( RelationshipTypeService relationshipTypeService )
+    {
+        this.relationshipTypeService = relationshipTypeService;
+    }
+
+    public void setRelationshipId( Integer relationshipId )
+    {
+        this.relationshipId = relationshipId;
+    }
+
+    public void setRelationshipFromA( boolean relationshipFromA )
+    {
+        this.relationshipFromA = relationshipFromA;
+    }
+
+    public void setRelationshipService( RelationshipService relationshipService )
+    {
+        this.relationshipService = relationshipService;
+    }
+
     public void setSystemSettingManager( SystemSettingManager systemSettingManager )
     {
         this.systemSettingManager = systemSettingManager;

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/PatientDashboardAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/PatientDashboardAction.java	2013-06-11 05:55:48 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/PatientDashboardAction.java	2013-08-08 06:20:51 +0000
@@ -220,9 +220,10 @@
         // Get patient-attribute-values
         // ---------------------------------------------------------------------
 
-        Collection<PatientAttributeValue> _attributeValues = patientAttributeValueService.getPatientAttributeValues( patient );
+        Collection<PatientAttributeValue> _attributeValues = patientAttributeValueService
+            .getPatientAttributeValues( patient );
         attributeValues = new HashSet<PatientAttributeValue>();
-        
+
         for ( Program program : programs )
         {
             Collection<PatientAttribute> atttributes = program.getPatientAttributes();
@@ -234,14 +235,14 @@
                 }
             }
         }
-        
+
         // ---------------------------------------------------------------------
         // Get patient-identifiers
         // ---------------------------------------------------------------------
 
         Collection<PatientIdentifier> _identifiers = patient.getIdentifiers();
         identifiers = new HashSet<PatientIdentifier>();
-        
+
         for ( Program program : programs )
         {
             Collection<PatientIdentifierType> identifierTypes = program.getPatientIdentifierTypes();
@@ -249,11 +250,11 @@
             {
                 if ( !identifierTypes.contains( identifier.getIdentifierType() ) )
                 {
-                    identifiers.add(identifier);
+                    identifiers.add( identifier );
                 }
             }
         }
-        
+
         // ---------------------------------------------------------------------
         // Get relationship
         // ---------------------------------------------------------------------

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ProgramEnrollmentAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ProgramEnrollmentAction.java	2013-03-06 04:14:33 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ProgramEnrollmentAction.java	2013-08-08 06:20:51 +0000
@@ -47,6 +47,7 @@
 import org.hisp.dhis.program.ProgramInstance;
 import org.hisp.dhis.program.ProgramInstanceService;
 import org.hisp.dhis.program.ProgramStageInstance;
+import org.hisp.dhis.program.ProgramStageInstanceService;
 import org.hisp.dhis.program.comparator.ProgramStageInstanceVisitDateComparator;
 
 import com.opensymphony.xwork2.Action;
@@ -69,6 +70,8 @@
 
     private SelectedStateManager selectedStateManager;
 
+    private ProgramStageInstanceService programStageInstanceService;
+
     // -------------------------------------------------------------------------
     // Input/Output
     // -------------------------------------------------------------------------
@@ -93,6 +96,8 @@
 
     private ProgramInstance programInstance;
 
+    private Collection<ProgramStageInstance> linkProgramStageInstances = new HashSet<ProgramStageInstance>();
+
     // -------------------------------------------------------------------------
     // Getters/Setters
     // -------------------------------------------------------------------------
@@ -102,6 +107,16 @@
         this.selectedStateManager = selectedStateManager;
     }
 
+    public Collection<ProgramStageInstance> getLinkProgramStageInstances()
+    {
+        return linkProgramStageInstances;
+    }
+
+    public void setProgramStageInstanceService( ProgramStageInstanceService programStageInstanceService )
+    {
+        this.programStageInstanceService = programStageInstanceService;
+    }
+
     public Collection<PatientAttribute> getNoGroupAttributes()
     {
         return noGroupAttributes;
@@ -185,6 +200,8 @@
         programStageInstances = new ArrayList<ProgramStageInstance>( programInstance.getProgramStageInstances() );
 
         Collections.sort( programStageInstances, new ProgramStageInstanceVisitDateComparator() );
+        
+        linkProgramStageInstances = programStageInstanceService.getProgramStageInstance( programInstance.getPatient() );
 
         loadIdentifierTypes( programInstance );
 

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ShowAddRelationshipPatientAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ShowAddRelationshipPatientAction.java	2012-09-21 10:27:45 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ShowAddRelationshipPatientAction.java	2013-08-08 06:20:51 +0000
@@ -27,9 +27,11 @@
 
 package org.hisp.dhis.caseentry.action.patient;
 
+import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.HashSet;
+import java.util.List;
 import java.util.Map;
 
 import org.hisp.dhis.organisationunit.OrganisationUnit;
@@ -100,17 +102,25 @@
 
     private Collection<User> healthWorkers;
 
+    private List<Program> programs;
+
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
 
     public String execute()
     {
-        patient = patientService.getPatient( id.intValue() );
+        OrganisationUnit organisationUnit = selectionManager.getSelectedOrganisationUnit();
+        patient = patientService.getPatient( id );
 
         identifierTypes = patientIdentifierTypeService.getAllPatientIdentifierTypes();
         Collection<PatientAttribute> patientAttributes = patientAttributeService.getAllPatientAttributes();
-        Collection<Program> programs = programService.getAllPrograms();
+
+        programs = new ArrayList<Program>( programService.getProgramsByDisplayOnAllOrgunit( true, null ) );
+        programs.addAll( programService.getProgramsByDisplayOnAllOrgunit( false, organisationUnit ) );
+        programs.retainAll( programService.getProgramsByCurrentUser() );
+        programs.removeAll( programService.getPrograms( Program.SINGLE_EVENT_WITHOUT_REGISTRATION ) );
+
         for ( Program program : programs )
         {
             identifierTypes.removeAll( program.getPatientIdentifierTypes() );
@@ -172,7 +182,6 @@
             }
         }
 
-        OrganisationUnit organisationUnit = selectionManager.getSelectedOrganisationUnit();
         healthWorkers = organisationUnit.getUsers();
 
         return SUCCESS;
@@ -181,12 +190,17 @@
     // -------------------------------------------------------------------------
     // Getter/Setter
     // -------------------------------------------------------------------------
-    
+
     public void setSelectionManager( OrganisationUnitSelectionManager selectionManager )
     {
         this.selectionManager = selectionManager;
     }
 
+    public List<Program> getPrograms()
+    {
+        return programs;
+    }
+
     public void setProgramService( ProgramService programService )
     {
         this.programService = programService;

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml	2013-08-07 08:46:28 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml	2013-08-08 06:20:51 +0000
@@ -487,6 +487,10 @@
 			ref="org.hisp.dhis.patient.PatientAttributeOptionService" />
 		<property name="userService" ref="org.hisp.dhis.user.UserService" />
 		<property name="systemSettingManager" ref="org.hisp.dhis.setting.SystemSettingManager" />
+		<property name="relationshipService"
+			ref="org.hisp.dhis.relationship.RelationshipService" />
+		<property name="relationshipTypeService"
+			ref="org.hisp.dhis.relationship.RelationshipTypeService" />
 	</bean>
 
 	<bean id="org.hisp.dhis.caseentry.action.patient.RemovePatientAction"
@@ -636,6 +640,8 @@
 			ref="org.hisp.dhis.patientattributevalue.PatientAttributeValueService" />
 		<property name="selectedStateManager"
 			ref="org.hisp.dhis.caseentry.state.SelectedStateManager" />
+		<property name="programStageInstanceService"
+			ref="org.hisp.dhis.program.ProgramStageInstanceService" />
 	</bean>
 
 	<bean

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties	2013-08-01 07:29:25 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties	2013-08-08 06:20:51 +0000
@@ -672,4 +672,5 @@
 recipients = Recipients
 scheduled = Scheduled
 event_registration = Event registration
-add_patient_related_the_selected_event = Add person related to the selected event
\ No newline at end of file
+add_patient_related_the_seleced_event = Add person related to the selected event
+related_patient = Related person
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addPatientForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addPatientForm.vm	2013-08-01 03:15:38 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addPatientForm.vm	2013-08-08 06:20:51 +0000
@@ -43,7 +43,7 @@
 	hideById('mainLinkLbl');
 </script>
 
-<h3>
+<h3 id='patientMamagementLink'>
 	<a href="javascript:loadPatientList();">$i18n.getString( 'patient_management' )</a>
 	&#8226; $i18n.getString( "add_new_patient" )
 </h3>
@@ -56,7 +56,7 @@
 	#parse( "/dhis-web-caseentry/patientForm.vm" )
 	<tr>
 		<td></td>
-		<td colspan='2'>
+		<td colspan='2' id='actionButtons'>
 			<input type="submit" class="button" value="$i18n.getString( 'add' )" onclick="isContinue=false;" style="width:70px;" />
 			<input type="submit" class="button" value="$i18n.getString( 'add_and_register_new' )" style="width:140px;" onclick="isContinue=true;"/>
 			<input type='button' class="button" value="$i18n.getString( 'cancel' )" onclick="loadPatientList();" style="width:70px;" />

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js	2013-08-07 08:46:28 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js	2013-08-08 06:20:51 +0000
@@ -1796,10 +1796,11 @@
 	jQuery('#dashboardHistoryDiv').toggle();
 }
 
-function viewPersonProgram ( displayedDiv, hidedDiv )
+function viewPersonProgram ( displayedDiv, hidedDiv1, hideDiv2 )
 {
 	showById(displayedDiv);
-	hideById(hidedDiv);
+	hideById(hidedDiv1);
+	hideById(hidedDiv2);
 }
 
 // --------------------------------------------------------------------

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js	2013-07-25 06:27:06 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js	2013-08-08 06:20:51 +0000
@@ -580,8 +580,7 @@
                 }
 
                 var blocked = jQuery('#entryFormContainer [id=blockEntryForm]').val();
-
-                if( blocked=='true' ) {
+				if( blocked=='true' ) {
                     blockEntryForm();
                 }
 

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patient.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patient.js	2013-07-23 09:20:16 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patient.js	2013-08-08 06:20:51 +0000
@@ -370,6 +370,15 @@
 					disableCompletedButton(true);
 				}
 			}
+			
+			var linkedEvent = jQuery(".stage-object-selected").attr("linkedEvent");
+			if( linkedEvent=='true' ) {
+				blockEntryForm();
+				disable('executionDate');
+			}
+			else{
+				enable('executionDate');
+			}
 			resize();
 			hideLoader();
 			hideById('contentDiv');

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageInstanceFlow.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageInstanceFlow.vm	2013-07-30 06:16:43 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageInstanceFlow.vm	2013-08-08 06:20:51 +0000
@@ -7,10 +7,42 @@
 			<div id='flow_$!programInstance.id' class="stage-flow">
 				<table class="table-flow">											
 					<tr id='programStageIdTR_$!programInstance.id'>
+						#foreach( $programStageInstance in $linkProgramStageInstances )
+						<td id='arrow_$programStageInstance.id' style='font-size:25px;'>&rarr;</td>
+						<td>
+							#set($valueDate=$format.formatDate( $programStageInstance.dueDate ))
+							#if($!programStageInstance.executionDate)
+								#set($valueDate=$format.formatDate( $programStageInstance.executionDate ))
+							#end
+							<div class="orgunit-object" id="org_$!programStageInstance.id">&nbsp;$!programStageInstance.organisationUnit.name</div>
+							<input type="button" name="programStageBtn"
+								id="ps_$!programStageInstance.id"
+								name="ps_$!programStageInstance.id"
+								pi="$programInstance.id"
+								psid="$programStageInstance.programStage.id"
+								psuid="$programStageInstance.programStage.uid"
+								psname="$programStageInstance.programStage.displayName"
+								status="$programStageInstance.getEventStatus()"
+								programType='$programInstance.program.type'
+								reportDate="$!format.formatDate( $!programStageInstance.executionDate )"
+								reportDateDes="$programStageInstance.programStage.reportDateDescription"
+								dueDate="$format.formatDate( $programStageInstance.dueDate )"
+								class="stage-object" 
+								value="$programStageInstance.programStage.displayName&#13;&#10;&nbsp;$valueDate" 
+								linkedEvent='true'
+								onclick="javascript:loadDataEntry( $programStageInstance.id );">
+							<script>	
+								var status = $programStageInstance.getEventStatus();
+								setEventColorStatus( $programStageInstance.id ,status);
+							</script>
+						</td>
+						#end
+						
 						#if( $programStageInstances)
 						#else
 							#set( $programStageInstances = $programInstance.programStageInstances)
 						#end
+						
 						#foreach( $programStageInstance in $programStageInstances )
 						<td id='arrow_$programStageInstance.id' style='font-size:25px;'>&rarr;</td>
 						<td>
@@ -33,6 +65,7 @@
 								dueDate="$format.formatDate( $programStageInstance.dueDate )"
 								class="stage-object" 
 								value="$programStageInstance.programStage.displayName&#13;&#10;&nbsp;$valueDate" 
+								linkedEvent='false'
 								onclick="javascript:loadDataEntry( $programStageInstance.id );">
 							<script>	
 								var status = $programStageInstance.getEventStatus();