mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-12-18 20:38:57 +00:00
Code cleanup [skip-ci]
This commit is contained in:
@@ -2,9 +2,15 @@
|
||||
|
||||
use Firefly\Storage\Account\AccountRepositoryInterface as ARI;
|
||||
|
||||
/**
|
||||
* Class AccountController
|
||||
*/
|
||||
class AccountController extends \BaseController
|
||||
{
|
||||
|
||||
/**
|
||||
* @param ARI $accounts
|
||||
*/
|
||||
public function __construct(ARI $accounts)
|
||||
{
|
||||
$this->accounts = $accounts;
|
||||
@@ -82,11 +88,11 @@ class AccountController extends \BaseController
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @param int $accountId
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function show($id)
|
||||
public function show($accountId)
|
||||
{
|
||||
|
||||
}
|
||||
@@ -128,6 +134,4 @@ class AccountController extends \BaseController
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,18 +1,21 @@
|
||||
<?php
|
||||
|
||||
class BaseController extends Controller {
|
||||
/**
|
||||
* Class BaseController
|
||||
*/
|
||||
class BaseController extends Controller
|
||||
{
|
||||
|
||||
/**
|
||||
* Setup the layout used by the controller.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setupLayout()
|
||||
{
|
||||
if ( ! is_null($this->layout))
|
||||
{
|
||||
$this->layout = View::make($this->layout);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Setup the layout used by the controller.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setupLayout()
|
||||
{
|
||||
if (!is_null($this->layout)) {
|
||||
$this->layout = View::make($this->layout);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4,36 +4,45 @@ use Firefly\Helper\Toolkit\Toolkit as tk;
|
||||
use Firefly\Storage\Account\AccountRepositoryInterface as ARI;
|
||||
use Firefly\Storage\TransactionJournal\TransactionJournalRepositoryInterface as TJRI;
|
||||
|
||||
/**
|
||||
* Class ChartController
|
||||
*/
|
||||
class ChartController extends BaseController
|
||||
{
|
||||
|
||||
protected $accounts;
|
||||
protected $journals;
|
||||
protected $_accounts;
|
||||
protected $_journals;
|
||||
|
||||
/**
|
||||
* @param ARI $accounts
|
||||
* @param TJRI $journals
|
||||
*/
|
||||
public function __construct(ARI $accounts, TJRI $journals)
|
||||
{
|
||||
$this->accounts = $accounts;
|
||||
$this->journals = $journals;
|
||||
$this->_accounts = $accounts;
|
||||
$this->_journals = $journals;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show home charts.
|
||||
* @param null $accountId
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function homeAccount($id = null)
|
||||
public function homeAccount($accountId = null)
|
||||
{
|
||||
list($start, $end) = tk::getDateRange();
|
||||
$current = clone $start;
|
||||
$return = [];
|
||||
$account = null;
|
||||
|
||||
if(!is_null($id)) {
|
||||
$account = $this->accounts->find($id);
|
||||
if (!is_null($accountId)) {
|
||||
$account = $this->_accounts->find($accountId);
|
||||
}
|
||||
|
||||
if (is_null($account)) {
|
||||
$accounts = $this->accounts->getActiveDefault();
|
||||
$accounts = $this->_accounts->getActiveDefault();
|
||||
|
||||
foreach ($accounts as $index => $account) {
|
||||
foreach ($accounts as $account) {
|
||||
$return[] = ['name' => $account->name, 'data' => []];
|
||||
}
|
||||
while ($current <= $end) {
|
||||
@@ -69,7 +78,7 @@ class ChartController extends BaseController
|
||||
'data' => []
|
||||
];
|
||||
|
||||
$result = $this->journals->homeBudgetChart($start, $end);
|
||||
$result = $this->_journals->homeBudgetChart($start, $end);
|
||||
|
||||
foreach ($result as $name => $amount) {
|
||||
$data['data'][] = [$name, $amount];
|
||||
@@ -85,7 +94,7 @@ class ChartController extends BaseController
|
||||
{
|
||||
list($start, $end) = tk::getDateRange();
|
||||
|
||||
$result = $this->journals->homeCategoryChart($start, $end);
|
||||
$result = $this->_journals->homeCategoryChart($start, $end);
|
||||
$data = [
|
||||
'type' => 'pie',
|
||||
'name' => 'Amount: ',
|
||||
@@ -111,7 +120,7 @@ class ChartController extends BaseController
|
||||
'data' => []
|
||||
];
|
||||
|
||||
$result = $this->journals->homeBeneficiaryChart($start, $end);
|
||||
$result = $this->_journals->homeBeneficiaryChart($start, $end);
|
||||
|
||||
foreach ($result as $name => $amount) {
|
||||
$data['data'][] = [$name, $amount];
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
<?php
|
||||
|
||||
class ComponentsController extends BaseController {
|
||||
/**
|
||||
* Class ComponentsController
|
||||
*/
|
||||
class ComponentsController extends BaseController
|
||||
{
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -3,37 +3,47 @@ use Firefly\Helper\Preferences\PreferencesHelperInterface as PHI;
|
||||
use Firefly\Storage\Account\AccountRepositoryInterface as ARI;
|
||||
use Firefly\Storage\TransactionJournal\TransactionJournalRepositoryInterface as TJRI;
|
||||
|
||||
|
||||
/**
|
||||
* Class HomeController
|
||||
*/
|
||||
class HomeController extends BaseController
|
||||
{
|
||||
protected $accounts;
|
||||
protected $preferences;
|
||||
protected $tj;
|
||||
protected $_accounts;
|
||||
protected $_preferences;
|
||||
protected $_journal;
|
||||
|
||||
public function __construct(ARI $accounts, PHI $preferences, TJRI $tj)
|
||||
/**
|
||||
* @param ARI $accounts
|
||||
* @param PHI $preferences
|
||||
* @param TJRI $journal
|
||||
*/
|
||||
public function __construct(ARI $accounts, PHI $preferences, TJRI $journal)
|
||||
{
|
||||
$this->accounts = $accounts;
|
||||
$this->preferences = $preferences;
|
||||
$this->tj = $tj;
|
||||
$this->_accounts = $accounts;
|
||||
$this->_preferences = $preferences;
|
||||
$this->_journal = $journal;
|
||||
View::share('menu', 'home');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return $this|\Illuminate\View\View
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
// get list setting:
|
||||
$pref = $this->preferences->get('frontpageAccounts', []);
|
||||
$pref = $this->_preferences->get('frontpageAccounts', []);
|
||||
|
||||
// get the accounts to display on the home screen:
|
||||
$count = $this->accounts->count();
|
||||
$count = $this->_accounts->count();
|
||||
if ($pref->data == []) {
|
||||
$list = $this->accounts->getActiveDefault();
|
||||
$list = $this->_accounts->getActiveDefault();
|
||||
} else {
|
||||
$list = $this->accounts->getByIds($pref->data);
|
||||
$list = $this->_accounts->getByIds($pref->data);
|
||||
}
|
||||
|
||||
// get transactions for each account:
|
||||
foreach ($list as $account) {
|
||||
$account->transactionList = $this->tj->getByAccount($account,10);
|
||||
$account->transactionList = $this->_journal->getByAccount($account, 10);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -5,19 +5,28 @@ use Firefly\Storage\Budget\BudgetRepositoryInterface as Bud;
|
||||
use Firefly\Storage\Category\CategoryRepositoryInterface as Cat;
|
||||
use Firefly\Storage\Component\ComponentRepositoryInterface as CRI;
|
||||
|
||||
/**
|
||||
* Class JsonController
|
||||
*/
|
||||
class JsonController extends BaseController
|
||||
{
|
||||
protected $accounts;
|
||||
protected $components;
|
||||
protected $categories;
|
||||
protected $budgets;
|
||||
protected $_accounts;
|
||||
protected $_components;
|
||||
protected $_categories;
|
||||
protected $_budgets;
|
||||
|
||||
/**
|
||||
* @param ARI $accounts
|
||||
* @param CRI $components
|
||||
* @param Cat $categories
|
||||
* @param Bud $budgets
|
||||
*/
|
||||
public function __construct(ARI $accounts, CRI $components, Cat $categories, Bud $budgets)
|
||||
{
|
||||
$this->components = $components;
|
||||
$this->accounts = $accounts;
|
||||
$this->categories = $categories;
|
||||
$this->budgets = $budgets;
|
||||
$this->_components = $components;
|
||||
$this->_accounts = $accounts;
|
||||
$this->_categories = $categories;
|
||||
$this->_budgets = $budgets;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -25,7 +34,7 @@ class JsonController extends BaseController
|
||||
*/
|
||||
public function beneficiaries()
|
||||
{
|
||||
$list = $this->accounts->getBeneficiaries();
|
||||
$list = $this->_accounts->getBeneficiaries();
|
||||
$return = [];
|
||||
foreach ($list as $entry) {
|
||||
$return[] = $entry->name;
|
||||
@@ -40,7 +49,7 @@ class JsonController extends BaseController
|
||||
*/
|
||||
public function categories()
|
||||
{
|
||||
$list = $this->categories->get();
|
||||
$list = $this->_categories->get();
|
||||
$return = [];
|
||||
foreach ($list as $entry) {
|
||||
$return[] = $entry->name;
|
||||
|
||||
@@ -2,21 +2,33 @@
|
||||
|
||||
use Firefly\Helper\Migration\MigrationHelperInterface as MHI;
|
||||
|
||||
/**
|
||||
* Class MigrationController
|
||||
*/
|
||||
class MigrationController extends BaseController
|
||||
{
|
||||
protected $migration;
|
||||
protected $_migration;
|
||||
|
||||
/**
|
||||
* @param MHI $migration
|
||||
*/
|
||||
public function __construct(MHI $migration)
|
||||
{
|
||||
$this->migration = $migration;
|
||||
$this->_migration = $migration;
|
||||
View::share('menu', 'home');
|
||||
|
||||
}
|
||||
|
||||
public function dev() {
|
||||
/**
|
||||
* Dev method
|
||||
*/
|
||||
public function dev()
|
||||
{
|
||||
$file = Config::get('dev.import');
|
||||
if(file_exists($file)) {
|
||||
if (file_exists($file)) {
|
||||
$user = User::find(1);
|
||||
|
||||
/** @noinspection PhpParamsInspection */
|
||||
Auth::login($user);
|
||||
/** @var Firefly\Helper\Migration\MigrationHelperInterface $migration */
|
||||
$migration = App::make('Firefly\Helper\Migration\MigrationHelperInterface');
|
||||
@@ -27,11 +39,17 @@ class MigrationController extends BaseController
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
return View::make('migrate.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return $this|\Illuminate\Http\RedirectResponse|\Illuminate\View\View
|
||||
*/
|
||||
public function postIndex()
|
||||
{
|
||||
if (Input::hasFile('exportFile')) {
|
||||
@@ -40,12 +58,12 @@ class MigrationController extends BaseController
|
||||
$file = Input::file('exportFile');
|
||||
$path = $file->getRealPath();
|
||||
|
||||
$this->migration->loadFile($path);
|
||||
$this->_migration->loadFile($path);
|
||||
|
||||
if (!$this->migration->validFile()) {
|
||||
if (!$this->_migration->validFile()) {
|
||||
return View::make('error')->with('message', 'Invalid JSON content.');
|
||||
}
|
||||
$this->migration->migrate();
|
||||
$this->_migration->migrate();
|
||||
return Redirect::route('index');
|
||||
} else {
|
||||
return View::make('error')->with('message', 'No file selected');
|
||||
|
||||
@@ -3,43 +3,57 @@
|
||||
use Firefly\Helper\Preferences\PreferencesHelperInterface as PHI;
|
||||
use Firefly\Storage\Account\AccountRepositoryInterface as ARI;
|
||||
|
||||
/**
|
||||
* Class PreferencesController
|
||||
*/
|
||||
class PreferencesController extends BaseController
|
||||
{
|
||||
protected $accounts;
|
||||
protected $preferences;
|
||||
protected $_accounts;
|
||||
protected $_preferences;
|
||||
|
||||
/**
|
||||
* @param ARI $accounts
|
||||
* @param PHI $preferences
|
||||
*/
|
||||
public function __construct(ARI $accounts, PHI $preferences)
|
||||
{
|
||||
|
||||
$this->accounts = $accounts;
|
||||
$this->preferences = $preferences;
|
||||
$this->_accounts = $accounts;
|
||||
$this->_preferences = $preferences;
|
||||
View::share('menu', 'home');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return $this|\Illuminate\View\View
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$accounts = $this->accounts->getDefault();
|
||||
$accounts = $this->_accounts->getDefault();
|
||||
|
||||
$viewRange = $this->preferences->get('viewRange','1M');
|
||||
$viewRange = $this->_preferences->get('viewRange', '1M');
|
||||
$viewRangeValue = $viewRange->data;
|
||||
|
||||
// pref:
|
||||
$frontpage = $this->preferences->get('frontpageAccounts', []);
|
||||
return View::make('preferences.index')->with('accounts', $accounts)->with('frontpageAccounts', $frontpage)->with('viewRange',$viewRangeValue);
|
||||
$frontpage = $this->_preferences->get('frontpageAccounts', []);
|
||||
return View::make('preferences.index')->with('accounts', $accounts)->with('frontpageAccounts', $frontpage)
|
||||
->with('viewRange', $viewRangeValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function postIndex()
|
||||
{
|
||||
|
||||
// frontpage accounts
|
||||
$frontpageAccounts = [];
|
||||
foreach(Input::get('frontpageAccounts') as $id) {
|
||||
foreach (Input::get('frontpageAccounts') as $id) {
|
||||
$frontpageAccounts[] = intval($id);
|
||||
}
|
||||
$this->preferences->set('frontpageAccounts',$frontpageAccounts);
|
||||
$this->_preferences->set('frontpageAccounts', $frontpageAccounts);
|
||||
|
||||
// view range:
|
||||
$this->preferences->set('viewRange',Input::get('viewRange'));
|
||||
$this->_preferences->set('viewRange', Input::get('viewRange'));
|
||||
// forget session values:
|
||||
Session::forget('start');
|
||||
Session::forget('end');
|
||||
|
||||
@@ -2,24 +2,41 @@
|
||||
|
||||
use Firefly\Storage\User\UserRepositoryInterface as URI;
|
||||
|
||||
/**
|
||||
* Class ProfileController
|
||||
*/
|
||||
class ProfileController extends BaseController
|
||||
{
|
||||
|
||||
public function __construct(URI $user) {
|
||||
/**
|
||||
* @param URI $user
|
||||
*/
|
||||
public function __construct(URI $user)
|
||||
{
|
||||
$this->user = $user;
|
||||
View::share('menu', 'home');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\View\View
|
||||
*
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
return View::make('profile.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function changePassword()
|
||||
{
|
||||
return View::make('profile.change-password');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\View\View
|
||||
*/
|
||||
public function postChangePassword()
|
||||
{
|
||||
|
||||
@@ -44,7 +61,8 @@ class ProfileController extends BaseController
|
||||
}
|
||||
|
||||
// update the user with the new password.
|
||||
$this->user->updatePassword(Auth::user(),Input::get('new1'));
|
||||
/** @noinspection PhpParamsInspection */
|
||||
$this->user->updatePassword(Auth::user(), Input::get('new1'));
|
||||
|
||||
Session::flash('success', 'Password changed!');
|
||||
return Redirect::route('profile');
|
||||
|
||||
@@ -6,44 +6,59 @@ use Firefly\Storage\Budget\BudgetRepositoryInterface as Bud;
|
||||
use Firefly\Storage\Category\CategoryRepositoryInterface as Cat;
|
||||
use Firefly\Storage\TransactionJournal\TransactionJournalRepositoryInterface as TJRI;
|
||||
|
||||
/**
|
||||
* Class TransactionController
|
||||
*/
|
||||
class TransactionController extends BaseController
|
||||
{
|
||||
|
||||
protected $accounts;
|
||||
protected $budgets;
|
||||
protected $categories;
|
||||
protected $tj;
|
||||
protected $_accounts;
|
||||
protected $_budgets;
|
||||
protected $_categories;
|
||||
protected $_journal;
|
||||
|
||||
public function __construct(ARI $accounts, Bud $budgets, Cat $categories, TJRI $tj)
|
||||
/**
|
||||
* @param ARI $accounts
|
||||
* @param Bud $budgets
|
||||
* @param Cat $categories
|
||||
* @param TJRI $journal
|
||||
*/
|
||||
public function __construct(ARI $accounts, Bud $budgets, Cat $categories, TJRI $journal)
|
||||
{
|
||||
$this->accounts = $accounts;
|
||||
$this->budgets = $budgets;
|
||||
$this->categories = $categories;
|
||||
$this->tj = $tj;
|
||||
$this->_accounts = $accounts;
|
||||
$this->_budgets = $budgets;
|
||||
$this->_categories = $categories;
|
||||
$this->_journal = $journal;
|
||||
|
||||
|
||||
View::share('menu', 'home');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return $this|\Illuminate\View\View
|
||||
*/
|
||||
public function createWithdrawal()
|
||||
{
|
||||
|
||||
// get accounts with names and id's.
|
||||
$accounts = $this->accounts->getActiveDefaultAsSelectList();
|
||||
$accounts = $this->_accounts->getActiveDefaultAsSelectList();
|
||||
|
||||
$budgets = $this->budgets->getAsSelectList();
|
||||
$budgets = $this->_budgets->getAsSelectList();
|
||||
|
||||
$budgets[0] = '(no budget)';
|
||||
|
||||
return View::make('transactions.withdrawal')->with('accounts', $accounts)->with('budgets', $budgets);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return $this|\Illuminate\View\View
|
||||
*/
|
||||
public function createDeposit()
|
||||
{
|
||||
// get accounts with names and id's.
|
||||
$accounts = $this->accounts->getActiveDefaultAsSelectList();
|
||||
$accounts = $this->_accounts->getActiveDefaultAsSelectList();
|
||||
|
||||
$budgets = $this->budgets->getAsSelectList();
|
||||
$budgets = $this->_budgets->getAsSelectList();
|
||||
|
||||
$budgets[0] = '(no budget)';
|
||||
|
||||
@@ -51,12 +66,15 @@ class TransactionController extends BaseController
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @return $this|\Illuminate\View\View
|
||||
*/
|
||||
public function createTransfer()
|
||||
{
|
||||
// get accounts with names and id's.
|
||||
$accounts = $this->accounts->getActiveDefaultAsSelectList();
|
||||
$accounts = $this->_accounts->getActiveDefaultAsSelectList();
|
||||
|
||||
$budgets = $this->budgets->getAsSelectList();
|
||||
$budgets = $this->_budgets->getAsSelectList();
|
||||
|
||||
$budgets[0] = '(no budget)';
|
||||
|
||||
@@ -64,25 +82,28 @@ class TransactionController extends BaseController
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function postCreateWithdrawal()
|
||||
{
|
||||
|
||||
// create or find beneficiary:
|
||||
$beneficiary = $this->accounts->createOrFindBeneficiary(Input::get('beneficiary'));
|
||||
$beneficiary = $this->_accounts->createOrFindBeneficiary(Input::get('beneficiary'));
|
||||
|
||||
// fall back to cash account if empty:
|
||||
if (is_null($beneficiary)) {
|
||||
$beneficiary = $this->accounts->getCashAccount();
|
||||
$beneficiary = $this->_accounts->getCashAccount();
|
||||
}
|
||||
|
||||
// create or find category:
|
||||
$category = $this->categories->createOrFind(Input::get('category'));
|
||||
$category = $this->_categories->createOrFind(Input::get('category'));
|
||||
|
||||
// find budget:
|
||||
$budget = $this->budgets->find(intval(Input::get('budget_id')));
|
||||
$budget = $this->_budgets->find(intval(Input::get('budget_id')));
|
||||
|
||||
// find account:
|
||||
$account = $this->accounts->find(intval(Input::get('account_id')));
|
||||
$account = $this->_accounts->find(intval(Input::get('account_id')));
|
||||
|
||||
// find amount & description:
|
||||
$description = trim(Input::get('description'));
|
||||
@@ -92,7 +113,7 @@ class TransactionController extends BaseController
|
||||
// create journal
|
||||
/** @var \TransactionJournal $journal */
|
||||
try {
|
||||
$journal = $this->tj->createSimpleJournal($account, $beneficiary, $description, $amount, $date);
|
||||
$journal = $this->_journal->createSimpleJournal($account, $beneficiary, $description, $amount, $date);
|
||||
} catch (\Firefly\Exception\FireflyException $e) {
|
||||
return Redirect::route('transactions.withdrawal')->withInput();
|
||||
}
|
||||
@@ -109,21 +130,24 @@ class TransactionController extends BaseController
|
||||
return Redirect::route('index');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function postCreateDeposit()
|
||||
{
|
||||
// create or find beneficiary:
|
||||
$beneficiary = $this->accounts->createOrFindBeneficiary(Input::get('beneficiary'));
|
||||
$beneficiary = $this->_accounts->createOrFindBeneficiary(Input::get('beneficiary'));
|
||||
|
||||
// fall back to cash account if empty:
|
||||
if (is_null($beneficiary)) {
|
||||
$beneficiary = $this->accounts->getCashAccount();
|
||||
$beneficiary = $this->_accounts->getCashAccount();
|
||||
}
|
||||
|
||||
// create or find category:
|
||||
$category = $this->categories->createOrFind(Input::get('category'));
|
||||
$category = $this->_categories->createOrFind(Input::get('category'));
|
||||
|
||||
// find account:
|
||||
$account = $this->accounts->find(intval(Input::get('account_id')));
|
||||
$account = $this->_accounts->find(intval(Input::get('account_id')));
|
||||
|
||||
// find amount & description:
|
||||
$description = trim(Input::get('description'));
|
||||
@@ -133,7 +157,7 @@ class TransactionController extends BaseController
|
||||
// create journal
|
||||
/** @var \TransactionJournal $journal */
|
||||
try {
|
||||
$journal = $this->tj->createSimpleJournal($beneficiary, $account, $description, $amount, $date);
|
||||
$journal = $this->_journal->createSimpleJournal($beneficiary, $account, $description, $amount, $date);
|
||||
} catch (\Firefly\Exception\FireflyException $e) {
|
||||
return Redirect::route('transactions.deposit')->withInput();
|
||||
}
|
||||
@@ -146,16 +170,19 @@ class TransactionController extends BaseController
|
||||
return Redirect::route('index');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function postCreateTransfer()
|
||||
{
|
||||
// create or find category:
|
||||
$category = $this->categories->createOrFind(Input::get('category'));
|
||||
$category = $this->_categories->createOrFind(Input::get('category'));
|
||||
|
||||
// find account to:
|
||||
$to = $this->accounts->find(intval(Input::get('account_to_id')));
|
||||
$toAccount = $this->_accounts->find(intval(Input::get('account_to_id')));
|
||||
|
||||
// find account from
|
||||
$from = $this->accounts->find(intval(Input::get('account_from_id')));
|
||||
$from = $this->_accounts->find(intval(Input::get('account_from_id')));
|
||||
|
||||
// find amount & description:
|
||||
$description = trim(Input::get('description'));
|
||||
@@ -165,7 +192,7 @@ class TransactionController extends BaseController
|
||||
// create journal
|
||||
/** @var \TransactionJournal $journal */
|
||||
try {
|
||||
$journal = $this->tj->createSimpleJournal($from, $to, $description, $amount, $date);
|
||||
$journal = $this->_journal->createSimpleJournal($from, $toAccount, $description, $amount, $date);
|
||||
} catch (\Firefly\Exception\FireflyException $e) {
|
||||
return Redirect::route('transactions.transfer')->withInput();
|
||||
}
|
||||
|
||||
@@ -3,6 +3,9 @@
|
||||
use Firefly\Helper\Email\EmailHelperInterface as EHI;
|
||||
use Firefly\Storage\User\UserRepositoryInterface as URI;
|
||||
|
||||
/**
|
||||
* Class UserController
|
||||
*/
|
||||
class UserController extends BaseController
|
||||
{
|
||||
|
||||
|
||||
Reference in New Issue
Block a user