Body: <p>My civicrm instance has been running for a few years now. Since a couple of weeks ago I cannot add contributions anymore if their total amount contains decimal points. Due to my German locales I use the comma characters as a decimal delimiter.</p>
  <p>Adding a contribution of 20,00 Euros works fine.<br/>
  Adding a contribution of 20,99 Euros does not work.</p>
  <p><strong>When adding contributions over the standard civi frontend</strong><br/>
  If a add a contribution of 20,99 over the standard gui and click &quot;save&quot;, then the hourglass appears and will never disappear. Nothing else happens. Nothing gets written to the db and no php or javascript errors get reported.</p>
  <p><strong>When adding contributions over API v3</strong><br/>
  My API Call (PHP Style):</p>
  <pre><code>$result = civicrm_api3('Contribution', 'create', [
        'financial_type_id' =&gt; &quot;Spende&quot;,
        'receive_date' =&gt; &quot;2022-03-20&quot;,
        'total_amount' =&gt; &quot;20,99&quot;,
        'contact_id' =&gt; 399,
      ]);
  </code></pre>
  <p>After exection an error message appears: &quot;DB Error: value count on row&quot;. Nothing is written to the database. The underlying sql:</p>
  <pre><code>INSERT INTO `civicrm_contribution` (`contact_id` , `financial_type_id` , `payment_instrument_id` , 
  `receive_date` , `total_amount` , `fee_amount` , `net_amount` , 
  `currency` , `contribution_status_id` , `check_number` , `tax_amount` ) 
  VALUES ( 399 ,  1 ,  5 ,  20220320000000 ,  20.99 ,  0 ,  20,99 , 'EUR' ,  1 ,  
  NULL ,  0 );
  </code></pre>
  <p>The SQL error is fairly obvious: the value of net_amount is basically a copy of total_amount. But while total_amount has been correctly formatted to &quot;20.99&quot; in the sql, the value of net_amount has been formatted as &quot;20,99&quot;, so the comma is interpreted as an sql value delimiter. But why is a wrong formatting used?</p>
  <p><strong>When adding contributions over API v4</strong><br/>
  The call</p>
  <pre><code>$results = civicrm_api4('Contribution', 'create', [
    'values' =&gt; [
      'contact_id' =&gt; 399, 
      'financial_type_id' =&gt; 1, 
      'receive_date' =&gt; '2022-03-01', 
      'total_amount' =&gt; '20,99',
    ],
  ]);
  </code></pre>
  <p>results in a warning: &quot;Formatting non-numeric values is no longer supported: 20,99 Caller: CRM_Utils_Money::format&quot;. The contribution is written to the db - but as &quot;20.00&quot;, so the 99 Cents are missing.</p>
  <p><strong>Localization and system setup</strong></p>
  <ul>
  <li>CiviCrm 5.47.2<br/>as a wordpress plugin<br/>Formatting locale: Deutsch (German)<br/>Thousands Separator: .<br/>Decimal Delimiter: ,</li>
  <li>Plugin for Wordpress 5.8.3<br/>language: German</li>
  <li>Php 7.4<br/></li>
  <li>Nginx 1.14</li>
  <li>ubuntu 18.04<br/>set to de_DE.UTF-8</li>
  </ul>
  <p>Any advice on how to fix this would be greatly appreciated!</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-03-20T17:58:28.650Z
Comments.Text: Welcome to SE! You have provided a lot of detail, but you say the problem started a couple of weeks ago, so something must have changed at that time (perhap something upgraded) if it was working correctly before then. I'd explore that as the next step in diagnosis.
Comments.UserDisplayName: Mick Kahn
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-03-20T19:31:31.127Z
Comments.Text: The problem is with net_amount which is not formatted correctly. Could you check your localization setting?
Comments.UserDisplayName: Pradeep Nayak
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-03-22T20:12:49.580Z
Comments.Text: Thank you both!
  Mick Kahn: I ran several updates on wordpress and civicrm, but I made no changes to the ubuntu/nginx/php settings.
  @Pradeep Nayak: I am not sure I get your question right. I set both Wordpress and CiviCRM to German. In a standalone-php-script (run outside Wordpress), locale_get_default() leads to "de_DE.utf-8". However localeconv() leads to decimal_point: "." and mon_decimal_point: "".
