← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 19429: tracker-capture: custom forms are applicable only when a program is selected

 

------------------------------------------------------------
revno: 19429
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2015-06-17 10:54:51 +0200
message:
  tracker-capture: custom forms are applicable only when a program is selected
modified:
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/registration-controller.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/services.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/tracker-capture.js
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.services.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-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/registration-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/registration-controller.js	2015-06-15 15:29:59 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/registration-controller.js	2015-06-17 08:54:51 +0000
@@ -102,15 +102,17 @@
         var mode = _mode ? _mode : 'ENROLLMENT';
         AttributesFactory.getByProgram($scope.selectedProgram).then(function(atts){
             $scope.attributes = atts;
-            $scope.customFormExists = false;               
-            TEFormService.getByProgram($scope.selectedProgram, $scope.attributes).then(function(teForm){
-                if(angular.isObject(teForm)){                        
-                    $scope.customFormExists = true;
-                    $scope.trackedEntityForm = teForm;                      
-                    $scope.customForm = CustomFormService.getForTrackedEntity($scope.trackedEntityForm, mode);
-                }                    
-            });  
-        });        
+            $scope.customFormExists = false;   
+            if($scope.selectedProgram && $scope.selectedProgram.id){
+                TEFormService.getByProgram($scope.selectedProgram, $scope.attributes).then(function(teForm){
+                    if(angular.isObject(teForm)){                        
+                        $scope.customFormExists = true;
+                        $scope.trackedEntityForm = teForm;                      
+                        $scope.customForm = CustomFormService.getForTrackedEntity($scope.trackedEntityForm, mode);
+                    }
+                });
+            }
+        });
     };
     
     $scope.registerEntity = function(destination){        

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/services.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/services.js	2015-06-16 12:17:07 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/services.js	2015-06-17 08:54:51 +0000
@@ -632,11 +632,7 @@
 .factory('TEFormService', function(TCStorageService, $q, $rootScope) {
 
     return {
-        getByProgram: function(program, attributes){            
-            
-            if(!program){
-                program = {id: 'NO_PROGRAM', name: 'NO_PROGRAM', selectIncidentDatesInFuture: false, selectEnrollmentDatesInFuture: false, displayIncidentDate: false};
-            }
+        getByProgram: function(program, attributes){ 
             
             var def = $q.defer();
             

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/tracker-capture.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/tracker-capture.js	2015-06-16 12:17:07 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/tracker-capture.js	2015-06-17 08:54:51 +0000
@@ -980,9 +980,6 @@
             _.each( _.values( response.trackedEntityForms ), function ( trackedEntityForm ) { 
                 
                 if( trackedEntityForm && trackedEntityForm.id){
-                    if(!trackedEntityForm.program || !trackedEntityForm.program.id){
-                        trackedEntityForm.program = {id: 'NO_PROGRAM', name: 'NO_PROGRAM'};
-                    }                    
                     trackedEntityForm.id = trackedEntityForm.program.id;
                     dhis2.tc.store.set( 'trackedEntityForms', trackedEntityForm );
                 }

=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.services.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.services.js	2015-06-16 11:22:51 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.services.js	2015-06-17 08:54:51 +0000
@@ -1089,7 +1089,7 @@
                                 $log.warn("Rule id:'" + rule.id + "'' and name:'" + rule.name + "' had no condition specified. Please check rule configuration.");
                             }
                             
-                            angular.forEach(rule.actions, function(action){
+                            angular.forEach(rule.programRuleActions, function(action){
                                 //In case the effect-hash is not populated, add entries
                                 if(angular.isUndefined( $rootScope.ruleeffects[executingEvent.event][action.id] )){
                                     $rootScope.ruleeffects[executingEvent.event][action.id] =  {