qbwc / qbxml

QBXML Parser and Validation Tool
MIT License
27 stars 41 forks source link

Fix error on float cast when the string to parse has a ',' in it. #12

Closed dan1d closed 8 years ago

dan1d commented 9 years ago

I needed this change because QB was sending a float string with "0,0" rather than "0.0" after using VendorAdd, so when doing Float("0,0") it throws an exception. Let me know if I should add an example or something so you can check your self.

JasonBarnabe commented 9 years ago

So is this a localization issue, where QuickBooks will return the numbers formatted for your language? Which field is being returned like this? Does it also happen for things that run through BIGDECIMAL_CAST?

dan1d commented 9 years ago

I don't think it is a localization issue as I've installed everything on english. The field which I'm getting that error is: balance. The actual error message and stacktrace: An error occured in QBWC::Session: invalid value for Float(): "0,00" /gems/qbxml-0.2.0/lib/qbxml/types.rb:8:in Float /gems/qbxml-0.2.0/lib/qbxml/types.rb:8:in `block in module:Types'

JasonBarnabe commented 9 years ago

According to this, it'll use your system settings. Can you change your system settings and see if the problem goes away?

It's kind of nuts that the API would be affected by this. I would like to be able to handle this, but I'm concerned that your solution may not work for other formats like 1,000.00.

JasonBarnabe commented 8 years ago

We would need a solution that works for all numeric formats.