← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13176: mobile light tracking does not seem to register orgunit of stages

 

------------------------------------------------------------
revno: 13176
committer: Long <Long@Long-Laptop>
branch nick: dhis2
timestamp: Mon 2013-12-09 13:44:46 +0700
message:
  mobile light tracking does not seem to register orgunit of stages
modified:
  dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/SaveProgramStageFormAction.java
  dhis-2/dhis-web/dhis-web-light/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/ShowSentSMSAction.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-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/SaveProgramStageFormAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/SaveProgramStageFormAction.java	2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/SaveProgramStageFormAction.java	2013-12-09 06:44:46 +0000
@@ -41,6 +41,8 @@
 import org.hisp.dhis.dataelement.DataElementCategoryService;
 import org.hisp.dhis.dataelement.DataElementService;
 import org.hisp.dhis.light.utils.NamebasedUtils;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
 import org.hisp.dhis.patient.Patient;
 import org.hisp.dhis.patient.PatientService;
 import org.hisp.dhis.patientdatavalue.PatientDataValue;
@@ -78,7 +80,7 @@
     // -------------------------------------------------------------------------
 
     private UserService userService;
-    
+
     public UserService getUserService()
     {
         return userService;
@@ -88,7 +90,7 @@
     {
         this.userService = userService;
     }
-    
+
     private NamebasedUtils util;
 
     public NamebasedUtils getUtil()
@@ -211,6 +213,18 @@
         this.programExpressionService = programExpressionService;
     }
 
+    private OrganisationUnitService organisationUnitService;
+
+    public OrganisationUnitService getOrganisationUnitService()
+    {
+        return organisationUnitService;
+    }
+
+    public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
+    {
+        this.organisationUnitService = organisationUnitService;
+    }
+
     // -------------------------------------------------------------------------
     // Input & Output
     // -------------------------------------------------------------------------
@@ -427,6 +441,7 @@
     {
         programStage = util.getProgramStage( programId, programStageId );
         program = programStageService.getProgramStage( programStageId ).getProgram();
+
         org.hisp.dhis.program.ProgramStage dhisProgramStage = programStageService.getProgramStage( programStageId );
 
         ProgramStageInstance programStageInstance = programStageInstanceService
@@ -447,8 +462,7 @@
             dataElements = new ArrayList<ProgramStageDataElement>( programStage.getProgramStageDataElements() );
         }
 
-        HttpServletRequest request = (HttpServletRequest) ActionContext.getContext().get(
-            StrutsStatics.HTTP_REQUEST );
+        HttpServletRequest request = (HttpServletRequest) ActionContext.getContext().get( StrutsStatics.HTTP_REQUEST );
         Map<String, String> parameterMap = ContextUtils.getParameterMap( request );
 
         // List<DataValue> dataValues = new ArrayList<DataValue>();
@@ -546,6 +560,8 @@
     private void savePatientDataValues( List<PatientDataValue> patientDataValues,
         ProgramStageInstance programStageInstance )
     {
+        OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( orgUnitId );
+
         for ( PatientDataValue patientDataValue : patientDataValues )
         {
             PatientDataValue previousPatientDataValue = patientDataValueService.getPatientDataValue(
@@ -580,6 +596,7 @@
         else
         {
             programStageInstance.setCompleted( true );
+            programStageInstance.setOrganisationUnit( organisationUnit );
         }
         programStageInstance.setExecutionDate( new Date() );
         programStageInstanceService.updateProgramStageInstance( programStageInstance );

=== 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-07-24 17:28:39 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/resources/META-INF/dhis/beans.xml	2013-12-09 06:44:46 +0000
@@ -210,6 +210,7 @@
 		<property name="programExpressionService" ref="org.hisp.dhis.program.ProgramExpressionService" />
 		<property name="patientDataValueService" ref="org.hisp.dhis.patientdatavalue.PatientDataValueService" />
 		<property name="userService" ref="org.hisp.dhis.user.UserService"/>
+		<property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService"/>
 	</bean>
 
 	<bean

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/ShowSentSMSAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/ShowSentSMSAction.java	2013-09-04 14:41:27 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/ShowSentSMSAction.java	2013-12-09 06:44:46 +0000
@@ -129,24 +129,27 @@
         throws Exception
     {
         listOutboundSMS = new ArrayList<OutboundSms>();
-        
+
         if ( filterStatusType != null && filterStatusType == 0 )
         {
             total = outboundSmsService.getOutboundSms( OutboundSmsStatus.OUTBOUND ).size();
             paging = createPaging( total );
-            listOutboundSMS = outboundSmsService.getOutboundSms( OutboundSmsStatus.OUTBOUND, paging.getStartPos(), paging.getPageSize() );
+            listOutboundSMS = outboundSmsService.getOutboundSms( OutboundSmsStatus.OUTBOUND, paging.getStartPos(),
+                paging.getPageSize() );
         }
         if ( filterStatusType != null && filterStatusType == 1 )
         {
             total = outboundSmsService.getOutboundSms( OutboundSmsStatus.SENT ).size();
             paging = createPaging( total );
-            listOutboundSMS = outboundSmsService.getOutboundSms( OutboundSmsStatus.SENT, paging.getStartPos(), paging.getPageSize() );
+            listOutboundSMS = outboundSmsService.getOutboundSms( OutboundSmsStatus.SENT, paging.getStartPos(),
+                paging.getPageSize() );
         }
         if ( filterStatusType != null && filterStatusType == 2 )
         {
             total = outboundSmsService.getOutboundSms( OutboundSmsStatus.ERROR ).size();
             paging = createPaging( total );
-            listOutboundSMS = outboundSmsService.getOutboundSms( OutboundSmsStatus.ERROR, paging.getStartPos(), paging.getPageSize() );
+            listOutboundSMS = outboundSmsService.getOutboundSms( OutboundSmsStatus.ERROR, paging.getStartPos(),
+                paging.getPageSize() );
         }
         if ( filterStatusType != null && filterStatusType == 3 || filterStatusType == null )
         {
@@ -156,7 +159,7 @@
             listOutboundSMS = outboundSmsService.getAllOutboundSms( paging.getStartPos(), paging.getPageSize() );
         }
 
-        //Get the name of recipients
+        // Get the name of recipients
         recipientNames = new ArrayList<String>();
         recipientNames.add( "" );
         String tempString;