Comments.UserDisplayName: Steve
Tags: <civicontribute><localisation>
Title: I cannot create a contribution with amounts with decimal points. Does anyone know how to fix this?
ThreadText: # I cannot create a contribution with amounts with decimal points. Does anyone know how to fix this?
  
  (Asked by: username_0 on 2022-03-20)
  
  My civicrm instance has been running for a few years now. Since a couple of weeks ago I cannot add contributions anymore if their total amount contains decimal points. Due to my German locales I use the comma characters as a decimal delimiter.
  
  Adding a contribution of 20,00 Euros works fine.  
  Adding a contribution of 20,99 Euros does not work.
  
  **When adding contributions over the standard civi frontend**  
  If a add a contribution of 20,99 over the standard gui and click "save", then the hourglass appears and will never disappear. Nothing else happens. Nothing gets written to the db and no php or javascript errors get reported.
  
  **When adding contributions over API v3**  
  My API Call (PHP Style):
  
  ```
  $result = civicrm_api3('Contribution', 'create', [
        'financial_type_id' => "Spende",
        'receive_date' => "2022-03-20",
        'total_amount' => "20,99",
        'contact_id' => 399,
      ]);
  
  ```
  
  After exection an error message appears: "DB Error: value count on row". Nothing is written to the database. The underlying sql:
  
  ```
  INSERT INTO `civicrm_contribution` (`contact_id` , `financial_type_id` , `payment_instrument_id` , 
  `receive_date` , `total_amount` , `fee_amount` , `net_amount` , 
  `currency` , `contribution_status_id` , `check_number` , `tax_amount` ) 
  VALUES ( 399 ,  1 ,  5 ,  20220320000000 ,  20.99 ,  0 ,  20,99 , 'EUR' ,  1 ,  
  NULL ,  0 );
  
  ```
  
  The SQL error is fairly obvious: the value of net\_amount is basically a copy of total\_amount. But while total\_amount has been correctly formatted to "20.99" in the sql, the value of net\_amount has been formatted as "20,99", so the comma is interpreted as an sql value delimiter. But why is a wrong formatting used?
  
  **When adding contributions over API v4**  
  The call
  
  ```
  $results = civicrm_api4('Contribution', 'create', [
    'values' => [
      'contact_id' => 399, 
      'financial_type_id' => 1, 
      'receive_date' => '2022-03-01', 
      'total_amount' => '20,99',
    ],
  ]);
  
  ```
  
  results in a warning: "Formatting non-numeric values is no longer supported: 20,99 Caller: CRM\_Utils\_Money::format". The contribution is written to the db - but as "20.00", so the 99 Cents are missing.
  
  **Localization and system setup**
  
  * CiviCrm 5.47.2  
    as a wordpress plugin  
    Formatting locale: Deutsch (German)  
    Thousands Separator: .  
    Decimal Delimiter: ,
  * Plugin for Wordpress 5.8.3  
    language: German
  * Php 7.4
  * Nginx 1.14
  * ubuntu 18.04  
    set to de\_DE.UTF-8
  
  Any advice on how to fix this would be greatly appreciated!
  
  **Tags:** civicontribute, localisation
  
  > **Comments:**
  > **username_1**: Welcome to SE! You have provided a lot of detail, but you say the problem started a couple of weeks ago, so something must have changed at that time (perhap something upgraded) if it was working correctly before then. I'd explore that as the next step in diagnosis.  
  > **username_2**: The problem is with net_amount which is not formatted correctly. Could you check your localization setting?  
  > **username_0**: Thank you both! username_1 username_1: I ran several updates on wordpress and civicrm, but I made no changes to the ubuntu/nginx/php settings. @username_2: I am not sure I get your question right. I set both Wordpress and CiviCRM to German. In a standalone-php-script (run outside Wordpress), locale_get_default() leads to "de_DE.utf-8". However localeconv() leads to decimal_point: "." and mon_decimal_point: "".  
  
  ---
  
  ## 0 answers
  
  