Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update field with yii2 money makes value 100 times less... #23

Closed
Marcuzzz opened this issue Nov 20, 2016 · 5 comments
Closed

Update field with yii2 money makes value 100 times less... #23

Marcuzzz opened this issue Nov 20, 2016 · 5 comments

Comments

@Marcuzzz
Copy link

I've trouble with updating a money value with the money extension.
It is saved correctly on create, also to the database but If I go and do an update, the value €2000,- is shown as: €20,00 instead of €2000,- and saved to the database as €20,00
How to correct this behaviour?

@ilbassa
Copy link

ilbassa commented Nov 24, 2016

Maybe there is a problem with the decimal separator?
I have resolved adding these lines in renderInput()
$this->value=str_replace(',', '.', $this->value);
$this->options=array_merge($this->options,['value'=>$this->value]);

@Marcuzzz
Copy link
Author

Yes could be.
What do you mean by renderInput...
I don't have "$this" I have a $model...

$this->value=str_replace(',', '.', $this->value);
$this->options=array_merge($this->options,['value'=>$this->value]);


<?= $form->field($model, 'PriceBuyout')->widget(MaskMoney::classname(), [
    'pluginOptions' => [
        'prefix' => '€ ',
        'suffix' => ' ,-',
        'allowNegative' => false
    ]
    ]);
 ?>

@ilbassa
Copy link

ilbassa commented Nov 28, 2016

I changed the core file MaskMoney.php which has renderInput().

@Marcuzzz
Copy link
Author

Marcuzzz commented Nov 29, 2016

if noticed when I comment out :
// suffix' => ' ,-',
It does work as expected...

@kartik-v
Copy link
Owner

Resolved via updates & enhancements to release v1.2.2. Duplicate to #26, #22, #16, #9.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants