dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #21666
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 10317: [mobile] fix bug in saving anonymous program
------------------------------------------------------------
revno: 10317
committer: Long <Long@Long-Laptop>
branch nick: dhis2
timestamp: Tue 2013-03-19 22:44:35 +0700
message:
[mobile] fix bug in saving anonymous program
modified:
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/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
--
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/anonymous/action/SaveAnonymousProgramAction.java'
--- 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
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/anonymous/action/SaveAnonymousProgramAction.java 2013-03-19 15:44:35 +0000
@@ -297,7 +297,7 @@
programInstance.setProgram( program );
- programInstance.setCompleted( false );
+ programInstance.setCompleted( true );
programInstanceService.addProgramInstance( programInstance );
@@ -311,9 +311,11 @@
programStageInstance.setExecutionDate( new Date() );
- programStageInstance.setCompleted( false );
+ programStageInstance.setCompleted( true );
programStageInstance.setOrganisationUnit( orgUnitService.getOrganisationUnit( orgUnitId ) );
+
+ programStageInstanceService.addProgramStageInstance( programStageInstance );
for ( ProgramStageDataElement programStageDataElement : programStageDataElements )
{
@@ -324,16 +326,22 @@
patientDataValue.setDataElement( dataElement );
String id = "DE" + dataElement.getId();
-
- patientDataValue.setValue( parameterMap.get( id ) );
-
- patientDataValue.setProgramStageInstance( programStageInstance );
-
- patientDataValue.setProvidedElsewhere( false );
-
- patientDataValue.setTimestamp( new Date() );
-
- patientDataValueService.savePatientDataValue( patientDataValue );
+
+ String value = parameterMap.get( id );
+
+ if ( value != null && !value.trim().equals( "" )) {
+
+ patientDataValue.setValue( value );
+
+ patientDataValue.setProgramStageInstance( programStageInstance );
+
+ patientDataValue.setProvidedElsewhere( false );
+
+ patientDataValue.setTimestamp( new Date() );
+
+ patientDataValueService.savePatientDataValue( patientDataValue );
+ }
+
}
return SUCCESS;
=== 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-03-18 08:17:23 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/resources/struts.xml 2013-03-19 15:44:35 +0000
@@ -520,7 +520,7 @@
<action name="saveAnonymousForm"
class="org.hisp.dhis.light.anonymous.action.SaveAnonymousProgramAction">
- <result name="success" type="redirect">/light/anonymous.action?validated=true</result>
+ <result name="success" type="redirect">/light/anonymous.action?validated=true&orgUnitId=${orgUnitId}</result>
<result name="error" type="velocity">/dhis-web-light/main.vm</result>
<param name="page">/dhis-web-light/anonymous/anonymousProgramForm.vm</param>
<param name="requiredAuthorities">F_PATIENT_DATAVALUE_ADD,F_PATIENT_DATAVALUE_UPDATE,F_PATIENT_DATAVALUE_DELETE</param>
=== 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 2013-03-18 08:17:23 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/anonymous/anonymousProgramForm.vm 2013-03-19 15:44:35 +0000
@@ -71,10 +71,7 @@
<div id="footer">
<h2>$i18n.getString( "navigate_to" )</h2>
<ul>
- <li><a href="anonymous.action">$i18n.getString("anomynous_program_list")</a></li>
- <li><a href="feedback.action">$i18n.getString("feedback")</a></li>
- <li><a href="../dhis-web-commons-security/logout.action">$i18n.getString("logout")</a></li>
- <li style="padding-top: 5px;"><a href="../">$i18n.getString("desktop_version")</a></li>
+ <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/anonymous/anonymousProgramSelection.vm'
--- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/anonymous/anonymousProgramSelection.vm 2013-03-18 08:17:23 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/anonymous/anonymousProgramSelection.vm 2013-03-19 15:44:35 +0000
@@ -15,8 +15,6 @@
<div id="footer">
<h2>$i18n.getString( "navigate_to" )</h2>
<ul>
- <li><a href="feedback.action">$i18n.getString("feedback")</a></li>
- <li><a href="../dhis-web-commons-security/logout.action">$i18n.getString("logout")</a></li>
- <li style="padding-top: 5px;"><a href="../">$i18n.getString("desktop_version")</a></li>
+ <li><a href="index.action">$i18n.getString("home")</a></li>
</ul>
</div>
\ No newline at end of file