Content
View differences
Updated by Parimal Satyal about 1 year ago
### Steps to reproduce
1. Go to /admin/costs
2. For the currency format, remove %n, enter, for instance, only `€`
<img class="op-uc-image op-uc-image_inline" src="/api/v3/attachments/436465/content">
### What is the buggy behavior?
* it's possible to not include %n - which is the actual value - in the format string
* this also breaks the frontend which then fails to render any work packages at all
```text
Uncaught TypeError: Cannot read properties of null (reading '0')
at CurrencyDisplayField.isEmpty (currency-display-field.module.ts:35:42)
at DisplayFieldRenderer.getText (display-field-renderer.ts:115:15)
at DisplayFieldRenderer.renderFieldValue (display-field-renderer.ts:79:29)
at DisplayFieldRenderer.render (display-field-renderer.ts:50:32)
at CellBuilder.render (cell-builder.ts:69:47)
at CellBuilder.build (cell-builder.ts:53:10)
at SingleHierarchyRowBuilder.buildCell (single-row-builder.ts:122:33)
at single-row-builder.ts:237:21 at Array.forEach (<anonymous>)
at SingleHierarchyRowBuilder.buildEmptyRow (single-row-builder.ts:229:27)
```
### What is the expected behavior?
* Add field validation so at least 1. it should not be allowed to not include `%n` in the `%n` must be present format string
* The Format 2. the field has a link to documentation that helps users understand the use of labels should also mention and explain both `%n` and `%u`
* "Eg. n%u%, where %n represents the number and %u the unit."
### Environment information
**OpenProject version**
_v15.5.0_
1. Go to /admin/costs
2. For the currency format, remove %n, enter, for instance, only `€`
<img class="op-uc-image op-uc-image_inline" src="/api/v3/attachments/436465/content">
### What is the buggy behavior?
* it's possible to not include %n - which is the actual value - in the format string
* this also breaks the frontend which then fails to render any work packages at all
```text
Uncaught TypeError: Cannot read properties of null (reading '0')
at CurrencyDisplayField.isEmpty (currency-display-field.module.ts:35:42)
at DisplayFieldRenderer.getText (display-field-renderer.ts:115:15)
at DisplayFieldRenderer.renderFieldValue (display-field-renderer.ts:79:29)
at DisplayFieldRenderer.render (display-field-renderer.ts:50:32)
at CellBuilder.render (cell-builder.ts:69:47)
at CellBuilder.build (cell-builder.ts:53:10)
at SingleHierarchyRowBuilder.buildCell (single-row-builder.ts:122:33)
at single-row-builder.ts:237:21 at Array.forEach (<anonymous>)
at SingleHierarchyRowBuilder.buildEmptyRow (single-row-builder.ts:229:27)
```
### What is the expected behavior?
* Add field validation so at least
* The Format
* "Eg. n%u%, where %n represents the number and %u the unit."
**OpenProject version**
_v15.5.0_