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

fix time entry dialog

Klaus Zanders26ab9b8b5662
diff --git a/frontend/src/stimulus/controllers/dynamic/time-entry.controller.ts b/frontend/src/stimulus/controllers/dynamic/time-entry.controller.ts
index aaa05e598a7..7276d0b3d95 100644
--- a/frontend/src/stimulus/controllers/dynamic/time-entry.controller.ts
+++ b/frontend/src/stimulus/controllers/dynamic/time-entry.controller.ts
@@ -55,7 +55,7 @@ export default class TimeEntryController extends Controller {
this.turboRequests = context.services.turboRequests;
this.pathHelper = context.services.pathHelperService;
- const workPackageAutocompleter = document.querySelector('opce-autocompleter[data-input-name*="time_entry[work_package_id]"]');
+ const workPackageAutocompleter = document.querySelector('opce-autocompleter[data-input-name*="time_entry[entity_id]"]');
if (workPackageAutocompleter) {
this.oldWorkPackageId = (workPackageAutocompleter as HTMLElement).dataset.inputValue || '';
}
@@ -69,7 +69,7 @@ export default class TimeEntryController extends Controller {
);
}
- workPackageChanged(event:InputEvent) {
+ entityChanged(event:InputEvent) {
const target = event.currentTarget as HTMLInputElement;
const newValue = target.value;
diff --git a/modules/costs/app/components/time_entries/activity_form.rb b/modules/costs/app/components/time_entries/activity_form.rb
index bdb7bfcaf03..4c4a8428e0a 100644
--- a/modules/costs/app/components/time_entries/activity_form.rb
+++ b/modules/costs/app/components/time_entries/activity_form.rb
@@ -41,7 +41,7 @@ module TimeEntries
focusDirectly: false,
multiple: false,
decorated: true,
- disabled: project_or_entity_selected?,
+ disabled: !project_or_entity_selected?,
append_to: "#time-entry-dialog"
}
) do |select|
diff --git a/modules/costs/app/components/time_entries/entity_form.rb b/modules/costs/app/components/time_entries/entity_form.rb
index bd73051da8f..a6e91197945 100644
--- a/modules/costs/app/components/time_entries/entity_form.rb
+++ b/modules/costs/app/components/time_entries/entity_form.rb
@@ -45,12 +45,12 @@ module TimeEntries
if show_work_package_field?
f.work_package_autocompleter name: :entity_id,
label: TimeEntry.human_attribute_name(:work_package),
- required: work_package_required?,
+ required: entity_required?,
validation_message: work_package_validation_error,
autocomplete_options: {
defaultData: false,
component: "opce-time-entries-work-package-autocompleter",
- hiddenFieldAction: "change->time-entry#workPackageChanged",
+ hiddenFieldAction: "change->time-entry#entityChanged",
focusDirectly: false,
append_to: "#time-entry-dialog",
url: work_package_completer_url,
@@ -84,7 +84,7 @@ module TimeEntries
#
# We're still discussing if we make the work package mandatory, then this will become obsolete and
# probably be removed.
- def work_package_required?
+ def entity_required?
model.project.blank?
end