=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/ActivityReportingService.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/ActivityReportingService.java 2012-04-10 06:49:47 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/ActivityReportingService.java 2012-10-12 09:22:44 +0000
@@ -44,7 +44,7 @@
public ActivityPlan getActivitiesByIdentifier( String keyword )
throws NotAllowedException;
- public void saveActivityReport( OrganisationUnit unit, ActivityValue activityValue )
+ public void saveActivityReport( OrganisationUnit unit, ActivityValue activityValue, Integer programStageSectionId )
throws NotAllowedException;
}
=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java 2012-10-09 04:45:29 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java 2012-10-12 09:22:44 +0000
@@ -67,6 +67,8 @@
import org.hisp.dhis.program.ProgramStageDataElement;
import org.hisp.dhis.program.ProgramStageInstance;
import org.hisp.dhis.program.ProgramStageInstanceService;
+import org.hisp.dhis.program.ProgramStageSection;
+import org.hisp.dhis.program.ProgramStageSectionService;
import org.hisp.dhis.system.util.DateUtils;
import org.joda.time.DateTime;
import org.joda.time.Period;
@@ -101,6 +103,13 @@
private PatientMobileSettingService patientMobileSettingService;
private PatientIdentifierService patientIdentifierService;
+
+ private ProgramStageSectionService programStageSectionService;
+
+ public void setProgramStageSectionService( ProgramStageSectionService programStageSectionService )
+ {
+ this.programStageSectionService = programStageSectionService;
+ }
// -------------------------------------------------------------------------
// MobileDataSetService
@@ -238,7 +247,7 @@
// -------------------------------------------------------------------------
@Override
- public void saveActivityReport( OrganisationUnit unit, ActivityValue activityValue )
+ public void saveActivityReport( OrganisationUnit unit, ActivityValue activityValue, Integer programStageSectionId )
throws NotAllowedException
{
@@ -251,10 +260,22 @@
programStageInstance.getProgramStage();
Collection dataElements = new ArrayList();
-
- for ( ProgramStageDataElement de : programStageInstance.getProgramStage().getProgramStageDataElements() )
- {
- dataElements.add( de.getDataElement() );
+
+ ProgramStageSection programStageSection = programStageSectionService.getProgramStageSection( programStageSectionId );
+
+ if ( programStageSectionId != null && programStageSectionId != 0 )
+ {
+ for ( ProgramStageDataElement de : programStageSection.getProgramStageDataElements() )
+ {
+ dataElements.add( de.getDataElement() );
+ }
+ }
+ else
+ {
+ for ( ProgramStageDataElement de : programStageInstance.getProgramStage().getProgramStageDataElements() )
+ {
+ dataElements.add( de.getDataElement() );
+ }
}
programStageInstance.getProgramStage().getProgramStageDataElements();
@@ -266,7 +287,7 @@
}
if ( dataElements.size() != dataElementIds.size() )
- {
+ {;
throw NotAllowedException.INVALID_PROGRAM_STAGE;
}
@@ -281,8 +302,12 @@
}
// Set ProgramStageInstance to completed
- programStageInstance.setCompleted( true );
- programStageInstanceService.updateProgramStageInstance( programStageInstance );
+ if ( programStageSectionId == 0 )
+ {
+ programStageInstance.setCompleted( true );
+ programStageInstanceService.updateProgramStageInstance( programStageInstance );
+ }
+
// Everything is fine, hence save
saveDataValues( activityValue, programStageInstance, dataElementMap );
@@ -441,7 +466,6 @@
dataElement = dataElementMap.get( dv.getId() );
PatientDataValue dataValue = dataValueService.getPatientDataValue( programStageInstance, dataElement );
-
if ( dataValue == null )
{
if ( value != null )
=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/resources/META-INF/dhis/beans.xml 2012-10-09 04:45:29 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/resources/META-INF/dhis/beans.xml 2012-10-12 09:22:44 +0000
@@ -24,6 +24,7 @@
+
=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/GetProgramStageFormAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/GetProgramStageFormAction.java 2012-07-13 09:18:09 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/GetProgramStageFormAction.java 2012-10-12 09:22:44 +0000
@@ -27,6 +27,7 @@
package org.hisp.dhis.light.namebaseddataentry.action;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
@@ -35,7 +36,7 @@
import org.hisp.dhis.api.mobile.model.Activity;
import org.hisp.dhis.api.mobile.model.ActivityPlan;
import org.hisp.dhis.api.mobile.model.DataElement;
-import org.hisp.dhis.api.mobile.model.ProgramStage;
+
import org.hisp.dhis.light.utils.NamebasedUtils;
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.patient.Patient;
@@ -43,14 +44,19 @@
import org.hisp.dhis.patientdatavalue.PatientDataValue;
import org.hisp.dhis.patientdatavalue.PatientDataValueService;
import org.hisp.dhis.program.Program;
+import org.hisp.dhis.program.ProgramStage;
+import org.hisp.dhis.program.ProgramStageDataElement;
import org.hisp.dhis.program.ProgramStageInstanceService;
+import org.hisp.dhis.program.ProgramStageSection;
+import org.hisp.dhis.program.ProgramStageSectionService;
import com.opensymphony.xwork2.Action;
public class GetProgramStageFormAction
implements Action
{
-
+ private static final String REDIRECT = "redirect";
+
// -------------------------------------------------------------------------
// Dependencies
// -------------------------------------------------------------------------
@@ -103,6 +109,12 @@
this.patientService = patientService;
}
+ private ProgramStageSectionService programStageSectionService;
+
+ public void setProgramStageSectionService( ProgramStageSectionService programStageSectionService )
+ {
+ this.programStageSectionService = programStageSectionService;
+ }
// -------------------------------------------------------------------------
// Input & Output
@@ -247,7 +259,33 @@
{
this.patient = patient;
}
-
+
+ private Integer programStageSectionId;
+
+ public void setProgramStageSectionId( Integer programStageSectionId )
+ {
+ this.programStageSectionId = programStageSectionId;
+ }
+
+ public Integer getProgramStageSectionId()
+ {
+ return programStageSectionId;
+ }
+
+ private List listOfProgramStageSections;
+
+ public List getListOfProgramStageSections()
+ {
+ return listOfProgramStageSections;
+ }
+
+ public ProgramStageSection programStageSection;
+
+ public ProgramStageSection getProgramStageSection()
+ {
+ return programStageSection;
+ }
+
// -------------------------------------------------------------------------
// Action Implementation
// -------------------------------------------------------------------------
@@ -269,7 +307,19 @@
prevDataValues.clear();
programStage = util.getProgramStage( programId, programStageId );
patient = patientService.getPatient( patientId );
- dataElements = programStage.getDataElements();
+
+ if( programStageSectionId != null && programStageSectionId != 0 )
+ {
+ this.programStageSection = programStageSectionService.getProgramStageSection( this.programStageSectionId );
+
+ List listOfProgramStageDataElement = programStageSection.getProgramStageDataElements();
+
+ dataElements = util.transformDataElementsToMobileModel( listOfProgramStageDataElement );
+ }
+ else
+ {
+ dataElements = util.transformDataElementsToMobileModel( programStageId );
+ }
program = programStageInstanceService.getProgramStageInstance( programStageInstanceId ).getProgramInstance().getProgram();
Collection patientDataValues = patientDataValueService
.getPatientDataValues( programStageInstanceService.getProgramStageInstance( programStageInstanceId ) );
=== added file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/GetProgramStageSectionAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/GetProgramStageSectionAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/GetProgramStageSectionAction.java 2012-10-12 09:22:44 +0000
@@ -0,0 +1,225 @@
+/*
+ * Copyright (c) 2004-2012, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package org.hisp.dhis.light.namebaseddataentry.action;
+
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import org.hisp.dhis.light.utils.NamebasedUtils;
+import org.hisp.dhis.patient.Patient;
+import org.hisp.dhis.patient.PatientService;
+import org.hisp.dhis.program.ProgramInstance;
+import org.hisp.dhis.program.ProgramInstanceService;
+import org.hisp.dhis.program.ProgramStage;
+import org.hisp.dhis.program.ProgramStageDataElement;
+import org.hisp.dhis.program.ProgramStageInstance;
+import org.hisp.dhis.program.ProgramStageInstanceService;
+import org.hisp.dhis.program.ProgramStageSection;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Nguyen Kim Lai
+ *
+ * @version $ GetProgramStageSectionAction.java Oct 10, 2012 $
+ */
+public class GetProgramStageSectionAction implements Action
+{
+ private static final String REDIRECT = "redirect";
+ private static final String REDIRECT_COMPLETED_FORM = "redirectCompletedForm";
+
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private NamebasedUtils util;
+
+ public void setUtil( NamebasedUtils util )
+ {
+ this.util = util;
+ }
+
+ private PatientService patientService;
+
+ public void setPatientService( PatientService patientService )
+ {
+ this.patientService = patientService;
+ }
+
+ private ProgramStageInstanceService programStageInstanceService;
+
+ public void setProgramStageInstanceService( ProgramStageInstanceService programStageInstanceService )
+ {
+ this.programStageInstanceService = programStageInstanceService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input & Output
+ // -------------------------------------------------------------------------
+
+ private Integer programInstanceId;
+
+ public Integer getProgramInstanceId()
+ {
+ return programInstanceId;
+ }
+
+ public void setProgramInstanceId( Integer programInstanceId )
+ {
+ this.programInstanceId = programInstanceId;
+ }
+
+ private Integer programStageInstanceId;
+
+ public Integer getProgramStageInstanceId()
+ {
+ return programStageInstanceId;
+ }
+
+ public void setProgramStageInstanceId( Integer programStageInstanceId )
+ {
+ this.programStageInstanceId = programStageInstanceId;
+ }
+
+ private Integer patientId;
+
+ public Integer getPatientId()
+ {
+ return patientId;
+ }
+
+ public void setPatientId( Integer patientId )
+ {
+ this.patientId = patientId;
+ }
+
+ private Patient patient;
+
+ public Patient getPatient()
+ {
+ return patient;
+ }
+
+ private Integer programId;
+
+ public void setProgramId( Integer programId )
+ {
+ this.programId = programId;
+ }
+
+ public Integer getProgramId()
+ {
+ return programId;
+ }
+
+ private Integer programStageId;
+
+ public void setProgramStageId( Integer programStageId )
+ {
+ this.programStageId = programStageId;
+ }
+
+ public Integer getProgramStageId()
+ {
+ return programStageId;
+ }
+
+ private Integer orgUnitId;
+
+ public void setOrgUnitId( Integer orgUnitId )
+ {
+ this.orgUnitId = orgUnitId;
+ }
+
+ public Integer getOrgUnitId()
+ {
+ return this.orgUnitId;
+ }
+
+ private ProgramStage programStage;
+
+ public ProgramStage getProgramStage()
+ {
+ return this.programStage;
+ }
+
+ private List listOfProgramStageSections;
+
+ public List getListOfProgramStageSections()
+ {
+ return listOfProgramStageSections;
+ }
+
+ private List listOfProgramStageDataElement;
+
+ public List getListOfProgramStageDataElement()
+ {
+ return listOfProgramStageDataElement;
+ }
+
+ public DateFormat getDateFormat()
+ {
+ return new SimpleDateFormat( "yyyy-MM-dd" );
+ }
+
+ public ProgramStageInstance programStageInstance;
+
+ public ProgramStageInstance getProgramStageInstance()
+ {
+ return programStageInstance;
+ }
+
+ @Override
+ public String execute()
+ throws Exception
+ {
+ programStageInstance = programStageInstanceService.getProgramStageInstance( programStageInstanceId );
+
+ patient = patientService.getPatient( patientId );
+
+ programStage = util.getProgramStage( programId, programStageId );
+
+ this.listOfProgramStageSections = new ArrayList(programStage.getProgramStageSections());
+
+ if( this.listOfProgramStageSections.size() == 0 && programStageInstance.isCompleted() == false)
+ {
+ return REDIRECT;
+ }
+ else if( this.listOfProgramStageSections.size() == 0 && programStageInstance.isCompleted() == true )
+ {
+ return REDIRECT_COMPLETED_FORM;
+ }
+
+ //this.listOfProgramStageDataElement = listOfProgramStageSections.get( 0 ).getProgramStageDataElements();
+ return SUCCESS;
+ }
+
+}
=== added file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/MarkCompleteProgramStageAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/MarkCompleteProgramStageAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/MarkCompleteProgramStageAction.java 2012-10-12 09:22:44 +0000
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2004-2012, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package org.hisp.dhis.light.namebaseddataentry.action;
+
+import org.hisp.dhis.program.ProgramStageInstance;
+import org.hisp.dhis.program.ProgramStageInstanceService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Nguyen Kim Lai
+ *
+ * @version $ MarkCompleteProgramStageHasSection.java Oct 12, 2012 $
+ */
+public class MarkCompleteProgramStageAction implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private ProgramStageInstanceService programStageInstanceService;
+
+ public void setProgramStageInstanceService( ProgramStageInstanceService programStageInstanceService )
+ {
+ this.programStageInstanceService = programStageInstanceService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input & Output
+ // -------------------------------------------------------------------------
+
+ private Integer programStageInstanceId;
+
+ public void setProgramStageInstanceId( Integer programStageInstanceId )
+ {
+ this.programStageInstanceId = programStageInstanceId;
+ }
+
+ private Integer patientId;
+
+ public void setPatientId( Integer patientId )
+ {
+ this.patientId = patientId;
+ }
+
+ public Integer getPatientId()
+ {
+ return patientId;
+ }
+
+ @Override
+ public String execute()
+ throws Exception
+ {
+ ProgramStageInstance programStageInstance = programStageInstanceService.getProgramStageInstance( programStageInstanceId );
+ programStageInstance.setCompleted( true );
+ programStageInstanceService.updateProgramStageInstance( programStageInstance );
+ return SUCCESS;
+ }
+
+}
=== 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 2012-10-01 04:36:31 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/SaveProgramStageFormAction.java 2012-10-12 09:22:44 +0000
@@ -45,7 +45,7 @@
import org.hisp.dhis.api.mobile.model.ActivityValue;
import org.hisp.dhis.api.mobile.model.DataElement;
import org.hisp.dhis.api.mobile.model.DataValue;
-import org.hisp.dhis.api.mobile.model.ProgramStage;
+//import org.hisp.dhis.api.mobile.model.ProgramStage;
import org.hisp.dhis.dataelement.DataElementCategoryService;
import org.hisp.dhis.dataelement.DataElementService;
import org.hisp.dhis.i18n.I18n;
@@ -57,10 +57,13 @@
import org.hisp.dhis.patient.PatientService;
import org.hisp.dhis.patientdatavalue.PatientDataValueService;
import org.hisp.dhis.program.Program;
+import org.hisp.dhis.program.ProgramStage;
import org.hisp.dhis.program.ProgramStageDataElement;
import org.hisp.dhis.program.ProgramStageDataElementService;
import org.hisp.dhis.program.ProgramStageInstance;
import org.hisp.dhis.program.ProgramStageInstanceService;
+import org.hisp.dhis.program.ProgramStageSection;
+import org.hisp.dhis.program.ProgramStageSectionService;
import org.hisp.dhis.program.ProgramStageService;
import org.hisp.dhis.program.ProgramValidation;
import org.hisp.dhis.program.ProgramValidationService;
@@ -199,6 +202,13 @@
{
this.programStageInstanceService = programStageInstanceService;
}
+
+ private ProgramStageSectionService programStageSectionService;
+
+ public void setProgramStageSectionService( ProgramStageSectionService programStageSectionService )
+ {
+ this.programStageSectionService = programStageSectionService;
+ }
// -------------------------------------------------------------------------
// Input & Output
@@ -378,6 +388,25 @@
{
this.rightsideFormulaMap = rightsideFormulaMap;
}
+
+ private Integer programStageSectionId;
+
+ public void setProgramStageSectionId( Integer programStageSectionId )
+ {
+ this.programStageSectionId = programStageSectionId;
+ }
+
+ public Integer getProgramStageSectionId()
+ {
+ return programStageSectionId;
+ }
+
+ public ProgramStageSection programStageSection;
+
+ public ProgramStageSection getProgramStageSection()
+ {
+ return programStageSection;
+ }
private I18n i18n;
@@ -401,7 +430,18 @@
org.hisp.dhis.program.ProgramStage dhisProgramStage = programStageService.getProgramStage( programStageId );
patient = patientService.getPatient( patientId );
- dataElements = programStage.getDataElements();
+ if( programStageSectionId != null && programStageSectionId != 0 )
+ {
+ this.programStageSection = programStageSectionService.getProgramStageSection( this.programStageSectionId );
+
+ List listOfProgramStageDataElement = programStageSection.getProgramStageDataElements();
+
+ dataElements = util.transformDataElementsToMobileModel( listOfProgramStageDataElement );
+ }
+ else
+ {
+ dataElements = util.transformDataElementsToMobileModel( programStageId );
+ }
int defaultCategoryOptionId = dataElementCategoryService.getDefaultDataElementCategoryOptionCombo().getId();
HttpServletRequest request = (HttpServletRequest) ActionContext.getContext().get(
@@ -469,7 +509,7 @@
try
{
- activityReportingService.saveActivityReport( organisationUnit, activityValue );
+ activityReportingService.saveActivityReport( organisationUnit, activityValue, programStageSectionId );
}
catch ( NotAllowedException e )
{
@@ -520,7 +560,7 @@
}
}
}
-
+
if ( !programValidations.isEmpty() )
{
leftsideFormulaMap = new HashMap( programValidations.size() );
=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevent/action/GetSingleEventFormAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevent/action/GetSingleEventFormAction.java 2012-10-09 04:45:29 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevent/action/GetSingleEventFormAction.java 2012-10-12 09:22:44 +0000
@@ -240,7 +240,6 @@
if ( searchResult != null )
{
this.prevDataValues.put( "DE" + this.dataElementIdForSearching, searchResult );
- System.out.println("ko co null");
}
else
{
=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/utils/NamebasedUtils.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/utils/NamebasedUtils.java 2012-07-29 10:56:12 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/utils/NamebasedUtils.java 2012-10-12 09:22:44 +0000
@@ -27,13 +27,18 @@
package org.hisp.dhis.light.utils;
-import org.hisp.dhis.api.mobile.IProgramService;
-import org.hisp.dhis.api.mobile.model.Program;
-import org.hisp.dhis.api.mobile.model.ProgramStage;
import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.program.Program;
+import org.hisp.dhis.program.ProgramService;
+import org.hisp.dhis.program.ProgramStage;
+import org.hisp.dhis.program.ProgramStageDataElement;
import org.hisp.dhis.program.ProgramStageInstance;
+import org.hisp.dhis.program.ProgramStageService;
+import org.springframework.beans.factory.annotation.Required;
+import java.util.ArrayList;
import java.util.Collection;
+import java.util.List;
import java.util.Set;
public class NamebasedUtils
@@ -42,16 +47,33 @@
// Dependencies
// -------------------------------------------------------------------------
- private IProgramService programService;
+ //private IProgramService IprgramService;
+ private ProgramService programService;
- public void setProgramService( IProgramService programService )
+ public void setProgramService( ProgramService programService )
{
this.programService = programService;
}
+
+ private ProgramStageService programStageService;
+
+ public void setProgramStageService( ProgramStageService programStageService )
+ {
+ this.programStageService = programStageService;
+ }
+
+ private org.hisp.dhis.mobile.service.ModelMapping modelMapping;
+
+ @Required
+ public void setModelMapping( org.hisp.dhis.mobile.service.ModelMapping modelMapping )
+ {
+ this.modelMapping = modelMapping;
+ }
public ProgramStage getProgramStage( int programId, int programStageId )
{
- Program program = programService.getProgram( programId, "" );
+ //Program program = programService.getProgram( programId, "" );
+ Program program = programService.getProgram( programId );
Collection stages = program.getProgramStages();
@@ -130,4 +152,35 @@
return null;
}
+
+ public List transformDataElementsToMobileModel( Integer programStageId )
+ {
+ ProgramStage programStage = programStageService.getProgramStage( programStageId );
+
+ List des = new ArrayList();
+
+ List programStageDataElements = new ArrayList(programStage.getProgramStageDataElements());
+
+ des = transformDataElementsToMobileModel( programStageDataElements );
+
+ return des;
+ }
+ public List transformDataElementsToMobileModel( List programStageDataElements)
+ {
+ List des = new ArrayList();
+
+ for ( ProgramStageDataElement programStagedataElement : programStageDataElements )
+ {
+ //programStagedataElement = i18n( i18nService, locale, programStagedataElement );
+
+ DataElement dataElement = programStagedataElement.getDataElement();
+
+ org.hisp.dhis.api.mobile.model.DataElement de = modelMapping.getDataElement( dataElement );
+
+ de.setCompulsory( programStagedataElement.isCompulsory() );
+
+ des.add( de );
+ }
+ return des;
+ }
}
=== 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 2012-10-03 07:43:08 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/resources/META-INF/dhis/beans.xml 2012-10-12 09:22:44 +0000
@@ -146,6 +146,22 @@
+
+
+
+
+
+
+
+
+
+
@@ -154,10 +170,14 @@
+
-
+
+
+
+
=== 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 2012-10-03 07:43:08 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/resources/struts.xml 2012-10-12 09:22:44 +0000
@@ -103,7 +103,15 @@
/dhis-web-light/main.vm
/dhis-web-light/namebased/selectActivity.vm
-
+
+
+ showProgramStageForm.action?programStageSectionId=0&programId=${programId}&programStageId=${programStageInstance.getProgramStage().getId()}&programStageInstanceId=${programStageInstance.getId()}&patientId=${patient.getId()}&programInstanceId=${programStageInstance.getProgramInstance().getId()}&orgUnitId=0
+ showCompletedProgramStageForm.action?programStageSectionId=0&programId=${programId}&programStageId=${programStageInstance.getProgramStage().getId()}&programStageInstanceId=${programStageInstance.getId()}&patientId=${patient.getId()}&programInstanceId=${programStageInstance.getProgramInstance().getId()}&orgUnitId=0
+ /dhis-web-light/main.vm
+ /dhis-web-light/namebased/selectProgramStageSection.vm
+
+
/dhis-web-light/main.vm
@@ -115,6 +123,11 @@
/dhis-web-light/main.vm
/dhis-web-light/namebased/completedProgramStageForm.vm
+
+
+ showPatientProgramList.action?patientId=${patientId}
+
=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/dataEntryOverview.vm'
--- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/dataEntryOverview.vm 2012-01-23 13:45:36 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/dataEntryOverview.vm 2012-10-12 09:22:44 +0000
@@ -61,17 +61,6 @@
-
-
-
-
-
-
-
-
-
-
-
#* This might get reactivated later, as configurable setting? *#
#*
=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/dataEntrySection.vm'
--- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/dataEntrySection.vm 2012-06-28 08:44:43 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/dataEntrySection.vm 2012-10-12 09:22:44 +0000
@@ -8,7 +8,6 @@
#end
$encoder.htmlEncode( $dataSetName )
-
#set( $validationViolationsSize = $validationViolations.size() )
#set( $typeViolationsSize = $typeViolations.size() )
@@ -35,7 +34,6 @@
#if( $sectionId)
#end
-
#macro( createSection $sectionName $dataElements )
=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/namebased/beneficiaryProgramList.vm'
--- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/namebased/beneficiaryProgramList.vm 2012-10-03 07:43:08 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/namebased/beneficiaryProgramList.vm 2012-10-12 09:22:44 +0000
@@ -21,7 +21,7 @@
#if($nextStage)
- - Next: $nextStage.getProgramStage().getName()
+ - Next: $nextStage.getProgramStage().getName()
#end
#end
=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/namebased/beneficiaryProgramStageList.vm'
--- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/namebased/beneficiaryProgramStageList.vm 2012-07-16 07:53:40 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/namebased/beneficiaryProgramStageList.vm 2012-10-12 09:22:44 +0000
@@ -17,10 +17,10 @@
#end
#if( $programStageInstance.isCompleted() == true )
-
+
$programStageInstance.getProgramStage().getName() (${dateFormat.format( $programStageInstance.executionDate )})
- #else
-
+ #else
+
$programStageInstance.getProgramStage().getName() (${dateFormat.format( $programStageInstance.dueDate)})
#end
=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/namebased/programStageForm.vm'
--- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/namebased/programStageForm.vm 2012-10-01 04:36:31 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/namebased/programStageForm.vm 2012-10-12 09:22:44 +0000
@@ -1,5 +1,12 @@
-$encoder.htmlEncode( $programStage.name )
-
+
#set( $typeViolationsSize = $typeViolations.size() )
#set( $programViolationsSize = $programValidations.size() )
@@ -15,7 +22,6 @@
#end
-