Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Map the subproject filter to the project attribute

Oliver Günther501544580167
diff --git a/frontend/src/app/components/wp-edit-form/work-package-filter-values.ts b/frontend/src/app/components/wp-edit-form/work-package-filter-values.ts
index e72a40d6e8c..c2d04dbd6d8 100644
--- a/frontend/src/app/components/wp-edit-form/work-package-filter-values.ts
+++ b/frontend/src/app/components/wp-edit-form/work-package-filter-values.ts
@@ -43,7 +43,8 @@ export class WorkPackageFilterValues {
// Avoid empty values
if (value) {
- this.setValueFor(filter.id, value);
+ let attributeName = this.mapFilterToAttribute(filter);
+ this.setValueFor(attributeName, value);
}
});
}
@@ -95,4 +96,21 @@ export class WorkPackageFilterValues {
return false;
}
+
+ /**
+ * Some filter ids need to be mapped to a different attribute name
+ * in order to be processed correctly.
+ *
+ * @param filter The filter to map
+ * @returns An attribute name string to set
+ * @private
+ */
+ private mapFilterToAttribute(filter:any):string {
+ if (filter.id === 'onlySubproject') {
+ return 'project';
+ }
+
+ // Default to returning the filter id
+ return filter.id;
+ }
}