← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13403: Data entry, simplified the multi org unit logic

 

------------------------------------------------------------
revno: 13403
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2013-12-23 15:04:33 +0100
message:
  Data entry, simplified the multi org unit logic
modified:
  dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.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-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js	2013-12-23 13:54:40 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js	2013-12-23 14:04:33 +0000
@@ -577,11 +577,10 @@
 function loadForm()
 {
 	var dataSetId = dhis2.de.currentDataSetId;
-	var multiOrg = !!$( '#selectedDataSetId :selected' ).data( 'multiorg' );
 	
 	dhis2.de.currentOrganisationUnitId = selection.getSelected()[0];
 
-    if ( !multiOrg && dhis2.de.storageManager.formExists( dataSetId ) )
+    if ( !dhis2.de.multiOrganisationUnit && dhis2.de.storageManager.formExists( dataSetId ) )
     {
         log( 'Loading form locally: ' + dataSetId );
 
@@ -589,17 +588,12 @@
 
         $( '#contentDiv' ).html( html );
 
-        dhis2.de.multiOrganisationUnit = !!$( '.formSection' ).data( 'multiorg' );
-
-        if ( !dhis2.de.multiOrganisationUnit )
-        {
-            if ( dhis2.de.dataSets[dataSetId].renderAsTabs ) {
-                $( "#tabs" ).tabs();
-            }
-
-            enableSectionFilter();
+        if ( dhis2.de.dataSets[dataSetId].renderAsTabs ) {
+            $( "#tabs" ).tabs();
         }
 
+        enableSectionFilter();
+
         loadDataValues();
         insertOptionSets();
     }
@@ -610,12 +604,10 @@
         $( '#contentDiv' ).load( 'loadForm.action', 
         {
             dataSetId : dataSetId,
-            multiOrganisationUnit: multiOrg ? getCurrentOrganisationUnit() : 0
+            multiOrganisationUnit: dhis2.de.multiOrganisationUnit ? getCurrentOrganisationUnit() : 0
         }, 
         function() 
         {
-        	dhis2.de.multiOrganisationUnit = !!$( '.formSection' ).data( 'multiorg' );
-
             if ( !dhis2.de.multiOrganisationUnit )
             {
                 if ( dhis2.de.dataSets[dataSetId].renderAsTabs ) {
@@ -954,6 +946,8 @@
         clearSectionFilters();
 
         dhis2.de.currentCategories = dhis2.de.getCategories( dataSetId );
+        
+        dhis2.de.multiOrganisationUnit = !!$( '#selectedDataSetId :selected' ).data( 'multiorg' );
 
         var attributeMarkup = dhis2.de.getAttributesMarkup();
         $( '#attributeComboDiv' ).html( attributeMarkup );