Civicase: Wrong Details in Change Custom Data Activity when filling an empty field
Overview
When custom case data is changed in CiviCase a Custom Data Activity is created logging the change in the activity details. This is working well in most circumstances but in some circumstances the change log contains misleading content.
Reproduction steps
- Create custom case field eg. of type text called "Custom text".
- Go to any case and change the data of this field from empty to "short text" (save changes), and then again from "short text" to "short text" (same text, save again).
- View the details of the two Custom Data Activity created.
Current behaviour
When changing the data of a custom text field called "Custom text" from "short text" to "a second short text" it will log: "Custom text: short text => a second short text".
However under the following two conditions this produces misleading logging:
-
When the text field above is empty in the beginning what you get is "Custom text: short text => short text". In practice this behavior may produce misunderstandings as it suggests that "short text" was already there and in use cases like application processes this may make a huge difference.
-
When the text field contains the same string a Custom Data Activity is created with Details empty.
Expected behaviour
-
In the first case one would expect something like "Custom text: [ ] => short text".
-
In the second case probably the best behaviour would be not to create an activity at all and showing an appropriate message instead.
Environment information
- Browser: Firefox 80.0.1
- CiviCRM: 5.28.1 on drupal 7 and 5.28.2 on WordPess 5.5.1