From 2d75f7ecb2324cd1092210a66d7b08a27e380258 Mon Sep 17 00:00:00 2001 From: Hagen Schink Date: Thu, 27 Nov 2014 10:40:20 +0100 Subject: [PATCH] Handle missing summarized cost entries If costs isn't activated for subprojects the summarized cost entries are missing in the API response for the current project's work package. --- app/assets/javascripts/angular/openproject-costs-app.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/angular/openproject-costs-app.js b/app/assets/javascripts/angular/openproject-costs-app.js index 974498dac9..1e37fb401e 100644 --- a/app/assets/javascripts/angular/openproject-costs-app.js +++ b/app/assets/javascripts/angular/openproject-costs-app.js @@ -35,7 +35,9 @@ openprojectCostsApp.run(['HookService', function(HookService) { switch (params.type) { case "spentUnits": - if (params.workPackage.embedded.summarizedCostEntries.length > 0) { + var summarizedCostEntries = params.workPackage.embedded.summarizedCostEntries; + + if (summarizedCostEntries && summarizedCostEntries.length > 0) { directive = "summarized-cost-entries"; } break;