dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #18039
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7445: Only show orgunits by the selected level which users select in Tabular report.
------------------------------------------------------------
revno: 7445
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2012-06-28 13:28:55 +0700
message:
Only show orgunits by the selected level which users select in Tabular report.
modified:
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/CreateAnonymousEncounterAction.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-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-06-24 14:49:04 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.java 2012-06-28 06:28:55 +0000
@@ -199,16 +199,15 @@
// ---------------------------------------------------------------------
// Headers TODO hidden cols
// ---------------------------------------------------------------------
-
+
Grid grid = new ListGrid();
grid.addHeader( new GridHeader( "id", true, true ) );
grid.addHeader( new GridHeader( "Report date", false, true ) );
- for ( int i = 0; i < maxLevel; i++ )
+ for ( int i=level; i<=maxLevel; i++ )
{
- int l = i + 1;
- String name = orgUnitLevelMap.containsKey( l ) ? orgUnitLevelMap.get( l ).getName() : "Level " + l;
+ String name = orgUnitLevelMap.containsKey( i ) ? orgUnitLevelMap.get( i ).getName() : "Level " + i;
grid.addHeader( new GridHeader( name, false, true ) );
}
@@ -255,10 +254,9 @@
String where = "";
String operator = "where ";
- for ( int i = 0; i < maxLevel; i++ )
+ for ( int i=level; i<=maxLevel; i++ )
{
- int l = i + 1;
- sql += "(select name from organisationunit where organisationunitid=ous.idlevel" + l + ") as level_" + i + ",";
+ sql += "(select name from organisationunit where organisationunitid=ous.idlevel" + i + ") as level_" + i + ",";
}
for ( TabularReportColumn column : columns )
@@ -334,7 +332,7 @@
sql += "order by ";
- for ( int i = 0; i < maxLevel; i++ )
+ for ( int i=level; i<=maxLevel; i++ )
{
sql += "level_" + i + ",";
}
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/CreateAnonymousEncounterAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/CreateAnonymousEncounterAction.java 2012-06-23 11:05:13 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/CreateAnonymousEncounterAction.java 2012-06-28 06:28:55 +0000
@@ -138,13 +138,13 @@
else
{
Program program = programService.getProgram( programId );
-
+ ProgramStage programStage = program.getProgramStages().iterator().next();
+
ProgramInstance programInstance = programInstanceService.getProgramInstances( program ).iterator().next();
ProgramStageInstance programStageInstance = new ProgramStageInstance();
programStageInstance.setProgramInstance( programInstance );
- ProgramStage programStage = programInstance.getProgram().getProgramStages().iterator().next();
programStageInstance.setProgramStage( programStage );
programStageInstance.setStageInProgram( programInstance.getProgramStageInstances().size() + 1 );