Fixed a bug where editing a transaction would lead to unset variables.

This commit is contained in:
Sander Dorigo 2014-10-03 21:36:42 +02:00
parent 6798cea268
commit a84064663a
2 changed files with 2 additions and 1 deletions

View File

@ -292,6 +292,7 @@ class TransactionController extends BaseController
} }
break; break;
default: default:
throw new FireflyException('Method ' . Input::get('post_submit_action') . ' not implemented yet.'); throw new FireflyException('Method ' . Input::get('post_submit_action') . ' not implemented yet.');
break; break;

View File

@ -167,7 +167,7 @@ class Transaction implements TransactionInterface
/* /*
* Connect budget and category: * 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]; $catids = is_null($category) ? [] : [$category->id];
$journal->budgets()->sync($budgetids); $journal->budgets()->sync($budgetids);
$journal->categories()->sync($catids); $journal->categories()->sync($catids);