=== 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( programStage.getProgramStageDataElements() ); } - HttpServletRequest request = (HttpServletRequest) ActionContext.getContext().get( - StrutsStatics.HTTP_REQUEST ); + HttpServletRequest request = (HttpServletRequest) ActionContext.getContext().get( StrutsStatics.HTTP_REQUEST ); Map parameterMap = ContextUtils.getParameterMap( request ); // List dataValues = new ArrayList(); @@ -546,6 +560,8 @@ private void savePatientDataValues( List 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 @@ + (); - + 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(); recipientNames.add( "" ); String tempString;