dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #19916
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8890: Only remove empty events in the selected orgunit in anonymous program.
------------------------------------------------------------
revno: 8890
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2012-11-06 09:44:50 +0700
message:
Only remove empty events in the selected orgunit in anonymous program.
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstanceService.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/caseentry/RemoveEmptyEventsAction.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-api/src/main/java/org/hisp/dhis/program/ProgramStageInstanceService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstanceService.java 2012-09-10 10:28:33 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstanceService.java 2012-11-06 02:44:50 +0000
@@ -96,7 +96,7 @@
List<Grid> getProgramStageInstancesReport( ProgramInstance programInstance, I18nFormat format, I18n i18n );
- void removeEmptyEvents( ProgramStage programStage );
+ void removeEmptyEvents( ProgramStage programStage, OrganisationUnit organisationUnit );
void updateProgramStageInstances( Collection<Integer> programStageInstances, OutboundSms outboundSms );
=== 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 2012-09-10 10:28:33 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramStageInstanceService.java 2012-11-06 02:44:50 +0000
@@ -258,9 +258,9 @@
return grids;
}
- public void removeEmptyEvents( ProgramStage programStage )
+ public void removeEmptyEvents( ProgramStage programStage, OrganisationUnit organisationUnit )
{
- programStageInstanceStore.removeEmptyEvents( programStage );
+ programStageInstanceStore.removeEmptyEvents( programStage, organisationUnit );
}
@Override
=== 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 2012-10-18 04:58:55 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.java 2012-11-06 02:44:50 +0000
@@ -247,11 +247,11 @@
return jdbcTemplate.queryForInt( sql );
}
- public void removeEmptyEvents( ProgramStage programStage )
+ public void removeEmptyEvents( ProgramStage programStage, OrganisationUnit organisationUnit )
{
String sql = "delete from programstageinstance where programstageid=" + programStage.getId()
+ + " and organisationunitid=" + organisationUnit.getId()
+ " and programstageinstanceid not in " + "(select pdv.programstageinstanceid from patientdatavalue pdv )";
-
jdbcTemplate.execute( sql );
}
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/RemoveEmptyEventsAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/RemoveEmptyEventsAction.java 2012-07-03 09:39:00 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/RemoveEmptyEventsAction.java 2012-11-06 02:44:50 +0000
@@ -27,6 +27,9 @@
package org.hisp.dhis.caseentry.action.caseentry;
+import org.hisp.dhis.caseentry.state.SelectedStateManager;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
import org.hisp.dhis.program.ProgramStage;
import org.hisp.dhis.program.ProgramStageInstanceService;
import org.hisp.dhis.program.ProgramStageService;
@@ -59,6 +62,13 @@
this.programStageInstanceService = programStageInstanceService;
}
+ private OrganisationUnitSelectionManager selectionManager;
+
+ public void setSelectionManager( OrganisationUnitSelectionManager selectionManager )
+ {
+ this.selectionManager = selectionManager;
+ }
+
// -------------------------------------------------------------------------
// Input/Output
// -------------------------------------------------------------------------
@@ -79,8 +89,10 @@
{
ProgramStage programStage = programStageService.getProgramStage( programStageId );
- programStageInstanceService.removeEmptyEvents( programStage );
-
+ OrganisationUnit organisationUnit = selectionManager.getSelectedOrganisationUnit();
+
+ programStageInstanceService.removeEmptyEvents( programStage, organisationUnit );
+
return SUCCESS;
}