Fix issue in number formatting.

This commit is contained in:
James Cole
2021-07-04 19:19:31 +02:00
parent b94885f8ba
commit 5eca404866
4 changed files with 24 additions and 23 deletions

View File

@@ -34,8 +34,6 @@ use Throwable;
* Class CurrencyForm * Class CurrencyForm
* *
* All currency related form methods. * All currency related form methods.
*
* See reference nr. 22
*/ */
class CurrencyForm class CurrencyForm
{ {
@@ -61,7 +59,7 @@ class CurrencyForm
* *
* @return string * @return string
*/ */
protected function currencyField(string $name, string $view, $value = null, array $options = null): string protected function currencyField(string $name, string $view, mixed $value = null, array $options = null): string
{ {
$label = $this->label($name, $options); $label = $this->label($name, $options);
$options = $this->expandOptionArray($name, $label, $options); $options = $this->expandOptionArray($name, $label, $options);

View File

@@ -182,7 +182,10 @@ class FireflyValidator extends Validator
$first = substr($value, 0, 4); $first = substr($value, 0, 4);
$last = substr($value, 4); $last = substr($value, 4);
$iban = $last . $first; $iban = $last . $first;
$iban = str_replace($search, $replace, $iban); $iban = trim(str_replace($search, $replace, $iban));
if (0 === strlen($iban)) {
return false;
}
$checksum = bcmod($iban, '97'); $checksum = bcmod($iban, '97');
return 1 === (int)$checksum; return 1 === (int)$checksum;