Invoices have started miscalculating on save in version 5.56.0, rounding down quantities
Overview
Please describe your problem or bug in detail. Since version 5.56.0 (or possibly a slightly earlier version) my generated invoices have started to calculate incorrectly. The item quantities are rounded down to integers. Fractional quantities can still be entered and the Total Value looks correct until the Save button is pressed, at which point the total value of the invoice becomes incorrect (lower than expected). It appears that all item quantities are now being rounded down to integers.
If you have already posted on https://civicrm.stackexchange.com or https://chat.civicrm.org, please include the link to that conversation.
Reproduction steps
- In CiviContribute Component Settings check Enable Tax and Invoicing. Create a price set in CiviContribute > Manage Price Sets and add a price field of type Text / Numeric Quantity. Give it a value.
- Go to the Contributions tab for any individual and click Record Contribution. Select the price set and field created in the previous step, and add a non-integer value (e.g. 1.5). Press TAB. Observe that the Total Amount is calculated correctly.
- Click the Save button. Observe that the total amount is now incorrect. Click the View link and observe that the item quantity has been rounded down to an integer.
Current behaviour
What happens currently. Please provide error messages, screenshots or gifs (LICEcap, SilentCast) where appropriate. Item quantities in invoices are rounded down to integers when the "Save" button for a new contribution is pressed (but are allowed and calculated correctly up to that point).
TIP: The best way to convey an error message is to copy it in here and use
three backtick ` symbols. You may edit the message to remove private
information (like passwords). The backticks will help to preserve any
special characters or spaces.
Expected behaviour
What should happen. Fractional item quantities allowed, as they were in previous versions. If they have been deliberately removed (why?), the restriction should be flagged earlier, rather than quietly recalculating after the invoice disappears from the screen.
Environment information
- Browser: Chrome 108.0.5359.125
- CiviCRM: 5.56.0
- PHP: 8.0_
- CMS: WordPress 6.1.1
- Database: MariaDB version 10.4.27
- Web Server: Apache version 2.4.54
Comments
Anything else you would like the reviewer to note.