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

avoid droping a week-day-only WP on a non-working day as start or end date

bsatarnejadb628ff7b33ec
diff --git a/frontend/src/app/features/team-planner/team-planner/planner/team-planner.component.ts b/frontend/src/app/features/team-planner/team-planner/planner/team-planner.component.ts
index 3206cfed41b..d8f38f9b4d5 100644
--- a/frontend/src/app/features/team-planner/team-planner/planner/team-planner.component.ts
+++ b/frontend/src/app/features/team-planner/team-planner/planner/team-planner.component.ts
@@ -293,6 +293,7 @@ export class TeamPlannerComponent extends UntilDestroyedMixin implements OnInit,
cannot_drag_here: this.I18n.t('js.team_planner.cannot_drag_here'),
updating: this.I18n.t('js.ajax.updating'),
successful_update: this.I18n.t('js.notice_successful_update'),
+ cannot_drag_to_non_working_day: this.I18n.t('js.team_planner.cannot_drag_to_non_working_day'),
};
principals$ = this.principalIds$
@@ -812,7 +813,13 @@ export class TeamPlannerComponent extends UntilDestroyedMixin implements OnInit,
private async updateEvent(info:EventResizeDoneArg|EventDropArg|EventReceiveArg):Promise<void> {
const changeset = this.workPackagesCalendar.updateDates(info);
-
+ const due = moment(info.event.endStr).subtract(1, 'day').toDate();
+ const start = moment(info.event.startStr).toDate();
+ if (!changeset.projectedResource.ignoreNonWorkingDays && (this.weekdayService.isNonWorkingDay(start) || this.weekdayService.isNonWorkingDay(due))) {
+ this.toastService.addError(this.text.cannot_drag_to_non_working_day);
+ info?.revert();
+ return;
+ }
const resource = info.event.getResources()[0];
if (resource) {
changeset.setValue('assignee', { href: resource.id });
diff --git a/modules/team_planner/config/locales/js-en.yml b/modules/team_planner/config/locales/js-en.yml
index fba6eb5e69b..4dbc566d21f 100644
--- a/modules/team_planner/config/locales/js-en.yml
+++ b/modules/team_planner/config/locales/js-en.yml
@@ -15,6 +15,7 @@ en:
today: 'Today'
drag_here_to_remove: 'Drag here to remove assignee and start and end dates.'
cannot_drag_here: 'Cannot remove the work package due to permissions or editing restrictions.'
+ cannot_drag_to_non_working_day : 'This work package cannot start/finish on a non-working day.'
quick_add:
empty_state: 'Use the search field to find work packages and drag them to the planner to assign it to someone and define start and end dates.'