← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8416: Only list or search events belong to selected orgunit in anonymous program.

 

------------------------------------------------------------
revno: 8416
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2012-10-07 11:42:04 +0700
message:
  Only list or search events belong to selected orgunit in anonymous program.
modified:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GenerateTabularReportAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/anonymousRegistration.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js


--
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-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GenerateTabularReportAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GenerateTabularReportAction.java	2012-10-07 03:09:51 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GenerateTabularReportAction.java	2012-10-07 04:42:04 +0000
@@ -318,6 +318,23 @@
         // ---------------------------------------------------------------------
         // Get program-stage, start-date, end-date
         // ---------------------------------------------------------------------
+        
+        if( level==0 )
+        {
+            level = organisationUnitService.getMaxOfOrganisationUnitLevels();
+            for ( Integer orgunitId : orgunitIds )
+            {
+                int orgLevel = organisationUnitService.getLevelOfOrganisationUnit( orgunitId );
+                if(level > orgLevel)
+                {
+                    level = orgLevel;
+                }
+            }
+        }
+        
+        // ---------------------------------------------------------------------
+        // Get program-stage, start-date, end-date
+        // ---------------------------------------------------------------------
 
         ProgramStage programStage = programStageService.getProgramStage( programStageId );
 
@@ -326,7 +343,7 @@
         Date startValue = format.parseDate( startDate );
         Date endValue = format.parseDate( endDate );
         List<TabularReportColumn> columns = getTableColumns();
-
+        
         // ---------------------------------------------------------------------
         // Generate tabular report
         // ---------------------------------------------------------------------

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/anonymousRegistration.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/anonymousRegistration.vm	2012-10-06 14:34:31 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/anonymousRegistration.vm	2012-10-07 04:42:04 +0000
@@ -60,14 +60,6 @@
 			<col/>
 			<col width="180"/>
 			<tr>
-				<td>$i18n.getString('use_data_from_level')</td>
-				<td>
-					<input type="radio" id='facilityLB1' name="facilityLB" value="selected" checked> $i18n.getString('selected')
-					<input type="radio" id='facilityLB2' name="facilityLB" value="childrenOnly"> $i18n.getString('children_only')
-					<input type="radio" id='facilityLB3' name="facilityLB" value="all"> $i18n.getString('all')
-				</td>
-			</tr>
-			<tr>
 				<td>$i18n.getString('show_hierachy_from_level')</td>
 				<td>
 					<select id="level" name="level">

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js	2012-10-06 14:57:31 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js	2012-10-07 04:42:04 +0000
@@ -194,6 +194,7 @@
 	if(listAll){	
 		params += '&startDate=';
 		params += '&endDate=';
+		params += '&level=0';
 		jQuery( '#compulsoryDE option' ).each( function( i, item ){
 			var input = jQuery( item );
 			params += '&searchingValues=de_' + input.val() + '_false_';
@@ -203,6 +204,7 @@
 	else{
 		params += '&startDate=' + getFieldValue('startDate');
 		params += '&endDate=' + getFieldValue('endDate');
+		params += '&level=' + $('select[id=level]').val();
 		var value = '';
 		var searchingValue = '';
 		jQuery( '#advancedSearchTB tr' ).each( function(){
@@ -227,8 +229,7 @@
 		})
 	}
 	
-	params += '&facilityLB=' + $('input[name=facilityLB]:checked').val();
-	params += '&level=' + $('select[id=level]').val();
+	params += '&facilityLB=selected';
 	params += '&orgunitIds=' + getFieldValue('orgunitId');
 	params += '&programStageId=' + jQuery('#programId option:selected').attr('psid');
 	params += '&orderByOrgunitAsc=false';