View Issue Details

IDProjectCategoryView StatusLast Update
0019482mantisbtcustom fieldspublic2017-12-04 02:17
Reporterapaulet Assigned Tovboctor  
PrioritynoneSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version1.2.19 
Target Version2.9.0Fixed in Version2.9.0 
Summary0019482: Using custom fields (date) with default value and required on resolve displays an error
Description

I create a custom field <i>test_date</i> which must be displayed and is required at the step <b>resolve</b>. I set a default value to <b>{+1 days}</b>.

When I report a bug, when I submit it, I have the message :
APPLICATION ERROR 0001303 : Invalid value for field "test_date".

Steps To Reproduce

Create a new project "TEST",
Create a new custom field with these values,

  • Type : date
  • Default value : {+1 days}
  • Add to Filter : checked
  • Display When Reporting Issues : unchecked
  • Display When Updating Issues : unchecked
  • Display When Resolving Issues : checked
  • Display When Closing Issues : checked
  • Required On Report : unchecked
  • Required On Update : unchecked
  • Required On Resolve : checked
  • Required On Close : checked
    Link the custom field to the project,
    Report a bug and submit it.
Additional Information

If you remove the default value, you don't have the error.

What I wanted to do :
When I pass the bug to the state Resolved, I wanted that the user enter a date which is required at this step and I wanted to set the date by default as tomorrow.

TagsNo tags attached.

Relationships

related to 0012602 closedvboctor Default value for a date don't work 
related to 0017354 closedcproensa Non-required custom fields with a minimum length fail to validate 
related to 0023594 closedvboctor Reporting an issue with default date {now} that is not visible doesn't work 

Activities

apaulet

apaulet

2015-03-10 13:32

reporter   ~0049160

Sorry, I forgot to set the reproductibility state to <b>always</b>

demon_ru

demon_ru

2017-11-07 05:07

reporter   ~0058151

In case I set default value "{today}" for custom field type "date" the value stored to database after bug created. The database value is "{today}"
print_custom_field_input has condition "$t_custom_field_value === null" and doesn't has "$p_field_def['type'] == CUSTOM_FIELD_TYPE_DATE"
ok. It just means that I will never be able to "defer" specifying default values at the time of change of the bug to the desired status.
any default values are stored at time of creation.
Am I wrong?

demon_ru

demon_ru

2017-11-07 05:18

reporter   ~0058152

function cfdef_prepare_date_default implementation does not match it's description:

  • @return string The calculated default date value if $p_value starts with '=', otherwise, returns $p_value.
dregad

dregad

2017-11-07 06:13

developer   ~0058153

any default values are stored at time of creation.

Correct.

function cfdef_prepare_date_default implementation does not match it's description:

Thanks for pointing that out

demon_ru

demon_ru

2017-11-07 11:25

reporter   ~0058157

custom_field_api didn't leave any chance to intervene to conduct and implement a default value depending on the bug status.
There is not a single event that could be implemented.
That was just a function implementation custom_field_date_set_default now impossible to do. This is a very serious loss of functionality while refactoring :(

It is sad that this issue exists in the open form starting in 2015.
After updating to the new version it has become the most sick surprise. Will have to implement a hack in the code.

demon_ru

demon_ru

2017-11-07 11:31

reporter   ~0058158

sorry. by implementation of custom_function_override_issue_update_validate that checks >status

vboctor

vboctor

2017-11-09 22:56

manager   ~0058171

The following issues were fixed:

  • Use of default values for custom fields of type was date was not working, e.g. {now}, {+2 days}, etc.
  • For issues that were submitted with invalid value for custom field, the issue was not viewable, currently it is viewable with empty date field.

@demon_ru, feel free to open a different issue for ability to set custom field value on update.