Merge branch 'release/3.4.3'

This commit is contained in:
James Cole 2015-06-01 17:37:02 +02:00
commit b252b9da66
125 changed files with 1826 additions and 1561 deletions

View File

@ -17,4 +17,5 @@ EMAIL_USERNAME=
EMAIL_PASSWORD=
ANALYTICS_ID=
EMAIL_PRETEND=false
RUNCLEANUP=true
RUNCLEANUP=true
SITE_OWNER=mail@example.com

5
.scrutinizer.yml Normal file
View File

@ -0,0 +1,5 @@
# .scrutinizer.yml
tools:
external_code_coverage:
timeout: 1800 # Timeout in seconds.
runs: 2

View File

@ -18,3 +18,5 @@ after_script:
- php vendor/bin/coveralls
- CODECLIMATE_REPO_TOKEN=26489f9e854fcdf7e7660ba29c1455694685465b1f90329a79f7d2bf448acb61 ./vendor/bin/test-reporter --stdout > codeclimate.json
- "curl -X POST -d @codeclimate.json -H 'Content-Type: application/json' -H 'User-Agent: Code Climate (PHP Test Reporter v0.1.1)' https://codeclimate.com/test_reports"
- wget https://scrutinizer-ci.com/ocular.phar
- php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml

View File

