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
do not allow moving an event from allDay to the normal calendar event when we are not allowing it
Klaus Zanderse5dd4b5ee7f4
diff --git a/frontend/src/stimulus/controllers/dynamic/my/time-tracking.controller.ts b/frontend/src/stimulus/controllers/dynamic/my/time-tracking.controller.tsindex 54af2962088..eee431cf0aa 100644--- a/frontend/src/stimulus/controllers/dynamic/my/time-tracking.controller.ts+++ b/frontend/src/stimulus/controllers/dynamic/my/time-tracking.controller.ts@@ -23,6 +23,7 @@ export default class MyTimeTrackingController extends Controller {canCreate: Boolean,locale: String,canEdit: Boolean,+ allowTimes: Boolean,forceTimes: Boolean,};@@ -33,6 +34,7 @@ export default class MyTimeTrackingController extends Controller {declare readonly initialDateValue:string;declare readonly canCreateValue:boolean;declare readonly canEditValue:boolean;+ declare readonly allowTimesValue:boolean;declare readonly forceTimesValue:boolean;declare readonly localeValue:string;declare readonly viewModeValue:string;@@ -164,11 +166,15 @@ export default class MyTimeTrackingController extends Controller {}},- eventAllow: (dropInfo) => {+ eventAllow: (dropInfo, draggedEvent) => {if (dropInfo.allDay && this.forceTimesValue) {return false;}+ if (!dropInfo.allDay && draggedEvent?.allDay && !this.allowTimesValue) {+ return false;+ }+return true;},diff --git a/modules/costs/app/components/my/time_tracking/calendar_component.rb b/modules/costs/app/components/my/time_tracking/calendar_component.rbindex c5276e6f2cf..8d229afcb62 100644--- a/modules/costs/app/components/my/time_tracking/calendar_component.rb+++ b/modules/costs/app/components/my/time_tracking/calendar_component.rb@@ -50,6 +50,7 @@ module My"my--time-tracking-initial-date-value" => date.iso8601,"my--time-tracking-can-create-value" => User.current.allowed_in_any_project?(:log_own_time),"my--time-tracking-can-edit-value" => User.current.allowed_in_any_project?(:edit_own_time_entries),+ "my--time-tracking-allow-times-value" => TimeEntry.can_track_start_and_end_time?,"my--time-tracking-force-times-value" => TimeEntry.must_track_start_and_end_time?,"my--time-tracking-locale-value" => I18n.locale}diff --git a/modules/costs/app/components/my/time_tracking/header_component.html.erb b/modules/costs/app/components/my/time_tracking/header_component.html.erbindex dc850a30bad..bd4f8b7fd8b 100644--- a/modules/costs/app/components/my/time_tracking/header_component.html.erb+++ b/modules/costs/app/components/my/time_tracking/header_component.html.erb@@ -14,14 +14,14 @@menu.with_item(label: t(:label_calendar),tag: :a,- href: url_for(params.permit(:controller, :action, :date).merge(view_mode: "calendar"))+ href: my_time_tracking_path(date: date, mode: mode, view_mode: "calendar")) do |item|item.with_leading_visual_icon(icon: :calendar)endmenu.with_item(label: t(:label_list),tag: :a,- href: url_for(params.permit(:controller, :date, :action).merge(view_mode: "list"))+ href: my_time_tracking_path(date: date, mode: mode, view_mode: "list")) do |item|item.with_leading_visual_icon(icon: "list-unordered")enddiff --git a/modules/costs/lib/costs/patches/permitted_params_patch.rb b/modules/costs/lib/costs/patches/permitted_params_patch.rbindex c3d4d269c68..6a770885345 100644--- a/modules/costs/lib/costs/patches/permitted_params_patch.rb+++ b/modules/costs/lib/costs/patches/permitted_params_patch.rb@@ -68,7 +68,7 @@ module Costs::Patches::PermittedParamsPatchdef time_entriesadditional_fields = []- additional_fields << :start_time if TimeEntry.can_track_start_and_end_time?+ additional_fields << :start_time if TimeEntry.can_track_start_and_end_time? || params.dig(:time_entry, :start_time).nil?params.require(:time_entry)