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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
fix behavior that created a new time entry instead of updating the old one
Klaus Zandersd47f81f52730
diff --git a/modules/costs/app/components/time_entries/time_entry_form_component.rb b/modules/costs/app/components/time_entries/time_entry_form_component.rbindex c81c15257b8..70f45291a61 100644--- a/modules/costs/app/components/time_entries/time_entry_form_component.rb+++ b/modules/costs/app/components/time_entries/time_entry_form_component.rb@@ -58,16 +58,22 @@ module TimeEntries}if time_entry.persisted?- base.merge({- url: time_entry_path(time_entry),- method: :patch- })+ base.deep_merge({+ url: time_entry_path(time_entry),+ method: :patch,+ data: {+ refresh_form_url: refresh_form_time_entry_path(time_entry)+ }+ })else- base.merge({- url: time_entries_path,- method: :post- })+ base.deep_merge({+ url: time_entries_path,+ method: :post,+ data: {+ refresh_form_url: refresh_form_time_entries_path+ }+ })endendenddiff --git a/modules/costs/app/controllers/time_entries_controller.rb b/modules/costs/app/controllers/time_entries_controller.rbindex 7598efb0570..191bb56a140 100644--- a/modules/costs/app/controllers/time_entries_controller.rb+++ b/modules/costs/app/controllers/time_entries_controller.rb@@ -40,7 +40,7 @@ class TimeEntriesController < ApplicationControllerbefore_action :load_and_authorize_optional_work_packageend- before_action :load_or_build_and_authorize_time_entry, only: %i[dialog update destroy]+ before_action :load_or_build_and_authorize_time_entry, only: %i[dialog update destroy refresh_form]authorization_checked! :dialog, :create, :update, :user_tz_caption, :refresh_form, :destroy@@ -68,7 +68,7 @@ class TimeEntriesController < ApplicationControllerdef refresh_formcall = TimeEntries::SetAttributesService.new(user: current_user,- model: TimeEntry.new,+ model: @time_entry,contract_class: EmptyContract).call(permitted_params.time_entries)diff --git a/modules/costs/config/routes.rb b/modules/costs/config/routes.rbindex bf5540981ee..ab1c4e3752b 100644--- a/modules/costs/config/routes.rb+++ b/modules/costs/config/routes.rb@@ -34,6 +34,7 @@ Rails.application.routes.draw doget :dialog, on: :memberget "/users/:user_id/tz_caption", action: :user_tz_caption, on: :collectionpost :refresh_form, on: :collection+ post :refresh_form, on: :memberendscope "projects/:project_id", as: "projects" do