@ -1,13 +1,9 @@
# Firefly III
#### 3.4.2
# Firefly III (v3.4.3)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/JC5/firefly-iii/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/JC5/firefly-iii/?branch=master)
[![Code Coverage](https://scrutinizer-ci.com/g/JC5/firefly-iii/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/JC5/firefly-iii/?branch=master)
[![Build Status](https://scrutinizer-ci.com/g/JC5/firefly-iii/badges/build.png?b=master)](https://scrutinizer-ci.com/g/JC5/firefly-iii/build-status/master)
[![Build Status](https://travis-ci.org/JC5/firefly-iii.svg?branch=develop)](https://travis-ci.org/JC5/firefly-iii)
[![Project Status](http://stillmaintained.com/JC5/firefly-iii.png?a=b)](http://stillmaintained.com/JC5/firefly-iii)
[![SensioLabsInsight](https://insight.sensiolabs.com/projects/d44c7012-5f50-41ad-add8-8445330e4102/mini.png)](https://insight.sensiolabs.com/projects/d44c7012-5f50-41ad-add8-8445330e4102)
[![Code Climate](https://codeclimate.com/github/JC5/firefly-iii/badges/gpa.svg)](https://codeclimate.com/github/JC5/firefly-iii)
[![Coverage Status](https://coveralls.io/repos/JC5/firefly-iii/badge.svg?branch=master)](https://coveralls.io/r/JC5/firefly-iii?branch=master)
[![Latest Stable Version](https://poser.pugx.org/grumpydictator/firefly-iii/v/stable.svg)](https://packagist.org/packages/grumpydictator/firefly-iii)
![GA](https://ga-beacon.appspot.com/UA-58172398-6/firefly-iii/readme)
## About
"Firefly III" is a financial manager. It can help you keep track of expenses, income, budgets and everything in between. It even supports credit cards, shared
@ -95,3 +91,9 @@ is adding translations.
Questions, ideas, bugs or other things to contribute? [Let me know](https://github.com/JC5/firefly-iii/issues/new)!
If you like this tool, feel free to [donate me some beer money](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=2ZMV952UUSCLU&lc=NL&item_name=Development%20of%20Firefly&currency_code=EUR&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHosted).
[![SensioLabsInsight](https://insight.sensiolabs.com/projects/d44c7012-5f50-41ad-add8-8445330e4102/mini.png)](https://insight.sensiolabs.com/projects/d44c7012-5f50-41ad-add8-8445330e4102)
[![Code Climate](https://codeclimate.com/github/JC5/firefly-iii/badges/gpa.svg)](https://codeclimate.com/github/JC5/firefly-iii)
[![Project Status](http://stillmaintained.com/JC5/firefly-iii.png?a=b)](http://stillmaintained.com/JC5/firefly-iii)
[![Latest Stable Version](https://poser.pugx.org/grumpydictator/firefly-iii/v/stable.svg)](https://packagist.org/packages/grumpydictator/firefly-iii)
![GA](https://ga-beacon.appspot.com/UA-58172398-6/firefly-iii/readme)

View File

@ -2,6 +2,7 @@
use Exception;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Symfony\Component\HttpKernel\Exception\HttpException;
/**
* Class Handler
@ -33,7 +34,7 @@ class Handler extends ExceptionHandler
*/
public function render($request, Exception $e)
{
if ($this->isHttpException($e)) {
if ($e instanceof HttpException) {
return $this->renderHttpException($e);
} else {
return parent::render($request, $e);

View File

@ -50,7 +50,7 @@ class UpdateJournalConnection
return;
}
$amount = $journal->amount;
$diff = $amount - $event->amount;// update current repetition
$diff = $amount - $event->amount; // update current repetition
$repetition->currentamount += $diff;
$repetition->save();

View File

@ -64,6 +64,7 @@ class BalanceLine
if ($this->getRole() == self::ROLE_DIFFROLE) {
return trans('firefly.leftUnbalanced');
}
return '';
}
/**

View File

@ -41,7 +41,7 @@ class Bill
public function getBills()
{
$this->bills->sortBy(
function (BillLine $bill) {
function(BillLine $bill) {
$active = intval($bill->getBill()->active) == 0 ? 1 : 0;
$name = $bill->getBill()->name;

View File

@ -55,7 +55,7 @@ class Category
public function getCategories()
{
$this->categories->sortByDesc(
function (CategoryModel $category) {
function(CategoryModel $category) {
return $category->spent;
}
);

View File

@ -67,7 +67,7 @@ class Expense
public function getExpenses()
{
$this->expenses->sortByDesc(
function (stdClass $object) {
function(stdClass $object) {
return $object->amount;
}
);

View File

@ -18,7 +18,7 @@ class Income
/** @var Collection */
protected $incomes;
/** @var float */
/** @var string */
protected $total;
/**
@ -68,7 +68,7 @@ class Income
public function getIncomes()
{
$this->incomes->sortByDesc(
function (stdClass $object) {
function(stdClass $object) {
return $object->amount;
}
);
@ -77,7 +77,7 @@ class Income
}
/**
* @return float
* @return string
*/
public function getTotal()
{

View File

@ -53,7 +53,7 @@ class ReportHelper implements ReportHelperInterface
* @param Carbon $end
* @param $shared
*
* @return Account
* @return AccountCollection
*/
public function getAccountReport(Carbon $date, Carbon $end, $shared)
{
@ -66,11 +66,12 @@ class ReportHelper implements ReportHelperInterface
// remove cash account, if any:
$accounts = $accounts->filter(
function (Account $account) {
function(Account $account) {
if ($account->accountType->type != 'Cash account') {
return $account;
}
} // @codeCoverageIgnore
return null;
}
);
// summarize:

View File

@ -3,10 +3,11 @@
namespace FireflyIII\Helpers\Report;
use Carbon\Carbon;
use FireflyIII\Helpers\Collection\Account;
use FireflyIII\Helpers\Collection\Account as AccountCollection;
use FireflyIII\Helpers\Collection\Balance;
use FireflyIII\Helpers\Collection\Budget as BudgetCollection;
use FireflyIII\Helpers\Collection\Category as CategoryCollection;
use FireflyIII\Helpers\Collection\Bill as BillCollection;
use FireflyIII\Helpers\Collection\Expense;
use FireflyIII\Helpers\Collection\Income;
@ -26,7 +27,7 @@ interface ReportHelperInterface
* @param Carbon $end
* @param boolean $shared
*
* @return Account
* @return AccountCollection
*/
public function getAccountReport(Carbon $date, Carbon $end, $shared);
@ -38,7 +39,7 @@ interface ReportHelperInterface
* @param Carbon $end
* @param boolean $shared
*
* @return Account
* @return BillCollection
*/
public function getBillReport(Carbon $start, Carbon $end, $shared);

View File

@ -35,15 +35,15 @@ class ReportQuery implements ReportQueryInterface
$query = $this->queryJournalsWithTransactions($start, $end);
if ($includeShared === false) {
$query->where(
function (Builder $query) {
function(Builder $query) {
$query->where(
function (Builder $q) { // only get withdrawals not from a shared account
function(Builder $q) { // only get withdrawals not from a shared account
$q->where('transaction_types.type', 'Withdrawal');
$q->where('acm_from.data', '!=', '"sharedAsset"');
}
);
$query->orWhere(
function (Builder $q) { // and transfers from a shared account.
function(Builder $q) { // and transfers from a shared account.
$q->where('transaction_types.type', 'Transfer');
$q->where('acm_to.data', '=', '"sharedAsset"');
}
@ -61,18 +61,19 @@ class ReportQuery implements ReportQueryInterface
);
$data->each(
function (TransactionJournal $journal) {
function(TransactionJournal $journal) {
if (intval($journal->account_encrypted) == 1) {
$journal->name = Crypt::decrypt($journal->name);
}
}
);
$data = $data->filter(
function (TransactionJournal $journal) {
function(TransactionJournal $journal) {
if ($journal->amount != 0) {
return $journal;
}
} // @codeCoverageIgnore
return null;
}
);
return $data;
@ -90,26 +91,26 @@ class ReportQuery implements ReportQueryInterface
public function getAllAccounts(Carbon $start, Carbon $end, $includeShared = false)
{
$query = Auth::user()->accounts()->orderBy('accounts.name', 'ASC')
->accountTypeIn(['Default account', 'Asset account', 'Cash account']);
->accountTypeIn(['Default account', 'Asset account', 'Cash account']);
if ($includeShared === false) {
$query->leftJoin(
'account_meta', function (JoinClause $join) {
'account_meta', function(JoinClause $join) {
$join->on('account_meta.account_id', '=', 'accounts.id')->where('account_meta.name', '=', 'accountRole');
}
)
->orderBy('accounts.name', 'ASC')
->where(
function (Builder $query) {
->orderBy('accounts.name', 'ASC')
->where(
function(Builder $query) {
$query->where('account_meta.data', '!=', '"sharedAsset"');
$query->orWhereNull('account_meta.data');
$query->where('account_meta.data', '!=', '"sharedAsset"');
$query->orWhereNull('account_meta.data');
}
);
}
);
}
$set = $query->get(['accounts.*']);
$set->each(
function (Account $account) use ($start, $end) {
function(Account $account) use ($start, $end) {
/**
* The balance for today always incorporates transactions
* made on today. So to get todays "start" balance, we sub one
@ -150,15 +151,15 @@ class ReportQuery implements ReportQueryInterface
// only get deposits not to a shared account
// and transfers to a shared account.
$query->where(
function (Builder $query) {
function(Builder $query) {
$query->where(
function (Builder $q) {
function(Builder $q) {
$q->where('transaction_types.type', 'Deposit');
$q->where('acm_to.data', '!=', '"sharedAsset"');
}
);
$query->orWhere(
function (Builder $q) {
function(Builder $q) {
$q->where('transaction_types.type', 'Transfer');
$q->where('acm_from.data', '=', '"sharedAsset"');
}
@ -177,18 +178,19 @@ class ReportQuery implements ReportQueryInterface
);
$data->each(
function (TransactionJournal $journal) {
function(TransactionJournal $journal) {
if (intval($journal->account_encrypted) == 1) {
$journal->name = Crypt::decrypt($journal->name);
}
}
);
$data = $data->filter(
function (TransactionJournal $journal) {
function(TransactionJournal $journal) {
if ($journal->amount != 0) {
return $journal;
}
} // @codeCoverageIgnore
return null;
}
);
return $data;
@ -208,16 +210,16 @@ class ReportQuery implements ReportQueryInterface
{
return floatval(
Auth::user()->transactionjournals()
->leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')
->leftJoin('budget_transaction_journal', 'budget_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id')
->transactionTypes(['Withdrawal'])
->where('transactions.account_id', $account->id)
->before($end)
->after($start)
->where('budget_transaction_journal.budget_id', $budget->id)
->get(['transaction_journals.*'])->sum('amount')
) * -1;
Auth::user()->transactionjournals()
->leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')
->leftJoin('budget_transaction_journal', 'budget_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id')
->transactionTypes(['Withdrawal'])
->where('transactions.account_id', $account->id)
->before($end)
->after($start)
->where('budget_transaction_journal.budget_id', $budget->id)
->get(['transaction_journals.*'])->sum('amount')
) * -1;
}
/**
@ -252,28 +254,28 @@ class ReportQuery implements ReportQueryInterface
{
$query = TransactionJournal::
leftJoin(
'transactions as t_from', function (JoinClause $join) {
'transactions as t_from', function(JoinClause $join) {
$join->on('t_from.transaction_journal_id', '=', 'transaction_journals.id')->where('t_from.amount', '<', 0);
}
)
->leftJoin('accounts as ac_from', 't_from.account_id', '=', 'ac_from.id')
->leftJoin(
'account_meta as acm_from', function (JoinClause $join) {
$join->on('ac_from.id', '=', 'acm_from.account_id')->where('acm_from.name', '=', 'accountRole');
}
)
->leftJoin(
'transactions as t_to', function (JoinClause $join) {
$join->on('t_to.transaction_journal_id', '=', 'transaction_journals.id')->where('t_to.amount', '>', 0);
}
)
->leftJoin('accounts as ac_to', 't_to.account_id', '=', 'ac_to.id')
->leftJoin(
'account_meta as acm_to', function (JoinClause $join) {
$join->on('ac_to.id', '=', 'acm_to.account_id')->where('acm_to.name', '=', 'accountRole');
}
)
->leftJoin('transaction_types', 'transaction_types.id', '=', 'transaction_journals.transaction_type_id');
->leftJoin('accounts as ac_from', 't_from.account_id', '=', 'ac_from.id')
->leftJoin(
'account_meta as acm_from', function(JoinClause $join) {
$join->on('ac_from.id', '=', 'acm_from.account_id')->where('acm_from.name', '=', 'accountRole');
}
)
->leftJoin(
'transactions as t_to', function(JoinClause $join) {
$join->on('t_to.transaction_journal_id', '=', 'transaction_journals.id')->where('t_to.amount', '>', 0);
}
)
->leftJoin('accounts as ac_to', 't_to.account_id', '=', 'ac_to.id')
->leftJoin(
'account_meta as acm_to', function(JoinClause $join) {
$join->on('ac_to.id', '=', 'acm_to.account_id')->where('acm_to.name', '=', 'accountRole');
}
)
->leftJoin('transaction_types', 'transaction_types.id', '=', 'transaction_journals.transaction_type_id');
$query->before($end)->after($start)->where('transaction_journals.user_id', Auth::user()->id);
return $query;

View File

@ -3,7 +3,6 @@
use Auth;
use Carbon\Carbon;
use Config;
use FireflyIII\Http\Requests;
use FireflyIII\Http\Requests\AccountFormRequest;
use FireflyIII\Models\Account;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
@ -95,7 +94,7 @@ class AccountController extends Controller
* @param AccountRepositoryInterface $repository
* @param Account $account
*
* @return View
* @return \Illuminate\View\View
*/
public function edit(AccountRepositoryInterface $repository, Account $account)
{
@ -140,7 +139,7 @@ class AccountController extends Controller
* @param AccountRepositoryInterface $repository
* @param $what
*
* @return View
* @return \Illuminate\View\View
*/
public function index(AccountRepositoryInterface $repository, $what)
{
@ -155,7 +154,7 @@ class AccountController extends Controller
$start = clone Session::get('start', Carbon::now()->startOfMonth());
$start->subDay();
$accounts->each(
function (Account $account) use ($start, $repository) {
function(Account $account) use ($start, $repository) {
$account->lastActivityDate = $repository->getLastActivity($account);
$account->startBalance = Steam::balance($account, $start);
$account->endBalance = Steam::balance($account, clone Session::get('end', Carbon::now()->endOfMonth()));
@ -169,7 +168,7 @@ class AccountController extends Controller
* @param AccountRepositoryInterface $repository
* @param Account $account
*
* @return View
* @return \Illuminate\View\View
*/
public function show(AccountRepositoryInterface $repository, Account $account)
{
@ -200,11 +199,11 @@ class AccountController extends Controller
'user' => Auth::user()->id,
'accountRole' => $request->input('accountRole'),
'openingBalance' => floatval($request->input('openingBalance')),
'openingBalanceDate' => new Carbon($request->input('openingBalanceDate')),
'openingBalanceDate' => new Carbon((string) $request->input('openingBalanceDate')),
'openingBalanceCurrency' => intval($request->input('balance_currency_id')),
];
$account = $repository->store($accountData);
$account = $repository->store($accountData);
Session::flash('success', 'New account "' . $account->name . '" stored!');
@ -226,7 +225,7 @@ class AccountController extends Controller
* @param AccountRepositoryInterface $repository
* @param Account $account
*
* @return $this|\Illuminate\Http\RedirectResponse
* @return \Illuminate\Http\RedirectResponse
*/
public function update(AccountFormRequest $request, AccountRepositoryInterface $repository, Account $account)
{
@ -238,7 +237,7 @@ class AccountController extends Controller
'accountRole' => $request->input('accountRole'),
'virtualBalance' => floatval($request->input('virtualBalance')),
'openingBalance' => floatval($request->input('openingBalance')),
'openingBalanceDate' => new Carbon($request->input('openingBalanceDate')),
'openingBalanceDate' => new Carbon((string) $request->input('openingBalanceDate')),
'openingBalanceCurrency' => intval($request->input('balance_currency_id')),
'ccType' => $request->input('ccType'),
'ccMonthlyPaymentDate' => $request->input('ccMonthlyPaymentDate'),
@ -252,7 +251,7 @@ class AccountController extends Controller
// set value so edit routine will not overwrite URL:
Session::put('accounts.edit.fromUpdate', true);
return Redirect::route('accounts.edit', $account->id)->withInput(['return_to_edit' => 1]);
return Redirect::route('accounts.edit', [$account->id])->withInput(['return_to_edit' => 1]);
}
// redirect to previous URL.

View File

@ -1,6 +1,9 @@
<?php namespace FireflyIII\Http\Controllers\Auth;
use App;
use FireflyIII\Http\Controllers\Controller;
use FireflyIII\Models\Role;
use FireflyIII\User;
use Illuminate\Contracts\Auth\Guard;
use Illuminate\Contracts\Auth\Registrar;
use Illuminate\Foundation\Auth\AuthenticatesAndRegistersUsers;
@ -67,7 +70,7 @@ class AuthController extends Controller
*
* @param Request $request
*
* @return \Illuminate\Http\Response
* @return \Illuminate\Http\RedirectResponse
*/
public function postRegister(Request $request)
{
@ -87,22 +90,34 @@ class AuthController extends Controller
$this->auth->login($this->registrar->create($data));
// get the email address
$email = $this->auth->user()->email;
if ($this->auth->user() instanceof User) {
$email = $this->auth->user()->email;
// send email.
Mail::send(
'emails.registered', [], function (Message $message) use ($email) {
$message->to($email, $email)->subject('Welcome to Firefly III!');
// send email.
Mail::send(
'emails.registered', [], function (Message $message) use ($email) {
$message->to($email, $email)->subject('Welcome to Firefly III!');
}
);
// set flash message
Session::flash('success', 'You have registered successfully!');
Session::flash('gaEventCategory', 'user');
Session::flash('gaEventAction', 'new-registration');
// first user ever?
if (User::count() == 1) {
$admin = Role::where('name', 'owner')->first();
$this->auth->user()->attachRole($admin);
// $this->auth->user()->roles()->save($admin);
}
return redirect($this->redirectPath());
}
);
App::abort(500, 'Not a user!');
// set flash message
Session::flash('success', 'You have registered successfully!');
Session::flash('gaEventCategory', 'user');
Session::flash('gaEventAction', 'new-registration');
return redirect($this->redirectPath());
return redirect('/');
}
}

View File

@ -1,10 +1,8 @@
<?php namespace FireflyIII\Http\Controllers;
use Config;
use FireflyIII\Http\Requests;
use FireflyIII\Http\Requests\BillFormRequest;
use FireflyIII\Models\Bill;
use FireflyIII\Models\Transaction;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\Repositories\Bill\BillRepositoryInterface;
use Input;
@ -32,7 +30,7 @@ class BillController extends Controller
}
/**
* @return $this
* @return \Illuminate\View\View
*/
public function create()
{
@ -53,7 +51,7 @@ class BillController extends Controller
/**
* @param Bill $bill
*
* @return $this
* @return \Illuminate\View\View
*/
public function delete(Bill $bill)
{
@ -85,7 +83,7 @@ class BillController extends Controller
/**
* @param Bill $bill
*
* @return $this
* @return \Illuminate\View\View
*/
public function edit(Bill $bill)
{
@ -112,7 +110,7 @@ class BillController extends Controller
{
$bills = $repository->getBills();
$bills->each(
function (Bill $bill) use ($repository) {
function(Bill $bill) use ($repository) {
$bill->nextExpectedMatch = $repository->nextExpectedMatch($bill);
$bill->lastFoundMatch = $repository->lastFoundMatch($bill);
}
@ -151,7 +149,7 @@ class BillController extends Controller
* @param BillRepositoryInterface $repository
* @param Bill $bill
*
* @return mixed
* @return \Illuminate\View\View
*/
public function show(BillRepositoryInterface $repository, Bill $bill)
{
@ -167,7 +165,7 @@ class BillController extends Controller
* @param BillFormRequest $request
* @param BillRepositoryInterface $repository
*
* @return $this|\Illuminate\Http\RedirectResponse
* @return \Illuminate\Http\RedirectResponse
*/
public function store(BillFormRequest $request, BillRepositoryInterface $repository)
{
@ -192,7 +190,7 @@ class BillController extends Controller
* @param BillRepositoryInterface $repository
* @param Bill $bill
*
* @return $this|\Illuminate\Http\RedirectResponse
* @return \Illuminate\Http\RedirectResponse
*/
public function update(BillFormRequest $request, BillRepositoryInterface $repository, Bill $bill)
{
@ -205,7 +203,7 @@ class BillController extends Controller
// set value so edit routine will not overwrite URL:
Session::put('bills.edit.fromUpdate', true);
return Redirect::route('bills.edit', $bill->id)->withInput(['return_to_edit' => 1]);
return Redirect::route('bills.edit', [$bill->id])->withInput(['return_to_edit' => 1]);
}
// redirect to previous URL.

View File

@ -3,7 +3,6 @@
use Amount;
use Auth;
use Carbon\Carbon;
use FireflyIII\Http\Requests;
use FireflyIII\Http\Requests\BudgetFormRequest;
use FireflyIII\Models\Budget;
use FireflyIII\Models\LimitRepetition;
@ -20,6 +19,7 @@ use View;
* Class BudgetController
*
* @package FireflyIII\Http\Controllers
* @SuppressWarnings(PHPMD.TooManyMethods)
*/
class BudgetController extends Controller
{
@ -55,7 +55,7 @@ class BudgetController extends Controller
}
/**
* @return $this
* @return \Illuminate\View\View
*/
public function create()
{
@ -110,7 +110,7 @@ class BudgetController extends Controller
/**
* @param Budget $budget
*
* @return $this
* @return \Illuminate\View\View
*/
public function edit(Budget $budget)
{
@ -131,7 +131,7 @@ class BudgetController extends Controller
/**
* @param BudgetRepositoryInterface $repository
*
* @return View
* @return \Illuminate\View\View
*/
public function index(BudgetRepositoryInterface $repository)
{
@ -173,7 +173,7 @@ class BudgetController extends Controller
/**
* @param BudgetRepositoryInterface $repository
*
* @return View
* @return \Illuminate\View\View
*/
public function noBudget(BudgetRepositoryInterface $repository)
{
@ -205,7 +205,7 @@ class BudgetController extends Controller
* @param Budget $budget
* @param LimitRepetition $repetition
*
* @return View
* @return \Illuminate\View\View
*/
public function show(BudgetRepositoryInterface $repository, Budget $budget, LimitRepetition $repetition = null)
{
@ -239,7 +239,7 @@ class BudgetController extends Controller
'name' => $request->input('name'),
'user' => Auth::user()->id,
];
$budget = $repository->store($budgetData);
$budget = $repository->store($budgetData);
Session::flash('success', 'New budget "' . $budget->name . '" stored!');
@ -260,7 +260,7 @@ class BudgetController extends Controller
* @param BudgetRepositoryInterface $repository
* @param Budget $budget
*
* @return $this|\Illuminate\Http\RedirectResponse
* @return \Illuminate\Http\RedirectResponse
*/
public function update(BudgetFormRequest $request, BudgetRepositoryInterface $repository, Budget $budget)
{
@ -277,7 +277,7 @@ class BudgetController extends Controller
// set value so edit routine will not overwrite URL:
Session::put('budgets.edit.fromUpdate', true);
return Redirect::route('budgets.edit', $budget->id)->withInput(['return_to_edit' => 1]);
return Redirect::route('budgets.edit', [$budget->id])->withInput(['return_to_edit' => 1]);
}
// redirect to previous URL.
@ -286,7 +286,7 @@ class BudgetController extends Controller
}
/**
* @return View
* @return \Illuminate\View\View
*/
public function updateIncome()
{

View File

@ -31,7 +31,7 @@ class CategoryController extends Controller
}
/**
* @return $this
* @return \Illuminate\View\View
*/
public function create()
{
@ -84,7 +84,7 @@ class CategoryController extends Controller
/**
* @param Category $category
*
* @return $this
* @return \Illuminate\View\View
*/
public function edit(Category $category)
{
@ -105,14 +105,14 @@ class CategoryController extends Controller
/**
* @param CategoryRepositoryInterface $repository
*
* @return $this
* @return \Illuminate\View\View
*/
public function index(CategoryRepositoryInterface $repository)
{
$categories = $repository->getCategories();
$categories->each(
function (Category $category) use ($repository) {
function(Category $category) use ($repository) {
$category->lastActivity = $repository->getLatestActivity($category);
}
);
@ -139,7 +139,7 @@ class CategoryController extends Controller
* @param CategoryRepositoryInterface $repository
* @param Category $category
*
* @return View
* @return \Illuminate\View\View
*/
public function show(CategoryRepositoryInterface $repository, Category $category)
{
@ -157,7 +157,7 @@ class CategoryController extends Controller
* @param CategoryFormRequest $request
* @param CategoryRepositoryInterface $repository
*
* @return mixed
* @return \Illuminate\Http\RedirectResponse
*/
public function store(CategoryFormRequest $request, CategoryRepositoryInterface $repository)
{
@ -165,7 +165,7 @@ class CategoryController extends Controller
'name' => $request->input('name'),
'user' => Auth::user()->id,
];
$category = $repository->store($categoryData);
$category = $repository->store($categoryData);
Session::flash('success', 'New category "' . $category->name . '" stored!');
@ -199,7 +199,7 @@ class CategoryController extends Controller
if (intval(Input::get('return_to_edit')) === 1) {
Session::put('categories.edit.fromUpdate', true);
return Redirect::route('categories.edit', $category->id);
return Redirect::route('categories.edit', [$category->id]);
}
// redirect to previous URL.

View File

@ -26,6 +26,10 @@ class AccountController extends Controller
* @param GChart $chart
* @param AccountRepositoryInterface $repository
*
* @param $year
* @param $month
* @param bool $shared
*
* @return \Symfony\Component\HttpFoundation\Response
*/
public function all(GChart $chart, AccountRepositoryInterface $repository, $year, $month, $shared = false)
@ -38,7 +42,6 @@ class AccountController extends Controller
/** @var Collection $accounts */
$accounts = $repository->getAccounts(['Default account', 'Asset account']);
if ($shared === false) {
// remove the shared accounts from the collection:
/** @var Account $account */
foreach ($accounts as $index => $account) {
if ($account->getMeta('accountRole') == 'sharedAsset') {
@ -71,7 +74,6 @@ class AccountController extends Controller
$chart->generate();
return Response::json($chart->getData());
}
/**

View File

@ -25,6 +25,8 @@ class BudgetController extends Controller
* @param GChart $chart
* @param BudgetRepositoryInterface $repository
* @param Budget $budget
*
* @return \Symfony\Component\HttpFoundation\Response
*/
public function budget(GChart $chart, BudgetRepositoryInterface $repository, Budget $budget)
{
@ -125,15 +127,15 @@ class BudgetController extends Controller
$overspent = $expenses > floatval($repetition->amount) ? $expenses - floatval($repetition->amount) : 0;
$allEntries->push(
[$budget->name . ' (' . $repetition->startdate->formatLocalized($this->monthAndDayFormat) . ')',
$left,
$spent,
$overspent
$left,
$spent,
$overspent
]
);
}
}
$noBudgetExpenses = $repository->getWithoutBudgetSum($start, $end);
$noBudgetExpenses = $repository->getWithoutBudgetSum($start, $end) * -1;
$allEntries->push([trans('firefly.noBudget'), 0, 0, $noBudgetExpenses]);
foreach ($allEntries as $entry) {

View File

@ -80,7 +80,7 @@ class CategoryController extends Controller
// sort by callback:
uasort(
$set,
function ($left, $right) {
function($left, $right) {
if ($left['sum'] == $right['sum']) {
return 0;
}

View File

@ -1,9 +1,8 @@
<?php namespace FireflyIII\Http\Controllers;
use Auth;
use Cache;
use FireflyIII\Http\Requests;
use FireflyIII\Http\Requests\CurrencyFormRequest;
use FireflyIII\Models\Transaction;
use FireflyIII\Models\TransactionCurrency;
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
use Input;
@ -109,8 +108,9 @@ class CurrencyController extends Controller
}
Session::flash('success', 'Currency "' . e($currency->name) . '" deleted');
$currency->delete();
if (Auth::user()->hasRole('owner')) {
$currency->delete();
}
return Redirect::to(Session::get('currency.delete.url'));
}
@ -148,6 +148,12 @@ class CurrencyController extends Controller
$currencies = $repository->get();
$defaultCurrency = $repository->getCurrencyByPreference(Preferences::get('currencyPreference', 'EUR'));
if (!Auth::user()->hasRole('owner')) {
Session::flash('warning', 'Please ask ' . env('SITE_OWNER') . ' to add, remove or edit currencies.');
}
return view('currency.index', compact('currencies', 'defaultCurrency'));
}
@ -160,11 +166,11 @@ class CurrencyController extends Controller
*/
public function store(CurrencyFormRequest $request, CurrencyRepositoryInterface $repository)
{
$data = $request->getCurrencyData();
$currency = $repository->store($data);
Session::flash('success', 'Currency "' . $currency->name . '" created');
$data = $request->getCurrencyData();
if (Auth::user()->hasRole('owner')) {
$currency = $repository->store($data);
Session::flash('success', 'Currency "' . $currency->name . '" created');
}
if (intval(Input::get('create_another')) === 1) {
Session::put('currency.create.fromStore', true);
@ -187,16 +193,17 @@ class CurrencyController extends Controller
*/
public function update(CurrencyFormRequest $request, CurrencyRepositoryInterface $repository, TransactionCurrency $currency)
{
$data = $request->getCurrencyData();
$currency = $repository->update($currency, $data);
$data = $request->getCurrencyData();
if (Auth::user()->hasRole('owner')) {
$currency = $repository->update($currency, $data);
}
Session::flash('success', 'Currency "' . e($currency->name) . '" updated.');
if (intval(Input::get('return_to_edit')) === 1) {
Session::put('currency.edit.fromUpdate', true);
return Redirect::route('currency.edit', $currency->id);
return Redirect::route('currency.edit', [$currency->id]);
}
// redirect to previous URL.

View File

@ -73,8 +73,8 @@ class HomeController extends Controller
if ($sum != 0) {
Session::flash(
'error', 'Your transactions are unbalanced. This means a'
. ' withdrawal, deposit or transfer was not stored properly. '
. 'Please check your accounts and transactions for errors.'
. ' withdrawal, deposit or transfer was not stored properly. '
. 'Please check your accounts and transactions for errors.'
);
}

View File

@ -4,7 +4,6 @@ use Amount;
use Carbon\Carbon;
use Config;
use ExpandedForm;
use FireflyIII\Http\Requests;
use FireflyIII\Http\Requests\PiggyBankFormRequest;
use FireflyIII\Models\PiggyBank;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
@ -18,6 +17,9 @@ use URL;
use View;
/**
*
* @SuppressWarnings(PHPMD.TooManyMethods)
*
* Class PiggyBankController
*
* @package FireflyIII\Http\Controllers
@ -135,11 +137,11 @@ class PiggyBankController extends Controller
$targetDate = $targetDate->format('Y-m-d');
}
$preFilled = ['name' => $piggyBank->name,
'account_id' => $piggyBank->account_id,
'targetamount' => $piggyBank->targetamount,
'targetdate' => $targetDate,
'reminder' => $piggyBank->reminder,
'remind_me' => intval($piggyBank->remind_me) == 1 && !is_null($piggyBank->reminder) ? true : false
'account_id' => $piggyBank->account_id,
'targetamount' => $piggyBank->targetamount,
'targetdate' => $targetDate,
'reminder' => $piggyBank->reminder,
'remind_me' => intval($piggyBank->remind_me) == 1 && !is_null($piggyBank->reminder) ? true : false
];
Session::flash('preFilled', $preFilled);
Session::flash('gaEventCategory', 'piggy-banks');
@ -237,11 +239,6 @@ class PiggyBankController extends Controller
// create event
$repository->createEvent($piggyBank, $amount);
/*
* Create event!
*/
//Event::fire('piggy_bank.addMoney', [$piggyBank, $amount]); // new and used.
Session::flash('success', 'Added ' . Amount::format($amount, false) . ' to "' . e($piggyBank->name) . '".');
} else {
Session::flash('error', 'Could not add ' . Amount::format($amount, false) . ' to "' . e($piggyBank->name) . '".');
@ -369,7 +366,7 @@ class PiggyBankController extends Controller
if (intval(Input::get('return_to_edit')) === 1) {
Session::put('piggy-banks.edit.fromUpdate', true);
return Redirect::route('piggy-banks.edit', $piggyBank->id);
return Redirect::route('piggy-banks.edit', [$piggyBank->id]);
}

View File

@ -31,7 +31,7 @@ class ReminderController extends Controller
];
Session::flash('_old_input', $data);
return Redirect::route('transactions.create', 'transfer');
return Redirect::route('transactions.create', ['transfer']);
}
/**

View File

@ -111,9 +111,11 @@ class TagController extends Controller
}
/**
* @param Tag $tag
* @param Tag $tag
*
* @return View
* @param TagRepositoryInterface $repository
*
* @return \Illuminate\View\View
*/
public function edit(Tag $tag, TagRepositoryInterface $repository)
{
@ -162,7 +164,7 @@ class TagController extends Controller
$state = $state == 'true' ? true : false;
Preferences::set('hideTagHelp', $state);
return Response::json(true);
return Response::json([true]);
}
/**
@ -198,7 +200,7 @@ class TagController extends Controller
*
* @param TagRepositoryInterface $repository
*
* @return $this|\Illuminate\Http\RedirectResponse
* @return \Illuminate\Http\RedirectResponse
*/
public function store(TagFormRequest $request, TagRepositoryInterface $repository)
{
@ -242,7 +244,7 @@ class TagController extends Controller
* @param TagRepositoryInterface $repository
* @param Tag $tag
*
* @return $this|\Illuminate\Http\RedirectResponse
* @return \Illuminate\Http\RedirectResponse
*/
public function update(TagFormRequest $request, TagRepositoryInterface $repository, Tag $tag)
{
@ -274,7 +276,7 @@ class TagController extends Controller
// set value so edit routine will not overwrite URL:
Session::put('tags.edit.fromUpdate', true);
return Redirect::route('tags.edit', $tag->id)->withInput(['return_to_edit' => 1]);
return Redirect::route('tags.edit', [$tag->id])->withInput(['return_to_edit' => 1]);
}
// redirect to previous URL.

View File

@ -5,7 +5,6 @@ use Carbon\Carbon;
use ExpandedForm;
use FireflyIII\Events\JournalCreated;
use FireflyIII\Events\JournalSaved;
use FireflyIII\Http\Requests;
use FireflyIII\Http\Requests\JournalFormRequest;
use FireflyIII\Models\Transaction;
use FireflyIII\Models\TransactionJournal;
@ -39,7 +38,7 @@ class TransactionController extends Controller
* @param AccountRepositoryInterface $repository
* @param string $what
*
* @return View
* @return \Illuminate\View\View
*/
public function create(AccountRepositoryInterface $repository, $what = 'deposit')
{
@ -76,7 +75,7 @@ class TransactionController extends Controller
*
* @param TransactionJournal $journal
*
* @return $this
* @return \Illuminate\View\View
*/
public function delete(TransactionJournal $journal)
{
@ -119,7 +118,7 @@ class TransactionController extends Controller
*/
public function edit(AccountRepositoryInterface $repository, TransactionJournal $journal)
{
$what = strtolower($journal->transactiontype->type);
$what = strtolower($journal->transactionType->type);
$accounts = ExpandedForm::makeSelectList($repository->getAccounts(['Default account', 'Asset account']));
$budgets = ExpandedForm::makeSelectList(Auth::user()->budgets()->get());
$budgets[0] = trans('form.noBudget');
@ -154,8 +153,8 @@ class TransactionController extends Controller
$preFilled['piggy_bank_id'] = $journal->piggyBankEvents()->orderBy('date', 'DESC')->first()->piggy_bank_id;
}
$preFilled['amount'] = $journal->actualAmount;
$preFilled['account_id'] = $journal->assetAccount->id;
$preFilled['amount'] = $journal->actual_amount;
$preFilled['account_id'] = $journal->asset_account->id;
$preFilled['expense_account'] = $transactions[0]->account->name;
$preFilled['revenue_account'] = $transactions[1]->account->name;
$preFilled['account_from_id'] = $transactions[1]->account->id;
@ -179,7 +178,7 @@ class TransactionController extends Controller
* @param JournalRepositoryInterface $repository
* @param $what
*
* @return View
* @return \Illuminate\View\View
*/
public function index(JournalRepositoryInterface $repository, $what)
{
@ -237,7 +236,7 @@ class TransactionController extends Controller
}
}
return Response::json(true);
return Response::json([true]);
}
@ -245,17 +244,17 @@ class TransactionController extends Controller
* @param JournalRepositoryInterface $repository
* @param TransactionJournal $journal
*
* @return $this
* @return \Illuminate\View\View
*/
public function show(JournalRepositoryInterface $repository, TransactionJournal $journal)
{
$journal->transactions->each(
function (Transaction $t) use ($journal, $repository) {
function(Transaction $t) use ($journal, $repository) {
$t->before = $repository->getAmountBefore($journal, $t);
$t->after = $t->before + $t->amount;
}
);
$subTitle = trans('firefly.' . $journal->transactiontype->type) . ' "' . e($journal->description) . '"';
$subTitle = trans('firefly.' . $journal->transactionType->type) . ' "' . e($journal->description) . '"';
return view('transactions.show', compact('journal', 'subTitle'));
}
@ -264,7 +263,7 @@ class TransactionController extends Controller
* @param JournalFormRequest $request
* @param JournalRepositoryInterface $repository
*
* @return $this|\Illuminate\Http\RedirectResponse
* @return \Illuminate\Http\RedirectResponse
*/
public function store(JournalFormRequest $request, JournalRepositoryInterface $repository)
{
@ -287,7 +286,7 @@ class TransactionController extends Controller
// set value so create routine will not overwrite URL:
Session::put('transactions.create.fromStore', true);
return Redirect::route('transactions.create', $request->input('what'))->withInput();
return Redirect::route('transactions.create', [$request->input('what')])->withInput();
}
// redirect to previous URL.
@ -301,7 +300,7 @@ class TransactionController extends Controller
* @param JournalRepositoryInterface $repository
* @param TransactionJournal $journal
*
* @return $this|\Illuminate\Http\RedirectResponse
* @return \Illuminate\Http\RedirectResponse
*/
public function update(JournalFormRequest $request, JournalRepositoryInterface $repository, TransactionJournal $journal)
{
@ -318,7 +317,7 @@ class TransactionController extends Controller
// set value so edit routine will not overwrite URL:
Session::put('transactions.edit.fromUpdate', true);
return Redirect::route('transactions.edit', $journal->id)->withInput(['return_to_edit' => 1]);
return Redirect::route('transactions.edit', [$journal->id])->withInput(['return_to_edit' => 1]);
}
// redirect to previous URL.

View File

@ -8,7 +8,6 @@ use FireflyIII\Models\Category;
use FireflyIII\Models\PiggyBank;
use FireflyIII\Models\Preference;
use FireflyIII\Models\Reminder;
use FireflyIII\Models\Transaction;
use FireflyIII\Models\TransactionJournal;
use Illuminate\Contracts\Auth\Guard;
use Illuminate\Http\Request;

View File

@ -7,6 +7,7 @@ use Carbon\Carbon;
use Closure;
use FireflyIII\Models\PiggyBank;
use FireflyIII\Models\Reminder;
use FireflyIII\User;
use Illuminate\Contracts\Auth\Guard;
use Illuminate\Http\Request;
use View;
@ -48,30 +49,33 @@ class Reminders
{
if ($this->auth->check() && !$request->isXmlHttpRequest()) {
// do reminders stuff.
$piggyBanks = $this->auth->user()->piggyBanks()->where('remind_me', 1)->get();
/** @var \FireflyIII\Helpers\Reminders\ReminderHelperInterface $helper */
$helper = App::make('FireflyIII\Helpers\Reminders\ReminderHelperInterface');
$reminders = [];
if ($this->auth->user() instanceof User) {
$piggyBanks = $this->auth->user()->piggyBanks()->where('remind_me', 1)->get();
/** @var \FireflyIII\Helpers\Reminders\ReminderHelperInterface $helper */
$helper = App::make('FireflyIII\Helpers\Reminders\ReminderHelperInterface');
/** @var PiggyBank $piggyBank */
foreach ($piggyBanks as $piggyBank) {
$helper->createReminders($piggyBank, new Carbon);
}
// delete invalid reminders
// this is a construction SQLITE cannot handle :(
if (env('DB_CONNECTION') != 'sqlite') {
Reminder::whereUserId($this->auth->user()->id)
->leftJoin('piggy_banks', 'piggy_banks.id', '=', 'remindersable_id')
->whereNull('piggy_banks.id')
->delete();
}
// get and list active reminders:
$reminders = $this->auth->user()->reminders()->today()->get();
$reminders->each(
function (Reminder $reminder) use ($helper) {
$reminder->description = $helper->getReminderText($reminder);
/** @var PiggyBank $piggyBank */
foreach ($piggyBanks as $piggyBank) {
$helper->createReminders($piggyBank, new Carbon);
}
);
// delete invalid reminders
// this is a construction SQLITE cannot handle :(
if (env('DB_CONNECTION') != 'sqlite') {
Reminder::whereUserId($this->auth->user()->id)
->leftJoin('piggy_banks', 'piggy_banks.id', '=', 'remindersable_id')
->whereNull('piggy_banks.id')
->delete();
}
// get and list active reminders:
$reminders = $this->auth->user()->reminders()->today()->get();
$reminders->each(
function (Reminder $reminder) use ($helper) {
$reminder->description = $helper->getReminderText($reminder);
}
);
}
View::share('reminders', $reminders);
}

View File

@ -2,6 +2,7 @@
namespace FireflyIII\Http\Requests;
use App;
use Auth;
use Carbon\Carbon;
use Exception;
@ -85,7 +86,7 @@ class JournalFormRequest extends Request
$rules['category'] = 'between:1,255';
break;
default:
throw new Exception('Cannot handle ' . $what);
App::abort(500, 'Cannot handle ' . $what);
break;
}

View File

@ -17,7 +17,7 @@ use FireflyIII\Models\TransactionJournal;
*/
Breadcrumbs::register(
'home',
function (Generator $breadcrumbs) {
function(Generator $breadcrumbs) {
$breadcrumbs->push(trans('breadcrumbs.home'), route('index'));
}
@ -25,7 +25,7 @@ Breadcrumbs::register(
Breadcrumbs::register(
'index',
function (Generator $breadcrumbs) {
function(Generator $breadcrumbs) {
$breadcrumbs->push(trans('breadcrumbs.home'), route('index'));
}
@ -34,87 +34,87 @@ Breadcrumbs::register(
// accounts
Breadcrumbs::register(
'accounts.index', function (Generator $breadcrumbs, $what) {
'accounts.index', function(Generator $breadcrumbs, $what) {
$breadcrumbs->parent('home');
$breadcrumbs->push(trans('breadcrumbs.' . strtolower(e($what)) . '_accounts'), route('accounts.index', $what));
$breadcrumbs->push(trans('breadcrumbs.' . strtolower(e($what)) . '_accounts'), route('accounts.index', [$what]));
}
);
Breadcrumbs::register(
'accounts.create', function (Generator $breadcrumbs, $what) {
'accounts.create', function(Generator $breadcrumbs, $what) {
$breadcrumbs->parent('accounts.index', $what);
$breadcrumbs->push(trans('breadcrumbs.new_' . strtolower(e($what)) . '_account'), route('accounts.create', $what));
$breadcrumbs->push(trans('breadcrumbs.new_' . strtolower(e($what)) . '_account'), route('accounts.create', [$what]));
}
);
Breadcrumbs::register(
'accounts.show', function (Generator $breadcrumbs, Account $account) {
'accounts.show', function(Generator $breadcrumbs, Account $account) {
$what = Config::get('firefly.shortNamesByFullName.' . $account->accountType->type);
$breadcrumbs->parent('accounts.index', $what);
$breadcrumbs->push(e($account->name), route('accounts.show', $account->id));
$breadcrumbs->push(e($account->name), route('accounts.show', [$account->id]));
}
);
Breadcrumbs::register(
'accounts.delete', function (Generator $breadcrumbs, Account $account) {
'accounts.delete', function(Generator $breadcrumbs, Account $account) {
$breadcrumbs->parent('accounts.show', $account);
$breadcrumbs->push(trans('breadcrumbs.delete_account', ['name' => e($account->name)]), route('accounts.delete', $account->id));
$breadcrumbs->push(trans('breadcrumbs.delete_account', ['name' => e($account->name)]), route('accounts.delete', [$account->id]));
}
);
Breadcrumbs::register(
'accounts.edit', function (Generator $breadcrumbs, Account $account) {
'accounts.edit', function(Generator $breadcrumbs, Account $account) {
$breadcrumbs->parent('accounts.show', $account);
$what = Config::get('firefly.shortNamesByFullName.' . $account->accountType->type);
$breadcrumbs->push(trans('breadcrumbs.edit_' . $what . '_account', ['name' => e($account->name)]), route('accounts.edit', $account->id));
$breadcrumbs->push(trans('breadcrumbs.edit_' . $what . '_account', ['name' => e($account->name)]), route('accounts.edit', [$account->id]));
}
);
// budgets.
Breadcrumbs::register(
'budgets.index', function (Generator $breadcrumbs) {
'budgets.index', function(Generator $breadcrumbs) {
$breadcrumbs->parent('home');
$breadcrumbs->push(trans('breadcrumbs.budgets'), route('budgets.index'));
}
);
Breadcrumbs::register(
'budgets.create', function (Generator $breadcrumbs) {
'budgets.create', function(Generator $breadcrumbs) {
$breadcrumbs->parent('budgets.index');
$breadcrumbs->push(trans('breadcrumbs.newBudget'), route('budgets.create'));
}
);
Breadcrumbs::register(
'budgets.edit', function (Generator $breadcrumbs, Budget $budget) {
'budgets.edit', function(Generator $breadcrumbs, Budget $budget) {
$breadcrumbs->parent('budgets.show', $budget);
$breadcrumbs->push(trans('breadcrumbs.edit_budget', ['name' => e($budget->name)]), route('budgets.edit', $budget->id));
$breadcrumbs->push(trans('breadcrumbs.edit_budget', ['name' => e($budget->name)]), route('budgets.edit', [$budget->id]));
}
);
Breadcrumbs::register(
'budgets.delete', function (Generator $breadcrumbs, Budget $budget) {
'budgets.delete', function(Generator $breadcrumbs, Budget $budget) {
$breadcrumbs->parent('budgets.show', $budget);
$breadcrumbs->push(trans('breadcrumbs.delete_budget', ['name' => e($budget->name)]), route('budgets.delete', $budget->id));
$breadcrumbs->push(trans('breadcrumbs.delete_budget', ['name' => e($budget->name)]), route('budgets.delete', [$budget->id]));
}
);
Breadcrumbs::register(
'budgets.noBudget', function (Generator $breadcrumbs, $subTitle) {
'budgets.noBudget', function(Generator $breadcrumbs, $subTitle) {
$breadcrumbs->parent('budgets.index');
$breadcrumbs->push($subTitle, route('budgets.noBudget'));
}
);
Breadcrumbs::register(
'budgets.show', function (Generator $breadcrumbs, Budget $budget, LimitRepetition $repetition = null) {
'budgets.show', function(Generator $breadcrumbs, Budget $budget, LimitRepetition $repetition = null) {
$breadcrumbs->parent('budgets.index');
$breadcrumbs->push(e($budget->name), route('budgets.show', $budget->id));
$breadcrumbs->push(e($budget->name), route('budgets.show', [$budget->id]));
if (!is_null($repetition) && !is_null($repetition->id)) {
$breadcrumbs->push(
Navigation::periodShow($repetition->startdate, $repetition->budgetlimit->repeat_freq), route('budgets.show', $budget->id, $repetition->id)
Navigation::periodShow($repetition->startdate, $repetition->budgetLimit->repeat_freq), route('budgets.show', [$budget->id, $repetition->id])
);
}
}
@ -122,41 +122,41 @@ Breadcrumbs::register(
// categories
Breadcrumbs::register(
'categories.index', function (Generator $breadcrumbs) {
'categories.index', function(Generator $breadcrumbs) {
$breadcrumbs->parent('home');
$breadcrumbs->push(trans('breadcrumbs.categories'), route('categories.index'));
}
);
Breadcrumbs::register(
'categories.create', function (Generator $breadcrumbs) {
'categories.create', function(Generator $breadcrumbs) {
$breadcrumbs->parent('categories.index');
$breadcrumbs->push(trans('breadcrumbs.newCategory'), route('categories.create'));
}
);
Breadcrumbs::register(
'categories.edit', function (Generator $breadcrumbs, Category $category) {
'categories.edit', function(Generator $breadcrumbs, Category $category) {
$breadcrumbs->parent('categories.show', $category);
$breadcrumbs->push(trans('breadcrumbs.edit_category', ['name' => e($category->name)]), route('categories.edit', $category->id));
$breadcrumbs->push(trans('breadcrumbs.edit_category', ['name' => e($category->name)]), route('categories.edit', [$category->id]));
}
);
Breadcrumbs::register(
'categories.delete', function (Generator $breadcrumbs, Category $category) {
'categories.delete', function(Generator $breadcrumbs, Category $category) {
$breadcrumbs->parent('categories.show', $category);
$breadcrumbs->push(trans('breadcrumbs.delete_category', ['name' => e($category->name)]), route('categories.delete', $category->id));
$breadcrumbs->push(trans('breadcrumbs.delete_category', ['name' => e($category->name)]), route('categories.delete', [$category->id]));
}
);
Breadcrumbs::register(
'categories.show', function (Generator $breadcrumbs, Category $category) {
'categories.show', function(Generator $breadcrumbs, Category $category) {
$breadcrumbs->parent('categories.index');
$breadcrumbs->push(e($category->name), route('categories.show', $category->id));
$breadcrumbs->push(e($category->name), route('categories.show', [$category->id]));
}
);
Breadcrumbs::register(
'categories.noCategory', function (Generator $breadcrumbs, $subTitle) {
'categories.noCategory', function(Generator $breadcrumbs, $subTitle) {
$breadcrumbs->parent('categories.index');
$breadcrumbs->push($subTitle, route('categories.noCategory'));
}
@ -164,64 +164,64 @@ Breadcrumbs::register(
// currencies.
Breadcrumbs::register(
'currency.index', function (Generator $breadcrumbs) {
'currency.index', function(Generator $breadcrumbs) {
$breadcrumbs->parent('home');
$breadcrumbs->push(trans('breadcrumbs.currencies'), route('currency.index'));
}
);
Breadcrumbs::register(
'currency.edit', function (Generator $breadcrumbs, TransactionCurrency $currency) {
'currency.edit', function(Generator $breadcrumbs, TransactionCurrency $currency) {
$breadcrumbs->parent('currency.index');
$breadcrumbs->push(trans('breadcrumbs.edit_currency', ['name' => e($currency->name)]), route('currency.edit', $currency->id));
$breadcrumbs->push(trans('breadcrumbs.edit_currency', ['name' => e($currency->name)]), route('currency.edit', [$currency->id]));
}
);
Breadcrumbs::register(
'currency.delete', function (Generator $breadcrumbs, TransactionCurrency $currency) {
'currency.delete', function(Generator $breadcrumbs, TransactionCurrency $currency) {
$breadcrumbs->parent('currency.index');
$breadcrumbs->push(trans('breadcrumbs.delete_currency', ['name' => e($currency->name)]), route('currency.delete', $currency->id));
$breadcrumbs->push(trans('breadcrumbs.delete_currency', ['name' => e($currency->name)]), route('currency.delete', [$currency->id]));
}
);
// piggy banks
Breadcrumbs::register(
'piggy-banks.index', function (Generator $breadcrumbs) {
'piggy-banks.index', function(Generator $breadcrumbs) {
$breadcrumbs->parent('home');
$breadcrumbs->push(trans('breadcrumbs.piggyBanks'), route('piggy-banks.index'));
}
);
Breadcrumbs::register(
'piggy-banks.create', function (Generator $breadcrumbs) {
'piggy-banks.create', function(Generator $breadcrumbs) {
$breadcrumbs->parent('piggy-banks.index');
$breadcrumbs->push(trans('breadcrumbs.newPiggyBank'), route('piggy-banks.create'));
}
);
Breadcrumbs::register(
'piggy-banks.edit', function (Generator $breadcrumbs, PiggyBank $piggyBank) {
'piggy-banks.edit', function(Generator $breadcrumbs, PiggyBank $piggyBank) {
$breadcrumbs->parent('piggy-banks.show', $piggyBank);
$breadcrumbs->push(trans('breadcrumbs.edit_piggyBank', ['name' => e($piggyBank->name)]), route('piggy-banks.edit', $piggyBank->id));
$breadcrumbs->push(trans('breadcrumbs.edit_piggyBank', ['name' => e($piggyBank->name)]), route('piggy-banks.edit', [$piggyBank->id]));
}
);
Breadcrumbs::register(
'piggy-banks.delete', function (Generator $breadcrumbs, PiggyBank $piggyBank) {
'piggy-banks.delete', function(Generator $breadcrumbs, PiggyBank $piggyBank) {
$breadcrumbs->parent('piggy-banks.show', $piggyBank);
$breadcrumbs->push(trans('breadcrumbs.delete_piggyBank', ['name' => e($piggyBank->name)]), route('piggy-banks.delete', $piggyBank->id));
$breadcrumbs->push(trans('breadcrumbs.delete_piggyBank', ['name' => e($piggyBank->name)]), route('piggy-banks.delete', [$piggyBank->id]));
}
);
Breadcrumbs::register(
'piggy-banks.show', function (Generator $breadcrumbs, PiggyBank $piggyBank) {
'piggy-banks.show', function(Generator $breadcrumbs, PiggyBank $piggyBank) {
$breadcrumbs->parent('piggy-banks.index');
$breadcrumbs->push(e($piggyBank->name), route('piggy-banks.show', $piggyBank->id));
$breadcrumbs->push(e($piggyBank->name), route('piggy-banks.show', [$piggyBank->id]));
}
);
// preferences
Breadcrumbs::register(
'preferences', function (Generator $breadcrumbs) {
'preferences', function(Generator $breadcrumbs) {
$breadcrumbs->parent('home');
$breadcrumbs->push(trans('breadcrumbs.preferences'), route('preferences'));
@ -230,14 +230,14 @@ Breadcrumbs::register(
// profile
Breadcrumbs::register(
'profile', function (Generator $breadcrumbs) {
'profile', function(Generator $breadcrumbs) {
$breadcrumbs->parent('home');
$breadcrumbs->push(trans('breadcrumbs.profile'), route('profile'));
}
);
Breadcrumbs::register(
'change-password', function (Generator $breadcrumbs) {
'change-password', function(Generator $breadcrumbs) {
$breadcrumbs->parent('profile');
$breadcrumbs->push(trans('breadcrumbs.changePassword'), route('change-password'));
@ -246,42 +246,42 @@ Breadcrumbs::register(
// bills
Breadcrumbs::register(
'bills.index', function (Generator $breadcrumbs) {
'bills.index', function(Generator $breadcrumbs) {
$breadcrumbs->parent('home');
$breadcrumbs->push(trans('breadcrumbs.bills'), route('bills.index'));
}
);
Breadcrumbs::register(
'bills.create', function (Generator $breadcrumbs) {
'bills.create', function(Generator $breadcrumbs) {
$breadcrumbs->parent('bills.index');
$breadcrumbs->push(trans('breadcrumbs.newBill'), route('bills.create'));
}
);
Breadcrumbs::register(
'bills.edit', function (Generator $breadcrumbs, Bill $bill) {
'bills.edit', function(Generator $breadcrumbs, Bill $bill) {
$breadcrumbs->parent('bills.show', $bill);
$breadcrumbs->push(trans('breadcrumbs.edit_bill', ['name' => e($bill->name)]), route('bills.edit', $bill->id));
$breadcrumbs->push(trans('breadcrumbs.edit_bill', ['name' => e($bill->name)]), route('bills.edit', [$bill->id]));
}
);
Breadcrumbs::register(
'bills.delete', function (Generator $breadcrumbs, Bill $bill) {
'bills.delete', function(Generator $breadcrumbs, Bill $bill) {
$breadcrumbs->parent('bills.show', $bill);
$breadcrumbs->push(trans('breadcrumbs.delete_bill', ['name' => e($bill->name)]), route('bills.delete', $bill->id));
$breadcrumbs->push(trans('breadcrumbs.delete_bill', ['name' => e($bill->name)]), route('bills.delete', [$bill->id]));
}
);
Breadcrumbs::register(
'bills.show', function (Generator $breadcrumbs, Bill $bill) {
'bills.show', function(Generator $breadcrumbs, Bill $bill) {
$breadcrumbs->parent('bills.index');
$breadcrumbs->push(e($bill->name), route('bills.show', $bill->id));
$breadcrumbs->push(e($bill->name), route('bills.show', [$bill->id]));
}
);
// reminders
Breadcrumbs::register(
'reminders.index', function (Generator $breadcrumbs) {
'reminders.index', function(Generator $breadcrumbs) {
$breadcrumbs->parent('home');
$breadcrumbs->push(trans('breadcrumbs.reminders'), route('reminders.index'));
@ -290,9 +290,9 @@ Breadcrumbs::register(
// reminders
Breadcrumbs::register(
'reminders.show', function (Generator $breadcrumbs, Reminder $reminder) {
'reminders.show', function(Generator $breadcrumbs, Reminder $reminder) {
$breadcrumbs->parent('reminders.index');
$breadcrumbs->push(trans('breadcrumbs.reminder', ['id' => e($reminder->id)]), route('reminders.show', $reminder->id));
$breadcrumbs->push(trans('breadcrumbs.reminder', ['id' => e($reminder->id)]), route('reminders.show', [$reminder->id]));
}
);
@ -300,26 +300,26 @@ Breadcrumbs::register(
// reports
Breadcrumbs::register(
'reports.index', function (Generator $breadcrumbs) {
'reports.index', function(Generator $breadcrumbs) {
$breadcrumbs->parent('home');
$breadcrumbs->push(trans('breadcrumbs.reports'), route('reports.index'));
}
);
Breadcrumbs::register(
'reports.year', function (Generator $breadcrumbs, Carbon $date, $shared) {
'reports.year', function(Generator $breadcrumbs, Carbon $date, $shared) {
$breadcrumbs->parent('reports.index');
if ($shared) {
$title = trans('breadcrumbs.yearly_report_shared', ['date' => $date->year]);
} else {
$title = trans('breadcrumbs.yearly_report', ['date' => $date->year]);
}
$breadcrumbs->push($title, route('reports.year', $date->year));
$breadcrumbs->push($title, route('reports.year', [$date->year]));
}
);
Breadcrumbs::register(
'reports.month', function (Generator $breadcrumbs, Carbon $date, $shared) {
'reports.month', function(Generator $breadcrumbs, Carbon $date, $shared) {
$breadcrumbs->parent('reports.year', $date, $shared);
if ($shared) {
@ -334,7 +334,7 @@ Breadcrumbs::register(
// search
Breadcrumbs::register(
'search', function (Generator $breadcrumbs, $query) {
'search', function(Generator $breadcrumbs, $query) {
$breadcrumbs->parent('home');
$breadcrumbs->push(trans('breadcrumbs.searchResult', ['query' => e($query)]), route('search'));
}
@ -342,73 +342,73 @@ Breadcrumbs::register(
// transactions
Breadcrumbs::register(
'transactions.index', function (Generator $breadcrumbs, $what) {
'transactions.index', function(Generator $breadcrumbs, $what) {
$breadcrumbs->parent('home');
$breadcrumbs->push(trans('breadcrumbs.' . $what . '_list'), route('transactions.index', $what));
$breadcrumbs->push(trans('breadcrumbs.' . $what . '_list'), route('transactions.index', [$what]));
}
);
Breadcrumbs::register(
'transactions.create', function (Generator $breadcrumbs, $what) {
'transactions.create', function(Generator $breadcrumbs, $what) {
$breadcrumbs->parent('transactions.index', $what);
$breadcrumbs->push(trans('breadcrumbs.create_' . e($what)), route('transactions.create', $what));
$breadcrumbs->push(trans('breadcrumbs.create_' . e($what)), route('transactions.create', [$what]));
}
);
Breadcrumbs::register(
'transactions.edit', function (Generator $breadcrumbs, TransactionJournal $journal) {
'transactions.edit', function(Generator $breadcrumbs, TransactionJournal $journal) {
$breadcrumbs->parent('transactions.show', $journal);
$breadcrumbs->push(trans('breadcrumbs.edit_journal', ['description' => $journal->description]), route('transactions.edit', $journal->id));
$breadcrumbs->push(trans('breadcrumbs.edit_journal', ['description' => $journal->description]), route('transactions.edit', [$journal->id]));
}
);
Breadcrumbs::register(
'transactions.delete', function (Generator $breadcrumbs, TransactionJournal $journal) {
'transactions.delete', function(Generator $breadcrumbs, TransactionJournal $journal) {
$breadcrumbs->parent('transactions.show', $journal);
$breadcrumbs->push(trans('breadcrumbs.delete_journal', ['description' => e($journal->description)]), route('transactions.delete', $journal->id));
$breadcrumbs->push(trans('breadcrumbs.delete_journal', ['description' => e($journal->description)]), route('transactions.delete', [$journal->id]));
}
);
Breadcrumbs::register(
'transactions.show', function (Generator $breadcrumbs, TransactionJournal $journal) {
'transactions.show', function(Generator $breadcrumbs, TransactionJournal $journal) {
$breadcrumbs->parent('transactions.index', strtolower($journal->transactionType->type));
$breadcrumbs->push($journal->description, route('transactions.show', $journal->id));
$breadcrumbs->push($journal->description, route('transactions.show', [$journal->id]));
}
);
// tags
Breadcrumbs::register(
'tags.index', function (Generator $breadcrumbs) {
'tags.index', function(Generator $breadcrumbs) {
$breadcrumbs->parent('home');
$breadcrumbs->push(trans('breadcrumbs.tags'), route('tags.index'));
}
);
Breadcrumbs::register(
'tags.create', function (Generator $breadcrumbs) {
'tags.create', function(Generator $breadcrumbs) {
$breadcrumbs->parent('tags.index');
$breadcrumbs->push(trans('breadcrumbs.createTag'), route('tags.create'));
}
);
Breadcrumbs::register(
'tags.edit', function (Generator $breadcrumbs, Tag $tag) {
'tags.edit', function(Generator $breadcrumbs, Tag $tag) {
$breadcrumbs->parent('tags.show', $tag);
$breadcrumbs->push(trans('breadcrumbs.edit_tag', ['tag' => e($tag->tag)]), route('tags.edit', $tag->id));
$breadcrumbs->push(trans('breadcrumbs.edit_tag', ['tag' => e($tag->tag)]), route('tags.edit', [$tag->id]));
}
);
Breadcrumbs::register(
'tags.delete', function (Generator $breadcrumbs, Tag $tag) {
'tags.delete', function(Generator $breadcrumbs, Tag $tag) {
$breadcrumbs->parent('tags.show', $tag);
$breadcrumbs->push(trans('breadcrumbs.delete_tag', ['tag' => e($tag->tag)]), route('tags.delete', $tag->id));
$breadcrumbs->push(trans('breadcrumbs.delete_tag', ['tag' => e($tag->tag)]), route('tags.delete', [$tag->id]));
}
);
Breadcrumbs::register(
'tags.show', function (Generator $breadcrumbs, Tag $tag) {
'tags.show', function(Generator $breadcrumbs, Tag $tag) {
$breadcrumbs->parent('tags.index');
$breadcrumbs->push(e($tag->tag), route('tags.show', $tag->id));
$breadcrumbs->push(e($tag->tag), route('tags.show', [$tag->id]));
}
);

View File

@ -13,16 +13,15 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
// models
/** @noinspection PhpUnusedParameterInspection */
Route::bind(
'account',
function ($value, $route) {
function($value) {
if (Auth::check()) {
$object = Account::leftJoin('account_types', 'account_types.id', '=', 'accounts.account_type_id')
->where('account_types.editable', 1)
->where('accounts.id', $value)
->where('user_id', Auth::user()->id)
->first(['accounts.*']);
->where('account_types.editable', 1)
->where('accounts.id', $value)
->where('user_id', Auth::user()->id)
->first(['accounts.*']);
if ($object) {
return $object;
}
@ -31,9 +30,8 @@ Route::bind(
}
);
/** @noinspection PhpUnusedParameterInspection */
Route::bind(
'tj', function ($value, $route) {
'tj', function($value) {
if (Auth::check()) {
$object = TransactionJournal::where('id', $value)->where('user_id', Auth::user()->id)->first();
if ($object) {
@ -45,9 +43,8 @@ Route::bind(
}
);
/** @noinspection PhpUnusedParameterInspection */
Route::bind(
'currency', function ($value, $route) {
'currency', function($value) {
if (Auth::check()) {
$object = TransactionCurrency::find($value);
if ($object) {
@ -58,9 +55,8 @@ Route::bind(
}
);
/** @noinspection PhpUnusedParameterInspection */
Route::bind(
'bill', function ($value, $route) {
'bill', function($value) {
if (Auth::check()) {
$object = Bill::where('id', $value)->where('user_id', Auth::user()->id)->first();
if ($object) {
@ -72,9 +68,8 @@ Route::bind(
}
);
/** @noinspection PhpUnusedParameterInspection */
Route::bind(
'budget', function ($value, $route) {
'budget', function($value) {
if (Auth::check()) {
$object = Budget::where('id', $value)->where('user_id', Auth::user()->id)->first();
if ($object) {
@ -86,9 +81,8 @@ Route::bind(
}
);
/** @noinspection PhpUnusedParameterInspection */
Route::bind(
'reminder', function ($value, $route) {
'reminder', function($value) {
if (Auth::check()) {
$object = Reminder::where('id', $value)->where('user_id', Auth::user()->id)->first();
if ($object) {
@ -100,15 +94,14 @@ Route::bind(
}
);
/** @noinspection PhpUnusedParameterInspection */
Route::bind(
'limitrepetition', function ($value, $route) {
'limitrepetition', function($value) {
if (Auth::check()) {
$object = LimitRepetition::where('limit_repetitions.id', $value)
->leftjoin('budget_limits', 'budget_limits.id', '=', 'limit_repetitions.budget_limit_id')
->leftJoin('budgets', 'budgets.id', '=', 'budget_limits.budget_id')
->where('budgets.user_id', Auth::user()->id)
->first(['limit_repetitions.*']);
->leftjoin('budget_limits', 'budget_limits.id', '=', 'limit_repetitions.budget_limit_id')
->leftJoin('budgets', 'budgets.id', '=', 'budget_limits.budget_id')
->where('budgets.user_id', Auth::user()->id)
->first(['limit_repetitions.*']);
if ($object) {
return $object;
}
@ -118,14 +111,13 @@ Route::bind(
}
);
/** @noinspection PhpUnusedParameterInspection */
Route::bind(
'piggyBank', function ($value, $route) {
'piggyBank', function($value) {
if (Auth::check()) {
$object = PiggyBank::where('piggy_banks.id', $value)
->leftJoin('accounts', 'accounts.id', '=', 'piggy_banks.account_id')
->where('accounts.user_id', Auth::user()->id)
->first(['piggy_banks.*']);
->leftJoin('accounts', 'accounts.id', '=', 'piggy_banks.account_id')
->where('accounts.user_id', Auth::user()->id)
->first(['piggy_banks.*']);
if ($object) {
return $object;
}
@ -135,9 +127,8 @@ Route::bind(
}
);
/** @noinspection PhpUnusedParameterInspection */
Route::bind(
'category', function ($value, $route) {
'category', function($value) {
if (Auth::check()) {
$object = Category::where('id', $value)->where('user_id', Auth::user()->id)->first();
if ($object) {
@ -151,7 +142,7 @@ Route::bind(
/** @noinspection PhpUnusedParameterInspection */
Route::bind(
'reminder', function ($value, $route) {
'reminder', function($value) {
if (Auth::check()) {
/** @var \FireflyIII\Models\Reminder $object */
$object = Reminder::find($value);
@ -166,9 +157,8 @@ Route::bind(
}
);
/** @noinspection PhpUnusedParameterInspection */
Route::bind(
'tag', function ($value, $route) {
'tag', function($value) {
if (Auth::check()) {
$object = Tag::where('id', $value)->where('user_id', Auth::user()->id)->first();
if ($object) {
@ -199,7 +189,7 @@ Route::get('/routes', ['uses' => 'HomeController@routes', 'as' => 'routes']);
* Home Controller
*/
Route::group(
['middleware' => ['auth', 'range', 'reminders']], function () {
['middleware' => ['auth', 'range', 'reminders']], function() {
Route::get('/', ['uses' => 'HomeController@index', 'as' => 'index', 'middleware' => 'cleanup']);
Route::get('/home', ['uses' => 'HomeController@index', 'as' => 'home']);
Route::post('/daterange', ['uses' => 'HomeController@dateRange', 'as' => 'daterange']);

View File

@ -11,6 +11,43 @@ use Watson\Validating\ValidatingTrait;
* Class Account
*
* @package FireflyIII\Models
* @property integer $id
* @property \Carbon\Carbon $created_at
* @property \Carbon\Carbon $updated_at
* @property \Carbon\Carbon $deleted_at
* @property integer $user_id
* @property integer $account_type_id
* @property string $name
* @property boolean $active
* @property boolean $encrypted
* @property float $virtual_balance
* @property string $virtual_balance_encrypted
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\AccountMeta[] $accountMeta
* @property-read \FireflyIII\Models\AccountType $accountType
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\PiggyBank[] $piggyBanks
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Transaction[] $transactions
* @property-read \FireflyIII\User $user
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Account whereId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Account whereCreatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Account whereUpdatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Account whereDeletedAt($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Account whereUserId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Account whereAccountTypeId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Account whereName($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Account whereActive($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Account whereEncrypted($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Account whereVirtualBalance($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Account whereVirtualBalanceEncrypted($value)
* @method static \FireflyIII\Models\Account accountTypeIn($types)
* @method static \FireflyIII\Models\Account hasMetaValue($name, $value)
* @property boolean joinedAccountTypes
* @property mixed startBalance
* @property mixed endBalance
* @property mixed lastActivityDate
* @property mixed piggyBalance
* @property mixed difference
* @propery mixed percentage
*
*/
class Account extends Model
{
@ -100,7 +137,7 @@ class Account extends Model
/**
* @codeCoverageIgnore
* @return array
* @return string[]
*/
public function getDates()
{
@ -109,7 +146,7 @@ class Account extends Model
/**
*
* @param $fieldName
* @param string $fieldName
*
* @codeCoverageIgnore
*
@ -179,7 +216,7 @@ class Account extends Model
{
$joinName = str_replace('.', '_', $name);
$query->leftJoin(
'account_meta as ' . $joinName, function (JoinClause $join) use ($joinName, $name) {
'account_meta as ' . $joinName, function(JoinClause $join) use ($joinName, $name) {
$join->on($joinName . '.account_id', '=', 'accounts.id')->where($joinName . '.name', '=', $name);
}
);

View File

@ -6,8 +6,21 @@ use Watson\Validating\ValidatingTrait;
/**
* Class AccountMeta
*
* @codeCoverageIgnore
* @codeCoverageIgnore
* @package FireflyIII\Models
* @property integer $id
* @property \Carbon\Carbon $created_at
* @property \Carbon\Carbon $updated_at
* @property integer $account_id
* @property string $name
* @property string $data
* @property-read \FireflyIII\Models\Account $account
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\AccountMeta whereId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\AccountMeta whereCreatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\AccountMeta whereUpdatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\AccountMeta whereAccountId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\AccountMeta whereName($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\AccountMeta whereData($value)
*/
class AccountMeta extends Model
{
@ -20,7 +33,7 @@ class AccountMeta extends Model
'name' => 'required|between:1,100',
'data' => 'required'
];
protected $table = 'account_meta';
protected $table = 'account_meta';
/**
*

View File

@ -5,8 +5,19 @@ use Illuminate\Database\Eloquent\Model;
/**
* Class AccountType
*
* @codeCoverageIgnore
* @codeCoverageIgnore
* @package FireflyIII\Models
* @property integer $id
* @property \Carbon\Carbon $created_at
* @property \Carbon\Carbon $updated_at
* @property string $type
* @property boolean $editable
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Account[] $accounts
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\AccountType whereId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\AccountType whereCreatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\AccountType whereUpdatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\AccountType whereType($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\AccountType whereEditable($value)
*/
class AccountType extends Model
{

View File

@ -4,16 +4,54 @@ use Crypt;
use Illuminate\Database\Eloquent\Model;
/**
* @codeCoverageIgnore
* Class Bill
* FireflyIII\Models\Bill
*
* @codeCoverageIgnore Class Bill
* @package FireflyIII\Models
* @property integer $id
* @property \Carbon\Carbon $created_at
* @property \Carbon\Carbon $updated_at
* @property integer $user_id
* @property string $name
* @property string $match
* @property float $amount_min
* @property string $amount_min_encrypted
* @property float $amount_max
* @property string $amount_max_encrypted
* @property \Carbon\Carbon $date
* @property boolean $active
* @property boolean $automatch
* @property string $repeat_freq
* @property integer $skip
* @property boolean $name_encrypted
* @property boolean $match_encrypted
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\TransactionJournal[] $transactionjournals
* @property-read \FireflyIII\User $user
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Bill whereId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Bill whereCreatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Bill whereUpdatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Bill whereUserId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Bill whereName($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Bill whereMatch($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Bill whereAmountMin($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Bill whereAmountMinEncrypted($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Bill whereAmountMax($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Bill whereAmountMaxEncrypted($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Bill whereDate($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Bill whereActive($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Bill whereAutomatch($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Bill whereRepeatFreq($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Bill whereSkip($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Bill whereNameEncrypted($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Bill whereMatchEncrypted($value)
* @property mixed nextExpectedMatch
* @property mixed lastFoundMatch
*/
class Bill extends Model
{
protected $fillable
= ['name', 'match', 'amount_min', 'match_encrypted', 'name_encrypted', 'user_id', 'amount_max', 'date', 'repeat_freq', 'skip', 'automatch', 'active',];
= ['name', 'match', 'amount_min', 'match_encrypted', 'name_encrypted', 'user_id', 'amount_max', 'date', 'repeat_freq', 'skip', 'automatch', 'active', ];
protected $hidden = ['amount_min_encrypted', 'amount_max_encrypted', 'name_encrypted', 'match_encrypted'];

View File

@ -7,8 +7,27 @@ use Illuminate\Database\Eloquent\SoftDeletes;
/**
* Class Budget
*
* @codeCoverageIgnore
* @codeCoverageIgnore
* @package FireflyIII\Models
* @property integer $id
* @property \Carbon\Carbon $created_at
* @property \Carbon\Carbon $updated_at
* @property \Carbon\Carbon $deleted_at
* @property string $name
* @property integer $user_id
* @property boolean $active
* @property boolean $encrypted
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\BudgetLimit[] $budgetlimits
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\TransactionJournal[] $transactionjournals
* @property-read \FireflyIII\User $user
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Budget whereId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Budget whereCreatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Budget whereUpdatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Budget whereDeletedAt($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Budget whereName($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Budget whereUserId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Budget whereActive($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Budget whereEncrypted($value)
*/
class Budget extends Model
{

View File

@ -5,8 +5,28 @@ use Illuminate\Database\Eloquent\Model;
/**
* Class BudgetLimit
*
* @codeCoverageIgnore
* @codeCoverageIgnore
* @package FireflyIII\Models
* @property integer $id
* @property \Carbon\Carbon $created_at
* @property \Carbon\Carbon $updated_at
* @property integer $budget_id
* @property \Carbon\Carbon $startdate
* @property float $amount
* @property string $amount_encrypted
* @property boolean $repeats
* @property string $repeat_freq
* @property-read \FireflyIII\Models\Budget $budget
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\LimitRepetition[] $limitrepetitions
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\BudgetLimit whereId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\BudgetLimit whereCreatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\BudgetLimit whereUpdatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\BudgetLimit whereBudgetId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\BudgetLimit whereStartdate($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\BudgetLimit whereAmount($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\BudgetLimit whereAmountEncrypted($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\BudgetLimit whereRepeats($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\BudgetLimit whereRepeatFreq($value)
*/
class BudgetLimit extends Model
{

View File

@ -7,8 +7,25 @@ use Illuminate\Database\Eloquent\SoftDeletes;
/**
* Class Category
*
*
* @package FireflyIII\Models
* @property integer $id
* @property \Carbon\Carbon $created_at
* @property \Carbon\Carbon $updated_at
* @property \Carbon\Carbon $deleted_at
* @property string $name
* @property integer $user_id
* @property boolean $encrypted
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\TransactionJournal[] $transactionjournals
* @property-read \FireflyIII\User $user
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Category whereId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Category whereCreatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Category whereUpdatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Category whereDeletedAt($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Category whereName($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Category whereUserId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Category whereEncrypted($value)
* @property mixed spent
* @property mixed lastActivity
*/
class Category extends Model
{
@ -21,7 +38,7 @@ class Category extends Model
* @param array $fields
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*
* @return Account|null
* @return Category
*/
public static function firstOrCreateEncrypted(array $fields)
{
@ -48,7 +65,7 @@ class Category extends Model
/**
* @codeCoverageIgnore
* @return array
* @return string[]
*/
public function getDates()
{

View File

@ -6,8 +6,22 @@ use Illuminate\Database\Eloquent\SoftDeletes;
/**
* Class Component
*
* @codeCoverageIgnore
* @codeCoverageIgnore
* @package FireflyIII\Models
* @property integer $id
* @property \Carbon\Carbon $created_at
* @property \Carbon\Carbon $updated_at
* @property \Carbon\Carbon $deleted_at
* @property string $name
* @property integer $user_id
* @property string $class
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Component whereId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Component whereCreatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Component whereUpdatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Component whereDeletedAt($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Component whereName($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Component whereUserId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Component whereClass($value)
*/
class Component extends Model
{

View File

@ -5,9 +5,25 @@ use Illuminate\Database\Eloquent\Model;
/**
* Class LimitRepetition
*
* @codeCoverageIgnore
*
* @codeCoverageIgnore
* @package FireflyIII\Models
* @property integer $id
* @property \Carbon\Carbon $created_at
* @property \Carbon\Carbon $updated_at
* @property integer $budget_limit_id
* @property \Carbon\Carbon $startdate
* @property \Carbon\Carbon $enddate
* @property float $amount
* @property string $amount_encrypted
* @property-read \FireflyIII\Models\BudgetLimit $budgetLimit
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\LimitRepetition whereId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\LimitRepetition whereCreatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\LimitRepetition whereUpdatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\LimitRepetition whereBudgetLimitId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\LimitRepetition whereStartdate($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\LimitRepetition whereEnddate($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\LimitRepetition whereAmount($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\LimitRepetition whereAmountEncrypted($value)
*/
class LimitRepetition extends Model
{

14
app/Models/Permission.php Normal file
View File

@ -0,0 +1,14 @@
<?php
namespace FireflyIII\Models;
use Zizaco\Entrust\EntrustPermission;
/**
* Class Permission
*
* @package FireflyIII\Models
*/
class Permission extends EntrustPermission
{
}

View File

@ -7,16 +7,50 @@ use Illuminate\Database\Eloquent\SoftDeletes;
/**
* Class PiggyBank
*
* @codeCoverageIgnore
*
* @codeCoverageIgnore
* @package FireflyIII\Models
* @property integer $id
* @property \Carbon\Carbon $created_at
* @property \Carbon\Carbon $updated_at
* @property \Carbon\Carbon $deleted_at
* @property integer $account_id
* @property string $name
* @property float $targetamount
* @property string $targetamount_encrypted
* @property \Carbon\Carbon $startdate
* @property \Carbon\Carbon $targetdate
* @property string $reminder
* @property integer $reminder_skip
* @property boolean $remind_me
* @property integer $order
* @property boolean $encrypted
* @property-read \FireflyIII\Models\Account $account
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\PiggyBankRepetition[] $piggyBankRepetitions
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\PiggyBankEvent[] $piggyBankEvents
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Reminder[] $reminders
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBank whereId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBank whereCreatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBank whereUpdatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBank whereDeletedAt($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBank whereAccountId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBank whereName($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBank whereTargetamount($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBank whereTargetamountEncrypted($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBank whereStartdate($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBank whereTargetdate($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBank whereReminder($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBank whereReminderSkip($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBank whereRemindMe($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBank whereOrder($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBank whereEncrypted($value)
* @property PiggyBankRepetition currentRep
*/
class PiggyBank extends Model
{
use SoftDeletes;
protected $fillable
= ['name', 'account_id', 'order', 'reminder_skip', 'targetamount', 'startdate', 'targetdate', 'reminder', 'remind_me'];
= ['name', 'account_id', 'order', 'reminder_skip', 'targetamount', 'startdate', 'targetdate', 'reminder', 'remind_me'];
protected $hidden = ['targetamount_encrypted', 'encrypted'];
/**
@ -55,7 +89,7 @@ class PiggyBank extends Model
}
/**
* @return array
* @return string[]
*/
public function getDates()
{
@ -82,7 +116,7 @@ class PiggyBank extends Model
*
* @param $value
*
* @return int
* @return boolean
*/
public function getRemindMeAttribute($value)
{

View File

@ -5,9 +5,26 @@ use Illuminate\Database\Eloquent\Model;
/**
* Class PiggyBankEvent
*
* @codeCoverageIgnore
*
* @codeCoverageIgnore
* @package FireflyIII\Models
* @property integer $id
* @property \Carbon\Carbon $created_at
* @property \Carbon\Carbon $updated_at
* @property integer $piggy_bank_id
* @property integer $transaction_journal_id
* @property \Carbon\Carbon $date
* @property float $amount
* @property string $amount_encrypted
* @property-read \FireflyIII\Models\PiggyBank $piggyBank
* @property-read \FireflyIII\Models\TransactionJournal $transactionJournal
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBankEvent whereId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBankEvent whereCreatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBankEvent whereUpdatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBankEvent wherePiggyBankId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBankEvent whereTransactionJournalId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBankEvent whereDate($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBankEvent whereAmount($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBankEvent whereAmountEncrypted($value)
*/
class PiggyBankEvent extends Model
{

View File

@ -7,8 +7,27 @@ use Illuminate\Database\Eloquent\Model;
/**
* Class PiggyBankRepetition
*
* @codeCoverageIgnore
* @codeCoverageIgnore
* @package FireflyIII\Models
* @property integer $id
* @property \Carbon\Carbon $created_at
* @property \Carbon\Carbon $updated_at
* @property integer $piggy_bank_id
* @property \Carbon\Carbon $startdate
* @property \Carbon\Carbon $targetdate
* @property float $currentamount
* @property string $currentamount_encrypted
* @property-read \FireflyIII\Models\PiggyBank $piggyBank
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBankRepetition whereId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBankRepetition whereCreatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBankRepetition whereUpdatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBankRepetition wherePiggyBankId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBankRepetition whereStartdate($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBankRepetition whereTargetdate($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBankRepetition whereCurrentamount($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBankRepetition whereCurrentamountEncrypted($value)
* @method static \FireflyIII\Models\PiggyBankRepetition onDates($start, $target)
* @method static \FireflyIII\Models\PiggyBankRepetition relevantOnDate($date)
*/
class PiggyBankRepetition extends Model
{
@ -58,13 +77,13 @@ class PiggyBankRepetition extends Model
$q->orWhereNull('startdate');
}
)
->where(
function (EloquentBuilder $q) use ($date) {
->where(
function (EloquentBuilder $q) use ($date) {
$q->where('targetdate', '>=', $date->format('Y-m-d 00:00:00'));
$q->orWhereNull('targetdate');
}
);
$q->where('targetdate', '>=', $date->format('Y-m-d 00:00:00'));
$q->orWhereNull('targetdate');
}
);
}
/**

View File

@ -6,8 +6,25 @@ use Illuminate\Database\Eloquent\Model;
/**
* Class Preference
*
* @codeCoverageIgnore
* @codeCoverageIgnore
* @package FireflyIII\Models
* @property integer $id
* @property \Carbon\Carbon $created_at
* @property \Carbon\Carbon $updated_at
* @property integer $user_id
* @property string $name
* @property string $name_encrypted
* @property string $data
* @property string $data_encrypted
* @property-read \FireflyIII\User $user
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Preference whereId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Preference whereCreatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Preference whereUpdatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Preference whereUserId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Preference whereName($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Preference whereNameEncrypted($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Preference whereData($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Preference whereDataEncrypted($value)
*/
class Preference extends Model
{

View File

@ -8,15 +8,43 @@ use Illuminate\Database\Eloquent\Model;
/**
* Class Reminder
*
* @codeCoverageIgnore
*
* @codeCoverageIgnore
* @package FireflyIII\Models
* @property integer $id
* @property \Carbon\Carbon $created_at
* @property \Carbon\Carbon $updated_at
* @property integer $user_id
* @property \Carbon\Carbon $startdate
* @property \Carbon\Carbon $enddate
* @property boolean $active
* @property boolean $notnow
* @property integer $remindersable_id
* @property string $remindersable_type
* @property string $metadata
* @property boolean $encrypted
* @property-read \ $remindersable
* @property-read \FireflyIII\User $user
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Reminder whereId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Reminder whereCreatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Reminder whereUpdatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Reminder whereUserId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Reminder whereStartdate($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Reminder whereEnddate($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Reminder whereActive($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Reminder whereNotnow($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Reminder whereRemindersableId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Reminder whereRemindersableType($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Reminder whereMetadata($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Reminder whereEncrypted($value)
* @method static \FireflyIII\Models\Reminder onDates($start, $end)
* @method static \FireflyIII\Models\Reminder today()
* @property string description
*/
class Reminder extends Model
{
protected $fillable = ['user_id', 'startdate', 'metadata', 'enddate', 'active', 'notnow', 'remindersable_id', 'remindersable_type',];
protected $fillable = ['user_id', 'startdate', 'metadata', 'enddate', 'active', 'notnow', 'remindersable_id', 'remindersable_type', ];
protected $hidden = ['encrypted'];
/**
@ -96,7 +124,7 @@ class Reminder extends Model
$today = new Carbon;
return $query->where('startdate', '<=', $today->format('Y-m-d 00:00:00'))->where('enddate', '>=', $today->format('Y-m-d 00:00:00'))->where('active', 1)
->where('notnow', 0);
->where('notnow', 0);
}
/**

14
app/Models/Role.php Normal file
View File

@ -0,0 +1,14 @@
<?php
namespace FireflyIII\Models;
use Zizaco\Entrust\EntrustRole;
/**
* Class Role
*
* @package FireflyIII\Models
*/
class Role extends EntrustRole
{
}

View File

@ -10,6 +10,32 @@ use Watson\Validating\ValidatingTrait;
* Class Tag
*
* @package FireflyIII\Models
* @property integer $id
* @property \Carbon\Carbon $created_at
* @property \Carbon\Carbon $updated_at
* @property string $deleted_at
* @property integer $user_id
* @property string $tag
* @property string $tagMode
* @property \Carbon\Carbon $date
* @property string $description
* @property float $latitude
* @property float $longitude
* @property integer $zoomLevel
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\TransactionJournal[] $transactionjournals
* @property-read \FireflyIII\User $user
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Tag whereId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Tag whereCreatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Tag whereUpdatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Tag whereDeletedAt($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Tag whereUserId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Tag whereTag($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Tag whereTagMode($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Tag whereDate($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Tag whereDescription($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Tag whereLatitude($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Tag whereLongitude($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Tag whereZoomLevel($value)
*/
class Tag extends Model
{
@ -63,7 +89,7 @@ class Tag extends Model
/**
* @codeCoverageIgnore
* @return array
* @return string[]
*/
public function getDates()
{

View File

@ -9,8 +9,32 @@ use Watson\Validating\ValidatingTrait;
/**
* Class Transaction
*
* @codeCoverageIgnore
* @codeCoverageIgnore
* @package FireflyIII\Models
* @property integer $id
* @property \Carbon\Carbon $created_at
* @property \Carbon\Carbon $updated_at
* @property \Carbon\Carbon $deleted_at
* @property integer $account_id
* @property integer $transaction_journal_id
* @property string $description
* @property float $amount
* @property string $amount_encrypted
* @property-read \FireflyIII\Models\Account $account
* @property-read \FireflyIII\Models\TransactionJournal $transactionJournal
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Transaction whereId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Transaction whereCreatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Transaction whereUpdatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Transaction whereDeletedAt($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Transaction whereAccountId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Transaction whereTransactionJournalId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Transaction whereDescription($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Transaction whereAmount($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Transaction whereAmountEncrypted($value)
* @method static \FireflyIII\Models\Transaction after($date)
* @method static \FireflyIII\Models\Transaction before($date)
* @property mixed before
* @property mixed after
*/
class Transaction extends Model
{

View File

@ -4,11 +4,25 @@ use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
/**
*
* Class TransactionCurrency
*
* @codeCoverageIgnore
* @codeCoverageIgnore
* @package FireflyIII\Models
* @property integer $id
* @property \Carbon\Carbon $created_at
* @property \Carbon\Carbon $updated_at
* @property \Carbon\Carbon $deleted_at
* @property string $code
* @property string $name
* @property string $symbol
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\TransactionJournal[] $transactionJournals
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionCurrency whereId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionCurrency whereCreatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionCurrency whereUpdatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionCurrency whereDeletedAt($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionCurrency whereCode($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionCurrency whereName($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionCurrency whereSymbol($value)
*/
class TransactionCurrency extends Model
{

View File

@ -6,8 +6,22 @@ use Illuminate\Database\Eloquent\SoftDeletes;
/**
* Class TransactionGroup
*
* @codeCoverageIgnore
* @codeCoverageIgnore
* @package FireflyIII\Models
* @property integer $id
* @property \Carbon\Carbon $created_at
* @property \Carbon\Carbon $updated_at
* @property \Carbon\Carbon $deleted_at
* @property integer $user_id
* @property string $relation
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\TransactionJournal[] $transactionjournals
* @property-read \FireflyIII\User $user
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionGroup whereId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionGroup whereCreatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionGroup whereUpdatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionGroup whereDeletedAt($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionGroup whereUserId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionGroup whereRelation($value)
*/
class TransactionGroup extends Model
{

View File

@ -12,6 +12,61 @@ use Watson\Validating\ValidatingTrait;
* Class TransactionJournal
*
* @package FireflyIII\Models
* @SuppressWarnings (PHPMD.TooManyMethods)
* @property integer $id
* @property \Carbon\Carbon $created_at
* @property \Carbon\Carbon $updated_at
* @property \Carbon\Carbon $deleted_at
* @property integer $user_id
* @property integer $transaction_type_id
* @property integer $bill_id
* @property integer $transaction_currency_id
* @property string $description
* @property boolean $completed
* @property \Carbon\Carbon $date
* @property boolean $encrypted
* @property integer $order
* @property-read \FireflyIII\Models\Bill $bill
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Budget[] $budgets
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Category[] $categories
* @property-read mixed $actual_amount
* @property-read mixed $amount
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Tag[] $tags
* @property-read mixed $asset_account
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Transaction[] $transactions
* @property-read mixed $corrected_actual_amount
* @property-read mixed $destination_account
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\PiggyBankEvent[] $piggyBankEvents
* @property-read \FireflyIII\Models\TransactionCurrency $transactionCurrency
* @property-read \FireflyIII\Models\TransactionType $transactionType
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\TransactionGroup[] $transactiongroups
* @property-read \FireflyIII\User $user
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionJournal whereId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionJournal whereCreatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionJournal whereUpdatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionJournal whereDeletedAt($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionJournal whereUserId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionJournal whereTransactionTypeId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionJournal whereBillId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionJournal whereTransactionCurrencyId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionJournal whereDescription($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionJournal whereCompleted($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionJournal whereDate($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionJournal whereEncrypted($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionJournal whereOrder($value)
* @method static \FireflyIII\Models\TransactionJournal accountIs($account)
* @method static \FireflyIII\Models\TransactionJournal after($date)
* @method static \FireflyIII\Models\TransactionJournal before($date)
* @method static \FireflyIII\Models\TransactionJournal onDate($date)
* @method static \FireflyIII\Models\TransactionJournal transactionTypes($types)
* @method static \FireflyIII\Models\TransactionJournal withRelevantData()
* @property-read mixed $expense_account
* @property string account_encrypted
* @property bool joinedTransactions
* @property bool joinedTransactionTypes
* @property mixed account_id
* @property mixed name
* @property mixed symbol
*/
class TransactionJournal extends Model
{
@ -103,7 +158,7 @@ class TransactionJournal extends Model
// loop other deposits, remove from our amount.
$others = $advancePayment->transactionJournals()->transactionTypes(['Deposit'])->get();
foreach ($others as $other) {
$amount = bcsub($amount, $other->actualAmount);
$amount = bcsub($amount, $other->actual_amount);
}
return $amount;
@ -124,7 +179,7 @@ class TransactionJournal extends Model
if ($this->transactionType->type == 'Withdrawal') {
$transfer = $balancingAct->transactionJournals()->transactionTypes(['Transfer'])->first();
if ($transfer) {
$amount = bcsub($amount, $transfer->actualAmount);
$amount = bcsub($amount, $transfer->actual_amount);
return $amount;
}
@ -148,22 +203,20 @@ class TransactionJournal extends Model
*/
public function getAssetAccountAttribute()
{
$positive = true; // the asset account is in the transaction with the positive amount.
if ($this->transactionType->type === 'Withdrawal') {
$positive = false;
}
/** @var Transaction $transaction */
foreach ($this->transactions()->get() as $transaction) {
if (floatval($transaction->amount) > 0 && $positive === true) {
return $transaction->account;
}
if (floatval($transaction->amount) < 0 && $positive === false) {
return $transaction->account;
}
// if it's a deposit, it's the one thats positive
// if it's a withdrawal, it's the one thats negative
// otherwise, it's either (return first one):
switch ($this->transactionType->type) {
case 'Deposit':
return $this->transactions()->where('amount', '>', 0)->first()->account;
case 'Withdrawal':
return $this->transactions()->where('amount', '<', 0)->first()->account;
}
return $this->transactions()->first()->account;
}
/**
@ -175,31 +228,9 @@ class TransactionJournal extends Model
return $this->hasMany('FireflyIII\Models\Transaction');
}
/**
* @return float
*/
public function getCorrectedActualAmountAttribute()
{
$amount = '0';
$type = $this->transactionType->type;
/** @var Transaction $t */
foreach ($this->transactions as $t) {
if ($t->amount > 0 && $type != 'Withdrawal') {
$amount = $t->amount;
break;
}
if ($t->amount < 0 && $type == 'Withdrawal') {
$amount = $t->amount;
break;
}
}
return $amount;
}
/**
* @codeCoverageIgnore
* @return array
* @return string[]
*/
public function getDates()
{
@ -237,6 +268,27 @@ class TransactionJournal extends Model
return $this->transactions()->first()->account;
}
/**
* @return Account
*/
public function getExpenseAccountAttribute()
{
// if it's a deposit, it's the one thats negative
// if it's a withdrawal, it's the one thats positive
// otherwise, it's either (return first one):
switch ($this->transactionType->type) {
case 'Deposit':
return $this->transactions()->where('amount', '<', 0)->first()->account;
case 'Withdrawal':
return $this->transactions()->where('amount', '>', 0)->first()->account;
}
return $this->transactions()->first()->account;
}
/**
* @codeCoverageIgnore
* @return \Illuminate\Database\Eloquent\Relations\HasMany
@ -267,7 +319,7 @@ class TransactionJournal extends Model
* @param EloquentBuilder $query
* @param Carbon $date
*
* @return mixed
* @return EloquentBuilder
*/
public function scopeAfter(EloquentBuilder $query, Carbon $date)
{
@ -280,7 +332,7 @@ class TransactionJournal extends Model
* @param EloquentBuilder $query
* @param Carbon $date
*
* @return mixed
* @return EloquentBuilder
*/
public function scopeBefore(EloquentBuilder $query, Carbon $date)
{
@ -293,7 +345,7 @@ class TransactionJournal extends Model
* @param EloquentBuilder $query
* @param Carbon $date
*
* @return mixed
* @return EloquentBuilder
*/
public function scopeOnDate(EloquentBuilder $query, Carbon $date)
{
@ -327,7 +379,7 @@ class TransactionJournal extends Model
public function scopeWithRelevantData(EloquentBuilder $query)
{
$query->with(
['transactions' => function (HasMany $q) {
['transactions' => function(HasMany $q) {
$q->orderBy('amount', 'ASC');
}, 'transactiontype', 'transactioncurrency', 'budgets', 'categories', 'transactions.account.accounttype', 'bill', 'budgets', 'categories']
);

View File

@ -5,7 +5,7 @@ use Illuminate\Database\Eloquent\Model;
/**
* Class TransactionRelation
*
* @codeCoverageIgnore
* @codeCoverageIgnore
* @package FireflyIII\Models
*/
class TransactionRelation extends Model

View File

@ -6,8 +6,19 @@ use Illuminate\Database\Eloquent\SoftDeletes;
/**
* Class TransactionType
*
* @codeCoverageIgnore
* @codeCoverageIgnore
* @package FireflyIII\Models
* @property integer $id
* @property \Carbon\Carbon $created_at
* @property \Carbon\Carbon $updated_at
* @property \Carbon\Carbon $deleted_at
* @property string $type
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\TransactionJournal[] $transactionJournals
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionType whereId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionType whereCreatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionType whereUpdatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionType whereDeletedAt($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionType whereType($value)
*/
class TransactionType extends Model
{

View File

@ -23,7 +23,7 @@ class BusServiceProvider extends ServiceProvider
public function boot(Dispatcher $dispatcher)
{
$dispatcher->mapUsing(
function ($command) {
function($command) {
return Dispatcher::simpleMapping(
$command, 'FireflyIII\Commands', 'FireflyIII\Handlers\Commands'
);

View File

@ -52,12 +52,12 @@ class EventServiceProvider extends ServiceProvider
$this->registerDeleteEvents();
$this->registerCreateEvents();
BudgetLimit::saved(
function (BudgetLimit $budgetLimit) {
function(BudgetLimit $budgetLimit) {
$end = Navigation::addPeriod(clone $budgetLimit->startdate, $budgetLimit->repeat_freq, 0);
$end->subDay();
$set = $budgetLimit->limitrepetitions()->where('startdate', $budgetLimit->startdate->format('Y-m-d'))->where('enddate', $end->format('Y-m-d'))
->get();
->get();
if ($set->count() == 0) {
$repetition = new LimitRepetition;
$repetition->startdate = $budgetLimit->startdate;
@ -91,7 +91,7 @@ class EventServiceProvider extends ServiceProvider
protected function registerDeleteEvents()
{
TransactionJournal::deleted(
function (TransactionJournal $journal) {
function(TransactionJournal $journal) {
/** @var Transaction $transaction */
foreach ($journal->transactions()->get() as $transaction) {
@ -100,7 +100,7 @@ class EventServiceProvider extends ServiceProvider
}
);
PiggyBank::deleting(
function (PiggyBank $piggyBank) {
function(PiggyBank $piggyBank) {
$reminders = $piggyBank->reminders()->get();
/** @var Reminder $reminder */
foreach ($reminders as $reminder) {
@ -110,7 +110,7 @@ class EventServiceProvider extends ServiceProvider
);
Account::deleted(
function (Account $account) {
function(Account $account) {
/** @var Transaction $transaction */
foreach ($account->transactions()->get() as $transaction) {
@ -131,7 +131,7 @@ class EventServiceProvider extends ServiceProvider
// move this routine to a filter
// in case of repeated piggy banks and/or other problems.
PiggyBank::created(
function (PiggyBank $piggyBank) {
function(PiggyBank $piggyBank) {
$repetition = new PiggyBankRepetition;
$repetition->piggyBank()->associate($piggyBank);
$repetition->startdate = is_null($piggyBank->startdate) ? null : $piggyBank->startdate;

View File

@ -30,7 +30,7 @@ class FireflyServiceProvider extends ServiceProvider
public function boot()
{
Validator::resolver(
function ($translator, $data, $rules, $messages) {
function($translator, $data, $rules, $messages) {
return new FireflyValidator($translator, $data, $rules, $messages);
}
);
@ -55,28 +55,28 @@ class FireflyServiceProvider extends ServiceProvider
$this->app->bind(
'preferences', function () {
'preferences', function() {
return new Preferences;
}
);
$this->app->bind(
'navigation', function () {
'navigation', function() {
return new Navigation;
}
);
$this->app->bind(
'amount', function () {
'amount', function() {
return new Amount;
}
);
$this->app->bind(
'steam', function () {
'steam', function() {
return new Steam;
}
);
$this->app->bind(
'expandedform', function () {
'expandedform', function() {
return new ExpandedForm;
}
);

View File

@ -44,7 +44,7 @@ class RouteServiceProvider extends ServiceProvider
public function map(Router $router)
{
$router->group(
['namespace' => $this->namespace], function ($router) {
['namespace' => $this->namespace], function($router) {
/** @noinspection PhpIncludeInspection */
require app_path('Http/routes.php');
}

View File

@ -25,6 +25,8 @@ use Steam;
/**
* @SuppressWarnings(PHPMD.TooManyMethods)
*
* Class AccountRepository
*
* @package FireflyIII\Repositories\Account
@ -62,7 +64,7 @@ class AccountRepository implements AccountRepositoryInterface
public function getAccounts(array $types)
{
$result = Auth::user()->accounts()->with(
['accountmeta' => function (HasMany $query) {
['accountmeta' => function(HasMany $query) {
$query->where('name', 'accountRole');
}]
)->accountTypeIn($types)->orderBy('accounts.name', 'ASC')->get(['accounts.*'])->sortBy('name');
@ -77,15 +79,15 @@ class AccountRepository implements AccountRepositoryInterface
public function getCreditCards()
{
return Auth::user()->accounts()
->hasMetaValue('accountRole', 'ccAsset')
->hasMetaValue('ccType', 'monthlyFull')
->get(
[
'accounts.*',
'ccType.data as ccType',
'accountRole.data as accountRole'
]
);
->hasMetaValue('accountRole', 'ccAsset')
->hasMetaValue('ccType', 'monthlyFull')
->get(
[
'accounts.*',
'ccType.data as ccType',
'accountRole.data as accountRole'
]
);
}
/**
@ -130,18 +132,18 @@ class AccountRepository implements AccountRepositoryInterface
public function getFrontpageTransactions(Account $account, Carbon $start, Carbon $end)
{
return Auth::user()
->transactionjournals()
->with(['transactions'])
->leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')
->leftJoin('accounts', 'accounts.id', '=', 'transactions.account_id')->where('accounts.id', $account->id)
->leftJoin('transaction_currencies', 'transaction_currencies.id', '=', 'transaction_journals.transaction_currency_id')
->leftJoin('transaction_types', 'transaction_types.id', '=', 'transaction_journals.transaction_type_id')
->before($end)
->after($start)
->orderBy('transaction_journals.date', 'DESC')
->orderBy('transaction_journals.id', 'DESC')
->take(10)
->get(['transaction_journals.*', 'transaction_currencies.symbol', 'transaction_types.type']);
->transactionjournals()
->with(['transactions'])
->leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')
->leftJoin('accounts', 'accounts.id', '=', 'transactions.account_id')->where('accounts.id', $account->id)
->leftJoin('transaction_currencies', 'transaction_currencies.id', '=', 'transaction_journals.transaction_currency_id')
->leftJoin('transaction_types', 'transaction_types.id', '=', 'transaction_journals.transaction_type_id')
->before($end)
->after($start)
->orderBy('transaction_journals.date', 'DESC')
->orderBy('transaction_journals.id', 'DESC')
->take(10)
->get(['transaction_journals.*', 'transaction_currencies.symbol', 'transaction_types.type']);
}
/**
@ -154,13 +156,13 @@ class AccountRepository implements AccountRepositoryInterface
{
$offset = ($page - 1) * 50;
$query = Auth::user()
->transactionJournals()
->withRelevantData()
->leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')
->where('transactions.account_id', $account->id)
->orderBy('transaction_journals.date', 'DESC')
->orderBy('transaction_journals.order', 'ASC')
->orderBy('transaction_journals.id', 'DESC');
->transactionJournals()
->withRelevantData()
->leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')
->where('transactions.account_id', $account->id)
->orderBy('transaction_journals.date', 'DESC')
->orderBy('transaction_journals.order', 'ASC')
->orderBy('transaction_journals.id', 'DESC');
$count = $query->count();
$set = $query->take(50)->offset($offset)->get(['transaction_journals.*']);
@ -211,7 +213,7 @@ class AccountRepository implements AccountRepositoryInterface
}
$accounts->each(
function (Account $account) use ($start, $end) {
function(Account $account) use ($start, $end) {
$account->startBalance = Steam::balance($account, $start, true);
$account->endBalance = Steam::balance($account, $end, true);
$account->piggyBalance = 0;
@ -249,7 +251,7 @@ class AccountRepository implements AccountRepositoryInterface
$end = clone Session::get('end', new Carbon);
$accounts->each(
function (Account $account) use ($start, $end) {
function(Account $account) use ($start, $end) {
$account->startBalance = Steam::balance($account, $start);
$account->endBalance = Steam::balance($account, $end);
@ -287,26 +289,27 @@ class AccountRepository implements AccountRepositoryInterface
*/
public function getTransfersInRange(Account $account, Carbon $start, Carbon $end)
{
$set = TransactionJournal::whereIn(
'id', function (Builder $q) use ($account, $start, $end) {
$set = TransactionJournal::whereIn(
'id', function(Builder $q) use ($account, $start, $end) {
$q->select('transaction_journals.id')
->from('transactions')
->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')
->leftJoin('transaction_types', 'transaction_types.id', '=', 'transaction_journals.transaction_type_id')
->where('transactions.account_id', $account->id)
->where('transaction_journals.user_id', Auth::user()->id)
->where('transaction_journals.date', '>=', $start->format('Y-m-d'))
->where('transaction_journals.date', '<=', $end->format('Y-m-d'))
->where('transaction_types.type', 'Transfer');
->from('transactions')
->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')
->leftJoin('transaction_types', 'transaction_types.id', '=', 'transaction_journals.transaction_type_id')
->where('transactions.account_id', $account->id)
->where('transaction_journals.user_id', Auth::user()->id)
->where('transaction_journals.date', '>=', $start->format('Y-m-d'))
->where('transaction_journals.date', '<=', $end->format('Y-m-d'))
->where('transaction_types.type', 'Transfer');
}
)->get();
$filtered = $set->filter(
function (TransactionJournal $journal) use ($account) {
function(TransactionJournal $journal) use ($account) {
if ($journal->destination_account->id == $account->id) {
return $journal;
}
} // @codeCoverageIgnore
return null;
}
);
return $filtered;
@ -339,15 +342,15 @@ class AccountRepository implements AccountRepositoryInterface
public function openingBalanceTransaction(Account $account)
{
return TransactionJournal::accountIs($account)
->orderBy('transaction_journals.date', 'ASC')
->orderBy('created_at', 'ASC')
->first(['transaction_journals.*']);
->orderBy('transaction_journals.date', 'ASC')
->orderBy('created_at', 'ASC')
->first(['transaction_journals.*']);
}
/**
* @param array $data
*
* @return Account;
* @return Account
*/
public function store(array $data)
{
@ -365,7 +368,7 @@ class AccountRepository implements AccountRepositoryInterface
'name' => $data['name'] . ' initial balance',
'active' => false,
];
$opposing = $this->storeAccount($opposingData);
$opposing = $this->storeAccount($opposingData);
$this->storeInitialBalance($newAccount, $opposing, $data);
}
@ -398,7 +401,6 @@ class AccountRepository implements AccountRepositoryInterface
// update meta data:
$this->updateMetadata($account, $data);
$openingBalance = $this->openingBalanceTransaction($account);
// if has openingbalance?
@ -416,15 +418,13 @@ class AccountRepository implements AccountRepositoryInterface
'name' => $data['name'] . ' initial balance',
'active' => false,
];
$opposing = $this->storeAccount($opposingData);
$opposing = $this->storeAccount($opposingData);
$this->storeInitialBalance($account, $opposing, $data);
}
} else {
// opening balance is zero, should we delete it?
if ($openingBalance) {
// delete existing opening balance.
$openingBalance->delete();
if ($openingBalance) { // opening balance is zero, should we delete it?
$openingBalance->delete(); // delete existing opening balance.
}
}
@ -451,7 +451,7 @@ class AccountRepository implements AccountRepositoryInterface
if (!$newAccount->isValid()) {
// does the account already exist?
$searchData = [
$searchData = [
'user_id' => $data['user'],
'account_type_id' => $accountType->id,
'name' => $data['name']

View File

@ -5,13 +5,10 @@ namespace FireflyIII\Repositories\Bill;
use Auth;
use Carbon\Carbon;
use DB;
use FireflyIII\Models\Account;
use FireflyIII\Models\AccountType;
use FireflyIII\Models\Bill;
use FireflyIII\Models\Transaction;
use FireflyIII\Models\TransactionJournal;
use Illuminate\Support\Collection;
use Log;
use Navigation;
/**
@ -28,7 +25,7 @@ class BillRepository implements BillRepositoryInterface
* @param Carbon $start
* @param Carbon $end
*
* @return float
* @return integer
*/
public function billPaymentsInRange(Bill $bill, Carbon $start, Carbon $end)
{
@ -70,7 +67,7 @@ class BillRepository implements BillRepositoryInterface
/**
* @param Bill $bill
*
* @return mixed
* @return boolean|null
*/
public function destroy(Bill $bill)
{
@ -212,7 +209,7 @@ class BillRepository implements BillRepositoryInterface
/**
* @param Bill $bill
*
* @return Carbon
* @return \Carbon\Carbon
*/
public function nextExpectedMatch(Bill $bill)
{
@ -244,7 +241,7 @@ class BillRepository implements BillRepositoryInterface
$end = Navigation::endOfPeriod(clone $start, $bill->repeat_freq);
$journalCount = $bill->transactionjournals()->before($end)->after($start)->count();
if ($journalCount == 0) {
$finalDate = clone $start;
$finalDate = new Carbon($start->format('Y-m-d'));
break;
}
}
@ -261,34 +258,15 @@ class BillRepository implements BillRepositoryInterface
* @param Bill $bill
* @param TransactionJournal $journal
*
* @return bool
* @return boolean|null
*/
public function scan(Bill $bill, TransactionJournal $journal)
{
$amountMatch = false;
$wordMatch = false;
$matches = explode(',', $bill->match);
$description = strtolower($journal->description);
/*
* Attach expense account to description for more narrow matching.
*/
$transactions = $journal->transactions()->get();
/** @var Transaction $transaction */
foreach ($transactions as $transaction) {
/** @var Account $account */
$account = $transaction->account()->first();
/** @var AccountType $type */
$type = $account->accountType()->first();
if ($type->type == 'Expense account' || $type->type == 'Beneficiary account') {
$description .= ' ' . strtolower($account->name);
}
}
Log::debug('Final description: ' . $description);
Log::debug('Matches searched: ' . join(':', $matches));
$count = 0;
$description = strtolower($journal->description) . ' ' . strtolower($journal->expense_account->name);
$count = 0;
foreach ($matches as $word) {
if (!(strpos($description, strtolower($word)) === false)) {
$count++;
@ -296,37 +274,24 @@ class BillRepository implements BillRepositoryInterface
}
if ($count >= count($matches)) {
$wordMatch = true;
Log::debug('word match is true');
} else {
Log::debug('Count: ' . $count . ', count(matches): ' . count($matches));
}
/*
* Match amount.
*/
if (count($transactions) > 1) {
$amount = max(floatval($transactions[0]->amount), floatval($transactions[1]->amount));
$min = floatval($bill->amount_min);
$max = floatval($bill->amount_max);
if ($amount >= $min && $amount <= $max) {
$amountMatch = true;
Log::debug('Amount match is true!');
}
if ($journal->amount >= $bill->amount_min && $journal->amount <= $bill->amount_max) {
$amountMatch = true;
}
/*
* If both, update!
*/
if ($wordMatch && $amountMatch) {
Log::debug('TOTAL match is true!');
$journal->bill()->associate($bill);
$journal->save();
} else {
if ((!$wordMatch || !$amountMatch) && $bill->id == $journal->bill_id) {
if ($bill->id == $journal->bill_id) {
// if no match, but bill used to match, remove it:
$journal->bill_id = null;
$journal->save();
@ -366,7 +331,7 @@ class BillRepository implements BillRepositoryInterface
* @param Bill $bill
* @param array $data
*
* @return Bill|static
* @return Bill
*/
public function update(Bill $bill, array $data)
{

View File

@ -103,7 +103,7 @@ interface BillRepositoryInterface
/**
* @param Bill $bill
*
* @return Carbon|null
* @return \Carbon\Carbon
*/
public function nextExpectedMatch(Bill $bill);

View File

@ -79,10 +79,10 @@ class BudgetRepository implements BudgetRepositoryInterface
/** @var Collection $repetitions */
return LimitRepetition::
leftJoin('budget_limits', 'limit_repetitions.budget_limit_id', '=', 'budget_limits.id')
->where('limit_repetitions.startdate', '<=', $end->format('Y-m-d 00:00:00'))
->where('limit_repetitions.startdate', '>=', $start->format('Y-m-d 00:00:00'))
->where('budget_limits.budget_id', $budget->id)
->get(['limit_repetitions.*']);
->where('limit_repetitions.startdate', '<=', $end->format('Y-m-d 00:00:00'))
->where('limit_repetitions.startdate', '>=', $start->format('Y-m-d 00:00:00'))
->where('budget_limits.budget_id', $budget->id)
->get(['limit_repetitions.*']);
}
/**
@ -146,7 +146,7 @@ class BudgetRepository implements BudgetRepositoryInterface
* @param LimitRepetition $repetition
* @param int $take
*
* @return \Illuminate\Pagination\Paginator
* @return LengthAwarePaginator
*/
public function getJournals(Budget $budget, LimitRepetition $repetition = null, $take = 50)
{
@ -154,9 +154,9 @@ class BudgetRepository implements BudgetRepositoryInterface
$setQuery = $budget->transactionJournals()->withRelevantData()->take($take)->offset($offset)
->orderBy('transaction_journals.date', 'DESC')
->orderBy('transaction_journals.order', 'ASC')
->orderBy('transaction_journals.id', 'DESC');
->orderBy('transaction_journals.date', 'DESC')
->orderBy('transaction_journals.order', 'ASC')
->orderBy('transaction_journals.id', 'DESC');
$countQuery = $budget->transactionJournals();
@ -196,9 +196,9 @@ class BudgetRepository implements BudgetRepositoryInterface
public function getLimitAmountOnDate(Budget $budget, Carbon $date)
{
$repetition = LimitRepetition::leftJoin('budget_limits', 'limit_repetitions.budget_limit_id', '=', 'budget_limits.id')
->where('limit_repetitions.startdate', $date->format('Y-m-d 00:00:00'))
->where('budget_limits.budget_id', $budget->id)
->first(['limit_repetitions.*']);
->where('limit_repetitions.startdate', $date->format('Y-m-d 00:00:00'))
->where('budget_limits.budget_id', $budget->id)
->first(['limit_repetitions.*']);
if ($repetition) {
return floatval($repetition->amount);
@ -216,42 +216,42 @@ class BudgetRepository implements BudgetRepositoryInterface
public function getWithoutBudget(Carbon $start, Carbon $end)
{
return Auth::user()
->transactionjournals()
->leftJoin('budget_transaction_journal', 'budget_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id')
->whereNull('budget_transaction_journal.id')
->before($end)
->after($start)
->orderBy('transaction_journals.date', 'DESC')
->orderBy('transaction_journals.order', 'ASC')
->orderBy('transaction_journals.id', 'DESC')
->get(['transaction_journals.*']);
->transactionjournals()
->leftJoin('budget_transaction_journal', 'budget_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id')
->whereNull('budget_transaction_journal.id')
->before($end)
->after($start)
->orderBy('transaction_journals.date', 'DESC')
->orderBy('transaction_journals.order', 'ASC')
->orderBy('transaction_journals.id', 'DESC')
->get(['transaction_journals.*']);
}
/**
* @param Carbon $start
* @param Carbon $end
*
* @return mixed
* @return double
*/
public function getWithoutBudgetSum(Carbon $start, Carbon $end)
{
$noBudgetSet = Auth::user()
->transactionjournals()
->whereNotIn(
'transaction_journals.id', function (QueryBuilder $query) use ($start, $end) {
$query
->select('transaction_journals.id')
->from('transaction_journals')
->leftJoin('budget_transaction_journal', 'budget_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id')
->where('transaction_journals.date', '>=', $start->format('Y-m-d 00:00:00'))
->where('transaction_journals.date', '<=', $end->format('Y-m-d 00:00:00'))
->whereNotNull('budget_transaction_journal.budget_id');
}
)
->after($start)
->before($end)
->transactionTypes(['Withdrawal'])
->get(['transaction_journals.*'])->sum('amount');
->transactionjournals()
->whereNotIn(
'transaction_journals.id', function (QueryBuilder $query) use ($start, $end) {
$query
->select('transaction_journals.id')
->from('transaction_journals')
->leftJoin('budget_transaction_journal', 'budget_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id')
->where('transaction_journals.date', '>=', $start->format('Y-m-d 00:00:00'))
->where('transaction_journals.date', '<=', $end->format('Y-m-d 00:00:00'))
->whereNotNull('budget_transaction_journal.budget_id');
}
)
->after($start)
->before($end)
->transactionTypes(['Withdrawal'])
->get(['transaction_journals.*'])->sum('amount');
return floatval($noBudgetSet) * -1;
}
@ -272,18 +272,18 @@ class BudgetRepository implements BudgetRepositoryInterface
} else {
// get all journals in this month where the asset account is NOT shared.
$sum = $budget->transactionjournals()
->before($end)
->after($start)
->leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')
->leftJoin('accounts', 'accounts.id', '=', 'transactions.account_id')
->leftJoin(
'account_meta', function (JoinClause $join) {
$join->on('account_meta.account_id', '=', 'accounts.id')->where('account_meta.name', '=', 'accountRole');
}
)
->where('account_meta.data', '!=', '"sharedAsset"')
->get(['transaction_journals.*'])
->sum('amount');
->before($end)
->after($start)
->leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')
->leftJoin('accounts', 'accounts.id', '=', 'transactions.account_id')
->leftJoin(
'account_meta', function (JoinClause $join) {
$join->on('account_meta.account_id', '=', 'accounts.id')->where('account_meta.name', '=', 'accountRole');
}
)
->where('account_meta.data', '!=', '"sharedAsset"')
->get(['transaction_journals.*'])
->sum('amount');
$sum = floatval($sum);
}
@ -330,7 +330,7 @@ class BudgetRepository implements BudgetRepositoryInterface
* @param Carbon $date
* @param $amount
*
* @return LimitRepetition|null
* @return BudgetLimit
*/
public function updateLimitAmount(Budget $budget, Carbon $date, $amount)
{

View File

@ -5,6 +5,7 @@ namespace FireflyIII\Repositories\Budget;
use Carbon\Carbon;
use FireflyIII\Models\Budget;
use FireflyIII\Models\LimitRepetition;
use Illuminate\Pagination\LengthAwarePaginator;
use Illuminate\Support\Collection;
/**
@ -89,7 +90,7 @@ interface BudgetRepositoryInterface
* @param LimitRepetition $repetition
* @param int $take
*
* @return \Illuminate\Pagination\Paginator
* @return LengthAwarePaginator
*/
public function getJournals(Budget $budget, LimitRepetition $repetition = null, $take = 50);

View File

@ -49,7 +49,7 @@ class CategoryRepository implements CategoryRepositoryInterface
/** @var Collection $set */
$set = Auth::user()->categories()->orderBy('name', 'ASC')->get();
$set->sortBy(
function (Category $category) {
function(Category $category) {
return $category->name;
}
);
@ -62,21 +62,21 @@ class CategoryRepository implements CategoryRepositoryInterface
* @param Carbon $start
* @param Carbon $end
*
* @return Collection
* @return array
*/
public function getCategoriesAndExpensesCorrected($start, $end)
{
$set = Auth::user()->transactionjournals()
->leftJoin(
'category_transaction_journal', 'category_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id'
)
->leftJoin('categories', 'categories.id', '=', 'category_transaction_journal.category_id')
->before($end)
->where('categories.user_id', Auth::user()->id)
->after($start)
->transactionTypes(['Withdrawal'])
->groupBy('categories.id')
->get(['categories.id as category_id', 'categories.encrypted as category_encrypted', 'categories.name', 'transaction_journals.*']);
->leftJoin(
'category_transaction_journal', 'category_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id'
)
->leftJoin('categories', 'categories.id', '=', 'category_transaction_journal.category_id')
->before($end)
->where('categories.user_id', Auth::user()->id)
->after($start)
->transactionTypes(['Withdrawal'])
->groupBy('categories.id')
->get(['categories.id as category_id', 'categories.encrypted as category_encrypted', 'categories.name', 'transaction_journals.*']);
$result = [];
foreach ($set as $entry) {
@ -143,10 +143,10 @@ class CategoryRepository implements CategoryRepositoryInterface
public function getLatestActivity(Category $category)
{
$latest = $category->transactionjournals()
->orderBy('transaction_journals.date', 'DESC')
->orderBy('transaction_journals.order', 'ASC')
->orderBy('transaction_journals.id', 'DESC')
->first();
->orderBy('transaction_journals.date', 'DESC')
->orderBy('transaction_journals.order', 'ASC')
->orderBy('transaction_journals.id', 'DESC')
->first();
if ($latest) {
return $latest->date;
}
@ -163,15 +163,15 @@ class CategoryRepository implements CategoryRepositoryInterface
public function getWithoutCategory(Carbon $start, Carbon $end)
{
return Auth::user()
->transactionjournals()
->leftJoin('category_transaction_journal', 'category_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id')
->whereNull('category_transaction_journal.id')
->before($end)
->after($start)
->orderBy('transaction_journals.date', 'DESC')
->orderBy('transaction_journals.order', 'ASC')
->orderBy('transaction_journals.id', 'DESC')
->get(['transaction_journals.*']);
->transactionjournals()
->leftJoin('category_transaction_journal', 'category_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id')
->whereNull('category_transaction_journal.id')
->before($end)
->after($start)
->orderBy('transaction_journals.date', 'DESC')
->orderBy('transaction_journals.order', 'ASC')
->orderBy('transaction_journals.id', 'DESC')
->get(['transaction_journals.*']);
}
/**
@ -190,8 +190,8 @@ class CategoryRepository implements CategoryRepositoryInterface
// always ignore transfers between accounts!
$sum = floatval(
$category->transactionjournals()
->transactionTypes(['Withdrawal'])
->before($end)->after($start)->get(['transaction_journals.*'])->sum('amount')
->transactionTypes(['Withdrawal'])
->before($end)->after($start)->get(['transaction_journals.*'])->sum('amount')
);
} else {
@ -204,7 +204,7 @@ class CategoryRepository implements CategoryRepositoryInterface
->leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')
->leftJoin('accounts', 'accounts.id', '=', 'transactions.account_id')
->leftJoin(
'account_meta', function (JoinClause $join) {
'account_meta', function(JoinClause $join) {
$join->on('account_meta.account_id', '=', 'accounts.id')->where('account_meta.name', '=', 'accountRole');
}
)

View File

@ -38,7 +38,7 @@ interface CategoryRepositoryInterface
* @param Carbon $start
* @param Carbon $end
*
* @return Collection
* @return array
*/
public function getCategoriesAndExpensesCorrected($start, $end);

View File

@ -29,7 +29,7 @@ class JournalRepository implements JournalRepositoryInterface
/**
* @param int $reminderId
*
* @return bool
* @return boolean|null
*/
public function deactivateReminder($reminderId)
{
@ -72,7 +72,7 @@ class JournalRepository implements JournalRepositoryInterface
* @param TransactionJournal $journal
* @param Transaction $transaction
*
* @return float
* @return integer
*/
public function getAmountBefore(TransactionJournal $journal, Transaction $transaction)
{
@ -111,7 +111,7 @@ class JournalRepository implements JournalRepositoryInterface
*/
public function getJournalsOfTypes(array $types, $offset, $page)
{
$set = Auth::user()->transactionJournals()->transactionTypes($types)->withRelevantData()->take(50)->offset($offset)
$set = Auth::user()->transactionJournals()->transactionTypes($types)->withRelevantData()->take(50)->offset($offset)
->orderBy('date', 'DESC')
->orderBy('order', 'ASC')
->orderBy('id', 'DESC')
@ -240,7 +240,7 @@ class JournalRepository implements JournalRepositoryInterface
* @param TransactionJournal $journal
* @param array $data
*
* @return mixed
* @return TransactionJournal
*/
public function update(TransactionJournal $journal, array $data)
{

View File

@ -33,7 +33,7 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface
/**
* @param PiggyBank $piggyBank
*
* @return bool
* @return boolean|null
*/
public function destroy(PiggyBank $piggyBank)
{
@ -102,7 +102,7 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface
public function setOrder($id, $order)
{
$piggyBank = PiggyBank::leftJoin('accounts', 'accounts.id', '=', 'piggy_banks.account_id')->where('accounts.user_id', Auth::user()->id)
->where('piggy_banks.id', $id)->first(['piggy_banks.*']);
->where('piggy_banks.id', $id)->first(['piggy_banks.*']);
if ($piggyBank) {
$piggyBank->order = $order;
$piggyBank->save();

View File

@ -36,14 +36,14 @@ class ReminderRepository implements ReminderRepositoryInterface
$today = new Carbon;
// active reminders:
$active = Auth::user()->reminders()
->where('notnow', 0)
->where('active', 1)
->where('startdate', '<=', $today->format('Y-m-d 00:00:00'))
->where('enddate', '>=', $today->format('Y-m-d 00:00:00'))
->get();
->where('notnow', 0)
->where('active', 1)
->where('startdate', '<=', $today->format('Y-m-d 00:00:00'))
->where('enddate', '>=', $today->format('Y-m-d 00:00:00'))
->get();
$active->each(
function (Reminder $reminder) {
function(Reminder $reminder) {
$reminder->description = $this->helper->getReminderText($reminder);
}
);
@ -58,11 +58,11 @@ class ReminderRepository implements ReminderRepositoryInterface
public function getDismissedReminders()
{
$dismissed = Auth::user()->reminders()
->where('notnow', 1)
->get();
->where('notnow', 1)
->get();
$dismissed->each(
function (Reminder $reminder) {
function(Reminder $reminder) {
$reminder->description = $this->helper->getReminderText($reminder);
}
);
@ -77,18 +77,18 @@ class ReminderRepository implements ReminderRepositoryInterface
{
$expired = Auth::user()->reminders()
->where('notnow', 0)
->where('active', 1)
->where(
function (Builder $q) {
$today = new Carbon;
$q->where('startdate', '>', $today->format('Y-m-d 00:00:00'));
$q->orWhere('enddate', '<', $today->format('Y-m-d 00:00:00'));
}
)->get();
->where('notnow', 0)
->where('active', 1)
->where(
function (Builder $q) {
$today = new Carbon;
$q->where('startdate', '>', $today->format('Y-m-d 00:00:00'));
$q->orWhere('enddate', '<', $today->format('Y-m-d 00:00:00'));
}
)->get();
$expired->each(
function (Reminder $reminder) {
function(Reminder $reminder) {
$reminder->description = $this->helper->getReminderText($reminder);
}
);
@ -106,7 +106,7 @@ class ReminderRepository implements ReminderRepositoryInterface
->get();
$inactive->each(
function (Reminder $reminder) {
function(Reminder $reminder) {
$reminder->description = $this->helper->getReminderText($reminder);
}
);

View File

@ -43,13 +43,10 @@ class TagRepository implements TagRepositoryInterface
$journal->tags()->save($tag);
return true;
break;
case 'balancingAct':
return $this->connectBalancingAct($journal, $tag);
break;
case 'advancePayment':
return $this->connectAdvancePayment($journal, $tag);
break;
}
return false;
@ -67,7 +64,7 @@ class TagRepository implements TagRepositoryInterface
* @param Carbon $start
* @param Carbon $end
*
* @return float
* @return integer
*/
public function coveredByBalancingActs(Account $account, Carbon $start, Carbon $end)
{
@ -112,7 +109,7 @@ class TagRepository implements TagRepositoryInterface
/** @var Collection $tags */
$tags = Auth::user()->tags()->get();
$tags->sortBy(
function (Tag $tag) {
function(Tag $tag) {
return $tag->tag;
}
);
@ -326,7 +323,7 @@ class TagRepository implements TagRepositoryInterface
$match = true;
/** @var TransactionJournal $check */
foreach ($tag->transactionjournals as $check) {
if ($check->assetAccount->id != $journal->assetAccount->id) {
if ($check->asset_account->id != $journal->asset_account->id) {
$match = false;
}
}

View File

@ -41,9 +41,9 @@ class Registrar implements RegistrarContract
{
return Validator::make(
$data, [
'email' => 'required|email|max:255|unique:users',
'password' => 'required|confirmed|min:6',
]
'email' => 'required|email|max:255|unique:users',
'password' => 'required|confirmed|min:6',
]
);
}

View File

@ -3,6 +3,7 @@
namespace FireflyIII\Support;
use Amount as Amt;
use Eloquent;
use Illuminate\Support\Collection;
use Illuminate\Support\MessageBag;
use Input;
@ -13,6 +14,8 @@ use View;
* Class ExpandedForm
*
* @package FireflyIII\Support
*
* @SuppressWarnings(PHPMD.TooManyMethods)
*/
class ExpandedForm
{
@ -46,7 +49,7 @@ class ExpandedForm
*
* @return mixed
*/
public function label($name, $options)
protected function label($name, $options)
{
if (isset($options['label'])) {
return $options['label'];
@ -63,7 +66,7 @@ class ExpandedForm
*
* @return array
*/
public function expandOptionArray($name, $label, array $options)
protected function expandOptionArray($name, $label, array $options)
{
$options['class'] = 'form-control';
$options['id'] = 'ffInput_' . $name;
@ -78,7 +81,7 @@ class ExpandedForm
*
* @return string
*/
public function getHolderClasses($name)
protected function getHolderClasses($name)
{
/*
* Get errors from session:
@ -100,7 +103,7 @@ class ExpandedForm
*
* @return mixed
*/
public function fillFieldValue($name, $value)
protected function fillFieldValue($name, $value)
{
if (Session::has('preFilled')) {
$preFilled = Session::get('preFilled');

View File

@ -118,7 +118,7 @@ class Navigation
'year' => 'endOfYear',
'yearly' => 'endOfYear',
];
$specials = ['mont', 'monthly'];
$specials = ['mont', 'monthly'];
$currentEnd = clone $theCurrentEnd;
@ -140,117 +140,6 @@ class Navigation
return $currentEnd;
}
/**
* @param $range
* @param Carbon $date
*
* @return Carbon
* @throws FireflyException
*/
public function jumpToNext($range, Carbon $date)
{
switch ($range) {
case '1D':
$date->endOfDay()->addDay();
break;
case '1W':
$date->endOfWeek()->addDay()->startOfWeek();
break;
case '1M':
$date->endOfMonth()->addDay()->startOfMonth();
break;
case '3M':
$date->lastOfQuarter()->addDay();
break;
case '6M':
if ($date->month >= 7) {
$date->startOfYear()->addYear();
} else {
$date->startOfYear()->addMonths(6);
}
break;
case '1Y':
$date->startOfYear()->addYear();
break;
default:
throw new FireflyException('Cannot do _next() on ' . $range);
break;
}
return $date;
}
/**
* @param $range
* @param Carbon $date
*
* @return Carbon
* @throws FireflyException
*/
public function jumpToPrevious($range, Carbon $date)
{
$functionMap = [
'1D' => 'Day',
'1W' => 'Week',
'1M' => 'Month',
'1Y' => 'Year'
];
if (isset($functionMap[$range])) {
$startFunction = 'startOf' . $functionMap[$range];
$subFunction = 'sub' . $functionMap[$range];
$date->$startFunction()->$subFunction();
return $date;
}
if ($range == '3M') {
$date->firstOfQuarter()->subMonths(3)->firstOfQuarter();
return $date;
}
if ($range == '6M') {
$date->startOfYear();
if ($date->month <= 6) {
$date->subMonths(6);
}
return $date;
}
throw new FireflyException('Cannot do _previous() on ' . $range);
}
/**
* @param $range
* @param Carbon $date
*
* @return string
* @throws FireflyException
*/
public function periodName($range, Carbon $date)
{
$formatMap = [
'1D' => 'jS F Y',
'1W' => '\w\e\ek W, Y',
'1M' => 'F Y',
'1Y' => 'Y',
];
if (isset($formatMap[$range])) {
return $date->format($formatMap[$range]);
}
if ($range == '3M') {
return 'Q' . ceil(($date->month / 12) * 4) . ' ' . $date->year;
}
if ($range == '6M') {
$half = ceil(($date->month / 12) * 2);
$halfName = $half == 1 ? 'first' : 'second';
return $halfName . ' half of ' . $date->year;
}
throw new FireflyException('No _periodName() for range "' . $range . '"');
}
/**
* @param Carbon $date
* @param $repeatFrequency
@ -381,7 +270,7 @@ class Navigation
'3M' => 'lastOfQuarter',
'1Y' => 'endOfYear',
];
$end = clone $start;
$end = clone $start;
if (isset($functionMap[$range])) {
$function = $functionMap[$range];

View File

@ -4,7 +4,6 @@ namespace FireflyIII\Support;
use Auth;
use FireflyIII\Models\Preference;
use Log;
/**
* Class Preferences

View File

@ -25,7 +25,7 @@ class Search implements SearchInterface
public function searchAccounts(array $words)
{
return Auth::user()->accounts()->with('accounttype')->where(
function (EloquentBuilder $q) use ($words) {
function(EloquentBuilder $q) use ($words) {
foreach ($words as $word) {
$q->orWhere('name', 'LIKE', '%' . e($word) . '%');
}
@ -43,7 +43,7 @@ class Search implements SearchInterface
/** @var Collection $set */
$set = Auth::user()->budgets()->get();
$newSet = $set->filter(
function (Budget $b) use ($words) {
function(Budget $b) use ($words) {
$found = 0;
foreach ($words as $word) {
if (!(strpos(strtolower($b->name), strtolower($word)) === false)) {
@ -68,7 +68,7 @@ class Search implements SearchInterface
/** @var Collection $set */
$set = Auth::user()->categories()->get();
$newSet = $set->filter(
function (Category $c) use ($words) {
function(Category $c) use ($words) {
$found = 0;
foreach ($words as $word) {
if (!(strpos(strtolower($c->name), strtolower($word)) === false)) {
@ -103,7 +103,7 @@ class Search implements SearchInterface
{
// decrypted transaction journals:
$decrypted = Auth::user()->transactionjournals()->withRelevantData()->where('encrypted', 0)->where(
function (EloquentBuilder $q) use ($words) {
function(EloquentBuilder $q) use ($words) {
foreach ($words as $word) {
$q->orWhere('description', 'LIKE', '%' . e($word) . '%');
}
@ -113,7 +113,7 @@ class Search implements SearchInterface
// encrypted
$all = Auth::user()->transactionjournals()->withRelevantData()->where('encrypted', 1)->get();
$set = $all->filter(
function (TransactionJournal $journal) use ($words) {
function(TransactionJournal $journal) use ($words) {
foreach ($words as $word) {
$haystack = strtolower($journal->description);
$word = strtolower($word);
@ -129,7 +129,7 @@ class Search implements SearchInterface
$filtered = $set->merge($decrypted);
$filtered->sortBy(
function (TransactionJournal $journal) {
function(TransactionJournal $journal) {
return intval($journal->date->format('U'));
}
);

View File

@ -6,7 +6,6 @@ use Carbon\Carbon;
use FireflyIII\Models\Account;
use FireflyIII\Models\PiggyBank;
use FireflyIII\Models\PiggyBankRepetition;
use Illuminate\Support\Collection;
/**
* Class Steam
@ -50,155 +49,4 @@ class Steam
return round($balance, 2);
}
/**
* Only return the top X entries, group the rest by amount
* and described as 'Others'. id = 0 as well
*
* @param array $array
* @param int $limit
*
* @return array
*/
public function limitArray(array $array, $limit = 10)
{
$others = [
'name' => 'Others',
'queryAmount' => 0
];
$return = [];
$count = 0;
foreach ($array as $id => $entry) {
if ($count < ($limit - 1)) {
$return[$id] = $entry;
} else {
$others['queryAmount'] += $entry['queryAmount'];
}
$count++;
}
$return[0] = $others;
return $return;
}
/**
* Turns a collection into an array. Needs the field 'id' for the key,
* and saves only 'name' and 'amount' as a sub array.
*
* @param \Illuminate\Support\Collection $collection
*
* @return array
*/
public function makeArray(Collection $collection)
{
$array = [];
foreach ($collection as $entry) {
$entry->spent = isset($entry->spent) ? floatval($entry->spent) : 0.0;
$id = intval($entry->id);
if (isset($array[$id])) {
$array[$id]['amount'] += floatval($entry->amount);
$array[$id]['queryAmount'] += floatval($entry->queryAmount);
$array[$id]['spent'] += floatval($entry->spent);
$array[$id]['encrypted'] = intval($entry->encrypted);
} else {
$array[$id] = [
'amount' => floatval($entry->amount),
'queryAmount' => floatval($entry->queryAmount),
'spent' => floatval($entry->spent),
'encrypted' => intval($entry->encrypted),
'name' => $entry->name
];
}
}
return $array;
}
/**
* Merges two of the arrays as defined above. Can't handle more (yet)
*
* @param array $one
* @param array $two
*
* @return array
*/
public function mergeArrays(array $one, array $two)
{
foreach ($two as $id => $value) {
// $otherId also exists in $one:
if (isset($one[$id])) {
$one[$id]['queryAmount'] += $value['queryAmount'];
$one[$id]['spent'] += $value['spent'];
} else {
$one[$id] = $value;
}
}
return $one;
}
/**
* @param PiggyBank $piggyBank
* @param PiggyBankRepetition $repetition
*
* @return int
*/
public function percentage(PiggyBank $piggyBank, PiggyBankRepetition $repetition)
{
$pct = $repetition->currentamount / $piggyBank->targetamount * 100;
if ($pct > 100) {
// @codeCoverageIgnoreStart
return 100;
// @codeCoverageIgnoreEnd
} else {
return floor($pct);
}
}
/**
* Sort an array where all 'amount' keys are positive floats.
*
* @param array $array
*
* @return array
*/
public function sortArray(array $array)
{
uasort(
$array, function ($left, $right) {
if ($left['queryAmount'] == $right['queryAmount']) {
return 0;
}
return ($left['queryAmount'] < $right['queryAmount']) ? 1 : -1;
}
);
return $array;
}
/**
* Sort an array where all 'amount' keys are negative floats.
*
* @param array $array
*
* @return array
*/
public function sortNegativeArray(array $array)
{
uasort(
$array, function ($left, $right) {
if ($left['queryAmount'] == $right['queryAmount']) {
return 0;
}
return ($left['queryAmount'] < $right['queryAmount']) ? -1 : 1;
}
);
return $array;
}
}

View File

@ -19,17 +19,18 @@ class Budget extends Twig_Extension
*/
public function getFunctions()
{
$functions = [];
$functions[] = new Twig_SimpleFunction(
'spentInRepetitionCorrected', function (LimitRepetition $repetition) {
'spentInRepetitionCorrected', function(LimitRepetition $repetition) {
$sum
= Auth::user()->transactionjournals()
->leftJoin('budget_transaction_journal', 'budget_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id')
->leftJoin('budget_limits', 'budget_limits.budget_id', '=', 'budget_transaction_journal.budget_id')
->leftJoin('limit_repetitions', 'limit_repetitions.budget_limit_id', '=', 'budget_limits.id')
->before($repetition->enddate)
->after($repetition->startdate)
->where('limit_repetitions.id', '=', $repetition->id)
->get(['transaction_journals.*'])->sum('amount');
->leftJoin('budget_transaction_journal', 'budget_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id')
->leftJoin('budget_limits', 'budget_limits.budget_id', '=', 'budget_transaction_journal.budget_id')
->leftJoin('limit_repetitions', 'limit_repetitions.budget_limit_id', '=', 'budget_limits.id')
->before($repetition->enddate)
->after($repetition->startdate)
->where('limit_repetitions.id', '=', $repetition->id)
->get(['transaction_journals.*'])->sum('amount');
return floatval($sum);
}

View File

@ -31,31 +31,31 @@ class General extends Twig_Extension
$filters = [];
$filters[] = new Twig_SimpleFilter(
'formatAmount', function ($string) {
'formatAmount', function($string) {
return App::make('amount')->format($string);
}, ['is_safe' => ['html']]
);
$filters[] = new Twig_SimpleFilter(
'formatTransaction', function (Transaction $transaction) {
'formatTransaction', function(Transaction $transaction) {
return App::make('amount')->formatTransaction($transaction);
}, ['is_safe' => ['html']]
);
$filters[] = new Twig_SimpleFilter(
'formatAmountPlain', function ($string) {
'formatAmountPlain', function($string) {
return App::make('amount')->format($string, false);
}, ['is_safe' => ['html']]
);
$filters[] = new Twig_SimpleFilter(
'formatJournal', function ($journal) {
'formatJournal', function($journal) {
return App::make('amount')->formatJournal($journal);
}, ['is_safe' => ['html']]
);
$filters[] = new Twig_SimpleFilter(
'balance', function (Account $account = null) {
'balance', function(Account $account = null) {
if (is_null($account)) {
return 'NULL';
}
@ -67,7 +67,7 @@ class General extends Twig_Extension
// should be a function but OK
$filters[] = new Twig_SimpleFilter(
'getAccountRole', function ($name) {
'getAccountRole', function($name) {
return Config::get('firefly.accountRoles.' . $name);
}
);
@ -83,32 +83,32 @@ class General extends Twig_Extension
$functions = [];
$functions[] = new Twig_SimpleFunction(
'getCurrencyCode', function () {
'getCurrencyCode', function() {
return App::make('amount')->getCurrencyCode();
}
);
$functions[] = new Twig_SimpleFunction(
'getCurrencySymbol', function () {
'getCurrencySymbol', function() {
return App::make('amount')->getCurrencySymbol();
}
);
$functions[] = new Twig_SimpleFunction(
'phpdate', function ($str) {
'phpdate', function($str) {
return date($str);
}
);
$functions[] = new Twig_SimpleFunction(
'env', function ($name, $default) {
'env', function($name, $default) {
return env($name, $default);
}
);
$functions[] = new Twig_SimpleFunction(
'activeRoute', function ($context) {
'activeRoute', function($context) {
$args = func_get_args();
$route = $args[1];
$what = isset($args[2]) ? $args[2] : false;

View File

@ -26,25 +26,20 @@ class Journal extends Twig_Extension
$filters = [];
$filters[] = new Twig_SimpleFilter(
'typeIcon', function (TransactionJournal $journal) {
'typeIcon', function(TransactionJournal $journal) {
$type = $journal->transactionType->type;
switch ($type) {
case 'Withdrawal':
return '<span class="glyphicon glyphicon-arrow-left" title="' . trans('firefly.withdrawal') . '"></span>';
break;
case 'Deposit':
return '<span class="glyphicon glyphicon-arrow-right" title="' . trans('firefly.deposit') . '"></span>';
break;
case 'Transfer':
return '<i class="fa fa-fw fa-exchange" title="' . trans('firefly.transfer') . '"></i>';
break;
case 'Opening balance':
return '<span class="glyphicon glyphicon-ban-circle" title="' . trans('firefly.openingBalance') . '"></span>';
break;
default:
return '';
break;
}
@ -64,7 +59,7 @@ class Journal extends Twig_Extension
$functions = [];
$functions[] = new Twig_SimpleFunction(
'invalidJournal', function (TransactionJournal $journal) {
'invalidJournal', function(TransactionJournal $journal) {
if (!isset($journal->transactions[1]) || !isset($journal->transactions[0])) {
return true;
}
@ -74,7 +69,7 @@ class Journal extends Twig_Extension
);
$functions[] = new Twig_SimpleFunction(
'relevantTags', function (TransactionJournal $journal) {
'relevantTags', function(TransactionJournal $journal) {
if ($journal->tags->count() == 0) {
return App::make('amount')->formatJournal($journal);
}
@ -86,8 +81,8 @@ class Journal extends Twig_Extension
// tags are present.
$amount = App::make('amount')->format($journal->actual_amount, false);
return '<a href="' . route('tags.show', $tag->id) . '" class="label label-success" title="' . $amount
. '"><i class="fa fa-fw fa-refresh"></i> ' . $tag->tag . '</a>';
return '<a href="' . route('tags.show', [$tag->id]) . '" class="label label-success" title="' . $amount
. '"><i class="fa fa-fw fa-refresh"></i> ' . $tag->tag . '</a>';
}
/*
@ -96,8 +91,8 @@ class Journal extends Twig_Extension
if ($tag->tagMode == 'advancePayment' && $journal->transactionType->type == 'Deposit') {
$amount = App::make('amount')->formatJournal($journal, false);
return '<a href="' . route('tags.show', $tag->id) . '" class="label label-success" title="' . $amount
. '"><i class="fa fa-fw fa-sort-numeric-desc"></i> ' . $tag->tag . '</a>';
return '<a href="' . route('tags.show', [$tag->id]) . '" class="label label-success" title="' . $amount
. '"><i class="fa fa-fw fa-sort-numeric-desc"></i> ' . $tag->tag . '</a>';
}
/*
* AdvancePayment with a withdrawal will show the amount with a link to
@ -106,7 +101,7 @@ class Journal extends Twig_Extension
if ($tag->tagMode == 'advancePayment' && $journal->transactionType->type == 'Withdrawal') {
$amount = App::make('amount')->formatJournal($journal);
return '<a href="' . route('tags.show', $tag->id) . '">' . $amount . '</a>';
return '<a href="' . route('tags.show', [$tag->id]) . '">' . $amount . '</a>';
}

View File

@ -22,7 +22,7 @@ class PiggyBank extends Twig_Extension
$functions = [];
$functions[] = new Twig_SimpleFunction(
'currentRelevantRepAmount', function (PB $piggyBank) {
'currentRelevantRepAmount', function(PB $piggyBank) {
return $piggyBank->currentRelevantRep()->currentamount;
}
);

View File

@ -21,7 +21,7 @@ class Translation extends Twig_Extension
$filters = [];
$filters[] = new Twig_SimpleFilter(
'_', function ($name) {
'_', function($name) {
return trans('firefly.' . $name);

View File

@ -5,16 +5,39 @@ use Illuminate\Auth\Passwords\CanResetPassword;
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract;
use Illuminate\Database\Eloquent\Model;
use Zizaco\Entrust\Traits\EntrustUserTrait;
/**
* Class User
*
* @package FireflyIII
* @property integer $id
* @property \Carbon\Carbon $created_at
* @property \Carbon\Carbon $updated_at
* @property string $email
* @property string $password
* @property string $reset
* @property string $remember_token
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Account[] $accounts
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Tag[] $tags
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Bill[] $bills
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Budget[] $budgets
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Category[] $categories
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Preference[] $preferences
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Reminder[] $reminders
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\TransactionJournal[] $transactionjournals
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\User whereId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\User whereCreatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\User whereUpdatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\User whereEmail($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\User wherePassword($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\User whereReset($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\User whereRememberToken($value)
*/
class User extends Model implements AuthenticatableContract, CanResetPasswordContract
{
use Authenticatable, CanResetPassword;
use Authenticatable, CanResetPassword, EntrustUserTrait;
/**
* The attributes that are mass assignable.

View File

@ -56,13 +56,9 @@ class FireflyValidator extends Validator
}
/**
* @param $attribute
* @param $value
* @param $parameters
*
* @return bool
*/
public function validatePiggyBankReminder($attribute, $value, $parameters)
public function validatePiggyBankReminder()
{
$array = $this->data;
// no reminder? dont care.
@ -99,7 +95,6 @@ class FireflyValidator extends Validator
{
$type = null;
/**
* Switch on different cases on which this method can respond:
*/
@ -133,6 +128,7 @@ class FireflyValidator extends Validator
try {
$value = Crypt::decrypt($value);
} catch (DecryptException $e) {
// if it fails, probably not encrypted.
}
@ -167,7 +163,7 @@ class FireflyValidator extends Validator
{
$query = DB::table($parameters[0])->where($parameters[1], $value);
$query->where('user_id', Auth::user()->id);
if (isset($paramers[2])) {
if (isset($parameters[2])) {
$query->where('id', '!=', $parameters[2]);
}
$count = $query->count();

View File

@ -28,7 +28,8 @@
"illuminate/html": "~5.0",
"league/commonmark": "0.7.*",
"rcrowe/twigbridge": "0.7.x@dev",
"twig/extensions": "~1.2"
"twig/extensions": "~1.2",
"zizaco/entrust": "dev-laravel-5"
},
"require-dev": {
"barryvdh/laravel-debugbar": "@stable",
@ -38,8 +39,9 @@
"satooshi/php-coveralls": "0.6.1",
"mockery/mockery": "0.9.*",
"league/factory-muffin": "~2.1",
"codeclimate/php-test-reporter": "^0.1.2"
"codeclimate/php-test-reporter": "^0.1.2",
"fzaninotto/faker": "^1.4"
},

250
composer.lock generated
View File

@ -4,24 +4,24 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"hash": "5c085b2cc90ffa610e386897066315a7",
"hash": "a0c92aa0223617ca2730500921bdd82c",
"packages": [
{
"name": "classpreloader/classpreloader",
"version": "1.3.0",
"version": "1.4.0",
"source": {
"type": "git",
"url": "https://github.com/ClassPreloader/ClassPreloader.git",
"reference": "0544616ba33fb2a6b792b3a7822650810c6d65d9"
"reference": "b76f3f4f603ebbe7e64351a7ef973431ddaf7b27"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/ClassPreloader/ClassPreloader/zipball/0544616ba33fb2a6b792b3a7822650810c6d65d9",
"reference": "0544616ba33fb2a6b792b3a7822650810c6d65d9",
"url": "https://api.github.com/repos/ClassPreloader/ClassPreloader/zipball/b76f3f4f603ebbe7e64351a7ef973431ddaf7b27",
"reference": "b76f3f4f603ebbe7e64351a7ef973431ddaf7b27",
"shasum": ""
},
"require": {
"nikic/php-parser": "^1.2.2",
"nikic/php-parser": "~1.3",
"php": ">=5.3.3",
"symfony/console": "~2.1",
"symfony/filesystem": "~2.1",
@ -36,7 +36,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.3-dev"
"dev-master": "1.4-dev"
}
},
"autoload": {
@ -49,13 +49,13 @@
"MIT"
],
"authors": [
{
"name": "Graham Campbell",
"email": "graham@mineuk.com"
},
{
"name": "Michael Dowling",
"email": "mtdowling@gmail.com"
},
{
"name": "Graham Campbell",
"email": "graham@cachethq.io"
}
],
"description": "Helps class loading performance by generating a single PHP file containing all of the autoloaded files for a specific use case",
@ -64,7 +64,7 @@
"class",
"preload"
],
"time": "2015-04-15 21:59:30"
"time": "2015-05-26 10:57:51"
},
{
"name": "danielstjules/stringy",
@ -1645,17 +1645,17 @@
},
{
"name": "symfony/console",
"version": "v2.6.7",
"version": "v2.6.8",
"target-dir": "Symfony/Component/Console",
"source": {
"type": "git",
"url": "https://github.com/symfony/Console.git",
"reference": "ebc5679854aa24ed7d65062e9e3ab0b18a917272"
"reference": "2343f6d8026306bd330e0c987e4c102483c213e7"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/Console/zipball/ebc5679854aa24ed7d65062e9e3ab0b18a917272",
"reference": "ebc5679854aa24ed7d65062e9e3ab0b18a917272",
"url": "https://api.github.com/repos/symfony/Console/zipball/2343f6d8026306bd330e0c987e4c102483c213e7",
"reference": "2343f6d8026306bd330e0c987e4c102483c213e7",
"shasum": ""
},
"require": {
@ -1699,21 +1699,21 @@
],
"description": "Symfony Console Component",
"homepage": "https://symfony.com",
"time": "2015-05-02 15:18:45"
"time": "2015-05-22 14:53:08"
},
{
"name": "symfony/debug",
"version": "v2.6.7",
"version": "v2.6.8",
"target-dir": "Symfony/Component/Debug",
"source": {
"type": "git",
"url": "https://github.com/symfony/Debug.git",
"reference": "ad4511a8fddce7ec163b513ba39a30ea4f32c9e7"
"reference": "4851a041c48e76b91a221db84ab5850daa6a7b33"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/Debug/zipball/ad4511a8fddce7ec163b513ba39a30ea4f32c9e7",
"reference": "ad4511a8fddce7ec163b513ba39a30ea4f32c9e7",
"url": "https://api.github.com/repos/symfony/Debug/zipball/4851a041c48e76b91a221db84ab5850daa6a7b33",
"reference": "4851a041c48e76b91a221db84ab5850daa6a7b33",
"shasum": ""
},
"require": {
@ -1760,11 +1760,11 @@
],
"description": "Symfony Debug Component",
"homepage": "https://symfony.com",
"time": "2015-05-08 13:17:44"
"time": "2015-05-20 13:09:45"
},
{
"name": "symfony/event-dispatcher",
"version": "v2.6.7",
"version": "v2.6.8",
"target-dir": "Symfony/Component/EventDispatcher",
"source": {
"type": "git",
@ -1823,17 +1823,17 @@
},
{
"name": "symfony/filesystem",
"version": "v2.6.7",
"version": "v2.6.8",
"target-dir": "Symfony/Component/Filesystem",
"source": {
"type": "git",
"url": "https://github.com/symfony/Filesystem.git",
"reference": "f73904bd2dae525c42ea1f0340c7c98480ecacde"
"reference": "1f8429f72a5bfa58b33fd96824bea146fc4b3f49"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/Filesystem/zipball/f73904bd2dae525c42ea1f0340c7c98480ecacde",
"reference": "f73904bd2dae525c42ea1f0340c7c98480ecacde",
"url": "https://api.github.com/repos/symfony/Filesystem/zipball/1f8429f72a5bfa58b33fd96824bea146fc4b3f49",
"reference": "1f8429f72a5bfa58b33fd96824bea146fc4b3f49",
"shasum": ""
},
"require": {
@ -1869,21 +1869,21 @@
],
"description": "Symfony Filesystem Component",
"homepage": "https://symfony.com",
"time": "2015-05-08 00:09:07"
"time": "2015-05-15 13:32:45"
},
{
"name": "symfony/finder",
"version": "v2.6.7",
"version": "v2.6.8",
"target-dir": "Symfony/Component/Finder",
"source": {
"type": "git",
"url": "https://github.com/symfony/Finder.git",
"reference": "704c64c8b12c8882640d5c0330a8414b1e06dc99"
"reference": "ffedd3e0ff8155188155e9322fe21b9ee012ac14"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/Finder/zipball/704c64c8b12c8882640d5c0330a8414b1e06dc99",
"reference": "704c64c8b12c8882640d5c0330a8414b1e06dc99",
"url": "https://api.github.com/repos/symfony/Finder/zipball/ffedd3e0ff8155188155e9322fe21b9ee012ac14",
"reference": "ffedd3e0ff8155188155e9322fe21b9ee012ac14",
"shasum": ""
},
"require": {
@ -1919,21 +1919,21 @@
],
"description": "Symfony Finder Component",
"homepage": "https://symfony.com",
"time": "2015-05-02 15:18:45"
"time": "2015-05-15 13:32:45"
},
{
"name": "symfony/http-foundation",
"version": "v2.6.7",
"version": "v2.6.8",
"target-dir": "Symfony/Component/HttpFoundation",
"source": {
"type": "git",
"url": "https://github.com/symfony/HttpFoundation.git",
"reference": "8a0d00980ef9f6b47ddbf24bdfbf70fead760816"
"reference": "f9b28dcc6d3e50f5568b42dda7292656a9fe8432"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/HttpFoundation/zipball/8a0d00980ef9f6b47ddbf24bdfbf70fead760816",
"reference": "8a0d00980ef9f6b47ddbf24bdfbf70fead760816",
"url": "https://api.github.com/repos/symfony/HttpFoundation/zipball/f9b28dcc6d3e50f5568b42dda7292656a9fe8432",
"reference": "f9b28dcc6d3e50f5568b42dda7292656a9fe8432",
"shasum": ""
},
"require": {
@ -1973,21 +1973,21 @@
],
"description": "Symfony HttpFoundation Component",
"homepage": "https://symfony.com",
"time": "2015-05-02 15:18:45"
"time": "2015-05-22 14:53:08"
},
{
"name": "symfony/http-kernel",
"version": "v2.6.7",
"version": "v2.6.8",
"target-dir": "Symfony/Component/HttpKernel",
"source": {
"type": "git",
"url": "https://github.com/symfony/HttpKernel.git",
"reference": "2010194de0a57731af9404c7f97fd300db98b7a3"
"reference": "a9a6f595941fce8dddd64f4e9bf47747cf1515fc"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/HttpKernel/zipball/2010194de0a57731af9404c7f97fd300db98b7a3",
"reference": "2010194de0a57731af9404c7f97fd300db98b7a3",
"url": "https://api.github.com/repos/symfony/HttpKernel/zipball/a9a6f595941fce8dddd64f4e9bf47747cf1515fc",
"reference": "a9a6f595941fce8dddd64f4e9bf47747cf1515fc",
"shasum": ""
},
"require": {
@ -2051,21 +2051,21 @@
],
"description": "Symfony HttpKernel Component",
"homepage": "https://symfony.com",
"time": "2015-05-11 01:58:49"
"time": "2015-05-27 00:17:10"
},
{
"name": "symfony/process",
"version": "v2.6.7",
"version": "v2.6.8",
"target-dir": "Symfony/Component/Process",
"source": {
"type": "git",
"url": "https://github.com/symfony/Process.git",
"reference": "9f3c4baaf840ed849e1b1f7bfd5ae246e8509562"
"reference": "7856d78ab6cce6e59d02d9e1a873441f6bd21306"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/Process/zipball/9f3c4baaf840ed849e1b1f7bfd5ae246e8509562",
"reference": "9f3c4baaf840ed849e1b1f7bfd5ae246e8509562",
"url": "https://api.github.com/repos/symfony/Process/zipball/7856d78ab6cce6e59d02d9e1a873441f6bd21306",
"reference": "7856d78ab6cce6e59d02d9e1a873441f6bd21306",
"shasum": ""
},
"require": {
@ -2101,21 +2101,21 @@
],
"description": "Symfony Process Component",
"homepage": "https://symfony.com",
"time": "2015-05-02 15:18:45"
"time": "2015-05-15 13:32:45"
},
{
"name": "symfony/routing",
"version": "v2.6.7",
"version": "v2.6.8",
"target-dir": "Symfony/Component/Routing",
"source": {
"type": "git",
"url": "https://github.com/symfony/Routing.git",
"reference": "1455ec537940f7428ea6aa9411f3c4bca69413a0"
"reference": "dc9df18a1cfe87de65e270e8f01407ca6d7c39cb"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/Routing/zipball/1455ec537940f7428ea6aa9411f3c4bca69413a0",
"reference": "1455ec537940f7428ea6aa9411f3c4bca69413a0",
"url": "https://api.github.com/repos/symfony/Routing/zipball/dc9df18a1cfe87de65e270e8f01407ca6d7c39cb",
"reference": "dc9df18a1cfe87de65e270e8f01407ca6d7c39cb",
"shasum": ""
},
"require": {
@ -2170,21 +2170,21 @@
"uri",
"url"
],
"time": "2015-05-02 15:18:45"
"time": "2015-05-15 13:32:45"
},
{
"name": "symfony/security-core",
"version": "v2.6.7",
"version": "v2.6.8",
"target-dir": "Symfony/Component/Security/Core",
"source": {
"type": "git",
"url": "https://github.com/symfony/security-core.git",
"reference": "d25c17db741f58c0f615e52006a47f6fb23cd9b3"
"reference": "1ad0ee4b2a1ab32924cd0be397f0196b5d47e5d0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/security-core/zipball/d25c17db741f58c0f615e52006a47f6fb23cd9b3",
"reference": "d25c17db741f58c0f615e52006a47f6fb23cd9b3",
"url": "https://api.github.com/repos/symfony/security-core/zipball/1ad0ee4b2a1ab32924cd0be397f0196b5d47e5d0",
"reference": "1ad0ee4b2a1ab32924cd0be397f0196b5d47e5d0",
"shasum": ""
},
"require": {
@ -2223,32 +2223,32 @@
"MIT"
],
"authors": [
{
"name": "Symfony Community",
"homepage": "http://symfony.com/contributors"
},
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony Security Component - Core Library",
"homepage": "http://symfony.com",
"time": "2015-03-30 15:54:10"
"homepage": "https://symfony.com",
"time": "2015-05-15 13:53:19"
},
{
"name": "symfony/translation",
"version": "v2.6.7",
"version": "v2.6.8",
"target-dir": "Symfony/Component/Translation",
"source": {
"type": "git",
"url": "https://github.com/symfony/Translation.git",
"reference": "398e0eedcb89243ad34a10d079a4b6ea4c0b61ff"
"reference": "d030b3d8d9699795dbf8c59e915ef879007a4483"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/Translation/zipball/398e0eedcb89243ad34a10d079a4b6ea4c0b61ff",
"reference": "398e0eedcb89243ad34a10d079a4b6ea4c0b61ff",
"url": "https://api.github.com/repos/symfony/Translation/zipball/d030b3d8d9699795dbf8c59e915ef879007a4483",
"reference": "d030b3d8d9699795dbf8c59e915ef879007a4483",
"shasum": ""
},
"require": {
@ -2293,11 +2293,11 @@
],
"description": "Symfony Translation Component",
"homepage": "https://symfony.com",
"time": "2015-05-05 16:51:00"
"time": "2015-05-22 14:37:51"
},
{
"name": "symfony/var-dumper",
"version": "v2.6.7",
"version": "v2.6.8",
"target-dir": "Symfony/Component/VarDumper",
"source": {
"type": "git",
@ -2569,6 +2569,73 @@
"validation"
],
"time": "2015-05-23 00:03:54"
},
{
"name": "zizaco/entrust",
"version": "dev-laravel-5",
"source": {
"type": "git",
"url": "https://github.com/Zizaco/entrust.git",
"reference": "804000c1c535221792b4e173ecdcc02b5681f5ec"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Zizaco/entrust/zipball/804000c1c535221792b4e173ecdcc02b5681f5ec",
"reference": "804000c1c535221792b4e173ecdcc02b5681f5ec",
"shasum": ""
},
"require": {
"illuminate/console": "~5.0",
"illuminate/support": "~5.0",
"php": ">=5.4.0"
},
"require-dev": {
"illuminate/database": "~5.0",
"mockery/mockery": "dev-master",
"phpunit/phpunit": "~4.1",
"sami/sami": "dev-master"
},
"type": "library",
"autoload": {
"classmap": [
"src/commands"
],
"psr-4": {
"Zizaco\\Entrust\\": "src/Entrust/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Andrew Elkins",
"homepage": "http://andrewelkins.com"
},
{
"name": "Zizaco Zizuini",
"email": "zizaco@gmail.com"
},
{
"name": "Ben Batschelet",
"homepage": "http://github.com/bbatsche"
},
{
"name": "Michele Angioni",
"email": "michele.angioni@gmail.com"
}
],
"description": "This package provides a flexible way to add Role-based Permissions to Laravel",
"keywords": [
"acl",
"auth",
"illuminate",
"laravel",
"permission",
"roles"
],
"time": "2015-05-25 00:17:51"
}
],
"packages-dev": [
@ -3393,16 +3460,16 @@
},
{
"name": "phpunit/php-code-coverage",
"version": "2.0.16",
"version": "2.0.17",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
"reference": "934fd03eb6840508231a7f73eb8940cf32c3b66c"
"reference": "c4e8e7725e351184a76544634855b8a9c405a6e3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/934fd03eb6840508231a7f73eb8940cf32c3b66c",
"reference": "934fd03eb6840508231a7f73eb8940cf32c3b66c",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/c4e8e7725e351184a76544634855b8a9c405a6e3",
"reference": "c4e8e7725e351184a76544634855b8a9c405a6e3",
"shasum": ""
},
"require": {
@ -3451,7 +3518,7 @@
"testing",
"xunit"
],
"time": "2015-04-11 04:35:00"
"time": "2015-05-25 05:11:59"
},
{
"name": "phpunit/php-file-iterator",
@ -3639,16 +3706,16 @@
},
{
"name": "phpunit/phpunit",
"version": "4.6.6",
"version": "4.6.7",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "3afe303d873a4d64c62ef84de491b97b006fbdac"
"reference": "57bf06dd4eebe2a5ced79a8de71509e7d5c18b25"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/3afe303d873a4d64c62ef84de491b97b006fbdac",
"reference": "3afe303d873a4d64c62ef84de491b97b006fbdac",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/57bf06dd4eebe2a5ced79a8de71509e7d5c18b25",
"reference": "57bf06dd4eebe2a5ced79a8de71509e7d5c18b25",
"shasum": ""
},
"require": {
@ -3707,7 +3774,7 @@
"testing",
"xunit"
],
"time": "2015-04-29 15:18:52"
"time": "2015-05-25 05:18:18"
},
{
"name": "phpunit/phpunit-mock-objects",
@ -4205,17 +4272,17 @@
},
{
"name": "symfony/class-loader",
"version": "v2.6.7",
"version": "v2.6.8",
"target-dir": "Symfony/Component/ClassLoader",
"source": {
"type": "git",
"url": "https://github.com/symfony/ClassLoader.git",
"reference": "695134c9b39559297fa5d1dcff6a9054bb56facb"
"reference": "abf5632a31402ae6ac19cd00683faf603046440a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/ClassLoader/zipball/695134c9b39559297fa5d1dcff6a9054bb56facb",
"reference": "695134c9b39559297fa5d1dcff6a9054bb56facb",
"url": "https://api.github.com/repos/symfony/ClassLoader/zipball/abf5632a31402ae6ac19cd00683faf603046440a",
"reference": "abf5632a31402ae6ac19cd00683faf603046440a",
"shasum": ""
},
"require": {
@ -4252,21 +4319,21 @@
],
"description": "Symfony ClassLoader Component",
"homepage": "https://symfony.com",
"time": "2015-05-02 15:18:45"
"time": "2015-05-15 13:32:45"
},
{
"name": "symfony/config",
"version": "v2.6.7",
"version": "v2.6.8",
"target-dir": "Symfony/Component/Config",
"source": {
"type": "git",
"url": "https://github.com/symfony/Config.git",
"reference": "b6fddb4aa2daaa2b06f0040071ac131b4a1ecf25"
"reference": "2696c5bc7c31485a482c10865d713de9fcc7aa31"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/Config/zipball/b6fddb4aa2daaa2b06f0040071ac131b4a1ecf25",
"reference": "b6fddb4aa2daaa2b06f0040071ac131b4a1ecf25",
"url": "https://api.github.com/repos/symfony/Config/zipball/2696c5bc7c31485a482c10865d713de9fcc7aa31",
"reference": "2696c5bc7c31485a482c10865d713de9fcc7aa31",
"shasum": ""
},
"require": {
@ -4303,11 +4370,11 @@
],
"description": "Symfony Config Component",
"homepage": "https://symfony.com",
"time": "2015-05-02 15:18:45"
"time": "2015-05-15 13:32:45"
},
{
"name": "symfony/stopwatch",
"version": "v2.6.7",
"version": "v2.6.8",
"target-dir": "Symfony/Component/Stopwatch",
"source": {
"type": "git",
@ -4357,7 +4424,7 @@
},
{
"name": "symfony/yaml",
"version": "v2.6.7",
"version": "v2.6.8",
"target-dir": "Symfony/Component/Yaml",
"source": {
"type": "git",
@ -4410,6 +4477,7 @@
"minimum-stability": "stable",
"stability-flags": {
"rcrowe/twigbridge": 20,
"zizaco/entrust": 20,
"barryvdh/laravel-debugbar": 0
},
"prefer-stable": false,

View File

@ -139,8 +139,9 @@ return [
'TwigBridge\ServiceProvider',
'DaveJamesMiller\Breadcrumbs\ServiceProvider',
'Barryvdh\Debugbar\ServiceProvider',
'Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider',
// 'Barryvdh\Debugbar\ServiceProvider',
// 'Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider',
'Zizaco\Entrust\EntrustServiceProvider',
/*
* Application Service Providers...
@ -210,6 +211,7 @@ return [
'Steam' => 'FireflyIII\Support\Facades\Steam',
'ExpandedForm' => 'FireflyIII\Support\Facades\ExpandedForm',
'Twig' => 'TwigBridge\Facade\Twig',
'Entrust' => 'Zizaco\Entrust\EntrustFacade'
],

7
config/breadcrumbs.php Normal file
View File

@ -0,0 +1,7 @@
<?php
return [
'view' => 'breadcrumbs::bootstrap3',
];

78
config/entrust.php Normal file
View File

@ -0,0 +1,78 @@
<?php
/**
* This file is part of Entrust,
* a role & permission management solution for Laravel.
*
* @license MIT
* @package Zizaco\Entrust
*/
return [
/*
|--------------------------------------------------------------------------
| Entrust Role Model
|--------------------------------------------------------------------------
|
| This is the Role model used by Entrust to create correct relations. Update
| the role if it is in a different namespace.
|
*/
'role' => 'FireflyIII\Models\Role',
/*
|--------------------------------------------------------------------------
| Entrust Roles Table
|--------------------------------------------------------------------------
|
| This is the roles table used by Entrust to save roles to the database.
|
*/
'roles_table' => 'roles',
/*
|--------------------------------------------------------------------------
| Entrust Permission Model
|--------------------------------------------------------------------------
|
| This is the Permission model used by Entrust to create correct relations.
| Update the permission if it is in a different namespace.
|
*/
'permission' => 'FireflyIII\Models\Permission',
/*
|--------------------------------------------------------------------------
| Entrust Permissions Table
|--------------------------------------------------------------------------
|
| This is the permissions table used by Entrust to save permissions to the
| database.
|
*/
'permissions_table' => 'permissions',
/*
|--------------------------------------------------------------------------
| Entrust permission_role Table
|--------------------------------------------------------------------------
|
| This is the permission_role table used by Entrust to save relationship
| between permissions and roles to the database.
|
*/
'permission_role_table' => 'permission_role',
/*
|--------------------------------------------------------------------------
| Entrust role_user Table
|--------------------------------------------------------------------------
|
| This is the role_user table used by Entrust to save assigned roles to the
| database.
|
*/
'role_user_table' => 'role_user',
];

View File

@ -18,60 +18,12 @@ class ChangesForV3409 extends Migration
*/
public function down()
{
// remove decryption, but this will destroy amounts.
Schema::table(
'accounts', function (Blueprint $table) {
$table->dropColumn('virtual_balance_encrypted');
}
);
Schema::table(
'bills', function (Blueprint $table) {
$table->dropColumn('amount_min_encrypted');
$table->dropColumn('amount_max_encrypted');
}
);
Schema::table(
'budget_limits', function (Blueprint $table) {
$table->dropColumn('amount_encrypted');
}
);
Schema::table(
'limit_repetitions', function (Blueprint $table) {
$table->dropColumn('amount_encrypted');
}
);
Schema::table(
'piggy_bank_events', function (Blueprint $table) {
$table->dropColumn('amount_encrypted');
}
);
Schema::table(
'piggy_bank_repetitions', function (Blueprint $table) {
$table->dropColumn('currentamount_encrypted');
}
);
Schema::table(
'piggy_banks', function (Blueprint $table) {
$table->dropColumn('targetamount_encrypted');
}
);
Schema::table(
'preferences', function (Blueprint $table) {
$table->dropColumn('name_encrypted');
$table->dropColumn('data_encrypted');
}
);
Schema::table(
'transactions', function (Blueprint $table) {
$table->dropColumn('amount_encrypted');
}
);
}
/**
@ -81,52 +33,7 @@ class ChangesForV3409 extends Migration
*/
public function up()
{
// encrypt account virtual balance:
Schema::table(
'accounts', function (Blueprint $table) {
$table->string('virtual_balance_encrypted')->nullable()->after('virtual_balance');
}
);
// encrypt bill amount_min and amount_max:
Schema::table(
'bills', function (Blueprint $table) {
$table->string('amount_min_encrypted')->nullable()->after('amount_min');
$table->string('amount_max_encrypted')->nullable()->after('amount_max');
}
);
// encrypt budget limit amount
Schema::table(
'budget_limits', function (Blueprint $table) {
$table->string('amount_encrypted')->nullable()->after('amount');
}
);
// encrypt limit repetition amount
Schema::table(
'limit_repetitions', function (Blueprint $table) {
$table->string('amount_encrypted')->nullable()->after('amount');
}
);
// encrypt piggy bank event amount
Schema::table(
'piggy_bank_events', function (Blueprint $table) {
$table->string('amount_encrypted')->nullable()->after('amount');
}
);
// encrypt piggy bank repetition currentamount
Schema::table(
'piggy_bank_repetitions', function (Blueprint $table) {
$table->string('currentamount_encrypted')->nullable()->after('currentamount');
}
);
// encrypt piggy bank targetamount
Schema::table(
'piggy_banks', function (Blueprint $table) {
$table->string('targetamount_encrypted')->nullable()->after('targetamount');
}
);
// encrypt preference name (add field)
// encrypt preference data (add field)
Schema::table(
@ -136,13 +43,6 @@ class ChangesForV3409 extends Migration
}
);
// encrypt transaction amount
Schema::table(
'transactions', function (Blueprint $table) {
$table->string('amount_encrypted')->nullable()->after('amount');
}
);
}
}

View File

@ -0,0 +1,74 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
/**
* Class EntrustSetupTables
*/
class EntrustSetupTables extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
// Create table for storing roles
Schema::create('roles', function (Blueprint $table) {
$table->increments('id');
$table->string('name')->unique();
$table->string('display_name')->nullable();
$table->string('description')->nullable();
$table->timestamps();
});
// Create table for associating roles to users (Many-to-Many)
Schema::create('role_user', function (Blueprint $table) {
$table->integer('user_id')->unsigned();
$table->integer('role_id')->unsigned();
$table->foreign('user_id')->references('id')->on('users')
->onUpdate('cascade')->onDelete('cascade');
$table->foreign('role_id')->references('id')->on('roles')
->onUpdate('cascade')->onDelete('cascade');
$table->primary(['user_id', 'role_id']);
});
// Create table for storing permissions
Schema::create('permissions', function (Blueprint $table) {
$table->increments('id');
$table->string('name')->unique();
$table->string('display_name')->nullable();
$table->string('description')->nullable();
$table->timestamps();
});
// Create table for associating permissions to roles (Many-to-Many)
Schema::create('permission_role', function (Blueprint $table) {
$table->integer('permission_id')->unsigned();
$table->integer('role_id')->unsigned();
$table->foreign('permission_id')->references('id')->on('permissions')
->onUpdate('cascade')->onDelete('cascade');
$table->foreign('role_id')->references('id')->on('roles')
->onUpdate('cascade')->onDelete('cascade');
$table->primary(['permission_id', 'role_id']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('permission_role');
Schema::drop('permissions');
Schema::drop('role_user');
Schema::drop('roles');
}
}

View File

@ -20,6 +20,7 @@ class DatabaseSeeder extends Seeder
$this->call('AccountTypeSeeder');
$this->call('TransactionCurrencySeeder');
$this->call('TransactionTypeSeeder');
$this->call('PermissionSeeder');
if (App::environment() == 'testing' || App::environment() == 'homestead' || gethostname() == 'vagrant-firefly-iii') {
$this->call('TestDataSeeder');

View File

@ -0,0 +1,21 @@
<?php
use FireflyIII\Models\Role;
use Illuminate\Database\Seeder;
/**
* Class PermissionSeeder
*/
class PermissionSeeder extends Seeder
{
public function run()
{
$owner = new Role;
$owner->name = 'owner';
$owner->display_name = 'Site Owner';
$owner->description = 'User runs this instance of FF3'; // optional
$owner->save();
}
}

View File

@ -1,4 +1,4 @@
/* global $ */
/* global $, googleLineChart, accountID, token */
// Return a helper with preserved width of cells

View File

@ -1,4 +1,4 @@
/* globals $, budgeted:false, currencySymbol, budgetIncomeTotal ,budgetedMuch, budgetedPercentage, token, budgetID, repetitionID, spent, budgeted*/
/* globals $, budgeted:true, currencySymbol, budgetIncomeTotal ,budgetedMuch, budgetedPercentage, token, budgetID, repetitionID, spent, googleLineChart */
function drawSpentBar() {
"use strict";
@ -188,10 +188,10 @@ $(function () {
//
//}
//
function updateIncome() {
function updateIncome(e) {
"use strict";
$('#monthlyBudgetModal').empty().load('budgets/income', function () {
$('#monthlyBudgetModal').modal('show');
$('#defaultModal').empty().load('budgets/income', function () {
$('#defaultModal').modal('show');
});
return false;

View File

@ -1,4 +1,4 @@
/* globals $, categoryID */
/* globals $, categoryID, googleColumnChart */
$(function () {
"use strict";
if (typeof categoryID !== 'undefined') {

View File

@ -1,4 +1,4 @@
/* globals start, end, dateRangeURL, everything, firstDate, moment, currentMonthName, $, previousMonthName, nextMonthName, applyLabel, cancelLabel, toLabel, customRangeLabel, fromLabel, */
/* globals token, start, end, dateRangeURL, everything, firstDate, moment, currentMonthName, $, previousMonthName, nextMonthName, applyLabel, cancelLabel, toLabel, customRangeLabel, fromLabel, */
$(function () {
"use strict";
$('.currencySelect').click(currencySelect);

View File

@ -1,4 +1,4 @@
/* globals google */
/* globals $, googleColumnChart, google, googleLineChart, googlePieChart, googleStackedColumnChart */
google.setOnLoadCallback(drawChart);

View File

@ -1,4 +1,4 @@
/* globals $, googleLineChart, token */
/* globals $, googleLineChart, token, piggyBankID */
// Return a helper with preserved width of cells
var fixHelper = function (e, tr) {
@ -50,8 +50,8 @@ $(function () {
function addMoney(e) {
"use strict";
var pigID = parseInt($(e.target).data('id'));
$('#moneyManagementModal').empty().load('piggy-banks/add/' + pigID, function () {
$('#moneyManagementModal').modal('show');
$('#defaultModal').empty().load('piggy-banks/add/' + pigID, function () {
$('#defaultModal').modal('show');
});
return false;
@ -60,8 +60,8 @@ function addMoney(e) {
function removeMoney(e) {
"use strict";
var pigID = parseInt($(e.target).data('id'));
$('#moneyManagementModal').empty().load('piggy-banks/remove/' + pigID, function () {
$('#moneyManagementModal').modal('show');
$('#defaultModal').empty().load('piggy-banks/remove/' + pigID, function () {
$('#defaultModal').modal('show');
});
return false;

View File

@ -1,4 +1,4 @@
/* globals expenseRestShow:true, incomeRestShow:true, year, shared, month, hideTheRest, showTheRest, showTheRestExpense, hideTheRestExpense, googleColumnChart, googleLineChart, googleStackedColumnChartg */
/* globals google, expenseRestShow:true, incomeRestShow:true, year, shared, month, hideTheRest, showTheRest, showTheRestExpense, hideTheRestExpense, googleColumnChart, googleLineChart, googleStackedColumnChart */
if (typeof(google) !== 'undefined') {
google.setOnLoadCallback(drawChart);
}

Some files were not shown because too many files have changed in this diff Show More