mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-25 13:10:35 +00:00
Fix #4774
This commit is contained in:
@@ -264,6 +264,9 @@ trait RecurringTransactionTrait
|
||||
$categoryFactory->setUser($transaction->recurrence->user);
|
||||
$category = $categoryFactory->findOrCreate($categoryId, null);
|
||||
if (null === $category) {
|
||||
// remove category:
|
||||
$transaction->recurrenceTransactionMeta()->where('name', 'category_id')->delete();
|
||||
$transaction->recurrenceTransactionMeta()->where('name', 'category_name')->delete();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -286,9 +286,17 @@ class RecurrenceUpdateService
|
||||
if (array_key_exists('budget_id', $current)) {
|
||||
$this->setBudget($match, (int)$current['budget_id']);
|
||||
}
|
||||
// reset category if name is set but empty:
|
||||
// can be removed when v1 is retired.
|
||||
if (array_key_exists('category_name', $current) && '' === (string)$current['category_name']) {
|
||||
$current['category_name'] = null;
|
||||
$current['category_id'] = 0;
|
||||
}
|
||||
|
||||
if (array_key_exists('category_id', $current)) {
|
||||
$this->setCategory($match, (int)$current['category_id']);
|
||||
}
|
||||
|
||||
if (array_key_exists('tags', $current)) {
|
||||
$this->updateTags($match, $current['tags']);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user