=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/service/ActivityReportingServiceImpl.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/service/ActivityReportingServiceImpl.java 2011-05-26 04:03:58 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/service/ActivityReportingServiceImpl.java 2011-06-22 07:50:35 +0000 @@ -155,13 +155,16 @@ Collection patients = patientIdentifierService.getPatientsByIdentifier( keyword, 0, patientIdentifierService.countGetPatientsByIdentifier( keyword ) ); - // Prevent the case that there are so many result (will hang the mobile - // phone ) because user just enter one or two number + // Make sure user input full beneficiary identifier number - if ( patients.size() > 10 ) + if ( patients.size() > 1 ) { throw NotAllowedException.NEED_MORE_SPECIFIC; } + else if ( patients.size() == 0 ) + { + throw NotAllowedException.NO_BENEFICIARY_FOUND; + } else { if ( patients != null ) @@ -191,7 +194,6 @@ } } } - return new ActivityPlan( items ); } === modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/service/NotAllowedException.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/service/NotAllowedException.java 2011-05-26 04:03:58 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/service/NotAllowedException.java 2011-06-22 07:50:35 +0000 @@ -45,7 +45,9 @@ public static final NotAllowedException NO_USER = new NotAllowedException( "NO_USER", "No user is logged in." ); - public static final NotAllowedException NEED_MORE_SPECIFIC = new NotAllowedException( "NEED_MORE_SPECIFIC", "So many result. Please be more specific" ); + public static final NotAllowedException NEED_MORE_SPECIFIC = new NotAllowedException( "NEED_MORE_SPECIFIC"); + + public static final NotAllowedException NO_BENEFICIARY_FOUND = new NotAllowedException( "NO_BENEFICIARY_FOUND"); private String reason;