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

Bug: can't update currency rate #7148

Closed
dolibarr95 opened this issue Jul 13, 2017 · 0 comments
Closed

Bug: can't update currency rate #7148

dolibarr95 opened this issue Jul 13, 2017 · 0 comments

Comments

@dolibarr95
Copy link
Contributor

dolibarr95 commented Jul 13, 2017

Bug

Can't update the rate of a currency

Environment

  • Version: 5.0.0
  • OS: Linux otos.planethoster.net
  • Web server: LiteSpeed
  • PHP: 5.6.28
  • Database: MySQL or MariaDB 10.1.19-MariaDB
  • URL(s): admin/multicurrency.php

Expected and actual behavior

I think the bug come from the variable $rate called with the GETPOST function. Because when i read it in core/lib/functions.lib.php there is no 'float' case.

elseif ($action == 'update_currency')
{
	$submit = GETPOST('submit', 'alpha');
	
	if ($submit == $langs->trans('Modify'))
	{
		$fk_multicurrency = GETPOST('fk_multicurrency', 'int');
		$rate = GETPOST('rate', 'float');
		$currency = new MultiCurrency($db);
		
		if ($currency->fetch($fk_multicurrency) > 0)
		{
			$currency->updateRate($rate);
		}	
	}
	elseif ($submit == $langs->trans('Delete'))
	{
		$fk_multicurrency = GETPOST('fk_multicurrency', 'int');
		$currency = new MultiCurrency($db);
		
		if ($currency->fetch($fk_multicurrency) > 0)
		{
			if ($currency->delete() > 0) setEventMessages($langs->trans('RecordDeleted'), array());
			else setEventMessages($langs->trans('ErrorDeleteCurrencyFail'), array(), 'errors');
		}
	}
}

Steps to reproduce the behavior

Dolibarr runs with EUR
Activate the multicurrency module
Create a new currency USD
Update the USD rate

tks for reading!

dolibarr95 added a commit to dolibarr95/dolibarr that referenced this issue Jul 13, 2017
Add a case to check 'float' with is_float() to fix Dolibarr#7148
@eldy eldy closed this as completed in 278bcfa Sep 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant