Enhancement
Fixed precision decimals
Issue description
Currently attribute types of datatype decimal may store any integer or decimal number. It should be possible to refine this further since some attribute types would benefit from a fixed number of decimal places, e.g. in the case of money or weight. The number of decimal places is usually called the precision. In the case of money it could be 2 and for weight in tons 3 would often make sense. When a fixed scale is chosen, the rounding method must be given as well.
Developer comments
This should have various effects in the system, but the main motivation is to relieve the programmer of rounding. Currently the argument of a respective Tobject API call needs to be rounded explicitly.
The forgetful programmer will write:
[%// Never a specific value in production and rarely an approximation of PI.
// But great for illustration:
$total = 3.1415;
// Here is the problem:
$this->set_net($total);
// Value of the attribute will be "3.1415"
// Bad things will happen from now on.%]
Avoiding the problem with explicit rounding:
[%$total = 3.1415;
$this->set_net(round($total, 2));
// value of the attribute will be "3.14"%]
Once this issue is resolved this should suffice:
[%$total = 3.1415;
$this->set_net($total);
// value of the attribute will be "3.14"%]
Trailing zeros should not be persisted in the database.
|
Work sessions
| Start |
2026-11-08T09:43:58
|
| End |
2026-11-08T10:23:45
|
| Participant |
Robert Cerny
|
|
We are sorry
This page cannot be displayed in your browser. Use Firefox, Opera, Safari, or Chrome instead.