dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #16216
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6111: (patient) Fixed bug: Don't load programs by selected orgunit in Program Summary report.
------------------------------------------------------------
revno: 6111
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2012-02-25 19:24:41 +0700
message:
(patient) Fixed bug: Don't load programs by selected orgunit in Program Summary report.
modified:
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/ReportSelectAction.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/reportSelect.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/report/ReportSelectAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/ReportSelectAction.java 2011-07-15 08:07:54 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/ReportSelectAction.java 2012-02-25 12:24:41 +0000
@@ -27,7 +27,12 @@
package org.hisp.dhis.caseentry.action.report;
+import java.util.Collection;
+
+import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
+import org.hisp.dhis.program.Program;
+import org.hisp.dhis.program.ProgramService;
import com.opensymphony.xwork2.Action;
@@ -41,7 +46,7 @@
// -------------------------------------------------------------------------
// Dependencies
// -------------------------------------------------------------------------
-
+
private OrganisationUnitSelectionManager selectionManager;
public void setSelectionManager( OrganisationUnitSelectionManager selectionManager )
@@ -49,13 +54,42 @@
this.selectionManager = selectionManager;
}
+ private ProgramService programService;
+
+ public void setProgramService( ProgramService programService )
+ {
+ this.programService = programService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private OrganisationUnit orgunit;
+
+ public OrganisationUnit getOrgunit()
+ {
+ return orgunit;
+ }
+
+ private Collection<Program> programs;
+
+ public Collection<Program> getPrograms()
+ {
+ return programs;
+ }
+
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
public String execute()
{
- selectionManager.clearSelectedOrganisationUnits();
+ orgunit = selectionManager.getSelectedOrganisationUnit();
+
+ programs = programService.getPrograms( orgunit );
+
+ programs.retainAll( programService.getPrograms( true, false ) );
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-02-11 13:58:02 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml 2012-02-25 12:24:41 +0000
@@ -234,6 +234,8 @@
scope="prototype">
<property name="selectionManager"
ref="org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager" />
+ <property name="programService"
+ ref="org.hisp.dhis.program.ProgramService" />
</bean>
<bean
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/reportSelect.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/reportSelect.vm 2012-02-25 03:16:51 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/reportSelect.vm 2012-02-25 12:24:41 +0000
@@ -14,14 +14,18 @@
<table>
<tr>
<td><label>$i18n.getString( "reporting_unit" )</label></td>
- <td><input type="text" readonly="readonly" id='orgunitname' name='orgunitname' value="[$i18n.getString( "select" )]" style="min-width:350px"></td>
+ <td><input type="text" readonly="readonly" id='orgunitname' name='orgunitname' #if($!orgunit) value="$!orgunit.name" #else value="[$i18n.getString( "select" )]" #end style="min-width:350px"></td>
</tr>
<tr>
<td><label for="programId">$i18n.getString( "program" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
<td>
- <select id="programId" name="programId" disabled style="min-width:350px" class="{validate:{required:true}}" >
- </select>
+ <select id="programId" name="programId" #if($!programs) #else disabled #end style="min-width:350px" class="{validate:{required:true}}" >
+ <option>[$i18n.getString('please_select_a_program')]</option>
+ #foreach( $program in $programs )
+ <option value='$program.id'>$program.name</option>
+ #end
+ </select>
</td>
</tr>
@@ -47,7 +51,7 @@
<tr>
<td></td>
- <td><input type="submit" id='generateBtn' name='generateBtn' disabled value="$i18n.getString( 'generate' )" style="width:10em" />
+ <td><input type="submit" id='generateBtn' name='generateBtn' #if($!programs) #else disabled #end value="$i18n.getString( 'generate' )" style="width:10em" />
<input type="button" value="$i18n.getString( 'cancel' )" onclick="window.location.href='index.action'" style="width:10em"/>
</td>
</tr>