← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 10286: [mobile] fix the no orgunit bug in anonymous

 

------------------------------------------------------------
revno: 10286
committer: Long <Long@Long-Laptop>
branch nick: dhis2
timestamp: Mon 2013-03-18 15:17:23 +0700
message:
  [mobile] fix the no orgunit bug in anonymous
added:
  dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/anonymous/selectAnonymousOrgUnit.vm
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/sms/incoming/IncomingSms.java
  dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/anonymous/action/GetAllAnonymousProgramAction.java
  dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/anonymous/action/SaveAnonymousProgramAction.java
  dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/anonymous/action/ShowAnonymousFormAction.java
  dhis-2/dhis-web/dhis-web-light/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-light/src/main/resources/struts.xml
  dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/anonymous/anonymousProgramForm.vm
  dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/anonymous/anonymousProgramSelection.vm
  dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/trackingMenu.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/sms/incoming/IncomingSms.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/sms/incoming/IncomingSms.java	2012-11-20 13:34:03 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/sms/incoming/IncomingSms.java	2013-03-18 08:17:23 +0000
@@ -32,7 +32,7 @@
 
 public class IncomingSms
     implements Serializable
-{
+{    
     private static final long serialVersionUID = 3954710607630454226L;
 
     private Integer id;

=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/anonymous/action/GetAllAnonymousProgramAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/anonymous/action/GetAllAnonymousProgramAction.java	2012-08-13 10:06:08 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/anonymous/action/GetAllAnonymousProgramAction.java	2013-03-18 08:17:23 +0000
@@ -77,6 +77,18 @@
     {
         this.validated = validated;
     }
+    
+    private int orgUnitId;
+    
+    public int getOrgUnitId()
+    {
+        return orgUnitId;
+    }
+
+    public void setOrgUnitId( int orgUnitId )
+    {
+        this.orgUnitId = orgUnitId;
+    }
 
     // -------------------------------------------------------------------------
     // Implementation Action

=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/anonymous/action/SaveAnonymousProgramAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/anonymous/action/SaveAnonymousProgramAction.java	2012-07-13 09:18:09 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/anonymous/action/SaveAnonymousProgramAction.java	2013-03-18 08:17:23 +0000
@@ -38,6 +38,7 @@
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataelement.DataElementService;
 import org.hisp.dhis.light.utils.NamebasedUtils;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
 import org.hisp.dhis.patientdatavalue.PatientDataValue;
 import org.hisp.dhis.patientdatavalue.PatientDataValueService;
 import org.hisp.dhis.program.Program;
@@ -124,6 +125,18 @@
     {
         this.programStageDataElementService = programStageDataElementService;
     }
+    
+    private OrganisationUnitService orgUnitService;
+    
+    public OrganisationUnitService getOrgUnitService()
+    {
+        return orgUnitService;
+    }
+
+    public void setOrgUnitService( OrganisationUnitService orgUnitService )
+    {
+        this.orgUnitService = orgUnitService;
+    }
 
     // -------------------------------------------------------------------------
     // Input Output
@@ -170,6 +183,18 @@
     {
         return program;
     }
+    
+    private int orgUnitId;
+    
+    public int getOrgUnitId()
+    {
+        return orgUnitId;
+    }
+
+    public void setOrgUnitId( int orgUnitId )
+    {
+        this.orgUnitId = orgUnitId;
+    }
 
     private ArrayList<ProgramStageDataElement> programStageDataElements = new ArrayList<ProgramStageDataElement>();
 
@@ -287,8 +312,8 @@
         programStageInstance.setExecutionDate( new Date() );
 
         programStageInstance.setCompleted( false );
-
-        programStageInstanceService.addProgramStageInstance( programStageInstance );
+        
+        programStageInstance.setOrganisationUnit( orgUnitService.getOrganisationUnit( orgUnitId ) );
 
         for ( ProgramStageDataElement programStageDataElement : programStageDataElements )
         {

=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/anonymous/action/ShowAnonymousFormAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/anonymous/action/ShowAnonymousFormAction.java	2012-07-13 09:18:09 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/anonymous/action/ShowAnonymousFormAction.java	2013-03-18 08:17:23 +0000
@@ -86,6 +86,18 @@
         return program;
     }
     
+    private int orgUnitId;
+    
+    public int getOrgUnitId()
+    {
+        return orgUnitId;
+    }
+
+    public void setOrgUnitId( int orgUnitId )
+    {
+        this.orgUnitId = orgUnitId;
+    }
+    
     private ArrayList<ProgramStageDataElement> programStageDataElements = new ArrayList<ProgramStageDataElement>();
 
     public ArrayList<ProgramStageDataElement> getProgramStageDataElements()

=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-light/src/main/resources/META-INF/dhis/beans.xml	2013-01-16 10:29:01 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/resources/META-INF/dhis/beans.xml	2013-03-18 08:17:23 +0000
@@ -540,6 +540,8 @@
 	<bean id="org.hisp.dhis.light.anonymous.action.SaveAnonymousProgramAction"
 		class="org.hisp.dhis.light.anonymous.action.SaveAnonymousProgramAction"
 		scope="prototype">
+		<property name="orgUnitService"
+			ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />	
 		<property name="programService" ref="org.hisp.dhis.program.ProgramService" />
 		<property name="util" ref="org.hisp.dhis.light.utils.NamebasedUtils" />
 		<property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />

=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-light/src/main/resources/struts.xml	2013-01-28 09:42:58 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/resources/struts.xml	2013-03-18 08:17:23 +0000
@@ -497,6 +497,14 @@
     </action>
 
     <!-- Anonymous -->
+    
+    <action name="selectAnonymousOrgUnit"
+        class="org.hisp.dhis.light.beneficiaryregistration.action.GetBeneficiaryRegistrationOrganisationUnitAction">
+	  <result name="redirect" type="redirect">/light/anonymous.action?orgUnitId=${orgUnitId}</result>	
+      <result name="success" type="velocity">/dhis-web-light/main.vm</result>
+      <param name="page">/dhis-web-light/anonymous/selectAnonymousOrgUnit.vm</param>
+    </action>
+    
     <action name="anonymous"
         class="org.hisp.dhis.light.anonymous.action.GetAllAnonymousProgramAction">
       <result name="success" type="velocity">/dhis-web-light/main.vm</result>

=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/anonymous/anonymousProgramForm.vm'
--- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/anonymous/anonymousProgramForm.vm	2012-07-13 09:18:09 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/anonymous/anonymousProgramForm.vm	2013-03-18 08:17:23 +0000
@@ -13,6 +13,7 @@
 
 <form action="saveAnonymousForm.action" method="POST">
 <input type="hidden" value="$programId" name="programId" />
+<input type="hidden" value="$orgUnitId" name="orgUnitId"/>
 <div class="header-box" align="center">
 	<p style="text-align: left;">
 

=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/anonymous/anonymousProgramSelection.vm'
--- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/anonymous/anonymousProgramSelection.vm	2012-08-13 10:06:08 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/anonymous/anonymousProgramSelection.vm	2013-03-18 08:17:23 +0000
@@ -7,7 +7,7 @@
 <p>
 <ul>
 #foreach( $program in $programs)
-	<li><a href="showAnonymousForm.action?programId=$program.id">$program.name</a></li>
+	<li><a href="showAnonymousForm.action?programId=$program.id&orgUnitId=$orgUnitId">$program.name</a></li>
 #end
 </ul>
 </p>

=== added file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/anonymous/selectAnonymousOrgUnit.vm'
--- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/anonymous/selectAnonymousOrgUnit.vm	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/anonymous/selectAnonymousOrgUnit.vm	2013-03-18 08:17:23 +0000
@@ -0,0 +1,15 @@
+<h2>$i18n.getString( "select_organisation_unit" )</h2>
+<p>
+<ul>
+#foreach( $organisationUnit in $organisationUnits )
+	<li><a href="anonymous.action?orgUnitId=$organisationUnit.id">$!encoder.htmlEncode( ${organisationUnit.name} )</a></li>
+#end
+</ul>
+</p>
+
+<div id="footer">
+<h2>$i18n.getString( "navigate_to" )</h2>
+<ul>
+	<li><a href="index.action">$i18n.getString("home")</a></li>
+</ul>
+</div>

=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/trackingMenu.vm'
--- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/trackingMenu.vm	2013-02-03 10:13:17 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/trackingMenu.vm	2013-03-18 08:17:23 +0000
@@ -22,7 +22,7 @@
     <li><a href="showFindBeneficiaryForm.action">$i18n.getString( "find_or_add_person" )</a></li>
     <li><a href="selectNamebasedOrganisationUnit.action">$i18n.getString( "visit_schedule" )</a></li>
     <li><a href="selectRegistrationOrganisationUnit.action">$i18n.getString( "beneficiary_registration" )</a></li>
-    <li><a href="anonymous.action">Anonymous</a></li>
+    <li><a href="selectAnonymousOrgUnit.action">Anonymous</a></li>
     <!-- <li><a href="showBeneficiarySearchingForm.action">$i18n.getString( "beneficiary_enrollment" )</a></li> -->
 </ul>
 </p>