82 Commits

Author SHA1 Message Date
ulferts ecfd47de4a Merge branch 'release/16.6' into release/17.0 2025-12-04 12:26:47 +01:00
Christophe Bliard d2ba93aa77 Make 2+ shared work packages accessible to non-project members
https://community.openproject.org/wp/68921

The condition was excluding work packages from a project if there was
more than one work package shared within the same project, and the user
was not a member of the project.

Reworked the query into a simpler sql applying union to get set of
member or entity permitted ids.

Co-authored-by: Jens Ulferts <jens.ulferts@googlemail.com>
2025-12-04 11:37:07 +01:00
ulferts f82f3ef979 remove Setting.large_instance_wp_allowed_to_sql 2025-11-28 11:44:17 +01:00
ulferts 7cef12463c work around poor PgSQL query planning 2025-10-24 18:19:11 +02:00
ulferts a7c5de71e4 limit projection to used column 2025-10-22 11:17:10 +02:00
ulferts 686ee49a97 rewrite allowed_to to avoid from 2025-10-17 10:07:36 +02:00
Pavel Balashou 1323927095 [#65068] Add deleted status to user.
https://community.openproject.org/work_packages/65068
2025-08-27 09:53:37 +02:00
ulferts 32017fd281 split up query for improved readability 2025-08-12 16:22:18 +02:00
ulferts e14e1c168d introduce setting to switch between sql strategies 2025-08-12 16:22:15 +02:00
ulferts f2fdc7ad5d hacking possibly advantageous SQL for WorkPackage.allowed_to 2025-08-12 16:22:14 +02:00
Markus Kahl b1161f290b Merge branch 'release/16.2' into merge-16.2-into-16.3 2025-08-05 15:24:59 +01:00
ulferts a2faa3bd23 avoid using CTE in subquery which leads to full wp table scan 2025-08-05 14:59:14 +02:00
Alexander Brandon Coles d17da65477 Freeze string literals in app/models
rubocop -A --only Style/FrozenStringLiteralComment,Layout/EmptyLineAfterMagicComment,Style/RedundantFreeze app/models
2025-07-22 18:26:13 +01:00
Klaus Zanders e51b0020d4 fix include spent time and visible scope 2025-07-09 10:41:06 +02:00
Ivan Kuchin a637335fe2 rename covering_dates_and_days_of_week to covering_dates_or_days_of_week 2025-06-04 18:33:32 +02:00
Ivan Kuchin e3fa8fc56c don't generate list of dates in covering_dates_and_days_of_week of work packages too 2025-06-04 18:33:27 +02:00
ulferts 1916529348 adapt sql in involving_user scope 2025-02-28 23:42:04 +01:00
Christophe Bliard 5fef66cca1 Better handle rescheduling with work packages switching to automatic
There was a bug where a parent of a work package switching to automatic
would not be properly rescheduled.
2025-02-25 09:18:25 +01:00
Christophe Bliard 26fbc5522a [59539] switch scheduling mode when modifying follows relations
When a work package becomes a successor of another work package, its
scheduling mode is switched to automatic if it has no children so that
it can be scheduled as soon as possible automatically.

Similarly, when a work package is no longer a successor of any other
work package, its scheduling mode is switched to manual if it has no
children and no dates so that it can keep its current dates.
2025-02-25 09:12:25 +01:00
Christophe Bliard b4d2f5dc9c [59539] Correctly reschedule predecessors needing relations rescheduling
Edge case not detected by the previous algorithm: relation has no lag
but covers non-working days changed into working days. The successors
need to be rescheduled, which is done by rescheduling from the
predecessor.
2025-02-25 09:12:24 +01:00
Christophe Bliard 2d7288d317 [59539] Make work packages manually scheduled by default
The `schedule_manually` column is also non-nullable now.

This includes the following changes:

- Automatically scheduled parent dates are and `ignore_non_working_days`
  attributes are now always derived from children's values, even if the
  children are scheduled manually.

  It's more natural. Without that, adding a child to a work package
  would not change the parent's dates.

  As a consequence, the parent can start on a non-working day if one of
  its children is manually scheduled, ignores non-working days, and
  starts on a non-working day. That's why the parent's
  `ignore_non_working_days` attribute is now also derived from all its
  children regardless of the scheduling mode.

  If the parent is manually scheduled, its dates and it's ability to
  ignore non-working days will still be defined independently from its
  children.

- Fix tests broken by scheduling mode being manual by default.

  The tests had to be adapted to explicitly set scheduling mode to
  automatic for followers and parents, and sometimes even follower's
  children. Without it, work packages would not be rescheduled
  automatically.

- Replace schedule helpers with table helpers.

  Schedule helpers helped well, but table helpers are more flexible and
  support more column types.

- Add "days counting" and "scheduling mode" columns to table helpers.

  "days counting" to set `ignore_non_working_days` attribute.
    - "all days" value maps to `ignore_non_working_days: true`.
    - "working days" value maps to `ignore_non_working_days: false`.
  "scheduling mode" to set `schedule_manually` attribute.
    - "manual" value maps to `schedule_manually: true`.
    - "automatic" value maps to `schedule_manually: false`.
2025-02-25 09:12:22 +01:00
Alexander Brandon Coles 1d707895c6 Grammar fixes in code, docs: possessive its/it's
- **it's** is a contraction of _it is_ or _it has_. It requires an
apostrophe.
- **its** is the posssive form of _it_, denoting ownership. It should
not use an apostrophe.
2025-02-12 06:36:46 -03:00
ulferts a4a53dec91 improve performance of involving_user scope which improves date alert creation performance 2025-01-27 22:01:44 +01:00
ulferts 88bd4f0257 use union instead of or for performance 2025-01-23 08:54:32 +01:00
ulferts 9c077a5962 prevent scope being applied in subquery 2025-01-23 08:54:30 +01:00
Jens Ulferts 785693f790 switch order to avoid CTE being included unnecessarily in subselects
Co-authored-by: Ivan Kuchin <i.kuchin@openproject.com>
2024-08-15 09:05:16 +02:00
ulferts feb3a40a0c change the filtering on the visible time entries to be done in the join 2024-08-14 11:07:26 +02:00
Ivan Kuchin 4911b8a149 remove years from copyrights (except for COPYRIGHT file) 2024-07-31 15:02:49 +02:00
Klaus Zanders 1660fce6ef Manage some leftover copyright noticesthat still mention 2023 2024-07-03 08:42:09 +02:00
ulferts 3b2121f733 Revert "Merge remote-tracking branch 'origin/release/13.4' into dev"
This reverts commit 40b2bbeb09, reversing
changes made to b4c6cb17cc.
2024-03-21 11:31:17 +01:00
Ivan Kuchin 7787e457a3 Revert "Merge branch 'dev' into release/13.4"
This reverts commit a901541269, reversing
changes made to e573ca00b7.
2024-03-20 20:19:08 +01:00
Ivan Kuchin 9e4934cd0a change quotes using rubocop --only Style/StringLiterals,Style/QuotedSymbols -a 2024-03-20 18:05:22 +01:00
Klaus Zanders 3df5152f08 Rewrite allowed_to scope for permitted work packages using CTE 2024-02-07 09:20:20 +01:00
Christophe Bliard c795874f7f Update copyright year for 2024
command used: `rg -l 'Copyright \(C\) 2012-202\d the OpenProject' | xargs -n 100 sed -i -r 's/Copyright \(C\) 2012-202. the OpenProject/Copyright (C) 2012-2024 the OpenProject/'`
2024-01-02 16:23:54 +01:00
Klaus Zanders 939dff23e7 WP Descendant query also allows single WP access 2023-12-12 10:18:30 +01:00
Klaus Zanders a68c8ac481 Rework query to not use binds 2023-11-27 10:22:59 +01:00
Klaus Zanders 71ead6f927 Refactor allowed to scope to use WHERE instead of hiding everything in the JOIN 2023-11-27 10:22:58 +01:00
Klaus Zanders c785cb7509 Add uncoping to the query so we don't mix with other filters 2023-11-27 10:22:55 +01:00
Klaus Zanders 7b6b2eeb45 Revert "Attempt to re-fix SQL errors"
This reverts commit 88f11ef9de.
2023-11-27 10:22:54 +01:00
Klaus Zanders f8a571f08f Attempt to re-fix SQL errors 2023-11-27 10:22:54 +01:00
Klaus Zanders ea7a054033 Improve query 2023-11-27 10:22:41 +01:00
Klaus Zanders 2e24263613 Fix return of allowed_to scope 2023-11-27 10:22:39 +01:00
Klaus Zanders b3b213a95f Fix SQL Queries that used the same table name multiple times 2023-11-27 10:22:36 +01:00
Klaus Zanders 5cb7c3bfc6 Restore AllowedTo query without extracted stuff 2023-11-27 10:22:35 +01:00
ulferts 4c2d9f9b24 add specs for relation contract 2023-10-20 16:34:22 +02:00
ulferts 322af4b738 fix reversing the relation if necessary before validation 2023-10-19 20:09:24 +02:00
ulferts 348dfe9bc6 extract allowed scope into concern 2023-10-10 09:30:30 +02:00
Klaus Zanders bd9f79a06c Remove unneeded join for non member setup on Work Packages 2023-10-09 09:37:39 +02:00
Klaus Zanders 528aa0040b Add type condition as well to the join 2023-10-09 09:32:37 +02:00
Klaus Zanders 86e3f5d161 Add an allowed_to scope to WorkPackage and build helpers to access permissions 2023-10-09 09:31:01 +02:00