Skip to content

Firefly III: a personal finances manager

Fixed a bug that will properly attach both budgets AND categories

Sander Dorigod9b70f7ad8d6
diff --git a/app/lib/Firefly/Helper/Controllers/Transaction.php b/app/lib/Firefly/Helper/Controllers/Transaction.php
index 181f0681f3..09ebe92014 100644
--- a/app/lib/Firefly/Helper/Controllers/Transaction.php
+++ b/app/lib/Firefly/Helper/Controllers/Transaction.php
@@ -93,6 +93,7 @@ class Transaction implements TransactionInterface
/*
* find budget using repository
*/
+
if (isset($data['budget_id'])) {
$budget = $this->_budgets->find($data['budget_id']);
}
@@ -172,8 +173,8 @@ class Transaction implements TransactionInterface
*/
$budgetids = !isset($budget) || (isset($budget) && is_null($budget)) ? [] : [$budget->id];
$catids = is_null($category) ? [] : [$category->id];
- $journal->budgets()->sync($budgetids);
- $journal->categories()->sync($catids);
+ $components = array_merge($budgetids,$catids);
+ $journal->components()->sync($components);
$journal->save();
if (isset($data['return_journal']) && $data['return_journal'] == true) {
return $journal;