Skip to content

Commit

Permalink
fix: prevent adding event to program stage
Browse files Browse the repository at this point in the history
  • Loading branch information
superskip committed May 2, 2024
1 parent e1d63f7 commit baf1500
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions components/dataentry/dataentry-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -330,20 +330,21 @@ trackerCapture.controller('DataEntryController',

//Adds support for HIDEPROGRAMSTAGE even if no event exists in enrollment
var processRegistrationRuleEffect = function(event, callerId){
$scope.stagesNotShowingInStageTasks = {};

angular.forEach($rootScope.ruleeffects[event], function(effect){
if (effect.action === "HIDEPROGRAMSTAGE") {
if (effect.programStage) {
if($scope.stagesNotShowingInStageTasks[effect.programStage.id] !== effect.ineffect )
{
$scope.stagesNotShowingInStageTasks[effect.programStage.id] = effect.ineffect;
if(effect.ineffect) {
$scope.stagesNotShowingInStageTasks[effect.programStage.id] = true;
}
updateTabularEntryStages();
}
else {
$log.warn("ProgramRuleAction " + effect.id + " is of type HIDEPROGRAMSTAGE, bot does not have a stage defined");
}
}
});
updateTabularEntryStages();
}

var processRuleEffect = function(event, callerId){
Expand Down Expand Up @@ -378,7 +379,8 @@ trackerCapture.controller('DataEntryController',
$scope.errorMessages[event] = [];
$scope.hiddenFields[event] = [];
$scope.mandatoryFields[event] = [];
$scope.optionVisibility[event] = { showOnly: null, hidden: {}};;
$scope.optionVisibility[event] = { showOnly: null, hidden: {}};
$scope.stagesNotShowingInStageTasks = {};

var dataElementOptionsChanged = [];

Expand Down Expand Up @@ -495,9 +497,8 @@ trackerCapture.controller('DataEntryController',
}
else if (effect.action === "HIDEPROGRAMSTAGE") {
if (effect.programStage) {
if($scope.stagesNotShowingInStageTasks[effect.programStage.id] !== effect.ineffect )
{
$scope.stagesNotShowingInStageTasks[effect.programStage.id] = effect.ineffect;
if(effect.ineffect) {
$scope.stagesNotShowingInStageTasks[effect.programStage.id] = true;
}
}
else {
Expand Down

0 comments on commit baf1500

Please sign in to comment.