208 Commits

Author SHA1 Message Date
Oliver Günther 34952c8217 Stricter parent validations when updating work packages
https://community.openproject.org/work_packages/72363
2026-04-22 14:03:23 +02:00
Oliver Günther e757ef55b6 Properly check move_work_packages in source project
https://community.openproject.org/work_packages/73924
2026-04-16 14:33:46 +02:00
ulferts 1240b066c3 work package creation and update including backlogs properties 2026-03-11 13:24:32 +01:00
Dombi Attila 60e747be2b Apply manage_sprint_items permissions on the work packages model and update specs.
- Do not remove the assign_versions permission anymore, it still has
purpose in the context of updating work packages.
- Update backlog related specs.
2026-03-03 15:40:36 +02:00
Tobias Dillmann c1b37623a5 [#71248] Refactor 2026-02-11 17:15:10 +01:00
Tobias Dillmann a766694c9d [#71248] Journal Sprint property for Work Packages 2026-02-11 17:15:10 +01:00
ulferts cc9155445a generalize generated attribute read-only safeguard 2026-02-04 13:01:20 +01:00
ulferts e3068116ba rework copy contract to always allow setting subject 2026-02-04 10:46:11 +01:00
ulferts 7236e78c61 no longer validate work package itself on wp activity update
This is in line with changes made regarding e.g. custom fields
2026-02-04 09:23:30 +01:00
ulferts b834859aab don't apply presence validation in case the subject is autogenerated 2026-02-03 18:11:25 +01:00
ulferts 0bcaa0f175 move automatic subject creation to SetAttributesService
This avoids having to reset the subject first and having to save the automatic subject in an after_perform.
This is especially useful if no change is performed at all. Without the change, even without a change saving would lead to a new journal
2026-02-02 18:03:44 +01:00
Kabiru Mwenja 17c7dcfff5 Fix internal comments authorization [OP#70979]
The API v3 was allowing reading/writing internal comments when both the
enterprise token doesn't allow it and when the project setting is disabled.

Reading (GET):
- Added EnterpriseToken check to internal_visible scope

Writing (POST):
- Added project.enabled_internal_comments check to CreateNoteContract
2026-01-28 21:04:59 +03:00
Christophe Bliard 8b8f8f0c35 Make "Project copy" copy all work packages as-is
When doing a project copy, copy as-is and accept that the state can be
faulty.

Before, it was disabling parts of the validations while keeping some
other parts, which made the experience confusing: the
SetAttributesService would be ok, but then saving the work package would
fail, and later the work package would be saved again without validation
in the `UpdateAncestorsService`.

Actually it was working previously only due to side-effects of
`UpdateAncestorsService` which does save and also due to changes
introduced in 0700299 which refactored the part that detect `save`
returned `false`, leading to believe that `save` always returned `true`.

Now the validation are done solely by the `SetAttributesService`, and
when saving the work package validations are ignored.
2026-01-08 11:59:52 +01:00
Dombi Attila a25c70822a [#68705] When project is copied, work packages with empty mandatory custom fields are not copied
https://community.openproject.org/work_packages/68705
2025-11-11 21:54:59 +02:00
Christophe Bliard ccf83e41b8 Automatically correct progress values when possible
https://community.openproject.org/wp/66592

In case the values ever get corrupted, instead of annoying the user with
a validation message which prevents saving the work package, it tries to
automatically correct the values.

The autocorrection is possible only if all values are set and are valid.
2025-08-19 16:52:00 +02:00
Christophe Bliard e22e3aeb48 Better check of progress values consistency
https://community.openproject.org/wp/66592

Previous check of % complete consistency with work and remaining work
was allowing a small range of % complete values. For instance with work
= 0.25h and remaining work=0.06h, it was allowing the range 76..77. But
when setting % complete to 75%, the derived remaining work would be
0.06h so 75% value *is* valid.

The fixed check is now simpler: it checks if the % complete value is the
one that would be calculated from work and remaining work, or if the
remaining work value is the one that would be calculated from work and %
complete.

A module has been extracted to ensure the same methods are used to
calculate the values in both validation and derivation.
2025-08-18 10:58:05 +02:00
Alexander Brandon Coles 0091ee164d Freeze string literals in app/contracts
rubocop -A --only Style/FrozenStringLiteralComment,Layout/EmptyLineAfterMagicComment,Style/RedundantFreeze app/contracts
2025-07-18 17:51:41 +01:00
ulferts eae07d536b ease the validation on project phases
Validation will only take place when the project_phase_definition_id value is changed. Before, it was always validated (unless the project was changed).
But with the larger amount of possibilities to disable project phases and with subsequent changes to the work package potentically being done by somebody
who does not have the permission to change the value, the validation needs to be more precise.
2025-07-08 15:39:35 +02:00
OpenProject Actions CI d4a935fa44 Merge branch 'release/16.1' into dev 2025-06-25 03:48:44 +00:00
Christophe Bliard 47ec7ec160 Merge pull request #19297 from opf/bugfix/65062-systemstackerror-in-workpackage-schedulingrules-schedule_automatically
[65062] Fix infinite loop when getting automatically scheduled ancestors
2025-06-24 15:15:41 +02:00
Christophe Bliard d66741ca8a [64203] Fix unclear error message on parent self-assignment
https://community.openproject.org/wp/64203

When updating a work package to be parent of itself, `closure_tree` gem
has hooks to update the work_package_hierarchies table and can detect
cycles. When a cycle is detected, it adds a "You cannot add an ancestor
as a descendant" error on `:parent_id`.

The fix is to remove this error before providing our own error message.
2025-06-24 11:38:16 +02:00
Christophe Bliard 72d44b8ad5 [65062] Fix infinite loop when getting automatically scheduled ancestors
https://community.openproject.org/wp/65062

When there is a cycle in the hierarchy, like trying to set the root
parent as a child of its own child, the scheduling dependency would loop
when trying to find all the automatically scheduled ancestors of the
work package.

This is now fixed by marking the visited work packages.
2025-06-24 11:11:08 +02:00
Ivan Kuchin bf556f4f30 remove stages_and_gates usage from production code 2025-06-20 12:34:59 +02:00
ulferts 12ff4cc5ca more pinpointed override 2025-06-04 16:22:38 +02:00
ulferts ff61d77ec3 allow copying associated phase definitions on copy base permission 2025-06-04 16:22:38 +02:00
OpenProject Actions CI 4f59cb992f Merge branch 'release/16.0' into dev 2025-05-31 03:45:12 +00:00
Kabiru Mwenja e66502e8df bug/64324 Enhance internal comments feature plan access (#19057)
https://community.openproject.org/work_packages/64324
2025-05-30 11:45:18 +03:00
OpenProject Actions CI 2dcedec67a Merge branch 'release/16.0' into dev 2025-05-28 03:46:46 +00:00
Oliver Günther e97bee391a Merge pull request #19006 from opf/bugfix/62426-some-dates-and-scheduling-mode-are-lost-when-creating-project-from-template
[62426] Preserve dates and scheduling mode when bulk copying
2025-05-27 09:51:16 +02:00
Henriette Darge 2e34fbbc60 Merge branch 'dev' into merge-release/16.0-20250527034646 2025-05-27 08:05:08 +02:00
Christophe Bliard 144d4975de Prohibit scheduling automatically in API if no predecessors or children
Only when creating a work package. The only case where it's possible is
when creating a work package with a parent explicitly set, and that
parent is automatically scheduled and has at least one predecessor.

When copying work packages, this restriction is removed as predecessors
and children are added later in the process.
2025-05-26 10:48:59 +02:00
ulferts c1df3a0216 robustness on validating wp`s category in case the project is nil 2025-05-21 14:59:54 +02:00
ulferts 42c14d1770 Merge remote-tracking branch 'origin/dev' into implementation/62981-show-and-edit-linked-phases-on-work-packages 2025-05-05 18:04:33 +02:00
Bruno Pagno ade2c2cac4 Merge pull request #18756 from opf/impl/63635-remove-internal-comments-feature-flag
Remove internal comments feature flag
2025-04-29 12:41:07 +02:00
ulferts ad33c93054 Merge remote-tracking branch 'origin/dev' into implementation/62981-show-and-edit-linked-phases-on-work-packages 2025-04-29 11:40:43 +02:00
Bruno Pagno aa53f1fa09 remove internal comments feature flag 2025-04-29 10:30:11 +02:00
Klaus Zanders 0a2a1782d6 Merge branch 'dev' into merge-release/15.5-20250429034308 2025-04-29 09:01:56 +02:00
Christophe Bliard baed105651 Keep due date when duration is 0 or negative
And order `reuse_current_due_date?` and `duration_assignable?` in the
order they are used.
2025-04-25 13:33:04 +02:00
Bruno Pagno 97ccf0bfc5 adjust internal comments internal representation 2025-04-24 13:12:32 +02:00
Bruno Pagno c2886046cd update comment permission names 2025-04-24 13:12:32 +02:00
Kabiru Mwenja 86bf1fddfc Merge pull request #18537 from opf/implementation/62363-adapt-attachment-uploads-on-comments-so-that-they-are-attached-to-the-container-on-submit
Implementation/62363 adapt attachment uploads on wp comments so that they are attached to the journal container on submit
2025-04-22 09:54:16 +03:00
ulferts c48cec8dd4 feature spec for moving linked wp 2025-04-17 10:31:00 +02:00
ulferts eec1525a98 setting project phase on work package 2025-04-17 10:30:54 +02:00
ulferts a18ef28118 show phase definition linked to work package 2025-04-17 10:27:06 +02:00
ulferts da2efde9b4 add permission check on setting journal_restricted 2025-04-14 16:16:49 +02:00
ulferts e904e530d8 remove WorkPackagePolicy 2025-04-14 16:16:48 +02:00
Kabiru Mwenja 5bf56b9ffb Derive comment attachment claims from rich text content
Claim inline attachments that are actually in use- leave any previosly uploaded but unclaimed
attachemnts for clean up (later)- this way we don't clog up storage with unused image files
2025-04-08 08:48:55 +03:00
Dombi Attila 9412dc226d [#60122] Required custom fields prevent a WorkPackage from being added as a child
https://community.openproject.org/work_packages/60122
2025-03-21 12:53:26 +02:00
Kabiru Mwenja 9bb1da4de3 Enhance wp note contract to include feature flag 2025-03-17 16:07:22 +03:00
Kabiru Mwenja b509d860c8 Merge branch 'dev' into implementation/60980-introduce-work-package-restricted-comments-as-part-of-journal-notes 2025-03-10 11:27:53 +03:00