← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 10427: fix for anonymous program association bug

 

------------------------------------------------------------
revno: 10427
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2013-03-27 17:32:37 +0700
message:
  fix for anonymous program association bug
modified:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.storage.dom.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/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js	2013-03-13 18:38:19 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js	2013-03-27 10:32:37 +0000
@@ -6,6 +6,8 @@
         cache: false
     } );
 
+    setHeaderMessage( "Loading.. please wait" );
+
     // initialize the stores, and then try and add the data
     DAO.programs = new dhis2.storage.Store( {name: 'programs'}, function ( store ) {
         DAO.programAssociations = new dhis2.storage.Store( {name: 'programAssociations'}, function ( store ) {
@@ -19,13 +21,15 @@
 
                     DAO.programAssociations.addAll( keys, objs, function ( store ) {
                         selection.setListenerFunction( organisationUnitSelected );
+                        hideHeaderMessage();
                     } );
                 } );
             } ).fail(function() {
                 selection.setListenerFunction( organisationUnitSelected );
+                hideHeaderMessage();
             });
         });
-    });
+    } );
 } );
 
 function organisationUnitSelected( orgUnits, orgUnitNames )
@@ -48,7 +52,7 @@
 	hideById('dataEntryInfor');
 
     DAO.programAssociations.fetch( orgUnits[0], function ( store, arr ) {
-        DAO.programs.fetch( arr, function ( store, arr ) {
+        DAO.programs.fetch( arr[0], function ( store, arr ) {
             jQuery( '#searchingAttributeIdTD [id=searchObjectId] option' ).remove();
             jQuery( '#advancedSearchTB [id=searchObjectId] option' ).remove();
             clearListById( 'displayInReports' );

=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.storage.dom.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.storage.dom.js	2013-03-26 20:32:26 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.storage.dom.js	2013-03-27 10:32:37 +0000
@@ -68,17 +68,14 @@
         addAll: function ( keys, objs, callback ) {
             var that = this;
 
-            if ( keys.length == 0 || objs.length == 0 ) {
-                if ( callback ) callback.call( that, that );
-                return;
+            while ( keys.length != 0 ) {
+                var key = keys.pop();
+                var obj = objs.pop();
+
+                that.add( key, obj );
             }
 
-            var key = keys.pop();
-            var obj = objs.pop();
-
-            this.add( key, obj, function ( store ) {
-                that.addAll( keys, objs, callback );
-            } );
+            if ( callback ) callback.call( that, that );
         },
 
         remove: function ( key, callback ) {