Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: extrafields type double wrong length #11331

Closed
fbosman opened this issue Jun 13, 2019 · 0 comments · Fixed by #11420
Closed

Bug: extrafields type double wrong length #11331

fbosman opened this issue Jun 13, 2019 · 0 comments · Fixed by #11420

Comments

@fbosman
Copy link
Contributor

fbosman commented Jun 13, 2019

Bug

Extrafields with type float need specific number of decimals. The system always imposes 24,8 as length and always shows 2 decimals.

Environment

  • Version: 9.04
  • OS: ubuntu
  • Web server: apache
  • PHP: 7.x
  • Database: mariadb
  • URL(s): [Affected URL(s)]

Expected and actual behavior

Extrafields with type float need specific number of decimals. The system always imposes 24,8 as length and always shows 2 decimals.

Suggested implementation

I did get it to work somehow:

In module core/actions_extrafields_inc.php

alter line 30: $extrasize=GETPOST('size','int');
to
$extrasize=GETPOST('size','intcomma');
otherwise a float will always have length 24,8

in module core/class/extrafields.class.php:
alter line 1543:
if (!empty($value)) {
$value=price($value);

to
if (!empty($value)) {
// $value=price($value);
$sizeparts = explode(",",$size);
$number_decimals = $sizeparts[1];
$value=price($value, 0, $langs, 0, 0, $number_decimals, '');

Suggested steps

I'm not very good in php, hope this is right and can be merged into the core.

@fbosman fbosman changed the title extrafields type double wrong length BUG: extrafields type double wrong length Jun 13, 2019
@fbosman fbosman changed the title BUG: extrafields type double wrong length Bug: extrafields type double wrong length Jun 13, 2019
eldy added a commit that referenced this issue Jun 28, 2019
Fix #11331 Bug: extrafields type double wrong length
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant