← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 19435: eventcapture now runs rules when first opening form

 

------------------------------------------------------------
revno: 19435
committer: Markus Bekken <markus.bekken@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2015-06-18 00:58:05 +0200
message:
  eventcapture now runs rules when first opening form
modified:
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/controllers.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-event-capture/scripts/controllers.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/controllers.js	2015-06-17 11:50:16 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/controllers.js	2015-06-17 22:58:05 +0000
@@ -466,6 +466,11 @@
         }); 
         $scope.currentEventOriginialValue = angular.copy($scope.currentEvent);
         
+        //Blank out rule effects, as there is no rules in effect before the first
+        //time the rules is run on a new page.
+        $rootScope.ruleeffects[$scope.currentEvent.event] = {};
+        
+        $scope.executeRules();
     };
     
     $scope.switchDataEntryForm = function(){
@@ -922,7 +927,6 @@
 
                                 //Blank out the value:
                                 affectedEvent[effect.dataElement.id] = "";
-                                $scope.saveDatavalueForEvent($scope.prStDes[effect.dataElement.id],null,affectedEvent);
                             }
 
                             $scope.hiddenFields[effect.dataElement.id] = effect.ineffect;

=== 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-17 11:50:16 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.services.js	2015-06-17 22:58:05 +0000
@@ -1099,7 +1099,7 @@
                                         dataElement:action.dataElement,
                                         content:action.content,
                                         data:action.data,
-                                        ineffect:false
+                                        ineffect:undefined
                                     };
                                 }