dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #43992
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 22323: Enrollment services now checks if the TEI being enrolled has the same tracked entity as the progr...
------------------------------------------------------------
revno: 22323
committer: Abyot Asalefew Gizaw <abyot@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2016-03-15 12:22:02 +0100
message:
Enrollment services now checks if the TEI being enrolled has the same tracked entity as the program its getting enrolled into
modified:
dhis-2/dhis-services/dhis-service-core/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-core/src/main/java/org/hisp/dhis/program/DefaultProgramInstanceService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultProgramInstanceService.java 2016-03-08 13:58:56 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultProgramInstanceService.java 2016-03-15 11:22:02 +0000
@@ -453,6 +453,13 @@
// ---------------------------------------------------------------------
// Add program instance
// ---------------------------------------------------------------------
+
+ if( program.getTrackedEntity() != trackedEntityInstance.getTrackedEntity() )
+ {
+ log.warn( "Tracked entitiy instance needs to have the same tracked entity as the program" );
+
+ throw new IllegalQueryException( "Tracked entitiy instance needs to have the same tracked entity as the program" );
+ }
ProgramInstance programInstance = new ProgramInstance();
programInstance.setUid( CodeGenerator.isValidCode( uid ) ? uid : CodeGenerator.generateCode() );