← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9105: Don't enroll person into single event with registration automatically.

 

------------------------------------------------------------
revno: 9105
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2012-11-23 10:02:35 +0700
message:
  Don't enroll person into single event with registration automatically.
modified:
  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/ProgramEnrollmentSelectAction.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/webapp/dhis-web-caseentry/patientDashboard.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/patient/PatientDashboardAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/PatientDashboardAction.java	2012-10-19 07:08:17 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/PatientDashboardAction.java	2012-11-23 03:02:35 +0000
@@ -30,11 +30,8 @@
 import java.util.Collection;
 import java.util.Date;
 import java.util.HashSet;
-import java.util.Iterator;
 import java.util.Set;
 
-import org.hisp.dhis.caseentry.state.SelectedStateManager;
-import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.patient.Patient;
 import org.hisp.dhis.patient.PatientAudit;
 import org.hisp.dhis.patient.PatientAuditService;
@@ -42,14 +39,11 @@
 import org.hisp.dhis.patient.PatientService;
 import org.hisp.dhis.patientattributevalue.PatientAttributeValue;
 import org.hisp.dhis.patientattributevalue.PatientAttributeValueService;
-import org.hisp.dhis.program.Program;
 import org.hisp.dhis.program.ProgramInstance;
 import org.hisp.dhis.program.ProgramInstanceService;
-import org.hisp.dhis.program.ProgramService;
 import org.hisp.dhis.relationship.Relationship;
 import org.hisp.dhis.relationship.RelationshipService;
 import org.hisp.dhis.user.CurrentUserService;
-import org.hisp.dhis.validation.ValidationCriteria;
 
 import com.opensymphony.xwork2.Action;
 
@@ -76,11 +70,7 @@
     private PatientAuditService patientAuditService;
 
     private CurrentUserService currentUserService;
-
-    private ProgramService programService;
-
-    private SelectedStateManager selectedStateManager;
-
+    
     // -------------------------------------------------------------------------
     // Input && Output
     // -------------------------------------------------------------------------
@@ -101,8 +91,6 @@
 
     private Collection<PatientAudit> patientAudits;
 
-    private Collection<Program> singlePrograms;
-
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
@@ -112,21 +100,6 @@
         this.patientAuditService = patientAuditService;
     }
 
-    public void setSelectedStateManager( SelectedStateManager selectedStateManager )
-    {
-        this.selectedStateManager = selectedStateManager;
-    }
-
-    public void setProgramService( ProgramService programService )
-    {
-        this.programService = programService;
-    }
-
-    public Collection<Program> getSinglePrograms()
-    {
-        return singlePrograms;
-    }
-
     public void setPatientAttributeValueService( PatientAttributeValueService patientAttributeValueService )
     {
         this.patientAttributeValueService = patientAttributeValueService;
@@ -227,32 +200,11 @@
         }
 
         // ---------------------------------------------------------------------
-        // Check single-event with registration
-        // ---------------------------------------------------------------------
-
-        OrganisationUnit orgunit = selectedStateManager.getSelectedOrganisationUnit();
-
-        singlePrograms = programService.getPrograms( Program.SINGLE_EVENT_WITH_REGISTRATION, orgunit );
-
-        singlePrograms.removeAll( patient.getPrograms() );       
-        Iterator<Program> iter = singlePrograms.iterator();
-        while( iter.hasNext() )
-        {
-            Program program = iter.next();
-            ValidationCriteria criteria = program.isValid( patient );
-
-            if( criteria!= null)
-            {
-                iter.remove();
-            }
-        }
-
-        // ---------------------------------------------------------------------
         // Patient-Audit
         // ---------------------------------------------------------------------
 
         patientAudits = patientAuditService.getPatientAudits( patient );
-        
+
         long millisInDay = 60 * 60 * 24 * 1000;
         long currentTime = new Date().getTime();
         long dateOnly = (currentTime / millisInDay) * millisInDay;

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ProgramEnrollmentSelectAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ProgramEnrollmentSelectAction.java	2012-11-01 15:15:26 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ProgramEnrollmentSelectAction.java	2012-11-23 03:02:35 +0000
@@ -29,6 +29,8 @@
 import java.util.ArrayList;
 import java.util.Collection;
 
+import org.hisp.dhis.caseentry.state.SelectedStateManager;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.patient.Patient;
 import org.hisp.dhis.patient.PatientService;
 import org.hisp.dhis.program.Program;
@@ -70,6 +72,13 @@
         this.programInstanceService = programInstanceService;
     }
 
+    private SelectedStateManager selectedStateManager;
+
+    public void setSelectedStateManager( SelectedStateManager selectedStateManager )
+    {
+        this.selectedStateManager = selectedStateManager;
+    }
+
     // -------------------------------------------------------------------------
     // Input/Output
     // -------------------------------------------------------------------------
@@ -107,13 +116,18 @@
         // Get all programs
         programs = programService.getPrograms( Program.MULTIPLE_EVENTS_WITH_REGISTRATION );
 
+        // Check single-event with registration
+        OrganisationUnit orgunit = selectedStateManager.getSelectedOrganisationUnit();
+
+        programs.addAll( programService.getPrograms( Program.SINGLE_EVENT_WITH_REGISTRATION, orgunit ) );
+        programs.removeAll( patient.getPrograms() );
         Collection<ProgramInstance> programInstances = programInstanceService.getProgramInstances( patient, false );
 
         for ( ProgramInstance programInstance : programInstances )
         {
             programs.remove( programInstance.getProgram() );
         }
-        
+
         return SUCCESS;
     }
 }

=== 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	2012-11-09 03:14:42 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml	2012-11-23 03:02:35 +0000
@@ -555,6 +555,7 @@
 		<property name="patientService" ref="org.hisp.dhis.patient.PatientService" />
 		<property name="programService" ref="org.hisp.dhis.program.ProgramService" />
 		<property name="programInstanceService" ref="org.hisp.dhis.program.ProgramInstanceService" />
+		<property name="selectedStateManager" ref="org.hisp.dhis.caseentry.state.SelectedStateManager" />
 	</bean>
 
 	<bean id="org.hisp.dhis.caseentry.action.patient.ProgramEnrollmentAction"
@@ -959,8 +960,6 @@
 		<property name="programInstanceService" ref="org.hisp.dhis.program.ProgramInstanceService" />
 		<property name="patientAuditService" ref="org.hisp.dhis.patient.PatientAuditService" />
 		<property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
-		<property name="programService" ref="org.hisp.dhis.program.ProgramService" />
-		<property name="selectedStateManager" ref="org.hisp.dhis.caseentry.state.SelectedStateManager" />
 	</bean>
 
 	<!-- Comment -->

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientDashboard.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientDashboard.vm	2012-11-22 03:20:13 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientDashboard.vm	2012-11-23 03:02:35 +0000
@@ -131,21 +131,6 @@
 					</tr>
 					#end
 				#end
-				#foreach($program in $singlePrograms)
-					<tr id='tr_$program.id' name='tr_$program.id' style='cursor:pointer;'
-						onclick='javascript:saveSingleEnrollment("$patient.id","$program.id")' >
-						<td>
-							<a><span id='infor_$program.id'></span></a>
-							<script>
-								var infor = "$program.name" + " (" + getCurrentDate() + ")";
-								setInnerHTML("infor_$program.id", infor);
-							</script>
-						</td>
-					</tr>
-					<tr style='cursor:pointer;'>
-						<td id='tr2_$programInstance.id'></td>
-					</tr>
-				#end
 			</table>
 		</div>
 	</div>