Fix issue in number formatting.

This commit is contained in:
James Cole 2021-07-04 19:19:31 +02:00
parent b94885f8ba
commit 5eca404866
No known key found for this signature in database
GPG Key ID: B5669F9493CDE38D
4 changed files with 24 additions and 23 deletions

View File

@ -72,7 +72,7 @@ interface BudgetLimitRepositoryInterface
public function find(Budget $budget, TransactionCurrency $currency, Carbon $start, Carbon $end): ?BudgetLimit; public function find(Budget $budget, TransactionCurrency $currency, Carbon $start, Carbon $end): ?BudgetLimit;
/** /**
* See reference nr. 11 * See reference nr. 11
* *
* @param Carbon|null $start * @param Carbon|null $start
* @param Carbon|null $end * @param Carbon|null $end

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

@ -38,7 +38,7 @@ use Log;
/** /**
* Trait PeriodOverview. * Trait PeriodOverview.
* *
* See reference nr. 36 * See reference nr. 36
* *
* - Always request start date and end date. * - Always request start date and end date.
* - Group expenses, income, etc. under this period. * - Group expenses, income, etc. under this period.
@ -91,7 +91,7 @@ trait PeriodOverview
$cache->addProperty('account-show-period-entries'); $cache->addProperty('account-show-period-entries');
$cache->addProperty($account->id); $cache->addProperty($account->id);
if ($cache->has()) { if ($cache->has()) {
return $cache->get(); return $cache->get();
} }
/** @var array $dates */ /** @var array $dates */
$dates = app('navigation')->blockPeriods($start, $end, $range); $dates = app('navigation')->blockPeriods($start, $end, $range);
@ -284,7 +284,7 @@ trait PeriodOverview
$cache->addProperty($category->id); $cache->addProperty($category->id);
if ($cache->has()) { if ($cache->has()) {
return $cache->get(); return $cache->get();
} }
/** @var array $dates */ /** @var array $dates */
$dates = app('navigation')->blockPeriods($start, $end, $range); $dates = app('navigation')->blockPeriods($start, $end, $range);
@ -360,7 +360,7 @@ trait PeriodOverview
$cache->addProperty('no-budget-period-entries'); $cache->addProperty('no-budget-period-entries');
if ($cache->has()) { if ($cache->has()) {
return $cache->get(); return $cache->get();
} }
/** @var array $dates */ /** @var array $dates */
@ -392,7 +392,7 @@ trait PeriodOverview
} }
/** /**
* See reference nr. 37 * See reference nr. 37
* *
* Show period overview for no category view. * Show period overview for no category view.
* *
@ -419,7 +419,7 @@ trait PeriodOverview
$cache->addProperty('no-category-period-entries'); $cache->addProperty('no-category-period-entries');
if ($cache->has()) { if ($cache->has()) {
return $cache->get(); return $cache->get();
} }
$dates = app('navigation')->blockPeriods($start, $end, $range); $dates = app('navigation')->blockPeriods($start, $end, $range);
@ -494,7 +494,7 @@ trait PeriodOverview
$cache->addProperty('tag-period-entries'); $cache->addProperty('tag-period-entries');
$cache->addProperty($tag->id); $cache->addProperty($tag->id);
if ($cache->has()) { if ($cache->has()) {
return $cache->get(); return $cache->get();
} }
/** @var array $dates */ /** @var array $dates */
$dates = app('navigation')->blockPeriods($start, $end, $range); $dates = app('navigation')->blockPeriods($start, $end, $range);
@ -568,7 +568,7 @@ trait PeriodOverview
$cache->addProperty('transactions-period-entries'); $cache->addProperty('transactions-period-entries');
$cache->addProperty($transactionType); $cache->addProperty($transactionType);
if ($cache->has()) { if ($cache->has()) {
return $cache->get(); return $cache->get();
} }
/** @var array $dates */ /** @var array $dates */
$dates = app('navigation')->blockPeriods($start, $end, $range); $dates = app('navigation')->blockPeriods($start, $end, $range);

View File

@ -179,10 +179,13 @@ class FireflyValidator extends Validator
'32', '33', '34', '35',]; '32', '33', '34', '35',];
// take // take
$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;
@ -265,7 +268,7 @@ class FireflyValidator extends Validator
$repository = app(BudgetRepositoryInterface::class); $repository = app(BudgetRepositoryInterface::class);
$budgets = $repository->getBudgets(); $budgets = $repository->getBudgets();
// count budgets, should have at least one // count budgets, should have at least one
// See reference nr. 102 // See reference nr. 102
$count = $budgets->filter( $count = $budgets->filter(
function (Budget $budget) use ($value) { function (Budget $budget) use ($value) {
return $budget->name === $value; return $budget->name === $value;
@ -439,7 +442,7 @@ class FireflyValidator extends Validator
*/ */
private function validateAccountAnonymously(): bool private function validateAccountAnonymously(): bool
{ {
if (!array_key_exists('user_id',$this->data)) { if (!array_key_exists('user_id', $this->data)) {
return false; return false;
} }
@ -448,7 +451,7 @@ class FireflyValidator extends Validator
$value = $this->data['name']; $value = $this->data['name'];
$set = $user->accounts()->where('account_type_id', $type->id)->get(); $set = $user->accounts()->where('account_type_id', $type->id)->get();
// See reference nr. 103 // See reference nr. 103
/** @var Account $entry */ /** @var Account $entry */
foreach ($set as $entry) { foreach ($set as $entry) {
if ($entry->name === $value) { if ($entry->name === $value) {
@ -480,7 +483,7 @@ class FireflyValidator extends Validator
$accountTypeIds = $accountTypes->pluck('id')->toArray(); $accountTypeIds = $accountTypes->pluck('id')->toArray();
/** @var Collection $set */ /** @var Collection $set */
$set = auth()->user()->accounts()->whereIn('account_type_id', $accountTypeIds)->where('id', '!=', $ignore)->get(); $set = auth()->user()->accounts()->whereIn('account_type_id', $accountTypeIds)->where('id', '!=', $ignore)->get();
// See reference nr. 104 // See reference nr. 104
/** @var Account $entry */ /** @var Account $entry */
foreach ($set as $entry) { foreach ($set as $entry) {
if ($entry->name === $value) { if ($entry->name === $value) {
@ -504,10 +507,10 @@ class FireflyValidator extends Validator
/** @var Collection $set */ /** @var Collection $set */
$set = auth()->user()->accounts()->where('account_type_id', $type->id)->where('id', '!=', $ignore)->get(); $set = auth()->user()->accounts()->where('account_type_id', $type->id)->where('id', '!=', $ignore)->get();
// See reference nr. 105 // See reference nr. 105
/** @var Account $entry */ /** @var Account $entry */
foreach ($set as $entry) { foreach ($set as $entry) {
// See reference nr. 106 // See reference nr. 106
if ($entry->name === $value) { if ($entry->name === $value) {
return false; return false;
} }
@ -718,7 +721,7 @@ class FireflyValidator extends Validator
* @param mixed $value * @param mixed $value
* @param mixed $parameters * @param mixed $parameters
* *
* See reference nr. 107 * See reference nr. 107
* *
* @return bool * @return bool
*/ */