79 Commits

Author SHA1 Message Date
Tobias Dillmann 92aee4780d [#69399] project custom field section: for_all controls the toggle 2025-12-12 09:59:50 +01:00
Dombi Attila 513792ef89 [#67839] "Required for all projects" should not require a value to be set for a Calculated Value
https://community.openproject.org/work_packages/67839
2025-11-03 13:48:00 +02:00
Tobias Dillmann f7b5770af2 [#66093] CalculatedValueError belongs to Project and CustomField
... instead of CustomValue. This avoids issues with soft deletion and
caching.
2025-09-24 19:19:03 +02:00
Tobias Dillmann 770c5236cf [#66093] WIP 2025-09-24 19:19:03 +02:00
Tobias Dillmann 916c09a238 [#66093] Add model: CustomValueError 2025-09-24 19:19:03 +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
Eric Schubert 61108493c1 [#58865] fixed some rubocop issues 2024-11-12 14:01:49 +01:00
Eric Schubert d27a077d4b [#58865] add enterprise banner to new custom field form
- https://community.openproject.org/work_packages/58865
- show banner below form field selection, if
  - hierarchy is selected AND
  - enterprise token is not active
- disable submit button, if the enterprise banner is shown
2024-11-12 13:59:10 +01:00
Dombi Attila 850fd795cd Invert visible logic to admin_only? 2024-08-07 15:38:27 +03:00
Ivan Kuchin 4911b8a149 remove years from copyrights (except for COPYRIGHT file) 2024-07-31 15:02:49 +02:00
Oliver Günther 1f73602839 Add "Link" custom field type
https://community.openproject.org/work_packages/26923
2024-04-29 08:35:35 +02:00
Ivan Kuchin 6678cab48d auto correct quotes 2024-03-28 18:22:34 +01:00
Jonas Jabari a00a44a3c7 fixed and finetuned project custom field activation for create, update and copy contexts 2024-03-08 10:47:03 +07:00
Jonas Jabari 8610e769f0 fixing project API 2024-02-28 15:48:28 +07: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
Christophe Bliard 0029bffe3d Correctly create default values for multi-value list custom field
https://community.openproject.org/wp/49765

https://community.openproject.org/wp/49784

Original bug was OP#49765: creating a list custom field and then adding
a comment to an existing work package would be impossible. An error
"<custom field> was attempted to be written but is not writable" was
displayed.

In WorkPackageContract, when evaluating what was changed by the user and
by the system, it checks if the custom values are newly set and if they
are default.

The default check was wrong for list custom field, as the default value
was an integer, and the value was a string (created automatically by
Redmine::Acts::Customizable#custom_field_values). i.e. check was `367 ==
"367"`

The default check was wrong for multi-value list custom field as well,
as the default value was a stringified array of integers, i.e. check was
`[367, 368] == "[367, 368]"`. And it is plain wrong anyway because two
CustomValue must be created in this case: one with value 367, second
with value 368. This prevented default values to be pre-selected in the
new work package form (bug #49784).

This commit fixes the default check by returning strings for default
value of list custom fields (bug #49765) and by creating multiple
CustomValue for multi-value list custom fields (bug #49784) when none is
present.
2023-08-25 17:27:22 +02:00
Christophe Bliard 28d54fd72f Don't use implicitly build boolean custom_values for change detection
https://community.openproject.org/wp/46492

In the continuity of #11897: detecting if the changed value is the
custom field default value need casting for boolean custom fields.
Without casting, the value would be `"f"` and the default value `false`.
2023-03-01 21:03:58 +01:00
Oliver Günther e949340f85 Merge remote-tracking branch 'origin/release/12.4' into dev 2023-01-12 13:56:37 +01:00
Oliver Günther 39c7e8e51f Don't use implicitly build custom_values for change detection 2023-01-12 13:21:53 +01:00
Christophe Bliard 21a696ef9b Update copyright information for 2023 2022-12-30 15:51:26 +01:00
Christophe Bliard 48a4f1b6ad lint with rubocop --autocorrect (safe cops only) 2022-06-02 10:40:10 +02:00
Christophe Bliard a33524ef6d remove ruby magic comment for utf-8
ruby interprets source encoding as utf-8 since 2.0.0, making magic comment redundant and useless
2022-03-10 19:36:58 +01:00
Christophe Bliard bc8d423ec2 update copyright information for 2022 2022-03-01 17:05:59 +01:00
Oliver Günther ccfa29c728 Move license and copyright docs to root, fix names and references 2021-09-02 21:50:46 +02:00
Oliver Günther ac049663a3 Add multiple option for project custom fields (#9125)
* Allow multi-select CFs for projects

* Render multiple custom values in project row

* Output arrays from custom_value_attributes for multiselect values

* Add spec for copying multi-value cf

* Fix custom field multiselect form on new custom fields

* Fix custom field builder specs

* Add spec for creating/updating projects with multi select

* Add spec to create new multi select project cfs

* Add spec for projects index displaying of custom fields
2021-03-30 17:29:32 +02:00
ulferts 1bdd2ab9ae safe automatic fixes by rubocop (#8994) 2021-02-11 16:02:18 +01:00
ulferts 6140f4c7e9 update copyright to 2021 (#8925)
Updates the copyright to 2021 for all files that have a copyright. Files in our source code without the copyright header still do not receive one automatically. Additionally, backlisted files are also excluded.

Previously the copyright of chiliproject which references redmine stated a copyright of redmine up to and including 2017 which is not true for the code we have in here. Because of that I changed that to 2013
2021-01-13 17:47:45 +01:00
Oliver Günther af4010b003 [33496] Don't try to lookup custom value by value
Only for list types, the value will be an integer to look up by id,
but instead use `CustomValue.new(...).typed_value` to use the formatter
classes to correctly look up the value.

https://community.openproject.com/wp/33496

[ci skip]
2020-09-04 12:50:13 +02:00
Oliver Günther 53f2d694ff Use AnyFixtures to generate fixtures from factories (#7230)
Uses FactoryBot to keep and maintain specific records in a special transaction that does not get removed after each spec.
They automatically are created whenever first hitting them.
This makes an excellent time saver for items that are commonly used, such as an admin user account
2020-04-09 11:54:26 +02:00
Henriette Dinger bd7f4e4814 Update copyright notice 2020-01-15 11:31:26 +01:00
Oliver Günther 6ef4211e77 Bump copyright to 2018 (#6171)
[ci skip]
2018-02-12 08:51:12 +01:00
Oliver Günther d4182ef24e [25877] Validate the correctness of a CF regexp
https://community.openproject.com/work_packages/25877
2017-07-20 11:42:32 +02:00
Jens Ulferts 9a347d7e83 move CustomFieldFormat to OpenProject namespace 2017-05-08 11:57:26 +02:00
Jens Ulferts 1a8a03ce56 cleanup code within custom_value area 2017-05-08 11:21:50 +02:00
Jens Ulferts 9a7f775edb code prettification for custom_value 2017-05-08 11:00:01 +02:00
Jens Ulferts 15479793ab move custom value string representation to strategy 2017-05-08 10:45:34 +02:00
Markus Kahl f5a57e3f42 list custom field normalisation and multi select 2017-02-17 14:38:24 +00:00
Oliver Günther 7cf11bb689 Update copyright notice 2017-01-10 15:11:43 +01:00
Jens Ulferts 701f196c25 eager load user and version custom fields in wp representer 2016-11-22 09:13:02 +01:00
Jens Ulferts a6d265eb79 force bool custom values to be stored uniformly 2016-09-14 11:36:44 +02:00
Jan Sandbrink 348d3c746e fix submission of "false" as CF value
it was not possible to set a custom field to false via APIv3.
Apparently the way the value is set in other places does not involve
"real" boolean types
2015-03-10 15:44:25 +01:00
Jan Sandbrink 1a25e19c2f remove 'true?' helper from custom_value 2015-02-26 16:24:32 +01:00
Jan Sandbrink 2e32e120f7 better naming 2015-02-26 16:01:42 +01:00
Jan Sandbrink 5ba53b49b9 various small fixes 2015-02-26 14:57:54 +01:00
Jan Sandbrink 25dec31c5a extract some case statements into fancy strategies
- 17 new files
- lots of new lines of code
- specs!
- same functionality as before
2015-02-26 11:18:52 +01:00
Jan Sandbrink 05884417f7 let custom values return typed values
this allows to have type-correct JSON output, e.g.:

12 instead of "12"
true instead of "1"
2015-02-26 11:18:51 +01:00
Jan Sandbrink 9532c39c5e add another case to repair list custom fields
Genius idea to require the parameter of a method to carry totally
different information, depending on internal state of the object
2015-02-26 11:18:51 +01:00
Jan Sandbrink ac655ac789 validate user and version custom fields 2015-02-26 11:18:51 +01:00
Alex Coles e0191e759c Update year in copyright header to 2015
[ci skip]
2015-01-01 00:02:57 +00:00
Alex Coles 721101ed25 Use 1.9+ Hash syntax in (Rails) models
Signed-off-by: Alex Coles <alex@alexbcoles.com>
2014-11-03 22:15:11 +01:00