dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #36895
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18871: minor bugfixes, change organisationUnits global variable to be {} to allow for merging, if offlin...
------------------------------------------------------------
revno: 18871
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2015-04-10 13:41:31 +0700
message:
minor bugfixes, change organisationUnits global variable to be {} to allow for merging, if offline level == 1, use level 2 so that children is also available
modified:
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/ouwt.js
dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetOrganisationUnitTreeAction.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-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/ouwt.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/ouwt.js 2015-04-08 10:59:12 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/ouwt.js 2015-04-10 06:41:31 +0000
@@ -194,7 +194,7 @@
};
this.setOrganisationUnits = function( ous ) {
- organisationUnits = [];
+ organisationUnits = {};
$.extend( organisationUnits, ous );
ous = ous ? _.values( ous ) : [];
=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetOrganisationUnitTreeAction.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetOrganisationUnitTreeAction.java 2015-03-15 20:49:24 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetOrganisationUnitTreeAction.java 2015-04-10 06:41:31 +0000
@@ -28,12 +28,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import java.util.UUID;
-
+import com.opensymphony.xwork2.Action;
import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator;
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.organisationunit.OrganisationUnitLevel;
@@ -43,10 +38,14 @@
import org.hisp.dhis.version.Version;
import org.hisp.dhis.version.VersionService;
-import com.opensymphony.xwork2.Action;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.UUID;
/**
- * @author mortenoh
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
*/
public class GetOrganisationUnitTreeAction
implements Action
@@ -236,7 +235,7 @@
if ( !versionOnly && !rootOrganisationUnits.isEmpty() )
{
Integer offlineLevels = getOfflineOrganisationUnitLevels();
-
+
for ( OrganisationUnit unit : rootOrganisationUnits )
{
organisationUnits.addAll( organisationUnitService.getOrganisationUnitWithChildren( unit.getId(), offlineLevels ) );
@@ -285,12 +284,9 @@
{
return null;
}
-
- if ( offlineLevel != null )
- {
- return offlineLevel;
- }
-
- return organisationUnitService.getOfflineOrganisationUnitLevels();
+
+ Integer level = offlineLevel != null ? offlineLevel : organisationUnitService.getOfflineOrganisationUnitLevels();
+
+ return level == 1 ? 2 : level;
}
}