dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #27380
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13626: minor fix to anonymous upload, allow orgunit-uid
------------------------------------------------------------
revno: 13626
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2014-01-07 18:22:31 +0100
message:
minor fix to anonymous upload, allow orgunit-uid
modified:
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/UploadAnonymousEventAction.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-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/UploadAnonymousEventAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/UploadAnonymousEventAction.java 2013-12-01 22:32:50 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/UploadAnonymousEventAction.java 2014-01-07 17:22:31 +0000
@@ -28,12 +28,8 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.servlet.ServletInputStream;
-
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.opensymphony.xwork2.Action;
import org.apache.struts2.ServletActionContext;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementService;
@@ -53,8 +49,10 @@
import org.hisp.dhis.user.CurrentUserService;
import org.springframework.beans.factory.annotation.Autowired;
-import com.fasterxml.jackson.core.type.TypeReference;
-import com.opensymphony.xwork2.Action;
+import javax.servlet.ServletInputStream;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
/**
* @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
@@ -110,7 +108,7 @@
// -------------------------------------------------------------------------
@Override
- @SuppressWarnings( "unchecked" )
+ @SuppressWarnings("unchecked")
public String execute()
throws Exception
{
@@ -181,7 +179,6 @@
try
{
programId = Integer.parseInt( (String) executionDate.get( "programId" ) );
- organisationUnitId = Integer.parseInt( (String) executionDate.get( "organisationUnitId" ) );
}
catch ( NumberFormatException e )
{
@@ -189,6 +186,23 @@
return ERROR;
}
+ try
+ {
+ organisationUnitId = Integer.parseInt( (String) executionDate.get( "organisationUnitId" ) );
+ }
+ catch ( NumberFormatException e )
+ {
+ OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( (String) executionDate.get( "organisationUnitId" ) );
+
+ if ( organisationUnit == null )
+ {
+ message = e.getMessage();
+ return ERROR;
+ }
+
+ organisationUnitId = organisationUnit.getId();
+ }
+
if ( date == null )
{
return INPUT;