sruupl / batflat

Lightweight, fast and easy CMS for free. Bootstrap ready. https://batflat.org
MIT License
134 stars 54 forks source link

Module inputs rounding down decimal values #31

Closed timplumb closed 5 years ago

timplumb commented 5 years ago

I've been looking at creating a simple module for BatFlat and have been struggling with this issue for the last day or so. If I add a decimal figure to a module input (20.99 for example) the figure is rounded down to the nearest integer (20 in this case). I thought this was an issue with my code but all of the standard modules in the CMS also do the same thing. For example if you add a gallery image caption 99.22 then you'll get just 99. What inside BatFlat is causing this to happen?

michu2k commented 5 years ago

Hi This issue happens, when PDO executes a new query, because of this: PDO::PARAM_INT. It's changing every number to int. This is a potential fix for this bug:

inc/core/lib/QueryBuilder.php line 877 bez nazwy-1

I'm not a PHP specialist, so @klocus take a look 😄

timplumb commented 5 years ago

Fantastic. That worked perfectly @michu2k. Many thanks. How do I go about getting this issue logged or fixed in the core CMS?

klocus commented 5 years ago

You can change QueryBuilder.php like @michu2k said. Or you can add HTML tag to your number, ex. <span>99.22</span> ;-)

EDIT: Fixed.