View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0022408 | mantisbt | custom fields | public | 2017-02-22 06:38 | 2023-10-31 16:36 |
Reporter | jensberke | Assigned To | vboctor | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | assigned | Resolution | open | ||
Product Version | 1.3.5 | ||||
Target Version | 2.27.0 | ||||
Summary | 0022408: Custom field's value logged as changed in history, when it wasn't changed | ||||
Description | If a custom field of type "multiselection list" in an issue already has a value and you change another value in the ticket, the custom field's value also gets logged in the issue history though it hasn't changed. | ||||
Steps To Reproduce |
| ||||
Tags | No tags attached. | ||||
has duplicate | 0022421 | closed | atrol | On Issue Update, history always lists the multiselection custom fields though they have not been updated |
has duplicate | 0023756 | closed | atrol | Multiselection list field in Issue History Always Shows New Value Instead of Old Value |
has duplicate | 0026750 | closed | atrol | multilist and checkbox customfields are listed in history without change |
related to | 0022464 | assigned | dregad | Loose type comparison can prevent custom field update |
I just checked Mantis 2.1.0 and it happens there as well. |
|
Right. The problem is caused by the function that get executed when storing/restoring the values to/from database No time to have a deeper look at the moment. |
|
The root cause is that bug_update.php does not compare old vs new value when building the list of custom fields to update [1]. The problem can be fixed there or in custom field API [2], by adding a comparison between old and new values; the latter is less efficient (we can avoid calling custom_field_set_value() completely, since we already know the values), but would ensure consistent behavior from SOAP API, so maybe we should do both. [1] https://github.com/mantisbt/mantisbt/blob/release-2.1.0/bug_update.php#L307-L308 |
|
@dregad, not sure if you are aware that it works for other custom field types because there is a comparison of old and new value in function history_log_event_direct [1] The comparison fails in this case as we store the values by adding | at the begin and the end)
but compare after removing the |
[1] https://github.com/mantisbt/mantisbt/blob/release-2.1.0/core/history_api.php#L78 EDIT (dregad) use Markdown |
|
@atrol I did not realize that, thanks for pointing me to it. I'll have a look at the logic there. That being said, I think it makes sense to merge the proposed change anyway, as there is no point in executing an UPDATE query when it's not needed. |
|
I think the logic in the call to history_log_event_direct() in custom_field_set_value() is wrong.
So history_log_event_direct() is effectively comparing apples with oranges. |
|
@atrol your feedback on 0022408:0055747 would be appreciated. Do you agree with my analysis ? |
|
I don't have time to have a deeper look and for tests. |
|
I didn't test either, but yes this is what I think |
|
@vboctor, what's your take on 0022408:0055747 ? |
|
Hi, |
|
Hi, i think the correct fix is in the function custom_field_set_value : history_log_event_direct( $c_bug_id, $t_name, custom_field_database_to_value( $row['value'], $t_type ), $p_value ); So was this line in Mantis 1.2.10. So instead of $t_value it has to be $p_value, which is the new not formatted value. |
|
@dregad seems reasonable since it seems to fix the issue :) |
|
Hi! Any update on this issue? from the above history it looks like the PR is there but we're still seeing this issue so are there plans to roll it out? |
|
@sandyj there is a good reason that the PR is not merged, see my comment |
|
In file
can we call a |
|
created a pull request: https://github.com/mantisbt/mantisbt/pull/1514 |
|
still happening in 2.23.0 |
|
and still happening in 2.25.2 |
|