From b1b13d369609e701b60d244e38eccfd4ae820793 Mon Sep 17 00:00:00 2001 From: James Cole Date: Thu, 9 Aug 2018 20:49:30 +0200 Subject: [PATCH] Can no longer set a budget to an expense. --- app/Services/Internal/Update/JournalUpdateService.php | 8 ++++++++ tests/Feature/Controllers/ProfileControllerTest.php | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/app/Services/Internal/Update/JournalUpdateService.php b/app/Services/Internal/Update/JournalUpdateService.php index d364514dd3..99dae64026 100644 --- a/app/Services/Internal/Update/JournalUpdateService.php +++ b/app/Services/Internal/Update/JournalUpdateService.php @@ -150,7 +150,15 @@ class JournalUpdateService foreach ($journal->transactions as $transaction) { $service->updateBudget($transaction, $budgetId); } + return $journal; } + // clear budget. + /** @var Transaction $transaction */ + foreach ($journal->transactions as $transaction) { + $transaction->budgets()->sync([]); + } + // remove budgets from journal: + $journal->budgets()->sync([]); return $journal; } diff --git a/tests/Feature/Controllers/ProfileControllerTest.php b/tests/Feature/Controllers/ProfileControllerTest.php index 1138b109c8..8fff851215 100644 --- a/tests/Feature/Controllers/ProfileControllerTest.php +++ b/tests/Feature/Controllers/ProfileControllerTest.php @@ -126,7 +126,7 @@ class ProfileControllerTest extends TestCase } /** - * @covers \FireflyIII\Http\Controllers\ProfileControllerAccount + * @covers \FireflyIII\Http\Controllers\ProfileController */ public function testDeleteAccount(): void { @@ -141,7 +141,7 @@ class ProfileControllerTest extends TestCase } /** - * @covers \FireflyIII\Http\Controllers\ProfileControllerCode + * @covers \FireflyIII\Http\Controllers\ProfileController */ public function testDeleteCode(): void {