dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #27842
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13873: fixes for updating event status in event-api
------------------------------------------------------------
revno: 13873
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2014-01-28 15:10:39 +0700
message:
fixes for updating event status in event-api
modified:
dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/AbstractEventService.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-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/AbstractEventService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/AbstractEventService.java 2014-01-27 10:31:33 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/AbstractEventService.java 2014-01-28 08:10:39 +0000
@@ -462,10 +462,28 @@
String storedBy = getStoredBy( event, null );
+ if ( event.getStatus() == EventStatus.ACTIVE )
+ {
+ programStageInstance.setCompleted( false );
+ programStageInstance.setStatus( ProgramStageInstance.ACTIVE_STATUS );
+ programStageInstance.setCompletedDate( null );
+ programStageInstance.setCompletedUser( null );
+ }
+ else if ( event.getStatus() == EventStatus.COMPLETED )
+ {
+ programStageInstance.setStatus( ProgramStageInstance.COMPLETED_STATUS );
+ programStageInstance.setCompletedDate( date );
+ programStageInstance.setCompletedUser( storedBy );
+
+ if ( !programStageInstance.isCompleted() )
+ {
+ programStageInstanceService.completeProgramStageInstance( programStageInstance, i18nManager.getI18nFormat() );
+ }
+ }
+
programStageInstance.setDueDate( date );
programStageInstance.setExecutionDate( date );
programStageInstance.setOrganisationUnit( organisationUnit );
- programStageInstance.setCompletedUser( storedBy );
programStageInstanceService.updateProgramStageInstance( programStageInstance );