mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-15 16:57:09 +00:00
Fix #10837
This commit is contained in:
@@ -59,7 +59,7 @@ class RecurringEnrichment implements EnrichmentInterface
|
|||||||
private Collection $collection;
|
private Collection $collection;
|
||||||
private array $ids = [];
|
private array $ids = [];
|
||||||
private array $transactionTypeIds = [];
|
private array $transactionTypeIds = [];
|
||||||
private array $transactionTypes = [];
|
//private array $transactionTypes = [];
|
||||||
private array $notes = [];
|
private array $notes = [];
|
||||||
private array $repetitions = [];
|
private array $repetitions = [];
|
||||||
private array $transactions = [];
|
private array $transactions = [];
|
||||||
@@ -131,11 +131,11 @@ class RecurringEnrichment implements EnrichmentInterface
|
|||||||
$this->ids = array_unique($this->ids);
|
$this->ids = array_unique($this->ids);
|
||||||
|
|
||||||
// collect transaction types.
|
// collect transaction types.
|
||||||
$transactionTypes = TransactionType::whereIn('id', array_unique($this->transactionTypeIds))->get();
|
// $transactionTypes = TransactionType::whereIn('id', array_unique($this->transactionTypeIds))->get();
|
||||||
foreach ($transactionTypes as $transactionType) {
|
// foreach ($transactionTypes as $transactionType) {
|
||||||
$id = (int)$transactionType->id;
|
// $id = (int)$transactionType->id;
|
||||||
$this->transactionTypes[$id] = TransactionTypeEnum::from($transactionType->type);
|
// $this->transactionTypes[$id] = TransactionTypeEnum::from($transactionType->type);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
private function collectRepetitions(): void
|
private function collectRepetitions(): void
|
||||||
@@ -400,7 +400,7 @@ class RecurringEnrichment implements EnrichmentInterface
|
|||||||
private function collectTransactionMetaData(): void
|
private function collectTransactionMetaData(): void
|
||||||
{
|
{
|
||||||
$ids = array_keys($this->transactions);
|
$ids = array_keys($this->transactions);
|
||||||
$meta = RecurrenceTransactionMeta::whereIn('rt_id', $ids)->get();
|
$meta = RecurrenceTransactionMeta::whereNull('deleted_at')->whereIn('rt_id', $ids)->get();
|
||||||
// other meta-data to be collected:
|
// other meta-data to be collected:
|
||||||
$billIds = [];
|
$billIds = [];
|
||||||
$piggyBankIds = [];
|
$piggyBankIds = [];
|
||||||
@@ -410,8 +410,14 @@ class RecurringEnrichment implements EnrichmentInterface
|
|||||||
foreach ($meta as $entry) {
|
foreach ($meta as $entry) {
|
||||||
$id = (int)$entry->id;
|
$id = (int)$entry->id;
|
||||||
$transactionId = (int)$entry->rt_id;
|
$transactionId = (int)$entry->rt_id;
|
||||||
$recurrenceId = $this->recurrenceIds[$transactionId];
|
|
||||||
$name = (string)$entry->name;
|
// this should refer to another array, were rtIds can be used to find the recurrence.
|
||||||
|
$recurrenceId = $this->recurrenceIds[$transactionId] ?? 0;
|
||||||
|
$name = (string)$entry->name ?? '';
|
||||||
|
if(0 === $recurrenceId) {
|
||||||
|
Log::error(sprintf('Could not find recurrence ID for recurrence transaction ID %d', $transactionId));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
switch ($name) {
|
switch ($name) {
|
||||||
default:
|
default:
|
||||||
|
Reference in New Issue
Block a user