#40619·dolibarr

Project/Lead: default opportunity probability is 100x too high when changing the opportunity status

Author: glu000Created Sep 20, 2026Updated Sep 20, 2026

Bug

On the project/lead card, changing the Opportunity status fills the probability field with a value that is 100 times too high (e.g. 10000 instead of 100 for status WON). The "Previous value" hint shown next to the field is wrong in the same way (7500 % instead of 75 %).

This only happens in languages where SeparatorThousand is . — currently da_DK, ca_ES, de_DE, de_AT, el_GR, es_CL, es_CO, es_EC, es_ES, hr_HR, gl_ES, lo_LA, tr_TR. In en_US the value happens to survive, which is why this is not visible in the default language.

The wrong value is not only cosmetic: it is submitted on save, and llx_projet.opp_percent is double(5,2) (max 999.99), so the value gets truncated or rejected depending on sql_mode.

Cause

htdocs/projet/card.php runs the percent values through price2numjs():

javascript
jQuery("#opp_percent").val(price2numjs(defaultpercent));
jQuery("#oldopppercent").text(' - PreviousValue: '+price2numjs(oldpercent)+' %');

But both values are raw DB values that are already in universal numeric format:

  • defaultpercent is the defaultpercent attribute written by FormProjets::selectOpportunityStatus() (htdocs/core/class/html.formprojet.class.php) straight from llx_c_lead_status.percent, column type double(5,2) → the string "100.00".
  • oldpercent is $object->opp_percent from llx_projet.opp_percent, also double(5,2) → the string "75.00".

price2numjs() (htdocs/core/js/lib_head.js.php) expects a localized number and strips the thousand separator first:

javascript
amount = amount.replace(thousand, '');        // "." in de_DE
amount = amount.replace(dec, '.');            // "," in de_DE

So "100.00" becomes "10000" and "75.00" becomes "7500".

The same raw value is also assigned unconverted in two places (creation form and the oldpercent branch), which puts 100.00 / 75.00 into the field instead of 100 / 75.

Dolibarr Version

23.0.4 (code is identical in develop)

Environment PHP

8.1

Environment Database

MySQL 8.4.9

Steps to reproduce the behavior and expected behavior

  1. Enable the Projects module with opportunities (PROJECT_USE_OPPORTUNITIES).
  2. Set the user language to German (de_DE) or any other language listed above.
  3. Open a lead whose current opportunity status has a probability of 75 % and click Modify.
  4. Change Opportunity status to Won (probability 100 % in the dictionary).

Expected: the probability field shows 100, the hint next to it shows - Previous value: 75 %.

Actual: the probability field shows 10000, the hint shows - Previous value: 7500 %.