Cleanup controllers and small bug fixes.

This commit is contained in:
James Cole 2014-09-09 20:00:04 +02:00
parent 309177ca9c
commit f9dc627d84
15 changed files with 143 additions and 98 deletions

View File

@ -8,8 +8,6 @@ use Firefly\Storage\Account\AccountRepositoryInterface as ARI;
*
* @SuppressWarnings(PHPMD.CamelCasePropertyName)
*/
class AccountController extends \BaseController
{
@ -18,7 +16,7 @@ class AccountController extends \BaseController
/**
* @param ARI $repository
* @param AI $accounts
* @param AI $accounts
*/
public function __construct(ARI $repository, AI $accounts)
{
@ -42,7 +40,7 @@ class AccountController extends \BaseController
public function delete(Account $account)
{
return View::make('accounts.delete')->with('account', $account)
->with('title', 'Delete account "' . $account->name . '"');
->with('title', 'Delete account "' . $account->name . '"');
}
/**
@ -69,7 +67,7 @@ class AccountController extends \BaseController
{
$openingBalance = $this->_accounts->openingBalanceTransaction($account);
return View::make('accounts.edit')->with('account', $account)->with('openingBalance', $openingBalance)
->with('title', 'Edit account "' . $account->name . '"');
->with('title', 'Edit account "' . $account->name . '"');
}
/**
@ -105,8 +103,10 @@ class AccountController extends \BaseController
{
$data = $this->_accounts->show($account, 40);
return View::make('accounts.show')->with('account', $account)->with('show', $data)->with('title',
'Details for account "' . $account->name . '"');
return View::make('accounts.show')->with('account', $account)->with('show', $data)->with(
'title',
'Details for account "' . $account->name . '"'
);
}
/**

View File

@ -1,6 +1,6 @@
<?php
use \Illuminate\Routing\Controller;
use Illuminate\Routing\Controller;
/**
* Class BaseController
@ -13,10 +13,6 @@ class BaseController extends Controller
*/
public function __construct()
{
\Event::fire('limits.check');
\Event::fire('piggybanks.check');
\Event::fire('recurring.check');
}
/**

View File

@ -8,6 +8,7 @@ use Firefly\Storage\Budget\BudgetRepositoryInterface as BRI;
* Class BudgetController
*
* @SuppressWarnings(PHPMD.CamelCasePropertyName)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*
*/
class BudgetController extends BaseController
@ -17,7 +18,7 @@ class BudgetController extends BaseController
protected $_repository;
/**
* @param BI $budgets
* @param BI $budgets
* @param BRI $repository
*/
public function __construct(BI $budgets, BRI $repository)
@ -44,7 +45,7 @@ class BudgetController extends BaseController
public function delete(Budget $budget)
{
return View::make('budgets.delete')->with('budget', $budget)
->with('title', 'Delete budget "' . $budget->name . '"');
->with('title', 'Delete budget "' . $budget->name . '"');
}
/**
@ -75,7 +76,7 @@ class BudgetController extends BaseController
public function edit(Budget $budget)
{
return View::make('budgets.edit')->with('budget', $budget)
->with('title', 'Edit budget "' . $budget->name . '"');
->with('title', 'Edit budget "' . $budget->name . '"');
}
@ -87,7 +88,7 @@ class BudgetController extends BaseController
$budgets = $this->_repository->get();
return View::make('budgets.indexByBudget')->with('budgets', $budgets)->with('today', new Carbon)
->with('title', 'All your budgets grouped by budget');
->with('title', 'All your budgets grouped by budget');
}
@ -101,7 +102,7 @@ class BudgetController extends BaseController
$budgets = $this->_budgets->organizeByDate($set);
return View::make('budgets.indexByDate')->with('budgets', $budgets)
->with('title', 'All your budgets grouped by date');
->with('title', 'All your budgets grouped by date');
}
@ -113,7 +114,7 @@ class BudgetController extends BaseController
* - Show a specific repetition.
* - Show everything shows NO repetition.
*
* @param Budget $budget
* @param Budget $budget
* @param LimitRepetition $repetition
*
* @return int
@ -128,8 +129,10 @@ class BudgetController extends BaseController
case (!is_null($repetition)):
$data = $this->_budgets->organizeRepetition($repetition);
$view = 1;
$title = $budget->name . ', ' . $repetition->periodShow() . ', ' . mf($repetition->limit->amount,
false);
$title = $budget->name . ', ' . $repetition->periodShow() . ', ' . mf(
$repetition->limit->amount,
false
);
break;
case (Input::get('noenvelope') == 'true'):
$data = $this->_budgets->outsideRepetitions($budget);
@ -144,12 +147,12 @@ class BudgetController extends BaseController
}
return View::make('budgets.show')
->with('budget', $budget)
->with('repetitions', $data)
->with('view', $view)
->with('highlight', Input::get('highlight'))
->with('useSessionDates', $useSessionDates)
->with('title', $title);
->with('budget', $budget)
->with('repetitions', $data)
->with('view', $view)
->with('highlight', Input::get('highlight'))
->with('useSessionDates', $useSessionDates)
->with('title', $title);
}
/**

View File

@ -5,6 +5,8 @@ use Firefly\Storage\Category\CategoryRepositoryInterface as CRI;
/**
* Class CategoryController
*
* @SuppressWarnings(PHPMD.CamelCasePropertyName)
*/
class CategoryController extends BaseController
{
@ -13,7 +15,7 @@ class CategoryController extends BaseController
/**
* @param CRI $repository
* @param CI $category
* @param CI $category
*/
public function __construct(CRI $repository, CI $category)
{
@ -37,7 +39,7 @@ class CategoryController extends BaseController
public function delete(Category $category)
{
return View::make('categories.delete')->with('category', $category)
->with('title', 'Delete category "' . $category->name . '"');
->with('title', 'Delete category "' . $category->name . '"');
}
/**
@ -88,8 +90,8 @@ class CategoryController extends BaseController
$journals = $this->_category->journalsInRange($category, $start, $end);
return View::make('categories.show')->with('category', $category)->with('journals', $journals)->with(
'highlight', Input::get('highlight')
)->with('title', 'Overview for category "'.$category->name.'"');;
'highlight', Input::get('highlight')
)->with('title', 'Overview for category "' . $category->name . '"');
}
/**

View File

@ -6,6 +6,9 @@ use Firefly\Storage\Account\AccountRepositoryInterface;
/**
* Class ChartController
*
* @SuppressWarnings(PHPMD.CamelCasePropertyName)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class ChartController extends BaseController
{
@ -143,15 +146,15 @@ class ChartController extends BaseController
public function budgetNoLimits(\Budget $budget)
{
/*
* We can go about this two ways. Either we find all transactions which definitely are IN an envelope
* and exclude them or we search for transactions outside of the range of any of the envelopes we have.
* Firefly can go about this two ways. Either it finds all transactions which definitely are IN an envelope
* and exclude them or it searches for transactions outside of the range of any of the envelopes there are.
*
* Since either is shitty we go with the first one because it's easier to build.
* Since either is kinda shitty Firefly uses the first one because it's easier to build.
*/
$inRepetitions = $this->_chart->allJournalsInBudgetEnvelope($budget);
/*
* With this set of id's, we can search for all journals NOT in that set.
* With this set of id's, Firefly can search for all journals NOT in that set.
* BUT they have to be in the budget (duh).
*/
$set = $this->_chart->journalsNotInSet($budget, $inRepetitions);
@ -226,14 +229,15 @@ class ChartController extends BaseController
$reps = $this->_chart->limitsInRange($budget, $start, $end);
/*
* For each limitrepetition we create a serie that contains the amount left in
* For each limitrepetition Firefly creates a serie that contains the amount left in
* the limitrepetition for its entire date-range. Entries are only actually included when they
* fall into the charts date range.
*
* So example: we have a session date from Jan 15 to Jan 30. The limitrepetition starts at 1 Jan until 1 Feb.
* So example: the user has a session date from Jan 15 to Jan 30. The limitrepetition
* starts at 1 Jan until 1 Feb.
*
* We loop from 1 Jan to 1 Feb but only include Jan 15 / Jan 30. But we do keep count of the amount outside
* of these dates because otherwise the line might be wrong.
* Firefly loops from 1 Jan to 1 Feb but only includes Jan 15 / Jan 30.
* But it does keep count of the amount outside of these dates because otherwise the line might be wrong.
*/
/** @var \LimitRepetition $repetition */
foreach ($reps as $repetition) {

View File

@ -1,5 +1,4 @@
<?php
use Carbon\Carbon;
use Firefly\Helper\Preferences\PreferencesHelperInterface as PHI;
use Firefly\Storage\Account\AccountRepositoryInterface as ARI;
use Firefly\Storage\Reminder\ReminderRepositoryInterface as RRI;
@ -7,6 +6,8 @@ use Firefly\Storage\TransactionJournal\TransactionJournalRepositoryInterface as
/**
* Class HomeController
*
* @SuppressWarnings(PHPMD.CamelCasePropertyName)
*/
class HomeController extends BaseController
{
@ -15,12 +16,18 @@ class HomeController extends BaseController
protected $_journal;
protected $_reminders;
/**
* @param ARI $accounts
* @param PHI $preferences
* @param TJRI $journal
* @param RRI $reminders
*/
public function __construct(ARI $accounts, PHI $preferences, TJRI $journal, RRI $reminders)
{
$this->_accounts = $accounts;
$this->_accounts = $accounts;
$this->_preferences = $preferences;
$this->_journal = $journal;
$this->_reminders = $reminders;
$this->_journal = $journal;
$this->_reminders = $reminders;
}
/**
@ -38,11 +45,14 @@ class HomeController extends BaseController
*/
public function index()
{
Event::fire('limits.check');
Event::fire('piggybanks.check');
Event::fire('recurring.check');
// count, maybe we need some introducing text to show:
// count, maybe Firefly needs some introducing text to show:
$count = $this->_accounts->count();
$start = Session::get('start');
$end = Session::get('end');
$end = Session::get('end');
// get the preference for the home accounts to show:

View File

@ -7,6 +7,8 @@ use Firefly\Storage\Component\ComponentRepositoryInterface as CRI;
/**
* Class JsonController
*
* @SuppressWarnings(PHPMD.CamelCasePropertyName)
*/
class JsonController extends BaseController
{
@ -24,9 +26,9 @@ class JsonController extends BaseController
public function __construct(ARI $accounts, CRI $components, Cat $categories, Bud $budgets)
{
$this->_components = $components;
$this->_accounts = $accounts;
$this->_accounts = $accounts;
$this->_categories = $categories;
$this->_budgets = $budgets;
$this->_budgets = $budgets;
}
/**
@ -34,7 +36,7 @@ class JsonController extends BaseController
*/
public function beneficiaries()
{
$list = $this->_accounts->getBeneficiaries();
$list = $this->_accounts->getBeneficiaries();
$return = [];
foreach ($list as $entry) {
$return[] = $entry->name;
@ -49,7 +51,7 @@ class JsonController extends BaseController
*/
public function categories()
{
$list = $this->_categories->get();
$list = $this->_categories->get();
$return = [];
foreach ($list as $entry) {
$return[] = $entry->name;

View File

@ -5,6 +5,8 @@ use Firefly\Storage\Limit\LimitRepositoryInterface as LRI;
/**
* Class LimitController
*
* @SuppressWarnings(PHPMD.CamelCasePropertyName)
*/
class LimitController extends BaseController
{
@ -19,7 +21,7 @@ class LimitController extends BaseController
public function __construct(BRI $budgets, LRI $limits)
{
$this->_budgets = $budgets;
$this->_limits = $limits;
$this->_limits = $limits;
}
/**
@ -29,7 +31,7 @@ class LimitController extends BaseController
*/
public function create(\Budget $budget = null)
{
$periods = \Config::get('firefly.periods_to_text');
$periods = \Config::get('firefly.periods_to_text');
$prefilled = [
'startdate' => \Input::get('startdate') ? : date('Y-m-d'),
'repeat_freq' => \Input::get('repeat_freq') ? : 'monthly',
@ -98,7 +100,7 @@ class LimitController extends BaseController
public function store(Budget $budget = null)
{
// find a limit with these properties, as we might already have one:
// find a limit with these properties, as Firefly might already have one:
$limit = $this->_limits->store(Input::all());
if ($limit->validate()) {
Session::flash('success', 'Envelope created!');
@ -110,7 +112,7 @@ class LimitController extends BaseController
}
} else {
Session::flash('error', 'Could not save new envelope.');
$budgetId = $budget ? $budget->id : null;
$budgetId = $budget ? $budget->id : null;
$parameters = [$budgetId, 'from' => Input::get('from')];
return Redirect::route('budgets.limits.create', $parameters)->withInput()

View File

@ -27,7 +27,7 @@ class MigrateController extends BaseController
$fullName = $path . DIRECTORY_SEPARATOR . $fileName;
if (is_writable($path)) {
Input::file('file')->move($path, $fileName);
// so now we push something in a queue and do something with it! Yay!
// so now Firefly pushes something in a queue and does something with it! Yay!
\Log::debug('Pushed a job to start the import.');
Queue::push('Firefly\Queue\Import@start', ['file' => $fullName, 'user' => \Auth::user()->id]);
Session::flash('success', 'The import job has been queued. Please be patient. Data will appear');

View File

@ -7,6 +7,10 @@ use Firefly\Storage\Piggybank\PiggybankRepositoryInterface as PRI;
/**
* Class PiggybankController
*
* @SuppressWarnings(PHPMD.CamelCasePropertyName)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
* @SuppressWarnings(PHPMD.TooManyMethods)
*
*/
class PiggybankController extends BaseController
{
@ -21,16 +25,18 @@ class PiggybankController extends BaseController
public function __construct(PRI $repository, ARI $accounts)
{
$this->_repository = $repository;
$this->_accounts = $accounts;
$this->_accounts = $accounts;
}
/**
* @param Piggybank $piggyBank
*
* @return $this
*/
public function addMoney(Piggybank $piggyBank)
{
$what = 'add';
$maxAdd = $this->_repository->leftOnAccount($piggyBank->account);
$what = 'add';
$maxAdd = $this->_repository->leftOnAccount($piggyBank->account);
$maxRemove = null;
return View::make('piggybanks.modifyAmount')->with('what', $what)->with('maxAdd', $maxAdd)->with(
@ -43,7 +49,7 @@ class PiggybankController extends BaseController
*/
public function createPiggybank()
{
$periods = Config::get('firefly.piggybank_periods');
$periods = Config::get('firefly.piggybank_periods');
$accounts = $this->_accounts->getActiveDefaultAsSelectList();
return View::make('piggybanks.create-piggybank')->with('accounts', $accounts)->with('periods', $periods);
@ -54,7 +60,7 @@ class PiggybankController extends BaseController
*/
public function createRepeated()
{
$periods = Config::get('firefly.piggybank_periods');
$periods = Config::get('firefly.piggybank_periods');
$accounts = $this->_accounts->getActiveDefaultAsSelectList();
return View::make('piggybanks.create-repeated')->with('accounts', $accounts)->with('periods', $periods);
@ -93,7 +99,7 @@ class PiggybankController extends BaseController
public function edit(Piggybank $piggyBank)
{
$accounts = $this->_accounts->getActiveDefaultAsSelectList();
$periods = Config::get('firefly.piggybank_periods');
$periods = Config::get('firefly.piggybank_periods');
if ($piggyBank->repeats == 1) {
return View::make('piggybanks.edit-repeated')->with('piggybank', $piggyBank)->with('accounts', $accounts)
->with('periods', $periods);
@ -110,19 +116,19 @@ class PiggybankController extends BaseController
*/
public function index()
{
$countRepeating = $this->_repository->countRepeating();
$countRepeating = $this->_repository->countRepeating();
$countNonRepeating = $this->_repository->countNonrepeating();
$piggybanks = $this->_repository->get();
// get the accounts with each piggy bank and check their balance; we might need to
// get the accounts with each piggy bank and check their balance; Fireflyy might needs to
// show the user a correction.
$accounts = [];
/** @var \Piggybank $piggybank */
foreach ($piggybanks as $piggybank) {
$account = $piggybank->account;
$id = $account->id;
$id = $account->id;
if (!isset($accounts[$id])) {
$accounts[$id] = ['account' => $account, 'left' => $this->_repository->leftOnAccount($account)];
}
@ -158,7 +164,7 @@ class PiggybankController extends BaseController
}
break;
case 'remove':
$rep = $piggyBank->currentRelevantRep();
$rep = $piggyBank->currentRelevantRep();
$maxRemove = $rep->currentamount;
if (round($amount, 2) <= round($maxRemove, 2)) {
Session::flash('success', 'Amount updated!');
@ -175,11 +181,13 @@ class PiggybankController extends BaseController
/**
* @param Piggybank $piggyBank
*
* @return $this
*/
public function removeMoney(Piggybank $piggyBank)
{
$what = 'remove';
$maxAdd = $this->_repository->leftOnAccount($piggyBank->account);
$what = 'remove';
$maxAdd = $this->_repository->leftOnAccount($piggyBank->account);
$maxRemove = $piggyBank->currentRelevantRep()->currentamount;
return View::make('piggybanks.modifyAmount')->with('what', $what)->with('maxAdd', $maxAdd)->with(
@ -193,7 +201,7 @@ class PiggybankController extends BaseController
public function show(Piggybank $piggyBank)
{
$leftOnAccount = $this->_repository->leftOnAccount($piggyBank->account);
$balance = $piggyBank->account->balance();
$balance = $piggyBank->account->balance();
return View::make('piggybanks.show')->with('piggyBank', $piggyBank)->with('leftOnAccount', $leftOnAccount)
->with('balance', $balance);
@ -208,10 +216,10 @@ class PiggybankController extends BaseController
unset($data['_token']);
// extend the data array with the settings needed to create a piggy bank:
$data['repeats'] = 0;
$data['repeats'] = 0;
$data['rep_times'] = 1;
$data['rep_every'] = 1;
$data['order'] = 0;
$data['order'] = 0;
$piggyBank = $this->_repository->store($data);
if (!is_null($piggyBank->id)) {
@ -240,7 +248,7 @@ class PiggybankController extends BaseController
// extend the data array with the settings needed to create a repeated:
$data['repeats'] = 1;
$data['order'] = 0;
$data['order'] = 0;
$piggyBank = $this->_repository->store($data);
if ($piggyBank->id) {
@ -258,6 +266,8 @@ class PiggybankController extends BaseController
}
/**
* @param Piggybank $piggyBank
*
* @return $this|\Illuminate\Http\RedirectResponse
*/
public function update(Piggybank $piggyBank)

View File

@ -5,6 +5,8 @@ use Firefly\Storage\Account\AccountRepositoryInterface as ARI;
/**
* Class PreferencesController
*
* @SuppressWarnings(PHPMD.CamelCasePropertyName)
*/
class PreferencesController extends BaseController
{
@ -18,7 +20,7 @@ class PreferencesController extends BaseController
public function __construct(ARI $accounts, PHI $preferences)
{
$this->_accounts = $accounts;
$this->_accounts = $accounts;
$this->_preferences = $preferences;
}
@ -29,7 +31,7 @@ class PreferencesController extends BaseController
{
$accounts = $this->_accounts->getDefault();
$viewRange = $this->_preferences->get('viewRange', '1M');
$viewRange = $this->_preferences->get('viewRange', '1M');
$viewRangeValue = $viewRange->data;
// pref:

View File

@ -4,6 +4,8 @@ use Firefly\Storage\RecurringTransaction\RecurringTransactionRepositoryInterface
/**
* Class RecurringController
*
* @SuppressWarnings(PHPMD.CamelCasePropertyName)
*/
class RecurringController extends BaseController
{
@ -114,6 +116,8 @@ class RecurringController extends BaseController
/**
* @param RecurringTransaction $recurringTransaction
*
* @return $this|\Illuminate\Http\RedirectResponse
*/
public function update(RecurringTransaction $recurringTransaction)
{

View File

@ -5,12 +5,17 @@ use Firefly\Storage\Reminder\ReminderRepositoryInterface as RRI;
/**
* Class ReminderController
*
* @SuppressWarnings(PHPMD.CamelCasePropertyName)
*/
class ReminderController extends BaseController
{
protected $_repository;
/**
* @param RRI $repository
*/
public function __construct(RRI $repository)
{
$this->_repository = $repository;
@ -33,8 +38,8 @@ class ReminderController extends BaseController
*/
public function modalDialog()
{
$today = new Carbon;
$reminders = $this->_repository->get();
$today = new Carbon;
$reminders = $this->_repository->getPiggybankReminders();
/** @var \Reminder $reminder */
foreach ($reminders as $index => $reminder) {
@ -66,6 +71,8 @@ class ReminderController extends BaseController
/**
* @param Reminder $reminder
*
* @return $this|\Illuminate\Http\RedirectResponse
*/
public function redirect(\Reminder $reminder)
{
@ -83,6 +90,7 @@ class ReminderController extends BaseController
route('transactions.create', ['what' => 'transfer']) . '?' . http_build_query($parameters)
);
}
return View::make('error')->with('message', 'No such reminder.');
}

View File

@ -6,6 +6,8 @@ use Firefly\Storage\TransactionJournal\TransactionJournalRepositoryInterface as
/**
* Class TransactionController
*
* @SuppressWarnings(PHPMD.CamelCasePropertyName)
*/
class TransactionController extends BaseController
{
@ -30,18 +32,18 @@ class TransactionController extends BaseController
// get accounts with names and id's.
/** @var \Firefly\Storage\Account\AccountRepositoryInterface $accountRepository */
$accountRepository = App::make('Firefly\Storage\Account\AccountRepositoryInterface');
$accounts = $accountRepository->getActiveDefaultAsSelectList();
$accounts = $accountRepository->getActiveDefaultAsSelectList();
// get budgets as a select list.
/** @var \Firefly\Storage\Budget\BudgetRepositoryInterface $budgetRepository */
$budgetRepository = App::make('Firefly\Storage\Budget\BudgetRepositoryInterface');
$budgets = $budgetRepository->getAsSelectList();
$budgets[0] = '(no budget)';
$budgets = $budgetRepository->getAsSelectList();
$budgets[0] = '(no budget)';
// get the piggy banks.
/** @var \Firefly\Storage\Piggybank\PiggybankRepositoryInterface $piggyRepository */
$piggyRepository = App::make('Firefly\Storage\Piggybank\PiggybankRepositoryInterface');
$piggies = $piggyRepository->get();
$piggies = $piggyRepository->get();
return View::make('transactions.create')->with('accounts', $accounts)->with('budgets', $budgets)->with(
'what', $what
@ -88,18 +90,18 @@ class TransactionController extends BaseController
// get accounts with names and id's.
/** @var \Firefly\Storage\Account\AccountRepositoryInterface $accountRepository */
$accountRepository = App::make('Firefly\Storage\Account\AccountRepositoryInterface');
$accounts = $accountRepository->getActiveDefaultAsSelectList();
$accounts = $accountRepository->getActiveDefaultAsSelectList();
// get budgets as a select list.
/** @var \Firefly\Storage\Budget\BudgetRepositoryInterface $budgetRepository */
$budgetRepository = App::make('Firefly\Storage\Budget\BudgetRepositoryInterface');
$budgets = $budgetRepository->getAsSelectList();
$budgets[0] = '(no budget)';
$budgets = $budgetRepository->getAsSelectList();
$budgets[0] = '(no budget)';
// get the piggy banks.
/** @var \Firefly\Storage\Piggybank\PiggybankRepositoryInterface $piggyRepository */
$piggyRepository = App::make('Firefly\Storage\Piggybank\PiggybankRepositoryInterface');
$piggies = $piggyRepository->get();
$piggies = $piggyRepository->get();
// piggy bank id?
$piggyBankId = null;
foreach ($journal->transactions as $t) {
@ -107,7 +109,7 @@ class TransactionController extends BaseController
}
// data to properly display form:
$data = [
$data = [
'date' => $journal->date->format('Y-m-d'),
'category' => '',
'budget_id' => 0,
@ -119,23 +121,23 @@ class TransactionController extends BaseController
}
switch ($journal->transactiontype->type) {
case 'Withdrawal':
$data['account_id'] = $journal->transactions[0]->account->id;
$data['account_id'] = $journal->transactions[0]->account->id;
$data['beneficiary'] = $journal->transactions[1]->account->name;
$data['amount'] = floatval($journal->transactions[1]->amount);
$budget = $journal->budgets()->first();
$data['amount'] = floatval($journal->transactions[1]->amount);
$budget = $journal->budgets()->first();
if (!is_null($budget)) {
$data['budget_id'] = $budget->id;
}
break;
case 'Deposit':
$data['account_id'] = $journal->transactions[1]->account->id;
$data['account_id'] = $journal->transactions[1]->account->id;
$data['beneficiary'] = $journal->transactions[0]->account->name;
$data['amount'] = floatval($journal->transactions[1]->amount);
$data['amount'] = floatval($journal->transactions[1]->amount);
break;
case 'Transfer':
$data['account_from_id'] = $journal->transactions[1]->account->id;
$data['account_to_id'] = $journal->transactions[0]->account->id;
$data['amount'] = floatval($journal->transactions[1]->amount);
$data['account_to_id'] = $journal->transactions[0]->account->id;
$data['amount'] = floatval($journal->transactions[1]->amount);
break;
}
@ -150,15 +152,15 @@ class TransactionController extends BaseController
public function index()
{
$start = is_null(Input::get('startdate')) ? null : new Carbon(Input::get('startdate'));
$end = is_null(Input::get('enddate')) ? null : new Carbon(Input::get('enddate'));
$end = is_null(Input::get('enddate')) ? null : new Carbon(Input::get('enddate'));
if ($start <= $end && !is_null($start) && !is_null($end)) {
$journals = $this->_repository->paginate(25, $start, $end);
$filtered = true;
$filters = ['start' => $start, 'end' => $end];
$filters = ['start' => $start, 'end' => $end];
} else {
$journals = $this->_repository->paginate(25);
$filtered = false;
$filters = null;
$filters = null;
}
@ -192,12 +194,12 @@ class TransactionController extends BaseController
if (Input::get('reminder')) {
/** @var \Firefly\Storage\Reminder\ReminderRepositoryInterface $reminders */
$reminders = App::make('Firefly\Storage\Reminder\ReminderRepositoryInterface');
$reminder = $reminders->find(Input::get('reminder'));
$reminder = $reminders->find(Input::get('reminder'));
$reminders->deactivate($reminder);
}
// trigger the creation for recurring transactions.
Event::fire('journals.store',[$journal]);
Event::fire('journals.store', [$journal]);
if (Input::get('create') == '1') {
return Redirect::route('transactions.create', [$what])->withInput();
@ -226,7 +228,7 @@ class TransactionController extends BaseController
if ($journal->validate()) {
// has been saved, return to index:
Session::flash('success', 'Transaction updated!');
Event::fire('journals.update',[$journal]);
Event::fire('journals.update', [$journal]);
return Redirect::route('transactions.index');
} else {

View File

@ -17,7 +17,7 @@ class UserController extends BaseController
*/
public function __construct(URI $user, EHI $email)
{
$this->user = $user;
$this->user = $user;
$this->email = $email;
}
@ -41,11 +41,11 @@ class UserController extends BaseController
public function postLogin()
{
$rememberMe = Input::get('remember_me') == '1';
$data = [
$data = [
'email' => Input::get('email'),
'password' => Input::get('password')
];
$result = Auth::attempt($data, $rememberMe);
$result = Auth::attempt($data, $rememberMe);
if ($result) {
Session::flash('success', 'Logged in!');