dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #37139
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18996: bug fix in auto-generating events
------------------------------------------------------------
revno: 18996
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2015-04-23 17:16:31 +0200
message:
bug fix in auto-generating events
modified:
dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/program/DefaultProgramInstanceService.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-tracker/src/main/java/org/hisp/dhis/program/DefaultProgramInstanceService.java'
--- dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/program/DefaultProgramInstanceService.java 2015-04-09 10:54:52 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/program/DefaultProgramInstanceService.java 2015-04-23 15:16:31 +0000
@@ -287,11 +287,11 @@
for ( Program program : programs )
{
List<TrackedEntityAttribute> atttributes = program.getTrackedEntityAttributes();
-
+
while ( iterAttribute.hasNext() )
{
TrackedEntityAttributeValue attributeValue = iterAttribute.next();
-
+
if ( !atttributes.contains( attributeValue.getAttribute() ) )
{
iterAttribute.remove();
@@ -471,7 +471,8 @@
public ProgramInstance enrollTrackedEntityInstance( TrackedEntityInstance entityInstance, Program program,
Date enrollmentDate, Date dateOfIncident, OrganisationUnit organisationUnit )
{
- return enrollTrackedEntityInstance( CodeGenerator.generateCode(), entityInstance, program, enrollmentDate, dateOfIncident, organisationUnit );
+ return enrollTrackedEntityInstance( CodeGenerator.generateCode(), entityInstance, program, enrollmentDate,
+ dateOfIncident, organisationUnit );
}
@Override
@@ -689,12 +690,15 @@
programStageInstance = new ProgramStageInstance();
programStageInstance.setProgramInstance( programInstance );
programStageInstance.setProgramStage( programStage );
+ programStageInstance.setOrganisationUnit( orgunit );
programStageInstance.setDueDate( dueDate );
+ programStageInstance.setStatus( EventStatus.SCHEDULE );
- if ( programInstance.getProgram().isSingleEvent() )
+ if ( programStage.getOpenAfterEnrollment() || programInstance.getProgram().isSingleEvent()
+ || programStage.getPeriodType() != null )
{
- programStageInstance.setOrganisationUnit( orgunit );
programStageInstance.setExecutionDate( dueDate );
+ programStageInstance.setStatus( EventStatus.ACTIVE );
}
}
@@ -836,7 +840,7 @@
&& rm.getWhenToSend() != null
&& rm.getWhenToSend() == status
&& (rm.getMessageType() == TrackedEntityInstanceReminder.MESSAGE_TYPE_DHIS_MESSAGE || rm
- .getMessageType() == TrackedEntityInstanceReminder.MESSAGE_TYPE_BOTH) )
+ .getMessageType() == TrackedEntityInstanceReminder.MESSAGE_TYPE_BOTH) )
{
int id = messageService.sendMessage( programInstance.getProgram().getDisplayName(),
reminderService.getMessageFromTemplate( rm, programInstance, format ), null,