From a84064663aa5116647a1a9a1212e957c9e6e733c Mon Sep 17 00:00:00 2001 From: Sander Dorigo Date: Fri, 3 Oct 2014 21:36:42 +0200 Subject: [PATCH] Fixed a bug where editing a transaction would lead to unset variables. --- app/controllers/TransactionController.php | 1 + app/lib/Firefly/Helper/Controllers/Transaction.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/TransactionController.php b/app/controllers/TransactionController.php index 63b3b34af0..6c66675ce4 100644 --- a/app/controllers/TransactionController.php +++ b/app/controllers/TransactionController.php @@ -292,6 +292,7 @@ class TransactionController extends BaseController } break; + default: throw new FireflyException('Method ' . Input::get('post_submit_action') . ' not implemented yet.'); break; diff --git a/app/lib/Firefly/Helper/Controllers/Transaction.php b/app/lib/Firefly/Helper/Controllers/Transaction.php index 281d35b3b8..c6cf4c665a 100644 --- a/app/lib/Firefly/Helper/Controllers/Transaction.php +++ b/app/lib/Firefly/Helper/Controllers/Transaction.php @@ -167,7 +167,7 @@ class Transaction implements TransactionInterface /* * Connect budget and category: */ - $budgetids = is_null($budget) ? [] : [$budget->id]; + $budgetids = !isset($budget) || (isset($budget) && is_null($budget)) ? [] : [$budget->id]; $catids = is_null($category) ? [] : [$category->id]; $journal->budgets()->sync($budgetids); $journal->categories()->sync($catids);