174 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 2e19fb154e fix spec descriptions 2026-03-19 12:08:57 +01: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
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 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
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 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
Ivan Kuchin ede5e5be14 remove stages_and_gates usage from specs 2025-06-20 12:35:00 +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
Henriette Darge 2e34fbbc60 Merge branch 'dev' into merge-release/16.0-20250527034646 2025-05-27 08:05:08 +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 37e295f007 use shared examples for validation 2025-05-21 14:59:08 +02:00
ulferts 0b4367806b autofix include_examples 2025-05-21 14:54:18 +02:00
Jan Sandbrink 03c8db36bf Merge pull request #18806 from opf/frozen-specs
Freeze string literals in specs
2025-05-07 07:54:10 +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
Jan Sandbrink 0b87e7543f Freeze string literals in specs
Rolling out frozen string literals further by freezing all
string literals in core specs.
2025-05-05 09:29:55 +02:00
ulferts a47d6ec3f7 linting 2025-04-30 10:14:54 +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
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 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 d5a6c893f8 Add comment attachment claims contract spec 2025-04-08 13:55:17 +03:00
Kabiru Mwenja 9bb1da4de3 Enhance wp note contract to include feature flag 2025-03-17 16:07:22 +03:00
Kabiru Mwenja 1fa19e01f2 add failed contract error message 2025-03-17 12:47:53 +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
Kabiru Mwenja a3e685e7bf Update work package note contract with restriction
Do not allow empty notes with restriction, as empty notes are not seen as comments
2025-02-28 08:36:45 +03:00
Christophe Bliard 366dc2dc18 Display error in date picker for invalid duration
If duration is negative or garbage, an error is displayed in the date
picker. It will not display any derivation-related errors for start and
due dates. For instance if start date is set, due date is not set, and
duration is invalid, then it won't display "can not be set to null as
start date and duration are known" error for due date.
2025-02-25 09:18:19 +01:00
Christophe Bliard 4ac1b1ca7a Remove :percent_complete_edition feature flag
% complete edition will be released in 14.6
2024-09-25 15:31:11 +02:00
Christophe Bliard 4807c232e8 Merge pull request #16539 from opf/feature/57258-progress-values-derivation-hints
[57258] Indicate which fields are automatically derived and why in progress pop over
2024-08-28 09:55:47 +02:00
Christophe Bliard e14576261a Merge pull request #16419 from opf/fix/editable_percent_complete_adjustments
[52233] Fix multiple issues related to % complete being editable
2024-08-28 09:42:35 +02:00
Christophe Bliard 5fc40d4af1 Handle cases with imprecise progress value derivations
As the work and remaining work values are rounded to two decimals, it
can lead to strange result of % complete computation and validation.

Two examples:
- A derived % complete of 99.9% should not be rounded to 100% because there is still
  some work remaining. It should be 99% in this case.
- Setting work to 2h and remaining work to 1.999h should not lead to 99%
  complete because remaining work will be rounded to 2h, so % complete
  should be 100% in this case.

These really are edge cases.
2024-08-27 16:02:55 +02:00
Christophe Bliard 6851972eb2 Handle invalid work and remaining work values
In case work or remaining work are set to unparsable strings, no values
should be derived and no hints should be displayed.
2024-08-27 16:02:55 +02:00
Christophe Bliard b1dec39313 Update wording to match the one used in user messages 2024-08-23 14:49:13 +02:00
Christophe Bliard 321a4f1531 Avoid % complete errors when remaining work exceeds work
In this case, do not tell that % complete should be set when work and
remaining work are set if remaining work is greater than work. No need
to overwhelm the user.
2024-08-22 17:27:19 +02:00
Ivan Kuchin a8e418bbb3 remove years from copyrights 2024-08-16 17:31:28 +02:00
Christophe Bliard 03721ce32c [52233] Validate % complete numericality when it's a string
If invalid, work and remaining work values are not derived.
2024-08-16 11:08:10 +02:00
Christophe Bliard 4330f53758 [52233] Handle progress value derivation when % complete is 100%
In this case remaining work can only be 2 values:
- 0h if work is set
- unset if work is unset
2024-08-14 16:19:52 +02:00
Christophe Bliard 711846d6f8 Improve error messages with invalid progress values
If work or remaining work are negative, do not display any error for %
complete being inconsistent nor for remaining work exceeding work.
2024-08-14 16:19:51 +02:00