← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2633: Fixed bug in orgunit search

 

------------------------------------------------------------
revno: 2633
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2011-01-19 12:18:34 +0100
message:
  Fixed bug in orgunit search
modified:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/search/SearchOrganisationUnitsAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/resources/org/hisp/dhis/oum/i18n_module.properties
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/organisationUnitSearch.vm


--
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-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/search/SearchOrganisationUnitsAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/search/SearchOrganisationUnitsAction.java	2010-12-13 17:03:08 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/search/SearchOrganisationUnitsAction.java	2011-01-19 11:18:34 +0000
@@ -142,21 +142,23 @@
         // Assemble groups and get search result
         // ---------------------------------------------------------------------
 
+        name = StringUtils.trimToNull( name );
+        
         selectedOrganisationUnit = selectionManager.getSelectedOrganisationUnit();
         
-        if ( StringUtils.isNotBlank( name ) || !CollectionUtils.isEmpty( groupId ) )
+        Collection<OrganisationUnitGroup> groups = new HashSet<OrganisationUnitGroup>();
+        
+        for ( Integer id : groupId )
         {
-            Collection<OrganisationUnitGroup> groups = new HashSet<OrganisationUnitGroup>();
-            
-            for ( Integer id : groupId )
+            if ( id != ANY )
             {
-                if ( id != ANY )
-                {
-                    OrganisationUnitGroup group = organisationUnitGroupService.getOrganisationUnitGroup( id );
-                    groups.add( group );
-                }
+                OrganisationUnitGroup group = organisationUnitGroupService.getOrganisationUnitGroup( id );
+                groups.add( group );
             }
-    
+        }
+                
+        if ( !( name == null && CollectionUtils.isEmpty( groups ) ) )
+        {
             organisationUnits = organisationUnitService.getOrganisationUnitsByNameAndGroups( name, groups, selectedOrganisationUnit );
         }
         

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/resources/org/hisp/dhis/oum/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/resources/org/hisp/dhis/oum/i18n_module.properties	2010-12-16 15:32:46 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/resources/org/hisp/dhis/oum/i18n_module.properties	2011-01-19 11:18:34 +0000
@@ -101,7 +101,7 @@
 org_unit_search_management							= Organisation unit search
 criteria											= Criteria
 options												= Options
-any													= Any
+all													= All
 search_result										= Search result
 search												= Search
 organisation_units									= organisation units

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/organisationUnitSearch.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/organisationUnitSearch.vm	2010-12-14 07:12:30 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/organisationUnitSearch.vm	2011-01-19 11:18:34 +0000
@@ -29,7 +29,7 @@
 <td>$encoder.htmlEncode( $groupSet.name )</td>
 <td>
   <select name="groupId" style="width:325px">
-  <option value="0">[ $i18n.getString( "any" ) ]</option>
+  <option value="0">[ $i18n.getString( "all" ) $encoder.htmlEncode( $groupSet.name ) ]</option>
     #foreach( $group in $groupSet.organisationUnitGroups )
     <option value="$group.id"
     #if( $groupId && $groupId.contains( $group.id ) )selected="selected"#end