← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6910: (local/vn) Minor fix for dataentry hospital

 

------------------------------------------------------------
revno: 6910
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2012-05-11 15:28:02 +0700
message:
  (local/vn) Minor fix for dataentry hospital
modified:
  local/vn/dhis-web-dataentry-hospital/src/main/java/org/hisp/dhis/de/action/LoadDataSetsAction.java
  local/vn/dhis-web-dataentry-hospital/src/main/java/org/hisp/dhis/de/action/LoadDepartmentsAction.java
  local/vn/dhis-web-dataentry-hospital/src/main/resources/META-INF/dhis/beans.xml


--
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 'local/vn/dhis-web-dataentry-hospital/src/main/java/org/hisp/dhis/de/action/LoadDataSetsAction.java'
--- local/vn/dhis-web-dataentry-hospital/src/main/java/org/hisp/dhis/de/action/LoadDataSetsAction.java	2012-05-10 16:18:43 +0000
+++ local/vn/dhis-web-dataentry-hospital/src/main/java/org/hisp/dhis/de/action/LoadDataSetsAction.java	2012-05-11 08:28:02 +0000
@@ -34,6 +34,8 @@
 import org.hisp.dhis.dataset.DataSetService;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
+import org.hisp.dhis.user.CurrentUserService;
+import org.hisp.dhis.user.UserAuthorityGroup;
 
 import com.opensymphony.xwork2.Action;
 
@@ -63,6 +65,13 @@
         this.dataSetService = dataSetService;
     }
 
+    private CurrentUserService currentUserService;
+
+    public void setCurrentUserService( CurrentUserService currentUserService )
+    {
+        this.currentUserService = currentUserService;
+    }
+
     // -------------------------------------------------------------------------
     // Output
     // -------------------------------------------------------------------------
@@ -85,6 +94,13 @@
         sources.add( selectionManager.getSelectedOrganisationUnit() );
 
         dataSets = dataSetService.getDataSetsBySources( sources );
+        
+        Collection<UserAuthorityGroup> authorityGroups = currentUserService.getCurrentUser().getUserCredentials().getUserAuthorityGroups();
+        
+        for( UserAuthorityGroup UserAuthorityGroup : authorityGroups )
+        {
+            dataSets.retainAll( UserAuthorityGroup.getDataSets() );
+        }
 
         return SUCCESS;
     }

=== modified file 'local/vn/dhis-web-dataentry-hospital/src/main/java/org/hisp/dhis/de/action/LoadDepartmentsAction.java'
--- local/vn/dhis-web-dataentry-hospital/src/main/java/org/hisp/dhis/de/action/LoadDepartmentsAction.java	2012-05-10 16:18:43 +0000
+++ local/vn/dhis-web-dataentry-hospital/src/main/java/org/hisp/dhis/de/action/LoadDepartmentsAction.java	2012-05-11 08:28:02 +0000
@@ -124,7 +124,6 @@
         {
             departmentInOrgunit.addAll( association.getCategoryOption().getCategoryOptionCombos() );
         }
-   System.out.println("\n\n === \n departmentInOrgunit : " + departmentInOrgunit );     
         DataSet dataSet = dataSetService.getDataSet( dataSetId );
 
         String description = dataSet.getDescription();
@@ -132,14 +131,13 @@
         {
             Collection<DataSet> dataSets = localDataSetService.getDataSetsByDescription( description );
             dataSets.remove( dataSet );
-System.out.println("\n\n dataSets : " + dataSets );  
+
             for ( DataSet relativedataSet : dataSets )
             {
                 if ( relativedataSet.getDataEntryForm() != null )
                 {
                     DataElementCategoryOptionCombo optionCombo = localDataSetService.getDepartmentByDataSet( relativedataSet );
-System.out.println("\n\n optionCombo : " + optionCombo );
-System.out.println("\n\n departmentInOrgunit.contains( optionCombo ) : " + departmentInOrgunit.contains( optionCombo ) ); 
+
                     if( departmentInOrgunit.contains( optionCombo ) )
                     {
                         mapDataSets.put( relativedataSet.getId(), optionCombo.getName() );

=== modified file 'local/vn/dhis-web-dataentry-hospital/src/main/resources/META-INF/dhis/beans.xml'
--- local/vn/dhis-web-dataentry-hospital/src/main/resources/META-INF/dhis/beans.xml	2012-05-10 16:18:43 +0000
+++ local/vn/dhis-web-dataentry-hospital/src/main/resources/META-INF/dhis/beans.xml	2012-05-11 08:28:02 +0000
@@ -140,6 +140,7 @@
    <bean id="org.hisp.dhis.de.action.LoadDataSetsAction" class="org.hisp.dhis.de.action.LoadDataSetsAction" scope="prototype">
 	 <property name="selectionManager" ref="org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager" />
 	 <property name="dataSetService" ref="org.hisp.dhis.dataset.DataSetService" />
+	 <property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
   </bean>
   
   <bean id="org.hisp.dhis.de.action.LoadAttributeValuesAction" class="org.hisp.dhis.de.action.LoadAttributeValuesAction" scope="prototype">