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

[43933] Allow editing NWD on parent when manually scheduled (#11324)

Oliver Günther80aa5c61d2b1
diff --git a/frontend/src/app/shared/components/datepicker/multi-date-modal/multi-date.modal.html b/frontend/src/app/shared/components/datepicker/multi-date-modal/multi-date.modal.html
index 900654493fb..7f6d541532b 100644
--- a/frontend/src/app/shared/components/datepicker/multi-date-modal/multi-date.modal.html
+++ b/frontend/src/app/shared/components/datepicker/multi-date-modal/multi-date.modal.html
@@ -17,7 +17,7 @@
></op-datepicker-scheduling-toggle>
<op-datepicker-working-days-toggle
name="ignoreNonWorkingDays"
- [disabled]="!ignoreNonWorkingDaysWritable"
+ [disabled]="!(scheduleManually || ignoreNonWorkingDaysWritable)"
[(ngModel)]="ignoreNonWorkingDays"
(ngModelChange)="changeNonWorkingDays()"
></op-datepicker-working-days-toggle>
diff --git a/frontend/src/app/shared/components/datepicker/multi-date-modal/multi-date.modal.ts b/frontend/src/app/shared/components/datepicker/multi-date-modal/multi-date.modal.ts
index 99d8b2fa233..837274946bb 100644
--- a/frontend/src/app/shared/components/datepicker/multi-date-modal/multi-date.modal.ts
+++ b/frontend/src/app/shared/components/datepicker/multi-date-modal/multi-date.modal.ts
@@ -298,6 +298,12 @@ export class MultiDateModalComponent extends OpModalComponent implements AfterVi
changeSchedulingMode():void {
this.initializeDatepicker();
+
+ // If removing manual scheduling on parent, reset ignoreNWD to original value
+ if (this.scheduleManually === false && !this.ignoreNonWorkingDaysWritable) {
+ this.ignoreNonWorkingDays = !!this.changeset.value('ignoreNonWorkingDays');
+ }
+
this.cdRef.detectChanges();
}
diff --git a/spec/features/work_packages/details/date_editor_spec.rb b/spec/features/work_packages/details/date_editor_spec.rb
index ed146bb5a31..46c51c803e2 100644
--- a/spec/features/work_packages/details/date_editor_spec.rb
+++ b/spec/features/work_packages/details/date_editor_spec.rb
@@ -45,6 +45,7 @@ describe 'date inplace editor',
let(:hierarchy) { ::Components::WorkPackages::Hierarchies.new }
let(:start_date) { work_packages_page.edit_field(:combinedDate) }
+ let(:datepicker) { start_date.datepicker }
before do
login_as(user)
@@ -454,6 +455,32 @@ describe 'date inplace editor',
wp_table.expect_work_package_listed child
wp_timeline.expect_timeline!
end
+
+ it 'allows switching to manual scheduling to set the ignore NWD (Regression #43933)' do
+ expect(page).to have_selector('[data-qa-selector="op-modal-banner-info"] span',
+ text: 'Automatically scheduled. Dates are derived from relations.')
+
+ # Expect ignore NWD disabled
+ datepicker.expect_ignore_non_working_days_disabled
+ datepicker.expect_ignore_non_working_days 'Include weekends'
+
+ # When toggling manually scheduled
+ start_date.set_scheduling_mode manually: true
+ datepicker.expect_ignore_non_working_days_enabled
+ datepicker.ignore_non_working_days 'Work week'
+ datepicker.expect_ignore_non_working_days 'Work week'
+
+ expect(page).to have_selector('[data-qa-selector="op-modal-banner-warning"] span',
+ text: 'Manual scheduling enabled, all relations ignored.')
+
+ # Reset when disabled
+ start_date.set_scheduling_mode manually: false
+ datepicker.expect_ignore_non_working_days_disabled
+ datepicker.expect_ignore_non_working_days 'Include weekends'
+
+ expect(page).to have_selector('[data-qa-selector="op-modal-banner-info"] span',
+ text: 'Automatically scheduled. Dates are derived from relations.')
+ end
end
end
diff --git a/spec/support/components/datepicker/work_package_datepicker.rb b/spec/support/components/datepicker/work_package_datepicker.rb
index e35a4ff5135..65d0d87255d 100644
--- a/spec/support/components/datepicker/work_package_datepicker.rb
+++ b/spec/support/components/datepicker/work_package_datepicker.rb
@@ -174,6 +174,21 @@ module Components
expect_scheduling_mode(val)
end
+ def ignore_non_working_days_toggle
+ container
+ .find('[data-qa-selector="op-datepicker-modal--include-non-working-days"]')
+ end
+
+ def expect_ignore_non_working_days_disabled
+ expect(ignore_non_working_days_toggle)
+ .to have_selector('[data-qa-selector="spot-toggle--option"][data-qa-disabled]', count: 2)
+ end
+
+ def expect_ignore_non_working_days_enabled
+ page.raise_if_found('[data-qa-selector="op-datepicker-modal--include-non-working-days"] ' \
+ '[data-qa-selector="spot-toggle--option"][data-qa-disabled]')
+ end
+
def expect_ignore_non_working_days(val)
text = ignore_non_working_days_option(val)