Page MenuHomeIn-Portal Phabricator

INP-1829 - Add "keep_cents" field option for "kFormatter::Format" method
ClosedPublic

Authored by alex on Sep 29 2022, 11:25 AM.

Details

Test Plan
  1. open the /index.php file for editing
  2. replace $application->Run(); line with below code:
/** @var UsersItem $user */
$user = $application->recallObject('u.test', null, array('skip_autoload' => true));
$user->SetFieldOption('EmailVerified', 'formatter', 'kFormatter');
$user->SetFieldOption('EmailVerified', 'format', '%01.6f');
$user->SetFieldOption('EmailVerified', 'keep_cents', 2);
$user->SetDBField('EmailVerified', '12.345000'); echo $user->GetField('EmailVerified') . '<br/>' . PHP_EOL; // '12.345'
$user->SetDBField('EmailVerified', '12.300000'); echo $user->GetField('EmailVerified') . '<br/>' . PHP_EOL; // '12.30'
$user->SetDBField('EmailVerified', '12.030000'); echo $user->GetField('EmailVerified') . '<br/>' . PHP_EOL; // '12.03'
$user->SetDBField('EmailVerified', '12.030050'); echo $user->GetField('EmailVerified') . '<br/>' . PHP_EOL; // '12.03005'
$user->SetDBField('EmailVerified', '12.000000'); echo $user->GetField('EmailVerified') . '<br/>' . PHP_EOL; // '12.00'
  1. save changes
  2. open the /index.php file from the Web Browser
  3. confirm, that the output contains:
12.345
12.30
12.03
12.03005
12.00

Diff Detail

Repository
rINP In-Portal
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

alex created this revision.Sep 29 2022, 11:25 AM
alex requested review of this revision.Sep 29 2022, 11:25 AM
alex updated this revision to Diff 1100.Sep 29 2022, 11:27 AM

Typo fix in the comment.

alex edited the test plan for this revision. (Show Details)Oct 4 2022, 10:03 AM
alex added a project: Restricted Project.
erik accepted this revision.Oct 6 2022, 5:06 AM
This revision is now accepted and ready to land.Oct 6 2022, 5:06 AM
This revision was landed with ongoing or failed builds.Nov 15 2023, 5:40 AM
This revision was automatically updated to reflect the committed changes.