From 82aee94202bb685343d437ecd3cdd0909e5bdc43 Mon Sep 17 00:00:00 2001 From: Tony Valle <79843014+superskip@users.noreply.github.com> Date: Thu, 25 May 2023 18:46:48 +0200 Subject: [PATCH] fix: [DHIS2-15340] use orgunit of selected event before owning orgunit (#1742) --- d2-tracker/dhis2.angular.services.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/d2-tracker/dhis2.angular.services.js b/d2-tracker/dhis2.angular.services.js index e4fa09a46..aefed6fd6 100644 --- a/d2-tracker/dhis2.angular.services.js +++ b/d2-tracker/dhis2.angular.services.js @@ -3317,7 +3317,7 @@ var d2Services = angular.module('d2Services', ['ngResource']) * @param {*} flag execution flags */ var internalFetchContextData = function(selectedEnrollment,executingEvent){ - return OrgUnitFactory.getFromStoreOrServer( selectedEnrollment ? selectedEnrollment.orgUnit : executingEvent.orgUnit ) + return OrgUnitFactory.getFromStoreOrServer(executingEvent && executingEvent.orgUnit ? executingEvent.orgUnit : selectedEnrollment.orgUnit) .then(function (orgUnit) { var data = { selectedOrgUnit: orgUnit, selectedProgramStage: null}; if(executingEvent && executingEvent.program && executingEvent.programStage){