Bug #17291
closed
eval double2 makes negative double values positive!
Added by Benjamin Bergmann over 17 years ago.
Updated about 6 years ago.
Description
in tca-fields with eval = double2 negative values like -0.18 are changed to the positive value 0.18.
values lower than or equal to -1.0 are stored correctly
(issue imported from #M5595)
Files
My first patch (October 2007) had some side-effects (e.g. entering '-4' would yield '--4.00'). I made a new patch which alters the logic of evalFunc_parseDouble() [instead of changing evalFunc_parseInt() as my first patch did].
After splitting the 'value' (which is then stored in theVal) from the decimals, an if-statement checks if theVal is starting with a minus-sign. If so, it's chopped off the beginning of theVal and the var neg is set to '-'.
The "construction" of the new value is unchanged. However, after this is done, it is multiplied by 100 to check for an actual value (not zero) and neg is prepended. This is a sanity check to prevent '-0.00' as result.
Thus you get this (entered => result):
'' => '0' [because of if (!value) return 0;]
'-' => '0.00'
'-0' => '0.00'
'-.4' => '-0.40'
'-4' => '-4.00'
'.4' => '0.40'
'4' => '4.00'
Ergo: It works as it should without interfering with evalFunc_parseInt().
Hopefully, some of you can thouroughly test it so the patch may find its way into the core. :)
Hey,
you want to send this patch to the core list?
I tried, but the core list is closed to outsiders... :(
What address should I send my patch to?!
Thank you very much. My error was to try to send it to the listfielders-mailing-list directly instead of sending it to the newsgroup.
Feels good to contribute, at last. ;)
Hey Sylvere,
could you please update your patch?
Thanks!
I'll try to do so soon. Sorry, being quite busy at the moment.
- Status changed from New to Needs Feedback
- Target version deleted (
0)
The issue is very old, does this issue exists in newer versions of TYPO3 CMS (4.5 or 6.1)?
I have tested the issue in 4.5 and 6.1 - it does not exist anymore.
The issue can be closed.
Looking at jsfunc.evalfield.js apparently my patch's logic was applied in a more elegant manner, effectively eliminating this bug. I didn't bother to check by whom and when, but it has been done. :)
- Status changed from Needs Feedback to Resolved
- Status changed from Resolved to Closed
Also available in: Atom
PDF