138 Commits

Author SHA1 Message Date
Oliver Günther 4cc9faef4f Consistently use OpenProject::SqlSanitization instead of forwarding to sanitize_sql_array 2026-05-27 10:08:16 +02:00
Oliver Günther 4724150e3d Avoid quote_string in favor of bindings where possible 2026-05-27 10:08:16 +02:00
Klaus Zanders 2c1c7afe39 Rubocop 2026-05-08 10:46:27 +02:00
Klaus Zanders e392f22e1d Allow sorting and selecting custom fields in user filters as well 2026-05-08 10:27:15 +02:00
Eric Schubert 595f4c7583 Merge branch 'dev' into merge-release/17.0-20251218034959 2025-12-18 11:19:44 +01:00
Marcello Rocha 73754944f8 Optimize number of queries on Hierarchy Custom field views. (#21467)
* Reduce the number of queries per compoment

* Adds job to update the counts
2025-12-17 16:34:28 +01:00
Eric Schubert d1e65c30df [#68225] reworked format for hierarchy items
- introduce default formatter instance
- added missing specs for persistence service methods
2025-12-05 12:58:39 +01:00
Eric Schubert 0cc0cb8f2d [#68225] use item formatter to display items
- https://community.openproject.org/work_packages/68225
- use item formatter for tree views, item view components and standard to_s
- add deprecation warning for stringifying methods without new
  formatting
2025-12-02 17:13:05 +01:00
Eric Schubert ac436b1cfe [#69129] harmonize suffix for hierarchy items
- https://community.openproject.org/work_packages/69129
- shorts and weights both are now serialized with parenthesis
2025-11-26 14:19:00 +01:00
Eric Schubert e22b8b3d74 [#69014] fix hierarchy display in project attributes filter
- https://community.openproject.org/work_packages/69014
- return custom field filter items with depth and label without path
2025-11-14 14:43:35 +01:00
Eric Schubert cda8d530ea [#68802] add shorts and weights to tree selector for project attributes
- https://community.openproject.org/work_packages/68802
2025-11-12 16:03:27 +01:00
Eric Schubert 503176a5e9 [#68794] enable hierarchy filters in project lists
- https://community.openproject.org/work_packages/68794
- add hierarchy filter to autocompleted filters
- add weight and score to filter value label
- fix some eslint issues in filter form controller
2025-11-10 16:22:45 +01:00
Yauheni Suhakou 0de0713a53 Big rename
Renames `scored_list` to `weighted_item_list`
2025-10-30 15:36:55 +01:00
Tobias Dillmann 26111f0919 [#64523] Allow 'Scored List' as formula format 2025-10-17 19:31:54 +02:00
Eric Schubert 222b41990d [#67328] add change parent to item's action menu
- https://community.openproject.org/work_packages/67328
- add new routes to change parent and get change parent dialog
- added missing locale keys
- fixed deprecated example in lookbook
- added intermediate text input for parent id
  - to be changed to filterable tree view selection
2025-09-16 13:56:31 +02:00
Eric Schubert d38f5220c1 [#66961] use scored list custom fields in work packages
- https://community.openproject.org/work_packages/66961
- adapt representer logic to handle scored lists
2025-08-28 12:52:47 +02:00
Ivan Kuchin 32741851d2 add CustomField.with_formula_referencing(id) scope 2025-08-22 20:19:15 +02:00
Ivan Kuchin 4ab159db18 recalculate values on formula change 2025-08-20 13:51:58 +02:00
Ivan Kuchin 2a593b10ba ensure affected_calculated_fields doesn't consider ids which are not in scope 2025-08-20 13:51:58 +02:00
Ivan Kuchin 3c5f0a701a fixed caching all paths in formula_references_id? 2025-08-20 13:03:18 +02:00
Tobias Dillmann acbae269a1 [#64351] Display calculated values in the project list
Co-authored-by: Ivan Kuchin <i.kuchin@openproject.com>
2025-08-12 10:22:38 +02:00
Ivan Kuchin 4790725ba2 create field_format_calculated_value scope and use it 2025-08-11 13:48:56 +02:00
Ivan Kuchin 9e299ac4f0 add affected_calculated_fields method 2025-08-11 13:48:51 +02:00
Ivan Kuchin f7be16057a extract factory for calculator to set options in one place 2025-08-11 13:48:51 +02:00
Ivan Kuchin 2833108ac8 make formula_str_without_patterns public 2025-08-11 13:48:49 +02:00
Tobias Dillmann 6bf7db3a1f [#64348] Assign value in fetch 2025-07-30 15:17:48 +02:00
Tobias Dillmann 9065bfb775 [#64348] Names 2025-07-30 15:17:48 +02:00
Tobias Dillmann 13f4805490 [#64348] Fix formula reference checking
The previous version lead to false positives
2025-07-30 15:17:48 +02:00
Tobias Dillmann ca37dc4f40 [#64348] Refactor #formula_references_id?
It is now a proper instance method that is called on the current custom
field instead of weirdly accepting another custom field as first
argument.
2025-07-30 15:17:48 +02:00
Tobias Dillmann e6d2cb4d0b [#64348] mv has_circular_reference? formula_references_id? 2025-07-30 15:17:48 +02:00
Tobias Dillmann 52c15efaa0 [#64348] use #formula_referenced_custom_field_ids 2025-07-30 15:17:48 +02:00
Ivan Kuchin 0a345aff63 [#64348] add formula_referenced_custom_field_ids method 2025-07-30 15:17:48 +02:00
Tobias Dillmann 82ab7f8de6 [#64348] Review feedback: increase code efficiency 2025-07-30 15:17:48 +02:00
Tobias Dillmann 610ab9c3d0 [#64348] Remove TODO comment
To implement this properly, we would have to either cache results of
previous validation checks, or we would have to perform certain queries
and operations again. For example, we would have to check which of the
surplus CFs do not have an allowed field format and add an error for
them.

After that, we would have to find all fields causing a circular
reference and add an error for them.

Same for fields not visible to the user, and so on and so on.

What I am trying to get at is: This would complicate matters quite a
lot. However, if all goes well, users will never add these fields to a
formula, since it is never suggested in the first place. So while being
nice and helpful, it hopefully will not happen very often. Therefore, I
would keep it vague for the first iteration and observe what the users
do with this feature.
2025-07-30 15:17:48 +02:00
Tobias Dillmann 8613c446f1 [#64348] Avoid circular references 2025-07-30 15:17:48 +02:00
Tobias Dillmann 8eaeaea334 [#64348] Use compact if/elsif instead of early returns 2025-07-30 15:17:48 +02:00
Tobias Dillmann 6df38e9573 [#64348] Simplify character validation 2025-07-30 15:17:48 +02:00
Tobias Dillmann 95b886d65c [#64348] Remove % from the suggestion list
It can be used as either modulo or for percentage calculations. Removing
it from the suggestion list for mathematical operators as that might be
confusing. You can still type % manually, though. Added specs for these
cases.
2025-07-30 15:17:48 +02:00
Tobias Dillmann 855810e400 [#64348] Use lookaheads/-behinds to get rid of flatten and compact 2025-07-30 15:17:48 +02:00
Tobias Dillmann 3ae1592b80 [#64348] Take formula cfs directly from formula 2025-07-30 15:17:48 +02:00
Tobias Dillmann 3237e2042b [#64348] Do not cache calculator instance 2025-07-30 15:17:48 +02:00
Tobias Dillmann 633dba465b [#64348] Use self.class for scoping 2025-07-30 15:17:48 +02:00
Tobias Dillmann cc610c153a [#64348] Remove redundant returns 2025-07-30 15:17:48 +02:00
Tobias Dillmann b6cd6e2bbd [#64348] Use a more explicit name for formula operators 2025-07-30 15:17:48 +02:00
Tobias Dillmann bd8e2cbfbd [#64348] Refine error message for invalid custom fields 2025-07-30 15:17:48 +02:00
Tobias Dillmann 080160bb43 [#64348] Adjust documentation 2025-07-30 15:17:48 +02:00
Tobias Dillmann 9338922f56 [#64348] Fixup specs for Calculated Values 2025-07-30 15:17:48 +02:00
Tobias Dillmann b8e42a9393 [#64348] Only allow patternized variables in formula string
Good: {{cf_21}}
Bad: cf_21
2025-07-30 15:17:48 +02:00
Tobias Dillmann 9e742beba1 [#64348] Fail validation if unknown custom field is in formula 2025-07-30 15:17:48 +02:00
Tobias Dillmann 6f32b605bf [#64348] Modulo operator for Calculated Values 2025-07-30 15:17:48 +02:00