mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-05 04:03:26 +00:00
Extra content to fix recurrences.
This commit is contained in:
@@ -25,6 +25,7 @@ namespace FireflyIII\Http\Requests;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Factory\CategoryFactory;
|
||||
use FireflyIII\Models\Recurrence;
|
||||
use FireflyIII\Models\TransactionType;
|
||||
use FireflyIII\Rules\ValidRecurrenceRepetitionType;
|
||||
@@ -123,6 +124,19 @@ class RecurrenceFormRequest extends FormRequest
|
||||
break;
|
||||
}
|
||||
|
||||
// replace category name with a new category:
|
||||
$factory = app(CategoryFactory::class);
|
||||
$factory->setUser(auth()->user());
|
||||
foreach($return['transactions'] as $index => $transaction) {
|
||||
$categoryName =$transaction['category_name'] ??null;
|
||||
if(null !== $categoryName) {
|
||||
$category = $factory->findOrCreate(null, $categoryName);
|
||||
if(null !== $category) {
|
||||
$return['transactions'][$index]['category_id'] = $category->id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user