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

add permitted params for time entries

Klaus Zandersbb3026b30496
diff --git a/modules/costs/app/controllers/projects/time_entries_controller.rb b/modules/costs/app/controllers/projects/time_entries_controller.rb
index 8eff458e2e2..ef84455136e 100644
--- a/modules/costs/app/controllers/projects/time_entries_controller.rb
+++ b/modules/costs/app/controllers/projects/time_entries_controller.rb
@@ -45,8 +45,16 @@ module Projects
end
end
- def create; end
+ def create
+ puts "*" * 100
+ pp(permitted_params.time_entries)
+ puts "*" * 100
+ end
- def update; end
+ def update
+ puts "*" * 100
+ pp(permitted_params.time_entries)
+ puts "*" * 100
+ end
end
end
diff --git a/modules/costs/lib/costs/patches/permitted_params_patch.rb b/modules/costs/lib/costs/patches/permitted_params_patch.rb
index 783e45c4396..8570d9eda61 100644
--- a/modules/costs/lib/costs/patches/permitted_params_patch.rb
+++ b/modules/costs/lib/costs/patches/permitted_params_patch.rb
@@ -62,5 +62,22 @@ module Costs::Patches::PermittedParamsPatch
params.require(:user).permit(new_rate_attributes: %i[valid_from rate],
existing_rate_attributes: %i[valid_from rate])
end
+
+ def time_entries
+ params
+ .require(:time_entry)
+ .permit(
+ :hours,
+ :comments,
+ :spent_on,
+ :start_time,
+ :work_package_id,
+ :activity,
+ :project_id,
+ :issue_id,
+ :user_id
+ )
+ .merge(custom_field_values(:time_entry))
+ end
end
end