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