Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »

In-Portal has developer-friendly code when dealing with number display. For example, while declaring a database column on PHP side developer can:

  • specify the "format" parameter for desired number precision during rounding, e.g. "5.127" will be shown as "5.13" with the "format" field option set to "%01.2f";
  • specify the "cut_zeros" parameter to remove trailing zeros from a number, e.g. "5.10000" will be shown as "5.1" and "5.00000" will be shown as "5".

There uncovered case would be money columns, where a fixed number of decimals places always need to be present (e.g. "5.00" instead of "5") and no rounding should occur on larger precisions, e.g. "5.1230" is shown as "5.123" instead of "5.12".

Solution

Change the "kFormatter::Format" method to support the "keep_cents" field option, which will cut zeros in that number to that (specified in theĀ "keep_cents" field option) number.

Related Tasks

  • No labels