Project

General

Profile

Actions

Defect #25726

closed

Issue details page shows default values for custom fields that aren't actually set

Added by Jens Krämer over 7 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
High
Category:
Custom fields
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed
Affected version:

Description

I posted this already as a comment in #21074 as this is where this behavior was most certainly introduced but it's probably a good idea to open a new issue for this.

The problem

When creating an issue custom field with a default value, the issue details page of issues that have existed before shows the field with this default value. However since the value is not really set in the DB you cannot see it in the issues list, nor can you find any of these issues when searching for it through the filters.

Steps to reproduce

  • Create a new issue.
  • Create a new issue custom field (I tried with boolean and text types) with a default value
  • look at the previously created issue in issues list (have the custom field displayed) and detail view
  • note the different values being shown for the custom field - issue details page shows the configured default, while the issue list shows the field as unset (empty).
  • When filtering the issue list for the field's value (or simply looking at the database) it turns out that the field is indeed unset (neither filtering for the field being 'yes' or 'no' turns up the issue). So clearly the details view is lying about the field's true value by replacing unset with the configured default.

Desired Behavior

Imho the default value for unset custom fields (where no corresponding custom_value exists) should only be preset in the edit form, but not when merely showing the issue details. Under all circumstances the details view should be consistent with the issues list in this regard.

I came up with a patch that checks if there is actually any custom value present in the database for the given field before calling show_value, but it feels more like a workaround than a solution.

Another related thing I observed is that, when editing such an issue and setting the custom field's value for the first time and to something other than the default, a journal detail is created saying "field xy was changed from <default> to <new value>", though the default was never really set on the field.

Finally, it might be a useful feature to offer the option of applying the default to all issues (matching tracker / project selection) when saving a custom field with a default set.


Files

0001-do-not-display-default-values-that-aren-t-actually-s.patch (1.86 KB) 0001-do-not-display-default-values-that-aren-t-actually-s.patch patch against trunk (better than the one in #21074) Jens Krämer, 2017-04-28 17:07

Related issues

Related to Redmine - Defect #9849: Custom field values of several issue custom field formats don't get set/updated properly during email issue creation/replyNew

Actions
Related to Redmine - Defect #21074: When changing the tracker of an existing issue, new custom fields are not initialized with their default valueClosedJean-Philippe Lang

Actions
Actions

Also available in: Atom PDF