dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #24427
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 11971: improve search patient function for J2ME
------------------------------------------------------------
revno: 11971
committer: Lai <lai.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2013-09-08 18:40:48 +0700
message:
improve search patient function for J2ME
modified:
dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/NotAllowedException.java
dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.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-mobile/src/main/java/org/hisp/dhis/api/mobile/NotAllowedException.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/NotAllowedException.java 2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/NotAllowedException.java 2013-09-08 11:40:48 +0000
@@ -52,6 +52,8 @@
public static final NotAllowedException NO_PROGRAM_FOUND = new NotAllowedException( "NO_PROGRAM_FOUND");
+ public static final NotAllowedException NO_PROGRAM_BELONG_ORGUNIT = new NotAllowedException( "NO_PROGRAM_BELONG_ORGUNIT");
+
private String reason;
public NotAllowedException( String reason )
=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java 2013-09-08 09:00:11 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java 2013-09-08 11:40:48 +0000
@@ -1883,6 +1883,23 @@
List<Patient> tempPatients = (List<Patient>) patientService.getPatients( orgUnit, program, null, null );
patients.retainAll( tempPatients );
}
+
+ if ( programId != 0 && orgUnitId != 0 )
+ {
+ boolean isProgramBelongToOrgUnit = false;
+ for( Program program: programService.getPrograms( orgUnit ))
+ {
+ if ( program.getId() == programId )
+ {
+ isProgramBelongToOrgUnit = true;
+ break;
+ }
+ }
+ if ( isProgramBelongToOrgUnit == false )
+ {
+ throw NotAllowedException.NO_PROGRAM_BELONG_ORGUNIT;
+ }
+ }
if ( patients.size() > 1 )
{