<div dir="ltr">Hi,<div><br></div><div>I have a question regarding weird behaviour of currency field value after save.</div><div><br></div><div>In our CMR we have thousand separator as "." and decimal separator as ",".</div>
<div><br></div><div>When creating or editing record I use CRMEntity class. I have added to Potentials "saldo" with currency field type.</div><div><br></div><div>When creating or editing Potential i have to convert normal float value to user displayed type (for example not 1000.00 but 1.000,00). I use for that function from Currency Field:</div>
<div><br></div><div>CurrencyField::convertToUserFormat( $money );<br></div><div><br></div><div>If I won't use that function the value will be obscured for example from 1000.00 it will remove the decimal separator as unknown character (in settings we have coma as decimal separator) making it 100000 . 00.</div>
<div><br></div><div>When Im creating or editing object and I add or change this value it's no problem - I remember to use mentioned function.</div><div><br></div><div>But later when for example im editing one field from Potentials and save the object, my "saldo" field is changed. It's as if the object gets the value from db (normal float value) and when saving it wants the value formated with dot as thousand separator and coma as decimal separator. It finds always just float value and so everytime I edit the object the currency field value is changed.</div>
<div><br></div><div>To fix it, when Im editing object I have to remember to reassign currency field value with formatted value, for example:</div><div><br></div><div>$object->column_fields['saldo'] = CurrencyField::convertToUserFormat( $object->column_fields['saldo'] );</div>
<div><br></div><div>I think that object should detect itself if the value isn't formatted correctly or if its normal float and convert it properly. Because it's pointless to reassign currency field value everytime I'm editing object even if the value doesnt change...</div>
<div><br clear="all"><div><div dir="ltr"><div style="color:rgb(136,136,136)"><b style="color:rgb(34,34,34)">Z poważaniem / <span style="font-size:10pt">Best regards</span></b><br></div><div style="color:rgb(136,136,136)">
<b style="color:rgb(34,34,34)"><span style="font-size:10pt"><br></span></b></div><div style="color:rgb(136,136,136)"><b>Maciej Stencel</b></div><div style="color:rgb(136,136,136)"><b>Tel: <a value="+48884998123" style="color:rgb(17,85,204)">+48 884-997-123</a></b></div>
<div style="color:rgb(136,136,136)"><b><a href="mailto:m.stencel@opensaas.pl" style="color:rgb(17,85,204)" target="_blank">m.stencel@opensaas.pl</a><br><font color="#888888"><span style="color:rgb(127,127,127)"></span></font><font color="#888888"><span style="color:rgb(127,127,127)"><a href="http://www.opensaas.pl/" style="color:rgb(17,85,204)" target="_blank">www.OpenSaaS.pl</a></span></font></b></div>
</div></div>
</div></div>