Merge pull request #111 from finnlabs/fix/17242_spent_time_assigned_to_wrong_group_and_order_of_costs_attributes_wrong

17242 Spent time assigned to wrong group and order of cost's attributes wrong
pull/6827/head
ulferts 10 years ago
commit 173f0c5935
  1. 21
      app/assets/javascripts/angular/openproject-costs-app.js

@ -33,22 +33,29 @@ openprojectCostsApp.run(['HookService',
'ConfigurationService', 'ConfigurationService',
'WorkPackagesOverviewService', 'WorkPackagesOverviewService',
function(HookService, ConfigurationService, WorkPackagesOverviewService) { function(HookService, ConfigurationService, WorkPackagesOverviewService) {
var addAttributesToGroup = function(group, attributes) {
angular.forEach(attributes, function(id, attribute) {
WorkPackagesOverviewService.addAttributeToGroup(group, id || attribute);
});
};
var setupCostsAttributes = function() { var setupCostsAttributes = function() {
var position = WorkPackagesOverviewService.getGroupedWorkPackageOverviewAttributes().length - 1; var position = WorkPackagesOverviewService.getGroupedWorkPackageOverviewAttributes().length - 1;
var costsAttributes = { var costsAttributes = {
overallCosts: null,
spentHours: 'spentHoursLinked',
costObject: null, costObject: null,
summarizedCostEntries: 'spentUnits' overallCosts: null,
summarizedCostEntries: 'spentUnits',
};
var estimatesAndTimeAttributes = {
spentHours: 'spentHoursLinked'
}; };
WorkPackagesOverviewService.removeAttribute('spentTime'); WorkPackagesOverviewService.removeAttribute('spentTime');
WorkPackagesOverviewService.addGroup('costs', position); WorkPackagesOverviewService.addGroup('costs', position);
angular.forEach(costsAttributes, function(id, costAttribute) { addAttributesToGroup('costs', costsAttributes);
WorkPackagesOverviewService.addAttributeToGroup('costs', id || costAttribute); addAttributesToGroup('estimatesAndTime', estimatesAndTimeAttributes);
}); };
}
if (ConfigurationService.isModuleEnabled('costs_module')) { if (ConfigurationService.isModuleEnabled('costs_module')) {
setupCostsAttributes(); setupCostsAttributes();

Loading…
Cancel
Save