A temporary fix for the problem that storing a transaction journal doesn't return the actual journal when successful.

This commit is contained in:
Sander Dorigo 2014-10-07 12:26:02 +02:00
parent d5bcf5497f
commit 1fbdb3d0ae
3 changed files with 16 additions and 4 deletions

View File

@ -268,7 +268,10 @@ class TransactionController extends BaseController
/* /*
* Try to store: * Try to store:
*/ */
$messageBag = $this->_helper->store($data); $data['return_journal'] = true;
$set = $this->_helper->store($data);
$journal = $set['journal'];
$messageBag = $set['messagebag'];
/* /*
* Failure! * Failure!
@ -283,6 +286,13 @@ class TransactionController extends BaseController
*/ */
Session::flash('success', 'Transaction "' . e(Input::get('description')) . '" saved!'); Session::flash('success', 'Transaction "' . e(Input::get('description')) . '" saved!');
/*
* Trigger something that will search for possibly matching recurring transactions.
* This only works for expenses. However, at this point we have no idea what the latest
* transaction is. We'll have to find it, and when the user creates a lot of them it might
* get lost somewhere.
*/
/* /*
* Redirect to original location or back to the form. * Redirect to original location or back to the form.
*/ */

View File

@ -469,7 +469,7 @@ class Transaction implements TransactionInterface
$journal->completed = true; $journal->completed = true;
$journal->save(); $journal->save();
if (isset($data['return_journal']) && $data['return_journal'] == true) { if (isset($data['return_journal']) && $data['return_journal'] == true) {
return $journal; return ['journal' => $journal, 'messagebag' => $journal->errors()];
} }
return $journal->errors(); return $journal->errors();
} }

View File

@ -106,7 +106,8 @@ class EloquentTransactionJournalRepository implements TransactionJournalReposito
'what' => 'transfer', 'what' => 'transfer',
'return_journal' => true 'return_journal' => true
]; ];
$journal = $transactions->store($set); $returnSet = $transactions->store($set);
$journal = $returnSet['journal'];
/* /*
* Validate the store action: * Validate the store action:
@ -333,7 +334,8 @@ class EloquentTransactionJournalRepository implements TransactionJournalReposito
/* /*
* Import it: * Import it:
*/ */
$journal = $transactions->store($set); $returnSet = $transactions->store($set);
$journal = $returnSet['journal'];
/* /*
* Validate the store action: * Validate the store action: