mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Fixed level 7!
This commit is contained in:
parent
23178614d5
commit
1aa8ebe57f
@ -18,6 +18,9 @@ parameters:
|
||||
- identifier: varTag.type
|
||||
- identifier: missingType.iterableValue # not interesting enough to fix.
|
||||
- identifier: missingType.generics # not interesting enough to fix.
|
||||
- "#Parameter \\#[1-2] \\$num[1-2] of function bc[a-z]+ expects numeric-string, [a-z\\-|&]+ given#"
|
||||
- '#expects view-string, string given#'
|
||||
- '#expects view-string\|null, string given#'
|
||||
|
||||
# phpstan can't handle this so we ignore them.
|
||||
- '#Call to an undefined method Illuminate\\Database\\Eloquent\\Relations\\HasMany::before#'
|
||||
@ -71,5 +74,5 @@ parameters:
|
||||
|
||||
# The level 8 is the highest level. original was 5
|
||||
# 7 is more than enough, higher just leaves NULL things.
|
||||
level: 6
|
||||
level: 7
|
||||
|
||||
|
@ -252,7 +252,12 @@ trait AccountCollection
|
||||
return false;
|
||||
}
|
||||
// in theory, this could lead to finding other users accounts.
|
||||
$balance = Steam::finalAccountBalance(Account::find($accountId), $transaction['date']);
|
||||
/** @var Account|null $account */
|
||||
$account = Account::find($accountId);
|
||||
if(null === $account) {
|
||||
continue;
|
||||
}
|
||||
$balance = Steam::finalAccountBalance($account, $transaction['date']);
|
||||
$result = bccomp($balance['balance'], $value);
|
||||
Log::debug(sprintf('"%s" vs "%s" is %d', $balance['balance'], $value, $result));
|
||||
|
||||
|
@ -118,7 +118,7 @@ class ShowController extends Controller
|
||||
|
||||
if (null !== $array['nr_of_repetitions']) {
|
||||
$left = $array['nr_of_repetitions'] - $array['journal_count'];
|
||||
$left = max(0, $left);
|
||||
$left = (int) max(0, $left);
|
||||
// limit each repetition to X occurrences:
|
||||
foreach ($array['repetitions'] as $index => $repetition) {
|
||||
$array['repetitions'][$index]['occurrences'] = array_slice($repetition['occurrences'], 0, $left);
|
||||
|
@ -33,6 +33,7 @@ use FireflyIII\Models\AccountMeta;
|
||||
use FireflyIII\Models\AccountType;
|
||||
use FireflyIII\Models\Attachment;
|
||||
use FireflyIII\Models\Location;
|
||||
use FireflyIII\Models\Transaction;
|
||||
use FireflyIII\Models\TransactionCurrency;
|
||||
use FireflyIII\Models\TransactionGroup;
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
@ -523,6 +524,7 @@ class AccountRepository implements AccountRepositoryInterface
|
||||
->first(['transaction_journals.id'])
|
||||
;
|
||||
if (null !== $first) {
|
||||
/** @var TransactionJournal|null */
|
||||
return TransactionJournal::find($first->id);
|
||||
}
|
||||
|
||||
|
@ -91,6 +91,7 @@ class AccountDestroyService
|
||||
$transaction->delete();
|
||||
$ibAccount->delete();
|
||||
}
|
||||
/** @var TransactionJournal|null $journal */
|
||||
$journal = TransactionJournal::find($journalId);
|
||||
if (null !== $journal) {
|
||||
/** @var JournalDestroyService $service */
|
||||
|
@ -50,6 +50,7 @@ class CurrencyForm
|
||||
|
||||
/**
|
||||
* @throws FireflyException
|
||||
* @phpstan-param view-string $view
|
||||
*/
|
||||
protected function currencyField(string $name, string $view, mixed $value = null, ?array $options = null): string
|
||||
{
|
||||
|
@ -129,6 +129,7 @@ class Steam
|
||||
|
||||
// find currency of this entry.
|
||||
$currencies[$entry->transaction_currency_id] ??= TransactionCurrency::find($entry->transaction_currency_id);
|
||||
/** @var TransactionCurrency $entryCurrency */
|
||||
$entryCurrency = $currencies[$entry->transaction_currency_id];
|
||||
|
||||
Log::debug(sprintf('Processing transaction(s) on date %s', $carbon->format('Y-m-d H:i:s')));
|
||||
|
@ -57,6 +57,7 @@ class BillTransformer extends AbstractTransformer
|
||||
*/
|
||||
public function collectMetaData(Collection $objects): Collection
|
||||
{
|
||||
/** @var array<int, TransactionCurrency> $currencies */
|
||||
$currencies = [];
|
||||
$bills = [];
|
||||
$this->notes = [];
|
||||
@ -140,25 +141,25 @@ class BillTransformer extends AbstractTransformer
|
||||
app('log')->debug(sprintf('Foreign currency is #%d', $transaction['foreign_currency_id']));
|
||||
$foreignCurrencyId = (int) $transaction['foreign_currency_id'];
|
||||
$currencies[$foreignCurrencyId] ??= TransactionCurrency::find($foreignCurrencyId);
|
||||
$foreignCurrencyCode = $currencies[$foreignCurrencyId]->code;
|
||||
$foreignCurrencyName = $currencies[$foreignCurrencyId]->name;
|
||||
$foreignCurrencySymbol = $currencies[$foreignCurrencyId]->symbol;
|
||||
$foreignCurrencyDp = $currencies[$foreignCurrencyId]->decimal_places;
|
||||
$foreignCurrencyCode = $currencies[$foreignCurrencyId]->code; // @phpstan-ignore property.notFound
|
||||
$foreignCurrencyName = $currencies[$foreignCurrencyId]->name; // @phpstan-ignore property.notFound
|
||||
$foreignCurrencySymbol = $currencies[$foreignCurrencyId]->symbol; // @phpstan-ignore property.notFound
|
||||
$foreignCurrencyDp = $currencies[$foreignCurrencyId]->decimal_places; // @phpstan-ignore property.notFound
|
||||
}
|
||||
|
||||
$this->paidDates[$billId][] = [
|
||||
'transaction_group_id' => (string) $journal->id,
|
||||
'transaction_journal_id' => (string) $journal->transaction_group_id,
|
||||
'date' => $journal->date->toAtomString(),
|
||||
'currency_id' => $currencies[$currencyId]->id,
|
||||
'currency_code' => $currencies[$currencyId]->code,
|
||||
'currency_name' => $currencies[$currencyId]->name,
|
||||
'currency_symbol' => $currencies[$currencyId]->symbol,
|
||||
'currency_decimal_places' => $currencies[$currencyId]->decimal_places,
|
||||
'native_currency_id' => $currencies[$currencyId]->id,
|
||||
'native_currency_code' => $currencies[$currencyId]->code,
|
||||
'native_currency_symbol' => $currencies[$currencyId]->symbol,
|
||||
'native_currency_decimal_places' => $currencies[$currencyId]->decimal_places,
|
||||
'currency_id' => $currencies[$currencyId]->id, // @phpstan-ignore property.notFound
|
||||
'currency_code' => $currencies[$currencyId]->code, // @phpstan-ignore property.notFound
|
||||
'currency_name' => $currencies[$currencyId]->name, // @phpstan-ignore property.notFound
|
||||
'currency_symbol' => $currencies[$currencyId]->symbol, // @phpstan-ignore property.notFound
|
||||
'currency_decimal_places' => $currencies[$currencyId]->decimal_places, // @phpstan-ignore property.notFound
|
||||
'native_currency_id' => $currencies[$currencyId]->id, // @phpstan-ignore property.notFound
|
||||
'native_currency_code' => $currencies[$currencyId]->code, // @phpstan-ignore property.notFound
|
||||
'native_currency_symbol' => $currencies[$currencyId]->symbol, // @phpstan-ignore property.notFound
|
||||
'native_currency_decimal_places' => $currencies[$currencyId]->decimal_places, // @phpstan-ignore property.notFound
|
||||
'foreign_currency_id' => $foreignCurrencyId,
|
||||
'foreign_currency_code' => $foreignCurrencyCode,
|
||||
'foreign_currency_name' => $foreignCurrencyName,
|
||||
@ -166,13 +167,8 @@ class BillTransformer extends AbstractTransformer
|
||||
'foreign_currency_decimal_places' => $foreignCurrencyDp,
|
||||
'amount' => $transaction['amount'],
|
||||
'foreign_amount' => $transaction['foreign_amount'],
|
||||
'native_amount' => $this->converter->convert($currencies[$currencyId], $this->default, $journal->date, $transaction['amount']),
|
||||
'foreign_native_amount' => '' === (string) $transaction['foreign_amount'] ? null : $this->converter->convert(
|
||||
$currencies[$foreignCurrencyId],
|
||||
$this->default,
|
||||
$journal->date,
|
||||
$transaction['foreign_amount']
|
||||
),
|
||||
'native_amount' => null,
|
||||
'foreign_native_amount' => null,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user