Skip to content

Problem with the price2num() function #36258

@catrielr

Description

@catrielr

Bug

Problem with the price2num() function

Lang configuration (ES_ar)
SeparatorDecimal=,
SeparatorThousand=.

Scale barcode:
2002100002753

Takepos barcode ruler
other:2+ref:4+qu:3+qd:3+other:1

The problem is here:
in the price2mun() function:

			if ($option == 2 && $thousand == '.' && preg_match('/\.(\d\d\d)$/', (string) $amount)) {	// It means the . is used as a thousand separator and string come from input data, so 1.123 is 1123
			$amount = str_replace($thousand, '', $amount);
		}

$amount = 0.275 (this comes from takepos ajax)
$options = 2
$thousand = "."

When it goes through here, it converts $amount to "0275" and then ends up being an integer of 275

Dolibarr Version

No response

Environment PHP

No response

Environment Database

No response

Steps to reproduce the behavior and expected behavior

No response

Attached files

No response

Metadata

Metadata

Assignees

Labels

BugThis is a bug (something does not work as expected)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions