mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-06 12:45:30 +00:00
Code cleanup
This commit is contained in:
@@ -123,7 +123,6 @@ class ReconcileController extends Controller
|
|||||||
* @return \Illuminate\Http\JsonResponse
|
* @return \Illuminate\Http\JsonResponse
|
||||||
*
|
*
|
||||||
* @throws FireflyException
|
* @throws FireflyException
|
||||||
* @throws \Throwable
|
|
||||||
*/
|
*/
|
||||||
public function overview(Request $request, Account $account, Carbon $start, Carbon $end)
|
public function overview(Request $request, Account $account, Carbon $start, Carbon $end)
|
||||||
{
|
{
|
||||||
@@ -189,7 +188,7 @@ class ReconcileController extends Controller
|
|||||||
|
|
||||||
return redirect(route('accounts.index', [config('firefly.shortNamesByFullName.' . $account->accountType->type)]));
|
return redirect(route('accounts.index', [config('firefly.shortNamesByFullName.' . $account->accountType->type)]));
|
||||||
}
|
}
|
||||||
$currencyId = intval($this->accountRepos->getMetaValue($account, 'currency_id'));
|
$currencyId = (int)$this->accountRepos->getMetaValue($account, 'currency_id');
|
||||||
$currency = $this->currencyRepos->findNull($currencyId);
|
$currency = $this->currencyRepos->findNull($currencyId);
|
||||||
if (0 === $currencyId) {
|
if (0 === $currencyId) {
|
||||||
$currency = app('amount')->getDefaultCurrency(); // @codeCoverageIgnore
|
$currency = app('amount')->getDefaultCurrency(); // @codeCoverageIgnore
|
||||||
@@ -263,7 +262,7 @@ class ReconcileController extends Controller
|
|||||||
|
|
||||||
/** @var Transaction $transaction */
|
/** @var Transaction $transaction */
|
||||||
foreach ($data['transactions'] as $transactionId) {
|
foreach ($data['transactions'] as $transactionId) {
|
||||||
$repository->reconcileById(intval($transactionId));
|
$repository->reconcileById((int)$transactionId);
|
||||||
}
|
}
|
||||||
Log::debug('Reconciled all transactions.');
|
Log::debug('Reconciled all transactions.');
|
||||||
|
|
||||||
@@ -300,7 +299,7 @@ class ReconcileController extends Controller
|
|||||||
'tags' => null,
|
'tags' => null,
|
||||||
'interest_date' => null,
|
'interest_date' => null,
|
||||||
'transactions' => [[
|
'transactions' => [[
|
||||||
'currency_id' => intval($this->accountRepos->getMetaValue($account, 'currency_id')),
|
'currency_id' => (int)$this->accountRepos->getMetaValue($account, 'currency_id'),
|
||||||
'currency_code' => null,
|
'currency_code' => null,
|
||||||
'description' => null,
|
'description' => null,
|
||||||
'amount' => app('steam')->positive($difference),
|
'amount' => app('steam')->positive($difference),
|
||||||
@@ -338,7 +337,6 @@ class ReconcileController extends Controller
|
|||||||
*
|
*
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*
|
*
|
||||||
* @throws \Throwable
|
|
||||||
* @throws FireflyException
|
* @throws FireflyException
|
||||||
*/
|
*/
|
||||||
public function transactions(Account $account, Carbon $start, Carbon $end)
|
public function transactions(Account $account, Carbon $start, Carbon $end)
|
||||||
@@ -350,7 +348,7 @@ class ReconcileController extends Controller
|
|||||||
$startDate = clone $start;
|
$startDate = clone $start;
|
||||||
$startDate->subDays(1);
|
$startDate->subDays(1);
|
||||||
|
|
||||||
$currencyId = intval($this->accountRepos->getMetaValue($account, 'currency_id'));
|
$currencyId = (int)$this->accountRepos->getMetaValue($account, 'currency_id');
|
||||||
$currency = $this->currencyRepos->findNull($currencyId);
|
$currency = $this->currencyRepos->findNull($currencyId);
|
||||||
if (0 === $currencyId) {
|
if (0 === $currencyId) {
|
||||||
$currency = app('amount')->getDefaultCurrency(); // @codeCoverageIgnore
|
$currency = app('amount')->getDefaultCurrency(); // @codeCoverageIgnore
|
||||||
@@ -400,7 +398,7 @@ class ReconcileController extends Controller
|
|||||||
$destination = $this->repository->getJournalDestinationAccounts($journal)->first();
|
$destination = $this->repository->getJournalDestinationAccounts($journal)->first();
|
||||||
if (bccomp($submitted['amount'], '0') === 1) {
|
if (bccomp($submitted['amount'], '0') === 1) {
|
||||||
// amount is positive, switch accounts:
|
// amount is positive, switch accounts:
|
||||||
list($source, $destination) = [$destination, $source];
|
[$source, $destination] = [$destination, $source];
|
||||||
|
|
||||||
}
|
}
|
||||||
// expand data with journal data:
|
// expand data with journal data:
|
||||||
@@ -417,7 +415,7 @@ class ReconcileController extends Controller
|
|||||||
'interest_date' => null,
|
'interest_date' => null,
|
||||||
'book_date' => null,
|
'book_date' => null,
|
||||||
'transactions' => [[
|
'transactions' => [[
|
||||||
'currency_id' => intval($journal->transaction_currency_id),
|
'currency_id' => (int)$journal->transaction_currency_id,
|
||||||
'currency_code' => null,
|
'currency_code' => null,
|
||||||
'description' => null,
|
'description' => null,
|
||||||
'amount' => app('steam')->positive($submitted['amount']),
|
'amount' => app('steam')->positive($submitted['amount']),
|
||||||
@@ -442,7 +440,7 @@ class ReconcileController extends Controller
|
|||||||
$this->repository->update($journal, $data);
|
$this->repository->update($journal, $data);
|
||||||
|
|
||||||
// @codeCoverageIgnoreStart
|
// @codeCoverageIgnoreStart
|
||||||
if (1 === intval($request->get('return_to_edit'))) {
|
if (1 === (int)$request->get('return_to_edit')) {
|
||||||
Session::put('reconcile.edit.fromUpdate', true);
|
Session::put('reconcile.edit.fromUpdate', true);
|
||||||
|
|
||||||
return redirect(route('accounts.reconcile.edit', [$journal->id]))->withInput(['return_to_edit' => 1]);
|
return redirect(route('accounts.reconcile.edit', [$journal->id]))->withInput(['return_to_edit' => 1]);
|
||||||
|
@@ -84,7 +84,6 @@ class AccountController extends Controller
|
|||||||
* @param string $what
|
* @param string $what
|
||||||
*
|
*
|
||||||
* @return View
|
* @return View
|
||||||
* @throws \RuntimeException
|
|
||||||
*/
|
*/
|
||||||
public function create(Request $request, string $what = 'asset')
|
public function create(Request $request, string $what = 'asset')
|
||||||
{
|
{
|
||||||
@@ -133,18 +132,17 @@ class AccountController extends Controller
|
|||||||
* @param Account $account
|
* @param Account $account
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
||||||
* @throws \RuntimeException
|
|
||||||
*/
|
*/
|
||||||
public function destroy(Request $request, Account $account)
|
public function destroy(Request $request, Account $account)
|
||||||
{
|
{
|
||||||
$type = $account->accountType->type;
|
$type = $account->accountType->type;
|
||||||
$typeName = config('firefly.shortNamesByFullName.' . $type);
|
$typeName = config('firefly.shortNamesByFullName.' . $type);
|
||||||
$name = $account->name;
|
$name = $account->name;
|
||||||
$moveTo = $this->repository->findNull(intval($request->get('move_account_before_delete')));
|
$moveTo = $this->repository->findNull((int)$request->get('move_account_before_delete'));
|
||||||
|
|
||||||
$this->repository->destroy($account, $moveTo);
|
$this->repository->destroy($account, $moveTo);
|
||||||
|
|
||||||
$request->session()->flash('success', strval(trans('firefly.' . $typeName . '_deleted', ['name' => $name])));
|
$request->session()->flash('success', (string)trans('firefly.' . $typeName . '_deleted', ['name' => $name]));
|
||||||
Preferences::mark();
|
Preferences::mark();
|
||||||
|
|
||||||
return redirect($this->getPreviousUri('accounts.delete.uri'));
|
return redirect($this->getPreviousUri('accounts.delete.uri'));
|
||||||
@@ -163,7 +161,7 @@ class AccountController extends Controller
|
|||||||
* @SuppressWarnings(PHPMD.CyclomaticComplexity) // long and complex but not that excessively so.
|
* @SuppressWarnings(PHPMD.CyclomaticComplexity) // long and complex but not that excessively so.
|
||||||
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
|
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
|
||||||
*
|
*
|
||||||
* @throws \RuntimeException
|
|
||||||
*/
|
*/
|
||||||
public function edit(Request $request, Account $account, AccountRepositoryInterface $repository)
|
public function edit(Request $request, Account $account, AccountRepositoryInterface $repository)
|
||||||
{
|
{
|
||||||
@@ -174,7 +172,7 @@ class AccountController extends Controller
|
|||||||
$currencySelectList = ExpandedForm::makeSelectList($allCurrencies);
|
$currencySelectList = ExpandedForm::makeSelectList($allCurrencies);
|
||||||
$roles = [];
|
$roles = [];
|
||||||
foreach (config('firefly.accountRoles') as $role) {
|
foreach (config('firefly.accountRoles') as $role) {
|
||||||
$roles[$role] = strval(trans('firefly.account_role_' . $role));
|
$roles[$role] = (string)trans('firefly.account_role_' . $role);
|
||||||
}
|
}
|
||||||
|
|
||||||
// put previous url in session if not redirect from store (not "return_to_edit").
|
// put previous url in session if not redirect from store (not "return_to_edit").
|
||||||
@@ -186,11 +184,11 @@ class AccountController extends Controller
|
|||||||
// pre fill some useful values.
|
// pre fill some useful values.
|
||||||
|
|
||||||
// the opening balance is tricky:
|
// the opening balance is tricky:
|
||||||
$openingBalanceAmount = strval($repository->getOpeningBalanceAmount($account));
|
$openingBalanceAmount = (string)$repository->getOpeningBalanceAmount($account);
|
||||||
$openingBalanceDate = $repository->getOpeningBalanceDate($account);
|
$openingBalanceDate = $repository->getOpeningBalanceDate($account);
|
||||||
$default = app('amount')->getDefaultCurrency();
|
$default = app('amount')->getDefaultCurrency();
|
||||||
$currency = $this->currencyRepos->findNull(intval($repository->getMetaValue($account, 'currency_id')));
|
$currency = $this->currencyRepos->findNull((int)$repository->getMetaValue($account, 'currency_id'));
|
||||||
if (is_null($currency)) {
|
if (null === $currency) {
|
||||||
$currency = $default;
|
$currency = $default;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -246,8 +244,8 @@ class AccountController extends Controller
|
|||||||
$types = config('firefly.accountTypesByIdentifier.' . $what);
|
$types = config('firefly.accountTypesByIdentifier.' . $what);
|
||||||
$collection = $this->repository->getAccountsByType($types);
|
$collection = $this->repository->getAccountsByType($types);
|
||||||
$total = $collection->count();
|
$total = $collection->count();
|
||||||
$page = 0 === intval($request->get('page')) ? 1 : intval($request->get('page'));
|
$page = 0 === (int)$request->get('page') ? 1 : (int)$request->get('page');
|
||||||
$pageSize = intval(Preferences::get('listPageSize', 50)->data);
|
$pageSize = (int)Preferences::get('listPageSize', 50)->data;
|
||||||
$accounts = $collection->slice(($page - 1) * $pageSize, $pageSize);
|
$accounts = $collection->slice(($page - 1) * $pageSize, $pageSize);
|
||||||
unset($collection);
|
unset($collection);
|
||||||
/** @var Carbon $start */
|
/** @var Carbon $start */
|
||||||
@@ -378,7 +376,6 @@ class AccountController extends Controller
|
|||||||
* @param AccountFormRequest $request
|
* @param AccountFormRequest $request
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
||||||
* @throws \RuntimeException
|
|
||||||
*/
|
*/
|
||||||
public function store(AccountFormRequest $request)
|
public function store(AccountFormRequest $request)
|
||||||
{
|
{
|
||||||
@@ -396,7 +393,7 @@ class AccountController extends Controller
|
|||||||
// @codeCoverageIgnoreEnd
|
// @codeCoverageIgnoreEnd
|
||||||
}
|
}
|
||||||
|
|
||||||
if (1 === intval($request->get('create_another'))) {
|
if (1 === (int)$request->get('create_another')) {
|
||||||
// set value so create routine will not overwrite URL:
|
// set value so create routine will not overwrite URL:
|
||||||
$request->session()->put('accounts.create.fromStore', true);
|
$request->session()->put('accounts.create.fromStore', true);
|
||||||
|
|
||||||
@@ -412,17 +409,16 @@ class AccountController extends Controller
|
|||||||
* @param Account $account
|
* @param Account $account
|
||||||
*
|
*
|
||||||
* @return $this|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
* @return $this|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
||||||
* @throws \RuntimeException
|
|
||||||
*/
|
*/
|
||||||
public function update(AccountFormRequest $request, Account $account)
|
public function update(AccountFormRequest $request, Account $account)
|
||||||
{
|
{
|
||||||
$data = $request->getAccountData();
|
$data = $request->getAccountData();
|
||||||
$this->repository->update($account, $data);
|
$this->repository->update($account, $data);
|
||||||
|
|
||||||
$request->session()->flash('success', strval(trans('firefly.updated_account', ['name' => $account->name])));
|
$request->session()->flash('success', (string)trans('firefly.updated_account', ['name' => $account->name]));
|
||||||
Preferences::mark();
|
Preferences::mark();
|
||||||
|
|
||||||
if (1 === intval($request->get('return_to_edit'))) {
|
if (1 === (int)$request->get('return_to_edit')) {
|
||||||
// set value so edit routine will not overwrite URL:
|
// set value so edit routine will not overwrite URL:
|
||||||
$request->session()->put('accounts.edit.fromUpdate', true);
|
$request->session()->put('accounts.edit.fromUpdate', true);
|
||||||
|
|
||||||
@@ -467,7 +463,7 @@ class AccountController extends Controller
|
|||||||
$start = $this->repository->oldestJournalDate($account);
|
$start = $this->repository->oldestJournalDate($account);
|
||||||
$end = $date ?? new Carbon;
|
$end = $date ?? new Carbon;
|
||||||
if ($end < $start) {
|
if ($end < $start) {
|
||||||
list($start, $end) = [$end, $start]; // @codeCoverageIgnore
|
[$start, $end] = [$end, $start]; // @codeCoverageIgnore
|
||||||
}
|
}
|
||||||
|
|
||||||
// properties for cache
|
// properties for cache
|
||||||
|
@@ -46,7 +46,7 @@ class ConfigurationController extends Controller
|
|||||||
|
|
||||||
$this->middleware(
|
$this->middleware(
|
||||||
function ($request, $next) {
|
function ($request, $next) {
|
||||||
app('view')->share('title', strval(trans('firefly.administration')));
|
app('view')->share('title', (string)trans('firefly.administration'));
|
||||||
app('view')->share('mainTitleIcon', 'fa-hand-spock-o');
|
app('view')->share('mainTitleIcon', 'fa-hand-spock-o');
|
||||||
|
|
||||||
return $next($request);
|
return $next($request);
|
||||||
@@ -61,7 +61,7 @@ class ConfigurationController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
$subTitle = strval(trans('firefly.instance_configuration'));
|
$subTitle = (string)trans('firefly.instance_configuration');
|
||||||
$subTitleIcon = 'fa-wrench';
|
$subTitleIcon = 'fa-wrench';
|
||||||
|
|
||||||
// all available configuration and their default value in case
|
// all available configuration and their default value in case
|
||||||
@@ -91,7 +91,7 @@ class ConfigurationController extends Controller
|
|||||||
FireflyConfig::set('is_demo_site', $data['is_demo_site']);
|
FireflyConfig::set('is_demo_site', $data['is_demo_site']);
|
||||||
|
|
||||||
// flash message
|
// flash message
|
||||||
Session::flash('success', strval(trans('firefly.configuration_updated')));
|
Session::flash('success', (string)trans('firefly.configuration_updated'));
|
||||||
Preferences::mark();
|
Preferences::mark();
|
||||||
|
|
||||||
return Redirect::route('admin.configuration.index');
|
return Redirect::route('admin.configuration.index');
|
||||||
|
@@ -50,7 +50,7 @@ class HomeController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
$title = strval(trans('firefly.administration'));
|
$title = (string)trans('firefly.administration');
|
||||||
$mainTitleIcon = 'fa-hand-spock-o';
|
$mainTitleIcon = 'fa-hand-spock-o';
|
||||||
|
|
||||||
return view('admin.index', compact('title', 'mainTitleIcon'));
|
return view('admin.index', compact('title', 'mainTitleIcon'));
|
||||||
@@ -66,7 +66,7 @@ class HomeController extends Controller
|
|||||||
$ipAddress = $request->ip();
|
$ipAddress = $request->ip();
|
||||||
Log::debug(sprintf('Now in testMessage() controller. IP is %s', $ipAddress));
|
Log::debug(sprintf('Now in testMessage() controller. IP is %s', $ipAddress));
|
||||||
event(new AdminRequestedTestMessage(auth()->user(), $ipAddress));
|
event(new AdminRequestedTestMessage(auth()->user(), $ipAddress));
|
||||||
Session::flash('info', strval(trans('firefly.send_test_triggered')));
|
Session::flash('info', (string)trans('firefly.send_test_triggered'));
|
||||||
|
|
||||||
return redirect(route('admin.index'));
|
return redirect(route('admin.index'));
|
||||||
}
|
}
|
||||||
|
@@ -45,7 +45,7 @@ class LinkController extends Controller
|
|||||||
|
|
||||||
$this->middleware(
|
$this->middleware(
|
||||||
function ($request, $next) {
|
function ($request, $next) {
|
||||||
app('view')->share('title', strval(trans('firefly.administration')));
|
app('view')->share('title', (string)trans('firefly.administration'));
|
||||||
app('view')->share('mainTitleIcon', 'fa-hand-spock-o');
|
app('view')->share('mainTitleIcon', 'fa-hand-spock-o');
|
||||||
|
|
||||||
return $next($request);
|
return $next($request);
|
||||||
@@ -76,12 +76,11 @@ class LinkController extends Controller
|
|||||||
* @param LinkType $linkType
|
* @param LinkType $linkType
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|View
|
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|View
|
||||||
* @throws \RuntimeException
|
|
||||||
*/
|
*/
|
||||||
public function delete(Request $request, LinkTypeRepositoryInterface $repository, LinkType $linkType)
|
public function delete(Request $request, LinkTypeRepositoryInterface $repository, LinkType $linkType)
|
||||||
{
|
{
|
||||||
if (!$linkType->editable) {
|
if (!$linkType->editable) {
|
||||||
$request->session()->flash('error', strval(trans('firefly.cannot_edit_link_type', ['name' => $linkType->name])));
|
$request->session()->flash('error', (string)trans('firefly.cannot_edit_link_type', ['name' => $linkType->name]));
|
||||||
|
|
||||||
return redirect(route('admin.links.index'));
|
return redirect(route('admin.links.index'));
|
||||||
}
|
}
|
||||||
@@ -109,15 +108,14 @@ class LinkController extends Controller
|
|||||||
* @param LinkType $linkType
|
* @param LinkType $linkType
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
||||||
* @throws \RuntimeException
|
|
||||||
*/
|
*/
|
||||||
public function destroy(Request $request, LinkTypeRepositoryInterface $repository, LinkType $linkType)
|
public function destroy(Request $request, LinkTypeRepositoryInterface $repository, LinkType $linkType)
|
||||||
{
|
{
|
||||||
$name = $linkType->name;
|
$name = $linkType->name;
|
||||||
$moveTo = $repository->find(intval($request->get('move_link_type_before_delete')));
|
$moveTo = $repository->find((int)$request->get('move_link_type_before_delete'));
|
||||||
$repository->destroy($linkType, $moveTo);
|
$repository->destroy($linkType, $moveTo);
|
||||||
|
|
||||||
$request->session()->flash('success', strval(trans('firefly.deleted_link_type', ['name' => $name])));
|
$request->session()->flash('success', (string)trans('firefly.deleted_link_type', ['name' => $name]));
|
||||||
Preferences::mark();
|
Preferences::mark();
|
||||||
|
|
||||||
return redirect($this->getPreviousUri('link_types.delete.uri'));
|
return redirect($this->getPreviousUri('link_types.delete.uri'));
|
||||||
@@ -128,12 +126,11 @@ class LinkController extends Controller
|
|||||||
* @param LinkType $linkType
|
* @param LinkType $linkType
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|\Illuminate\View\View
|
* @return \Illuminate\Contracts\View\Factory|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|\Illuminate\View\View
|
||||||
* @throws \RuntimeException
|
|
||||||
*/
|
*/
|
||||||
public function edit(Request $request, LinkType $linkType)
|
public function edit(Request $request, LinkType $linkType)
|
||||||
{
|
{
|
||||||
if (!$linkType->editable) {
|
if (!$linkType->editable) {
|
||||||
$request->session()->flash('error', strval(trans('firefly.cannot_edit_link_type', ['name' => $linkType->name])));
|
$request->session()->flash('error', (string)trans('firefly.cannot_edit_link_type', ['name' => $linkType->name]));
|
||||||
|
|
||||||
return redirect(route('admin.links.index'));
|
return redirect(route('admin.links.index'));
|
||||||
}
|
}
|
||||||
@@ -187,7 +184,6 @@ class LinkController extends Controller
|
|||||||
* @param LinkTypeRepositoryInterface $repository
|
* @param LinkTypeRepositoryInterface $repository
|
||||||
*
|
*
|
||||||
* @return $this|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
* @return $this|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
||||||
* @throws \RuntimeException
|
|
||||||
*/
|
*/
|
||||||
public function store(LinkTypeFormRequest $request, LinkTypeRepositoryInterface $repository)
|
public function store(LinkTypeFormRequest $request, LinkTypeRepositoryInterface $repository)
|
||||||
{
|
{
|
||||||
@@ -197,9 +193,9 @@ class LinkController extends Controller
|
|||||||
'outward' => $request->string('outward'),
|
'outward' => $request->string('outward'),
|
||||||
];
|
];
|
||||||
$linkType = $repository->store($data);
|
$linkType = $repository->store($data);
|
||||||
$request->session()->flash('success', strval(trans('firefly.stored_new_link_type', ['name' => $linkType->name])));
|
$request->session()->flash('success', (string)trans('firefly.stored_new_link_type', ['name' => $linkType->name]));
|
||||||
|
|
||||||
if (1 === intval($request->get('create_another'))) {
|
if (1 === (int)$request->get('create_another')) {
|
||||||
// set value so create routine will not overwrite URL:
|
// set value so create routine will not overwrite URL:
|
||||||
$request->session()->put('link_types.create.fromStore', true);
|
$request->session()->put('link_types.create.fromStore', true);
|
||||||
|
|
||||||
@@ -216,12 +212,11 @@ class LinkController extends Controller
|
|||||||
* @param LinkType $linkType
|
* @param LinkType $linkType
|
||||||
*
|
*
|
||||||
* @return $this|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
* @return $this|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
||||||
* @throws \RuntimeException
|
|
||||||
*/
|
*/
|
||||||
public function update(LinkTypeFormRequest $request, LinkTypeRepositoryInterface $repository, LinkType $linkType)
|
public function update(LinkTypeFormRequest $request, LinkTypeRepositoryInterface $repository, LinkType $linkType)
|
||||||
{
|
{
|
||||||
if (!$linkType->editable) {
|
if (!$linkType->editable) {
|
||||||
$request->session()->flash('error', strval(trans('firefly.cannot_edit_link_type', ['name' => $linkType->name])));
|
$request->session()->flash('error', (string)trans('firefly.cannot_edit_link_type', ['name' => $linkType->name]));
|
||||||
|
|
||||||
return redirect(route('admin.links.index'));
|
return redirect(route('admin.links.index'));
|
||||||
}
|
}
|
||||||
@@ -233,10 +228,10 @@ class LinkController extends Controller
|
|||||||
];
|
];
|
||||||
$repository->update($linkType, $data);
|
$repository->update($linkType, $data);
|
||||||
|
|
||||||
$request->session()->flash('success', strval(trans('firefly.updated_link_type', ['name' => $linkType->name])));
|
$request->session()->flash('success', (string)trans('firefly.updated_link_type', ['name' => $linkType->name]));
|
||||||
Preferences::mark();
|
Preferences::mark();
|
||||||
|
|
||||||
if (1 === intval($request->get('return_to_edit'))) {
|
if (1 === (int)$request->get('return_to_edit')) {
|
||||||
// set value so edit routine will not overwrite URL:
|
// set value so edit routine will not overwrite URL:
|
||||||
$request->session()->put('link_types.edit.fromUpdate', true);
|
$request->session()->put('link_types.edit.fromUpdate', true);
|
||||||
|
|
||||||
|
@@ -49,7 +49,7 @@ class UpdateController extends Controller
|
|||||||
parent::__construct();
|
parent::__construct();
|
||||||
$this->middleware(
|
$this->middleware(
|
||||||
function ($request, $next) {
|
function ($request, $next) {
|
||||||
app('view')->share('title', strval(trans('firefly.administration')));
|
app('view')->share('title', (string)trans('firefly.administration'));
|
||||||
app('view')->share('mainTitleIcon', 'fa-hand-spock-o');
|
app('view')->share('mainTitleIcon', 'fa-hand-spock-o');
|
||||||
|
|
||||||
return $next($request);
|
return $next($request);
|
||||||
@@ -87,10 +87,10 @@ class UpdateController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function post(Request $request)
|
public function post(Request $request)
|
||||||
{
|
{
|
||||||
$checkForUpdates = intval($request->get('check_for_updates'));
|
$checkForUpdates = (int)$request->get('check_for_updates');
|
||||||
FireflyConfig::set('permission_update_check', $checkForUpdates);
|
FireflyConfig::set('permission_update_check', $checkForUpdates);
|
||||||
FireflyConfig::set('last_update_check', time());
|
FireflyConfig::set('last_update_check', time());
|
||||||
Session::flash('success', strval(trans('firefly.configuration_updated')));
|
Session::flash('success', (string)trans('firefly.configuration_updated'));
|
||||||
|
|
||||||
return redirect(route('admin.update-check'));
|
return redirect(route('admin.update-check'));
|
||||||
}
|
}
|
||||||
@@ -118,7 +118,7 @@ class UpdateController extends Controller
|
|||||||
Log::error(sprintf('Could not check for updates: %s', $e->getMessage()));
|
Log::error(sprintf('Could not check for updates: %s', $e->getMessage()));
|
||||||
}
|
}
|
||||||
if ($check === -2) {
|
if ($check === -2) {
|
||||||
$string = strval(trans('firefly.update_check_error'));
|
$string = (string)trans('firefly.update_check_error');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($check === -1) {
|
if ($check === -1) {
|
||||||
@@ -126,25 +126,23 @@ class UpdateController extends Controller
|
|||||||
// has it been released for more than three days?
|
// has it been released for more than three days?
|
||||||
$today = new Carbon;
|
$today = new Carbon;
|
||||||
if ($today->diffInDays($first->getUpdated(), true) > 3) {
|
if ($today->diffInDays($first->getUpdated(), true) > 3) {
|
||||||
$string = strval(
|
$string = (string)trans(
|
||||||
trans(
|
|
||||||
'firefly.update_new_version_alert',
|
'firefly.update_new_version_alert',
|
||||||
[
|
[
|
||||||
'your_version' => $current,
|
'your_version' => $current,
|
||||||
'new_version' => $first->getTitle(),
|
'new_version' => $first->getTitle(),
|
||||||
'date' => $first->getUpdated()->formatLocalized($this->monthAndDayFormat),
|
'date' => $first->getUpdated()->formatLocalized($this->monthAndDayFormat),
|
||||||
]
|
]
|
||||||
)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($check === 0) {
|
if ($check === 0) {
|
||||||
// you are running the current version!
|
// you are running the current version!
|
||||||
$string = strval(trans('firefly.update_current_version_alert', ['version' => $current]));
|
$string = (string)trans('firefly.update_current_version_alert', ['version' => $current]);
|
||||||
}
|
}
|
||||||
if ($check === 1) {
|
if ($check === 1) {
|
||||||
// you are running a newer version!
|
// you are running a newer version!
|
||||||
$string = strval(trans('firefly.update_newer_version_alert', ['your_version' => $current, 'new_version' => $first->getTitle()]));
|
$string = (string)trans('firefly.update_newer_version_alert', ['your_version' => $current, 'new_version' => $first->getTitle()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return response()->json(['result' => $string]);
|
return response()->json(['result' => $string]);
|
||||||
|
@@ -47,7 +47,7 @@ class UserController extends Controller
|
|||||||
|
|
||||||
$this->middleware(
|
$this->middleware(
|
||||||
function ($request, $next) {
|
function ($request, $next) {
|
||||||
app('view')->share('title', strval(trans('firefly.administration')));
|
app('view')->share('title', (string)trans('firefly.administration'));
|
||||||
app('view')->share('mainTitleIcon', 'fa-hand-spock-o');
|
app('view')->share('mainTitleIcon', 'fa-hand-spock-o');
|
||||||
|
|
||||||
return $next($request);
|
return $next($request);
|
||||||
@@ -78,7 +78,7 @@ class UserController extends Controller
|
|||||||
public function destroy(User $user, UserRepositoryInterface $repository)
|
public function destroy(User $user, UserRepositoryInterface $repository)
|
||||||
{
|
{
|
||||||
$repository->destroy($user);
|
$repository->destroy($user);
|
||||||
Session::flash('success', strval(trans('firefly.user_deleted')));
|
Session::flash('success', (string)trans('firefly.user_deleted'));
|
||||||
|
|
||||||
return redirect(route('admin.users'));
|
return redirect(route('admin.users'));
|
||||||
}
|
}
|
||||||
@@ -96,13 +96,13 @@ class UserController extends Controller
|
|||||||
}
|
}
|
||||||
Session::forget('users.edit.fromUpdate');
|
Session::forget('users.edit.fromUpdate');
|
||||||
|
|
||||||
$subTitle = strval(trans('firefly.edit_user', ['email' => $user->email]));
|
$subTitle = (string)trans('firefly.edit_user', ['email' => $user->email]);
|
||||||
$subTitleIcon = 'fa-user-o';
|
$subTitleIcon = 'fa-user-o';
|
||||||
$codes = [
|
$codes = [
|
||||||
'' => strval(trans('firefly.no_block_code')),
|
'' => (string)trans('firefly.no_block_code'),
|
||||||
'bounced' => strval(trans('firefly.block_code_bounced')),
|
'bounced' => (string)trans('firefly.block_code_bounced'),
|
||||||
'expired' => strval(trans('firefly.block_code_expired')),
|
'expired' => (string)trans('firefly.block_code_expired'),
|
||||||
'email_changed' => strval(trans('firefly.block_code_email_changed')),
|
'email_changed' => (string)trans('firefly.block_code_email_changed'),
|
||||||
];
|
];
|
||||||
|
|
||||||
return view('admin.users.edit', compact('user', 'subTitle', 'subTitleIcon', 'codes'));
|
return view('admin.users.edit', compact('user', 'subTitle', 'subTitleIcon', 'codes'));
|
||||||
@@ -115,7 +115,7 @@ class UserController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function index(UserRepositoryInterface $repository)
|
public function index(UserRepositoryInterface $repository)
|
||||||
{
|
{
|
||||||
$subTitle = strval(trans('firefly.user_administration'));
|
$subTitle = (string)trans('firefly.user_administration');
|
||||||
$subTitleIcon = 'fa-users';
|
$subTitleIcon = 'fa-users';
|
||||||
$users = $repository->all();
|
$users = $repository->all();
|
||||||
|
|
||||||
@@ -143,9 +143,9 @@ class UserController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function show(UserRepositoryInterface $repository, User $user)
|
public function show(UserRepositoryInterface $repository, User $user)
|
||||||
{
|
{
|
||||||
$title = strval(trans('firefly.administration'));
|
$title = (string)trans('firefly.administration');
|
||||||
$mainTitleIcon = 'fa-hand-spock-o';
|
$mainTitleIcon = 'fa-hand-spock-o';
|
||||||
$subTitle = strval(trans('firefly.single_user_administration', ['email' => $user->email]));
|
$subTitle = (string)trans('firefly.single_user_administration', ['email' => $user->email]);
|
||||||
$subTitleIcon = 'fa-user';
|
$subTitleIcon = 'fa-user';
|
||||||
$information = $repository->getUserData($user);
|
$information = $repository->getUserData($user);
|
||||||
|
|
||||||
@@ -182,10 +182,10 @@ class UserController extends Controller
|
|||||||
$repository->changeStatus($user, $data['blocked'], $data['blocked_code']);
|
$repository->changeStatus($user, $data['blocked'], $data['blocked_code']);
|
||||||
$repository->updateEmail($user, $data['email']);
|
$repository->updateEmail($user, $data['email']);
|
||||||
|
|
||||||
Session::flash('success', strval(trans('firefly.updated_user', ['email' => $user->email])));
|
Session::flash('success', (string)trans('firefly.updated_user', ['email' => $user->email]));
|
||||||
Preferences::mark();
|
Preferences::mark();
|
||||||
|
|
||||||
if (1 === intval($request->get('return_to_edit'))) {
|
if (1 === (int)$request->get('return_to_edit')) {
|
||||||
// @codeCoverageIgnoreStart
|
// @codeCoverageIgnoreStart
|
||||||
Session::put('users.edit.fromUpdate', true);
|
Session::put('users.edit.fromUpdate', true);
|
||||||
|
|
||||||
|
@@ -80,7 +80,6 @@ class AttachmentController extends Controller
|
|||||||
* @param Attachment $attachment
|
* @param Attachment $attachment
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
||||||
* @throws \RuntimeException
|
|
||||||
*/
|
*/
|
||||||
public function destroy(Request $request, Attachment $attachment)
|
public function destroy(Request $request, Attachment $attachment)
|
||||||
{
|
{
|
||||||
@@ -88,7 +87,7 @@ class AttachmentController extends Controller
|
|||||||
|
|
||||||
$this->repository->destroy($attachment);
|
$this->repository->destroy($attachment);
|
||||||
|
|
||||||
$request->session()->flash('success', strval(trans('firefly.attachment_deleted', ['name' => $name])));
|
$request->session()->flash('success', (string)trans('firefly.attachment_deleted', ['name' => $name]));
|
||||||
Preferences::mark();
|
Preferences::mark();
|
||||||
|
|
||||||
return redirect($this->getPreviousUri('attachments.delete.uri'));
|
return redirect($this->getPreviousUri('attachments.delete.uri'));
|
||||||
@@ -130,7 +129,6 @@ class AttachmentController extends Controller
|
|||||||
* @param Attachment $attachment
|
* @param Attachment $attachment
|
||||||
*
|
*
|
||||||
* @return View
|
* @return View
|
||||||
* @throws \RuntimeException
|
|
||||||
*/
|
*/
|
||||||
public function edit(Request $request, Attachment $attachment)
|
public function edit(Request $request, Attachment $attachment)
|
||||||
{
|
{
|
||||||
@@ -154,17 +152,16 @@ class AttachmentController extends Controller
|
|||||||
* @param Attachment $attachment
|
* @param Attachment $attachment
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Http\RedirectResponse
|
* @return \Illuminate\Http\RedirectResponse
|
||||||
* @throws \RuntimeException
|
|
||||||
*/
|
*/
|
||||||
public function update(AttachmentFormRequest $request, Attachment $attachment)
|
public function update(AttachmentFormRequest $request, Attachment $attachment)
|
||||||
{
|
{
|
||||||
$data = $request->getAttachmentData();
|
$data = $request->getAttachmentData();
|
||||||
$this->repository->update($attachment, $data);
|
$this->repository->update($attachment, $data);
|
||||||
|
|
||||||
$request->session()->flash('success', strval(trans('firefly.attachment_updated', ['name' => $attachment->filename])));
|
$request->session()->flash('success', (string)trans('firefly.attachment_updated', ['name' => $attachment->filename]));
|
||||||
Preferences::mark();
|
Preferences::mark();
|
||||||
|
|
||||||
if (1 === intval($request->get('return_to_edit'))) {
|
if (1 === (int)$request->get('return_to_edit')) {
|
||||||
// @codeCoverageIgnoreStart
|
// @codeCoverageIgnoreStart
|
||||||
$request->session()->put('attachments.edit.fromUpdate', true);
|
$request->session()->put('attachments.edit.fromUpdate', true);
|
||||||
|
|
||||||
|
@@ -73,7 +73,7 @@ class ForgotPasswordController extends Controller
|
|||||||
// verify if the user is not a demo user. If so, we give him back an error.
|
// verify if the user is not a demo user. If so, we give him back an error.
|
||||||
$user = User::where('email', $request->get('email'))->first();
|
$user = User::where('email', $request->get('email'))->first();
|
||||||
|
|
||||||
if (!is_null($user) && $repository->hasRole($user, 'demo')) {
|
if (null !== $user && $repository->hasRole($user, 'demo')) {
|
||||||
return back()->withErrors(['email' => trans('firefly.cannot_reset_demo_user')]);
|
return back()->withErrors(['email' => trans('firefly.cannot_reset_demo_user')]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -65,7 +65,6 @@ class LoginController extends Controller
|
|||||||
*
|
*
|
||||||
* @return \Illuminate\Http\Response|\Symfony\Component\HttpFoundation\Response
|
* @return \Illuminate\Http\Response|\Symfony\Component\HttpFoundation\Response
|
||||||
*
|
*
|
||||||
* @throws \RuntimeException
|
|
||||||
* @throws \Illuminate\Validation\ValidationException
|
* @throws \Illuminate\Validation\ValidationException
|
||||||
*/
|
*/
|
||||||
public function login(Request $request)
|
public function login(Request $request)
|
||||||
@@ -103,7 +102,6 @@ class LoginController extends Controller
|
|||||||
* @param CookieJar $cookieJar
|
* @param CookieJar $cookieJar
|
||||||
*
|
*
|
||||||
* @return $this|\Illuminate\Http\RedirectResponse
|
* @return $this|\Illuminate\Http\RedirectResponse
|
||||||
* @throws \RuntimeException
|
|
||||||
*/
|
*/
|
||||||
public function logout(Request $request, CookieJar $cookieJar)
|
public function logout(Request $request, CookieJar $cookieJar)
|
||||||
{
|
{
|
||||||
@@ -121,7 +119,6 @@ class LoginController extends Controller
|
|||||||
* @param Request $request
|
* @param Request $request
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||||
* @throws \RuntimeException
|
|
||||||
*/
|
*/
|
||||||
public function showLoginForm(Request $request)
|
public function showLoginForm(Request $request)
|
||||||
{
|
{
|
||||||
|
@@ -83,7 +83,7 @@ class RegisterController extends Controller
|
|||||||
|
|
||||||
$this->guard()->login($user);
|
$this->guard()->login($user);
|
||||||
|
|
||||||
Session::flash('success', strval(trans('firefly.registered')));
|
Session::flash('success', (string)trans('firefly.registered'));
|
||||||
|
|
||||||
return $this->registered($request, $user)
|
return $this->registered($request, $user)
|
||||||
?: redirect($this->redirectPath());
|
?: redirect($this->redirectPath());
|
||||||
|
@@ -40,7 +40,6 @@ class TwoFactorController extends Controller
|
|||||||
*
|
*
|
||||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|\Illuminate\View\View
|
* @return \Illuminate\Contracts\View\Factory|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|\Illuminate\View\View
|
||||||
*
|
*
|
||||||
* @throws \RuntimeException
|
|
||||||
* @throws FireflyException
|
* @throws FireflyException
|
||||||
*
|
*
|
||||||
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
|
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
|
||||||
@@ -52,7 +51,7 @@ class TwoFactorController extends Controller
|
|||||||
// to make sure the validator in the next step gets the secret, we push it in session
|
// to make sure the validator in the next step gets the secret, we push it in session
|
||||||
$secretPreference = Preferences::get('twoFactorAuthSecret', null);
|
$secretPreference = Preferences::get('twoFactorAuthSecret', null);
|
||||||
$secret = null === $secretPreference ? null : $secretPreference->data;
|
$secret = null === $secretPreference ? null : $secretPreference->data;
|
||||||
$title = strval(trans('firefly.two_factor_title'));
|
$title = (string)trans('firefly.two_factor_title');
|
||||||
|
|
||||||
// make sure the user has two factor configured:
|
// make sure the user has two factor configured:
|
||||||
$has2FA = Preferences::get('twoFactorAuthEnabled', false)->data;
|
$has2FA = Preferences::get('twoFactorAuthEnabled', false)->data;
|
||||||
@@ -60,7 +59,7 @@ class TwoFactorController extends Controller
|
|||||||
return redirect(route('index'));
|
return redirect(route('index'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (0 === strlen(strval($secret))) {
|
if (0 === strlen((string)$secret)) {
|
||||||
throw new FireflyException('Your two factor authentication secret is empty, which it cannot be at this point. Please check the log files.');
|
throw new FireflyException('Your two factor authentication secret is empty, which it cannot be at this point. Please check the log files.');
|
||||||
}
|
}
|
||||||
$request->session()->flash('two-factor-secret', $secret);
|
$request->session()->flash('two-factor-secret', $secret);
|
||||||
@@ -75,7 +74,7 @@ class TwoFactorController extends Controller
|
|||||||
{
|
{
|
||||||
$user = auth()->user();
|
$user = auth()->user();
|
||||||
$siteOwner = env('SITE_OWNER', '');
|
$siteOwner = env('SITE_OWNER', '');
|
||||||
$title = strval(trans('firefly.two_factor_forgot_title'));
|
$title = (string)trans('firefly.two_factor_forgot_title');
|
||||||
|
|
||||||
Log::info(
|
Log::info(
|
||||||
'To reset the two factor authentication for user #' . $user->id .
|
'To reset the two factor authentication for user #' . $user->id .
|
||||||
@@ -92,7 +91,6 @@ class TwoFactorController extends Controller
|
|||||||
*
|
*
|
||||||
* @return mixed
|
* @return mixed
|
||||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter) // it's unused but the class does some validation.
|
* @SuppressWarnings(PHPMD.UnusedFormalParameter) // it's unused but the class does some validation.
|
||||||
* @throws \RuntimeException
|
|
||||||
*/
|
*/
|
||||||
public function postIndex(TokenFormRequest $request, CookieJar $cookieJar)
|
public function postIndex(TokenFormRequest $request, CookieJar $cookieJar)
|
||||||
{
|
{
|
||||||
|
@@ -75,7 +75,6 @@ class BillController extends Controller
|
|||||||
* @param Request $request
|
* @param Request $request
|
||||||
*
|
*
|
||||||
* @return View
|
* @return View
|
||||||
* @throws \RuntimeException
|
|
||||||
*/
|
*/
|
||||||
public function create(Request $request)
|
public function create(Request $request)
|
||||||
{
|
{
|
||||||
@@ -114,14 +113,13 @@ class BillController extends Controller
|
|||||||
* @param Bill $bill
|
* @param Bill $bill
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
||||||
* @throws \RuntimeException
|
|
||||||
*/
|
*/
|
||||||
public function destroy(Request $request, BillRepositoryInterface $repository, Bill $bill)
|
public function destroy(Request $request, BillRepositoryInterface $repository, Bill $bill)
|
||||||
{
|
{
|
||||||
$name = $bill->name;
|
$name = $bill->name;
|
||||||
$repository->destroy($bill);
|
$repository->destroy($bill);
|
||||||
|
|
||||||
$request->session()->flash('success', strval(trans('firefly.deleted_bill', ['name' => $name])));
|
$request->session()->flash('success', (string)trans('firefly.deleted_bill', ['name' => $name]));
|
||||||
Preferences::mark();
|
Preferences::mark();
|
||||||
|
|
||||||
return redirect($this->getPreviousUri('bills.delete.uri'));
|
return redirect($this->getPreviousUri('bills.delete.uri'));
|
||||||
@@ -132,7 +130,6 @@ class BillController extends Controller
|
|||||||
* @param Bill $bill
|
* @param Bill $bill
|
||||||
*
|
*
|
||||||
* @return View
|
* @return View
|
||||||
* @throws \RuntimeException
|
|
||||||
*/
|
*/
|
||||||
public function edit(Request $request, Bill $bill)
|
public function edit(Request $request, Bill $bill)
|
||||||
{
|
{
|
||||||
@@ -177,7 +174,7 @@ class BillController extends Controller
|
|||||||
{
|
{
|
||||||
$start = session('start');
|
$start = session('start');
|
||||||
$end = session('end');
|
$end = session('end');
|
||||||
$pageSize = intval(Preferences::get('listPageSize', 50)->data);
|
$pageSize = (int)Preferences::get('listPageSize', 50)->data;
|
||||||
$paginator = $repository->getPaginator($pageSize);
|
$paginator = $repository->getPaginator($pageSize);
|
||||||
$parameters = new ParameterBag();
|
$parameters = new ParameterBag();
|
||||||
$parameters->set('start', $start);
|
$parameters->set('start', $start);
|
||||||
@@ -201,12 +198,11 @@ class BillController extends Controller
|
|||||||
* @param Bill $bill
|
* @param Bill $bill
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
||||||
* @throws \RuntimeException
|
|
||||||
*/
|
*/
|
||||||
public function rescan(Request $request, BillRepositoryInterface $repository, Bill $bill)
|
public function rescan(Request $request, BillRepositoryInterface $repository, Bill $bill)
|
||||||
{
|
{
|
||||||
if (0 === intval($bill->active)) {
|
if (0 === (int)$bill->active) {
|
||||||
$request->session()->flash('warning', strval(trans('firefly.cannot_scan_inactive_bill')));
|
$request->session()->flash('warning', (string)trans('firefly.cannot_scan_inactive_bill'));
|
||||||
|
|
||||||
return redirect(URL::previous());
|
return redirect(URL::previous());
|
||||||
}
|
}
|
||||||
@@ -217,7 +213,7 @@ class BillController extends Controller
|
|||||||
$repository->scan($bill, $journal);
|
$repository->scan($bill, $journal);
|
||||||
}
|
}
|
||||||
|
|
||||||
$request->session()->flash('success', strval(trans('firefly.rescanned_bill')));
|
$request->session()->flash('success', (string)trans('firefly.rescanned_bill'));
|
||||||
Preferences::mark();
|
Preferences::mark();
|
||||||
|
|
||||||
return redirect(URL::previous());
|
return redirect(URL::previous());
|
||||||
@@ -236,8 +232,8 @@ class BillController extends Controller
|
|||||||
$start = session('start');
|
$start = session('start');
|
||||||
$end = session('end');
|
$end = session('end');
|
||||||
$year = $start->year;
|
$year = $start->year;
|
||||||
$page = intval($request->get('page'));
|
$page = (int)$request->get('page');
|
||||||
$pageSize = intval(Preferences::get('listPageSize', 50)->data);
|
$pageSize = (int)Preferences::get('listPageSize', 50)->data;
|
||||||
$yearAverage = $repository->getYearAverage($bill, $start);
|
$yearAverage = $repository->getYearAverage($bill, $start);
|
||||||
$overallAverage = $repository->getOverallAverage($bill);
|
$overallAverage = $repository->getOverallAverage($bill);
|
||||||
$manager = new Manager();
|
$manager = new Manager();
|
||||||
@@ -268,13 +264,12 @@ class BillController extends Controller
|
|||||||
* @param BillRepositoryInterface $repository
|
* @param BillRepositoryInterface $repository
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Http\RedirectResponse
|
* @return \Illuminate\Http\RedirectResponse
|
||||||
* @throws \RuntimeException
|
|
||||||
*/
|
*/
|
||||||
public function store(BillFormRequest $request, BillRepositoryInterface $repository)
|
public function store(BillFormRequest $request, BillRepositoryInterface $repository)
|
||||||
{
|
{
|
||||||
$billData = $request->getBillData();
|
$billData = $request->getBillData();
|
||||||
$bill = $repository->store($billData);
|
$bill = $repository->store($billData);
|
||||||
$request->session()->flash('success', strval(trans('firefly.stored_new_bill', ['name' => $bill->name])));
|
$request->session()->flash('success', (string)trans('firefly.stored_new_bill', ['name' => $bill->name]));
|
||||||
Preferences::mark();
|
Preferences::mark();
|
||||||
|
|
||||||
/** @var array $files */
|
/** @var array $files */
|
||||||
@@ -286,7 +281,7 @@ class BillController extends Controller
|
|||||||
$request->session()->flash('info', $this->attachments->getMessages()->get('attachments')); // @codeCoverageIgnore
|
$request->session()->flash('info', $this->attachments->getMessages()->get('attachments')); // @codeCoverageIgnore
|
||||||
}
|
}
|
||||||
|
|
||||||
if (1 === intval($request->get('create_another'))) {
|
if (1 === (int)$request->get('create_another')) {
|
||||||
// @codeCoverageIgnoreStart
|
// @codeCoverageIgnoreStart
|
||||||
$request->session()->put('bills.create.fromStore', true);
|
$request->session()->put('bills.create.fromStore', true);
|
||||||
|
|
||||||
@@ -304,14 +299,13 @@ class BillController extends Controller
|
|||||||
* @param Bill $bill
|
* @param Bill $bill
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Http\RedirectResponse
|
* @return \Illuminate\Http\RedirectResponse
|
||||||
* @throws \RuntimeException
|
|
||||||
*/
|
*/
|
||||||
public function update(BillFormRequest $request, BillRepositoryInterface $repository, Bill $bill)
|
public function update(BillFormRequest $request, BillRepositoryInterface $repository, Bill $bill)
|
||||||
{
|
{
|
||||||
$billData = $request->getBillData();
|
$billData = $request->getBillData();
|
||||||
$bill = $repository->update($bill, $billData);
|
$bill = $repository->update($bill, $billData);
|
||||||
|
|
||||||
$request->session()->flash('success', strval(trans('firefly.updated_bill', ['name' => $bill->name])));
|
$request->session()->flash('success', (string)trans('firefly.updated_bill', ['name' => $bill->name]));
|
||||||
Preferences::mark();
|
Preferences::mark();
|
||||||
|
|
||||||
/** @var array $files */
|
/** @var array $files */
|
||||||
@@ -323,7 +317,7 @@ class BillController extends Controller
|
|||||||
$request->session()->flash('info', $this->attachments->getMessages()->get('attachments')); // @codeCoverageIgnore
|
$request->session()->flash('info', $this->attachments->getMessages()->get('attachments')); // @codeCoverageIgnore
|
||||||
}
|
}
|
||||||
|
|
||||||
if (1 === intval($request->get('return_to_edit'))) {
|
if (1 === (int)$request->get('return_to_edit')) {
|
||||||
// @codeCoverageIgnoreStart
|
// @codeCoverageIgnoreStart
|
||||||
$request->session()->put('bills.edit.fromUpdate', true);
|
$request->session()->put('bills.edit.fromUpdate', true);
|
||||||
|
|
||||||
|
@@ -78,11 +78,10 @@ class BudgetController extends Controller
|
|||||||
* @param Budget $budget
|
* @param Budget $budget
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Http\JsonResponse
|
* @return \Illuminate\Http\JsonResponse
|
||||||
* @throws \InvalidArgumentException
|
|
||||||
*/
|
*/
|
||||||
public function amount(Request $request, BudgetRepositoryInterface $repository, Budget $budget)
|
public function amount(Request $request, BudgetRepositoryInterface $repository, Budget $budget)
|
||||||
{
|
{
|
||||||
$amount = strval($request->get('amount'));
|
$amount = (string)$request->get('amount');
|
||||||
$start = Carbon::createFromFormat('Y-m-d', $request->get('start'));
|
$start = Carbon::createFromFormat('Y-m-d', $request->get('start'));
|
||||||
$end = Carbon::createFromFormat('Y-m-d', $request->get('end'));
|
$end = Carbon::createFromFormat('Y-m-d', $request->get('end'));
|
||||||
$budgetLimit = $this->repository->updateLimitAmount($budget, $start, $end, $amount);
|
$budgetLimit = $this->repository->updateLimitAmount($budget, $start, $end, $amount);
|
||||||
@@ -106,18 +105,16 @@ class BudgetController extends Controller
|
|||||||
$diff = $start->diffInDays($end);
|
$diff = $start->diffInDays($end);
|
||||||
$current = $amount;
|
$current = $amount;
|
||||||
if ($diff > 0) {
|
if ($diff > 0) {
|
||||||
$current = bcdiv($amount, strval($diff));
|
$current = bcdiv($amount, (string)$diff);
|
||||||
}
|
}
|
||||||
if (bccomp(bcmul('1.1', $average), $current) === -1) {
|
if (bccomp(bcmul('1.1', $average), $current) === -1) {
|
||||||
$largeDiff = true;
|
$largeDiff = true;
|
||||||
$warnText = strval(
|
$warnText = (string)trans(
|
||||||
trans(
|
|
||||||
'firefly.over_budget_warn',
|
'firefly.over_budget_warn',
|
||||||
[
|
[
|
||||||
'amount' => app('amount')->formatAnything($currency, $average, false),
|
'amount' => app('amount')->formatAnything($currency, $average, false),
|
||||||
'over_amount' => app('amount')->formatAnything($currency, $current, false),
|
'over_amount' => app('amount')->formatAnything($currency, $current, false),
|
||||||
]
|
]
|
||||||
)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -142,7 +139,6 @@ class BudgetController extends Controller
|
|||||||
* @param Request $request
|
* @param Request $request
|
||||||
*
|
*
|
||||||
* @return View
|
* @return View
|
||||||
* @throws \RuntimeException
|
|
||||||
*/
|
*/
|
||||||
public function create(Request $request)
|
public function create(Request $request)
|
||||||
{
|
{
|
||||||
@@ -176,13 +172,12 @@ class BudgetController extends Controller
|
|||||||
* @param Budget $budget
|
* @param Budget $budget
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
||||||
* @throws \RuntimeException
|
|
||||||
*/
|
*/
|
||||||
public function destroy(Request $request, Budget $budget)
|
public function destroy(Request $request, Budget $budget)
|
||||||
{
|
{
|
||||||
$name = $budget->name;
|
$name = $budget->name;
|
||||||
$this->repository->destroy($budget);
|
$this->repository->destroy($budget);
|
||||||
$request->session()->flash('success', strval(trans('firefly.deleted_budget', ['name' => $name])));
|
$request->session()->flash('success', (string)trans('firefly.deleted_budget', ['name' => $name]));
|
||||||
Preferences::mark();
|
Preferences::mark();
|
||||||
|
|
||||||
return redirect($this->getPreviousUri('budgets.delete.uri'));
|
return redirect($this->getPreviousUri('budgets.delete.uri'));
|
||||||
@@ -193,7 +188,6 @@ class BudgetController extends Controller
|
|||||||
* @param Budget $budget
|
* @param Budget $budget
|
||||||
*
|
*
|
||||||
* @return View
|
* @return View
|
||||||
* @throws \RuntimeException
|
|
||||||
*/
|
*/
|
||||||
public function edit(Request $request, Budget $budget)
|
public function edit(Request $request, Budget $budget)
|
||||||
{
|
{
|
||||||
@@ -222,8 +216,8 @@ class BudgetController extends Controller
|
|||||||
$range = Preferences::get('viewRange', '1M')->data;
|
$range = Preferences::get('viewRange', '1M')->data;
|
||||||
$start = session('start', new Carbon);
|
$start = session('start', new Carbon);
|
||||||
$end = session('end', new Carbon);
|
$end = session('end', new Carbon);
|
||||||
$page = 0 === intval($request->get('page')) ? 1 : intval($request->get('page'));
|
$page = 0 === (int)$request->get('page') ? 1 : (int)$request->get('page');
|
||||||
$pageSize = intval(Preferences::get('listPageSize', 50)->data);
|
$pageSize = (int)Preferences::get('listPageSize', 50)->data;
|
||||||
|
|
||||||
// make date if present:
|
// make date if present:
|
||||||
if (null !== $moment || '' !== (string)$moment) {
|
if (null !== $moment || '' !== (string)$moment) {
|
||||||
@@ -366,7 +360,7 @@ class BudgetController extends Controller
|
|||||||
if (0 === $count) {
|
if (0 === $count) {
|
||||||
$count = 1;
|
$count = 1;
|
||||||
}
|
}
|
||||||
$result['available'] = bcdiv($total, strval($count));
|
$result['available'] = bcdiv($total, (string)$count);
|
||||||
|
|
||||||
// amount earned in this period:
|
// amount earned in this period:
|
||||||
$subDay = clone $end;
|
$subDay = clone $end;
|
||||||
@@ -374,13 +368,13 @@ class BudgetController extends Controller
|
|||||||
/** @var JournalCollectorInterface $collector */
|
/** @var JournalCollectorInterface $collector */
|
||||||
$collector = app(JournalCollectorInterface::class);
|
$collector = app(JournalCollectorInterface::class);
|
||||||
$collector->setAllAssetAccounts()->setRange($begin, $subDay)->setTypes([TransactionType::DEPOSIT])->withOpposingAccount();
|
$collector->setAllAssetAccounts()->setRange($begin, $subDay)->setTypes([TransactionType::DEPOSIT])->withOpposingAccount();
|
||||||
$result['earned'] = bcdiv(strval($collector->getJournals()->sum('transaction_amount')), strval($count));
|
$result['earned'] = bcdiv((string)$collector->getJournals()->sum('transaction_amount'), (string)$count);
|
||||||
|
|
||||||
// amount spent in period
|
// amount spent in period
|
||||||
/** @var JournalCollectorInterface $collector */
|
/** @var JournalCollectorInterface $collector */
|
||||||
$collector = app(JournalCollectorInterface::class);
|
$collector = app(JournalCollectorInterface::class);
|
||||||
$collector->setAllAssetAccounts()->setRange($begin, $subDay)->setTypes([TransactionType::WITHDRAWAL])->withOpposingAccount();
|
$collector->setAllAssetAccounts()->setRange($begin, $subDay)->setTypes([TransactionType::WITHDRAWAL])->withOpposingAccount();
|
||||||
$result['spent'] = bcdiv(strval($collector->getJournals()->sum('transaction_amount')), strval($count));
|
$result['spent'] = bcdiv((string)$collector->getJournals()->sum('transaction_amount'), (string)$count);
|
||||||
// suggestion starts with the amount spent
|
// suggestion starts with the amount spent
|
||||||
$result['suggested'] = bcmul($result['spent'], '-1');
|
$result['suggested'] = bcmul($result['spent'], '-1');
|
||||||
$result['suggested'] = 1 === bccomp($result['suggested'], $result['earned']) ? $result['earned'] : $result['suggested'];
|
$result['suggested'] = 1 === bccomp($result['suggested'], $result['earned']) ? $result['earned'] : $result['suggested'];
|
||||||
@@ -439,8 +433,8 @@ class BudgetController extends Controller
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$page = intval($request->get('page'));
|
$page = (int)$request->get('page');
|
||||||
$pageSize = intval(Preferences::get('listPageSize', 50)->data);
|
$pageSize = (int)Preferences::get('listPageSize', 50)->data;
|
||||||
|
|
||||||
/** @var JournalCollectorInterface $collector */
|
/** @var JournalCollectorInterface $collector */
|
||||||
$collector = app(JournalCollectorInterface::class);
|
$collector = app(JournalCollectorInterface::class);
|
||||||
@@ -456,7 +450,6 @@ class BudgetController extends Controller
|
|||||||
* @param BudgetIncomeRequest $request
|
* @param BudgetIncomeRequest $request
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Http\RedirectResponse
|
* @return \Illuminate\Http\RedirectResponse
|
||||||
* @throws \InvalidArgumentException
|
|
||||||
*/
|
*/
|
||||||
public function postUpdateIncome(BudgetIncomeRequest $request)
|
public function postUpdateIncome(BudgetIncomeRequest $request)
|
||||||
{
|
{
|
||||||
@@ -477,7 +470,6 @@ class BudgetController extends Controller
|
|||||||
* @param Budget $budget
|
* @param Budget $budget
|
||||||
*
|
*
|
||||||
* @return View
|
* @return View
|
||||||
* @throws \InvalidArgumentException
|
|
||||||
*/
|
*/
|
||||||
public function show(Request $request, Budget $budget)
|
public function show(Request $request, Budget $budget)
|
||||||
{
|
{
|
||||||
@@ -508,7 +500,6 @@ class BudgetController extends Controller
|
|||||||
*
|
*
|
||||||
* @return View
|
* @return View
|
||||||
*
|
*
|
||||||
* @throws \InvalidArgumentException
|
|
||||||
* @throws FireflyException
|
* @throws FireflyException
|
||||||
*/
|
*/
|
||||||
public function showByBudgetLimit(Request $request, Budget $budget, BudgetLimit $budgetLimit)
|
public function showByBudgetLimit(Request $request, Budget $budget, BudgetLimit $budgetLimit)
|
||||||
@@ -517,8 +508,8 @@ class BudgetController extends Controller
|
|||||||
throw new FireflyException('This budget limit is not part of this budget.');
|
throw new FireflyException('This budget limit is not part of this budget.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$page = intval($request->get('page'));
|
$page = (int)$request->get('page');
|
||||||
$pageSize = intval(Preferences::get('listPageSize', 50)->data);
|
$pageSize = (int)Preferences::get('listPageSize', 50)->data;
|
||||||
$subTitle = trans(
|
$subTitle = trans(
|
||||||
'firefly.budget_in_period',
|
'firefly.budget_in_period',
|
||||||
[
|
[
|
||||||
@@ -546,17 +537,16 @@ class BudgetController extends Controller
|
|||||||
* @param BudgetFormRequest $request
|
* @param BudgetFormRequest $request
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Http\RedirectResponse
|
* @return \Illuminate\Http\RedirectResponse
|
||||||
* @throws \RuntimeException
|
|
||||||
*/
|
*/
|
||||||
public function store(BudgetFormRequest $request)
|
public function store(BudgetFormRequest $request)
|
||||||
{
|
{
|
||||||
$data = $request->getBudgetData();
|
$data = $request->getBudgetData();
|
||||||
$budget = $this->repository->store($data);
|
$budget = $this->repository->store($data);
|
||||||
$this->repository->cleanupBudgets();
|
$this->repository->cleanupBudgets();
|
||||||
$request->session()->flash('success', strval(trans('firefly.stored_new_budget', ['name' => $budget->name])));
|
$request->session()->flash('success', (string)trans('firefly.stored_new_budget', ['name' => $budget->name]));
|
||||||
Preferences::mark();
|
Preferences::mark();
|
||||||
|
|
||||||
if (1 === intval($request->get('create_another'))) {
|
if (1 === (int)$request->get('create_another')) {
|
||||||
// @codeCoverageIgnoreStart
|
// @codeCoverageIgnoreStart
|
||||||
$request->session()->put('budgets.create.fromStore', true);
|
$request->session()->put('budgets.create.fromStore', true);
|
||||||
|
|
||||||
@@ -572,18 +562,17 @@ class BudgetController extends Controller
|
|||||||
* @param Budget $budget
|
* @param Budget $budget
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Http\RedirectResponse
|
* @return \Illuminate\Http\RedirectResponse
|
||||||
* @throws \RuntimeException
|
|
||||||
*/
|
*/
|
||||||
public function update(BudgetFormRequest $request, Budget $budget)
|
public function update(BudgetFormRequest $request, Budget $budget)
|
||||||
{
|
{
|
||||||
$data = $request->getBudgetData();
|
$data = $request->getBudgetData();
|
||||||
$this->repository->update($budget, $data);
|
$this->repository->update($budget, $data);
|
||||||
|
|
||||||
$request->session()->flash('success', strval(trans('firefly.updated_budget', ['name' => $budget->name])));
|
$request->session()->flash('success', (string)trans('firefly.updated_budget', ['name' => $budget->name]));
|
||||||
$this->repository->cleanupBudgets();
|
$this->repository->cleanupBudgets();
|
||||||
Preferences::mark();
|
Preferences::mark();
|
||||||
|
|
||||||
if (1 === intval($request->get('return_to_edit'))) {
|
if (1 === (int)$request->get('return_to_edit')) {
|
||||||
// @codeCoverageIgnoreStart
|
// @codeCoverageIgnoreStart
|
||||||
$request->session()->put('budgets.edit.fromUpdate', true);
|
$request->session()->put('budgets.edit.fromUpdate', true);
|
||||||
|
|
||||||
@@ -606,7 +595,7 @@ class BudgetController extends Controller
|
|||||||
$defaultCurrency = app('amount')->getDefaultCurrency();
|
$defaultCurrency = app('amount')->getDefaultCurrency();
|
||||||
$available = $this->repository->getAvailableBudget($defaultCurrency, $start, $end);
|
$available = $this->repository->getAvailableBudget($defaultCurrency, $start, $end);
|
||||||
$available = round($available, $defaultCurrency->decimal_places);
|
$available = round($available, $defaultCurrency->decimal_places);
|
||||||
$page = intval($request->get('page'));
|
$page = (int)$request->get('page');
|
||||||
|
|
||||||
return view('budgets.income', compact('available', 'start', 'end', 'page'));
|
return view('budgets.income', compact('available', 'start', 'end', 'page'));
|
||||||
}
|
}
|
||||||
@@ -672,7 +661,7 @@ class BudgetController extends Controller
|
|||||||
[TransactionType::WITHDRAWAL]
|
[TransactionType::WITHDRAWAL]
|
||||||
);
|
);
|
||||||
$set = $collector->getJournals();
|
$set = $collector->getJournals();
|
||||||
$sum = strval($set->sum('transaction_amount') ?? '0');
|
$sum = (string)($set->sum('transaction_amount') ?? '0');
|
||||||
$journals = $set->count();
|
$journals = $set->count();
|
||||||
$dateStr = $date['end']->format('Y-m-d');
|
$dateStr = $date['end']->format('Y-m-d');
|
||||||
$dateName = app('navigation')->periodShow($date['end'], $date['period']);
|
$dateName = app('navigation')->periodShow($date['end'], $date['period']);
|
||||||
|
@@ -77,7 +77,6 @@ class CategoryController extends Controller
|
|||||||
* @param Request $request
|
* @param Request $request
|
||||||
*
|
*
|
||||||
* @return View
|
* @return View
|
||||||
* @throws \RuntimeException
|
|
||||||
*/
|
*/
|
||||||
public function create(Request $request)
|
public function create(Request $request)
|
||||||
{
|
{
|
||||||
@@ -110,14 +109,13 @@ class CategoryController extends Controller
|
|||||||
* @param Category $category
|
* @param Category $category
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
||||||
* @throws \RuntimeException
|
|
||||||
*/
|
*/
|
||||||
public function destroy(Request $request, Category $category)
|
public function destroy(Request $request, Category $category)
|
||||||
{
|
{
|
||||||
$name = $category->name;
|
$name = $category->name;
|
||||||
$this->repository->destroy($category);
|
$this->repository->destroy($category);
|
||||||
|
|
||||||
$request->session()->flash('success', strval(trans('firefly.deleted_category', ['name' => $name])));
|
$request->session()->flash('success', (string)trans('firefly.deleted_category', ['name' => $name]));
|
||||||
Preferences::mark();
|
Preferences::mark();
|
||||||
|
|
||||||
return redirect($this->getPreviousUri('categories.delete.uri'));
|
return redirect($this->getPreviousUri('categories.delete.uri'));
|
||||||
@@ -128,7 +126,6 @@ class CategoryController extends Controller
|
|||||||
* @param Category $category
|
* @param Category $category
|
||||||
*
|
*
|
||||||
* @return View
|
* @return View
|
||||||
* @throws \RuntimeException
|
|
||||||
*/
|
*/
|
||||||
public function edit(Request $request, Category $category)
|
public function edit(Request $request, Category $category)
|
||||||
{
|
{
|
||||||
@@ -150,8 +147,8 @@ class CategoryController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function index(Request $request)
|
public function index(Request $request)
|
||||||
{
|
{
|
||||||
$page = 0 === intval($request->get('page')) ? 1 : intval($request->get('page'));
|
$page = 0 === (int)$request->get('page') ? 1 : (int)$request->get('page');
|
||||||
$pageSize = intval(Preferences::get('listPageSize', 50)->data);
|
$pageSize = (int)Preferences::get('listPageSize', 50)->data;
|
||||||
$collection = $this->repository->getCategories();
|
$collection = $this->repository->getCategories();
|
||||||
$total = $collection->count();
|
$total = $collection->count();
|
||||||
$collection = $collection->slice(($page - 1) * $pageSize, $pageSize);
|
$collection = $collection->slice(($page - 1) * $pageSize, $pageSize);
|
||||||
@@ -182,8 +179,8 @@ class CategoryController extends Controller
|
|||||||
$start = null;
|
$start = null;
|
||||||
$end = null;
|
$end = null;
|
||||||
$periods = new Collection;
|
$periods = new Collection;
|
||||||
$page = intval($request->get('page'));
|
$page = (int)$request->get('page');
|
||||||
$pageSize = intval(Preferences::get('listPageSize', 50)->data);
|
$pageSize = (int)Preferences::get('listPageSize', 50)->data;
|
||||||
|
|
||||||
// prep for "all" view.
|
// prep for "all" view.
|
||||||
if ('all' === $moment) {
|
if ('all' === $moment) {
|
||||||
@@ -239,8 +236,8 @@ class CategoryController extends Controller
|
|||||||
// default values:
|
// default values:
|
||||||
$subTitle = $category->name;
|
$subTitle = $category->name;
|
||||||
$subTitleIcon = 'fa-bar-chart';
|
$subTitleIcon = 'fa-bar-chart';
|
||||||
$page = intval($request->get('page'));
|
$page = (int)$request->get('page');
|
||||||
$pageSize = intval(Preferences::get('listPageSize', 50)->data);
|
$pageSize = (int)Preferences::get('listPageSize', 50)->data;
|
||||||
$range = Preferences::get('viewRange', '1M')->data;
|
$range = Preferences::get('viewRange', '1M')->data;
|
||||||
$start = null;
|
$start = null;
|
||||||
$end = null;
|
$end = null;
|
||||||
@@ -252,7 +249,7 @@ class CategoryController extends Controller
|
|||||||
$subTitle = trans('firefly.all_journals_for_category', ['name' => $category->name]);
|
$subTitle = trans('firefly.all_journals_for_category', ['name' => $category->name]);
|
||||||
$first = $repository->firstUseDate($category);
|
$first = $repository->firstUseDate($category);
|
||||||
/** @var Carbon $start */
|
/** @var Carbon $start */
|
||||||
$start = null === $first ? new Carbon : $first;
|
$start = $first ?? new Carbon;
|
||||||
$end = new Carbon;
|
$end = new Carbon;
|
||||||
$path = route('categories.show', [$category->id, 'all']);
|
$path = route('categories.show', [$category->id, 'all']);
|
||||||
}
|
}
|
||||||
@@ -300,17 +297,16 @@ class CategoryController extends Controller
|
|||||||
* @param CategoryRepositoryInterface $repository
|
* @param CategoryRepositoryInterface $repository
|
||||||
*
|
*
|
||||||
* @return $this|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
* @return $this|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
||||||
* @throws \RuntimeException
|
|
||||||
*/
|
*/
|
||||||
public function store(CategoryFormRequest $request, CategoryRepositoryInterface $repository)
|
public function store(CategoryFormRequest $request, CategoryRepositoryInterface $repository)
|
||||||
{
|
{
|
||||||
$data = $request->getCategoryData();
|
$data = $request->getCategoryData();
|
||||||
$category = $repository->store($data);
|
$category = $repository->store($data);
|
||||||
|
|
||||||
$request->session()->flash('success', strval(trans('firefly.stored_category', ['name' => $category->name])));
|
$request->session()->flash('success', (string)trans('firefly.stored_category', ['name' => $category->name]));
|
||||||
Preferences::mark();
|
Preferences::mark();
|
||||||
|
|
||||||
if (1 === intval($request->get('create_another'))) {
|
if (1 === (int)$request->get('create_another')) {
|
||||||
// @codeCoverageIgnoreStart
|
// @codeCoverageIgnoreStart
|
||||||
$request->session()->put('categories.create.fromStore', true);
|
$request->session()->put('categories.create.fromStore', true);
|
||||||
|
|
||||||
@@ -327,17 +323,16 @@ class CategoryController extends Controller
|
|||||||
* @param Category $category
|
* @param Category $category
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
||||||
* @throws \RuntimeException
|
|
||||||
*/
|
*/
|
||||||
public function update(CategoryFormRequest $request, CategoryRepositoryInterface $repository, Category $category)
|
public function update(CategoryFormRequest $request, CategoryRepositoryInterface $repository, Category $category)
|
||||||
{
|
{
|
||||||
$data = $request->getCategoryData();
|
$data = $request->getCategoryData();
|
||||||
$repository->update($category, $data);
|
$repository->update($category, $data);
|
||||||
|
|
||||||
$request->session()->flash('success', strval(trans('firefly.updated_category', ['name' => $category->name])));
|
$request->session()->flash('success', (string)trans('firefly.updated_category', ['name' => $category->name]));
|
||||||
Preferences::mark();
|
Preferences::mark();
|
||||||
|
|
||||||
if (1 === intval($request->get('return_to_edit'))) {
|
if (1 === (int)$request->get('return_to_edit')) {
|
||||||
// @codeCoverageIgnoreStart
|
// @codeCoverageIgnoreStart
|
||||||
$request->session()->put('categories.edit.fromUpdate', true);
|
$request->session()->put('categories.edit.fromUpdate', true);
|
||||||
|
|
||||||
|
@@ -93,7 +93,7 @@ class AccountController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
arsort($chartData);
|
arsort($chartData);
|
||||||
$data = $this->generator->singleSet(strval(trans('firefly.spent')), $chartData);
|
$data = $this->generator->singleSet((string)trans('firefly.spent'), $chartData);
|
||||||
$cache->store($data);
|
$cache->store($data);
|
||||||
|
|
||||||
return response()->json($data);
|
return response()->json($data);
|
||||||
@@ -124,8 +124,8 @@ class AccountController extends Controller
|
|||||||
|
|
||||||
/** @var Transaction $transaction */
|
/** @var Transaction $transaction */
|
||||||
foreach ($transactions as $transaction) {
|
foreach ($transactions as $transaction) {
|
||||||
$jrnlBudgetId = intval($transaction->transaction_journal_budget_id);
|
$jrnlBudgetId = (int)$transaction->transaction_journal_budget_id;
|
||||||
$transBudgetId = intval($transaction->transaction_budget_id);
|
$transBudgetId = (int)$transaction->transaction_budget_id;
|
||||||
$budgetId = max($jrnlBudgetId, $transBudgetId);
|
$budgetId = max($jrnlBudgetId, $transBudgetId);
|
||||||
$result[$budgetId] = $result[$budgetId] ?? '0';
|
$result[$budgetId] = $result[$budgetId] ?? '0';
|
||||||
$result[$budgetId] = bcadd($transaction->transaction_amount, $result[$budgetId]);
|
$result[$budgetId] = bcadd($transaction->transaction_amount, $result[$budgetId]);
|
||||||
@@ -181,8 +181,8 @@ class AccountController extends Controller
|
|||||||
$chartData = [];
|
$chartData = [];
|
||||||
/** @var Transaction $transaction */
|
/** @var Transaction $transaction */
|
||||||
foreach ($transactions as $transaction) {
|
foreach ($transactions as $transaction) {
|
||||||
$jrnlCatId = intval($transaction->transaction_journal_category_id);
|
$jrnlCatId = (int)$transaction->transaction_journal_category_id;
|
||||||
$transCatId = intval($transaction->transaction_category_id);
|
$transCatId = (int)$transaction->transaction_category_id;
|
||||||
$categoryId = max($jrnlCatId, $transCatId);
|
$categoryId = max($jrnlCatId, $transCatId);
|
||||||
$result[$categoryId] = $result[$categoryId] ?? '0';
|
$result[$categoryId] = $result[$categoryId] ?? '0';
|
||||||
$result[$categoryId] = bcadd($transaction->transaction_amount, $result[$categoryId]);
|
$result[$categoryId] = bcadd($transaction->transaction_amount, $result[$categoryId]);
|
||||||
@@ -264,8 +264,8 @@ class AccountController extends Controller
|
|||||||
$chartData = [];
|
$chartData = [];
|
||||||
/** @var Transaction $transaction */
|
/** @var Transaction $transaction */
|
||||||
foreach ($transactions as $transaction) {
|
foreach ($transactions as $transaction) {
|
||||||
$jrnlCatId = intval($transaction->transaction_journal_category_id);
|
$jrnlCatId = (int)$transaction->transaction_journal_category_id;
|
||||||
$transCatId = intval($transaction->transaction_category_id);
|
$transCatId = (int)$transaction->transaction_category_id;
|
||||||
$categoryId = max($jrnlCatId, $transCatId);
|
$categoryId = max($jrnlCatId, $transCatId);
|
||||||
$result[$categoryId] = $result[$categoryId] ?? '0';
|
$result[$categoryId] = $result[$categoryId] ?? '0';
|
||||||
$result[$categoryId] = bcadd($transaction->transaction_amount, $result[$categoryId]);
|
$result[$categoryId] = bcadd($transaction->transaction_amount, $result[$categoryId]);
|
||||||
@@ -336,7 +336,7 @@ class AccountController extends Controller
|
|||||||
$theDate = $current->format('Y-m-d');
|
$theDate = $current->format('Y-m-d');
|
||||||
$balance = $range[$theDate] ?? $previous;
|
$balance = $range[$theDate] ?? $previous;
|
||||||
$label = $current->formatLocalized($format);
|
$label = $current->formatLocalized($format);
|
||||||
$chartData[$label] = floatval($balance);
|
$chartData[$label] = (float)$balance;
|
||||||
$previous = $balance;
|
$previous = $balance;
|
||||||
$current->addDay();
|
$current->addDay();
|
||||||
}
|
}
|
||||||
@@ -346,7 +346,7 @@ class AccountController extends Controller
|
|||||||
case '1M':
|
case '1M':
|
||||||
case '1Y':
|
case '1Y':
|
||||||
while ($end >= $current) {
|
while ($end >= $current) {
|
||||||
$balance = floatval(app('steam')->balance($account, $current));
|
$balance = (float)app('steam')->balance($account, $current);
|
||||||
$label = app('navigation')->periodShow($current, $step);
|
$label = app('navigation')->periodShow($current, $step);
|
||||||
$chartData[$label] = $balance;
|
$chartData[$label] = $balance;
|
||||||
$current = app('navigation')->addPeriod($current, $step, 1);
|
$current = app('navigation')->addPeriod($current, $step, 1);
|
||||||
@@ -411,7 +411,7 @@ class AccountController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
arsort($chartData);
|
arsort($chartData);
|
||||||
$data = $this->generator->singleSet(strval(trans('firefly.earned')), $chartData);
|
$data = $this->generator->singleSet((string)trans('firefly.earned'), $chartData);
|
||||||
$cache->store($data);
|
$cache->store($data);
|
||||||
|
|
||||||
return response()->json($data);
|
return response()->json($data);
|
||||||
@@ -442,7 +442,7 @@ class AccountController extends Controller
|
|||||||
|
|
||||||
$chartData = [];
|
$chartData = [];
|
||||||
foreach ($accounts as $account) {
|
foreach ($accounts as $account) {
|
||||||
$currency = $repository->findNull(intval($account->getMeta('currency_id')));
|
$currency = $repository->findNull((int)$account->getMeta('currency_id'));
|
||||||
$currentSet = [
|
$currentSet = [
|
||||||
'label' => $account->name,
|
'label' => $account->name,
|
||||||
'currency_symbol' => $currency->symbol,
|
'currency_symbol' => $currency->symbol,
|
||||||
@@ -453,7 +453,7 @@ class AccountController extends Controller
|
|||||||
$previous = array_values($range)[0];
|
$previous = array_values($range)[0];
|
||||||
while ($currentStart <= $end) {
|
while ($currentStart <= $end) {
|
||||||
$format = $currentStart->format('Y-m-d');
|
$format = $currentStart->format('Y-m-d');
|
||||||
$label = $currentStart->formatLocalized(strval(trans('config.month_and_day')));
|
$label = $currentStart->formatLocalized((string)trans('config.month_and_day'));
|
||||||
$balance = isset($range[$format]) ? round($range[$format], 12) : $previous;
|
$balance = isset($range[$format]) ? round($range[$format], 12) : $previous;
|
||||||
$previous = $balance;
|
$previous = $balance;
|
||||||
$currentStart->addDay();
|
$currentStart->addDay();
|
||||||
|
@@ -71,8 +71,8 @@ class BillController extends Controller
|
|||||||
$paid = $repository->getBillsPaidInRange($start, $end); // will be a negative amount.
|
$paid = $repository->getBillsPaidInRange($start, $end); // will be a negative amount.
|
||||||
$unpaid = $repository->getBillsUnpaidInRange($start, $end); // will be a positive amount.
|
$unpaid = $repository->getBillsUnpaidInRange($start, $end); // will be a positive amount.
|
||||||
$chartData = [
|
$chartData = [
|
||||||
strval(trans('firefly.unpaid')) => $unpaid,
|
(string)trans('firefly.unpaid') => $unpaid,
|
||||||
strval(trans('firefly.paid')) => $paid,
|
(string)trans('firefly.paid') => $paid,
|
||||||
];
|
];
|
||||||
|
|
||||||
$data = $this->generator->pieChart($chartData);
|
$data = $this->generator->pieChart($chartData);
|
||||||
@@ -110,7 +110,7 @@ class BillController extends Controller
|
|||||||
|
|
||||||
/** @var Transaction $entry */
|
/** @var Transaction $entry */
|
||||||
foreach ($results as $entry) {
|
foreach ($results as $entry) {
|
||||||
$date = $entry->date->formatLocalized(strval(trans('config.month_and_day')));
|
$date = $entry->date->formatLocalized((string)trans('config.month_and_day'));
|
||||||
$chartData[0]['entries'][$date] = $bill->amount_min; // minimum amount of bill
|
$chartData[0]['entries'][$date] = $bill->amount_min; // minimum amount of bill
|
||||||
$chartData[1]['entries'][$date] = $bill->amount_max; // maximum amount of bill
|
$chartData[1]['entries'][$date] = $bill->amount_max; // maximum amount of bill
|
||||||
$chartData[2]['entries'][$date] = bcmul($entry->transaction_amount, '-1'); // amount of journal
|
$chartData[2]['entries'][$date] = bcmul($entry->transaction_amount, '-1'); // amount of journal
|
||||||
|
@@ -112,12 +112,12 @@ class BudgetController extends Controller
|
|||||||
}
|
}
|
||||||
$spent = $this->repository->spentInPeriod($budgetCollection, new Collection, $current, $currentEnd);
|
$spent = $this->repository->spentInPeriod($budgetCollection, new Collection, $current, $currentEnd);
|
||||||
$label = app('navigation')->periodShow($current, $step);
|
$label = app('navigation')->periodShow($current, $step);
|
||||||
$chartData[$label] = floatval(bcmul($spent, '-1'));
|
$chartData[$label] = (float)bcmul($spent, '-1');
|
||||||
$current = clone $currentEnd;
|
$current = clone $currentEnd;
|
||||||
$current->addDay();
|
$current->addDay();
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = $this->generator->singleSet(strval(trans('firefly.spent')), $chartData);
|
$data = $this->generator->singleSet((string)trans('firefly.spent'), $chartData);
|
||||||
|
|
||||||
$cache->store($data);
|
$cache->store($data);
|
||||||
|
|
||||||
@@ -161,12 +161,12 @@ class BudgetController extends Controller
|
|||||||
while ($start <= $end) {
|
while ($start <= $end) {
|
||||||
$spent = $this->repository->spentInPeriod($budgetCollection, new Collection, $start, $start);
|
$spent = $this->repository->spentInPeriod($budgetCollection, new Collection, $start, $start);
|
||||||
$amount = bcadd($amount, $spent);
|
$amount = bcadd($amount, $spent);
|
||||||
$format = $start->formatLocalized(strval(trans('config.month_and_day')));
|
$format = $start->formatLocalized((string)trans('config.month_and_day'));
|
||||||
$entries[$format] = $amount;
|
$entries[$format] = $amount;
|
||||||
|
|
||||||
$start->addDay();
|
$start->addDay();
|
||||||
}
|
}
|
||||||
$data = $this->generator->singleSet(strval(trans('firefly.left')), $entries);
|
$data = $this->generator->singleSet((string)trans('firefly.left'), $entries);
|
||||||
$cache->store($data);
|
$cache->store($data);
|
||||||
|
|
||||||
return response()->json($data);
|
return response()->json($data);
|
||||||
@@ -200,7 +200,7 @@ class BudgetController extends Controller
|
|||||||
$chartData = [];
|
$chartData = [];
|
||||||
/** @var Transaction $transaction */
|
/** @var Transaction $transaction */
|
||||||
foreach ($transactions as $transaction) {
|
foreach ($transactions as $transaction) {
|
||||||
$assetId = intval($transaction->account_id);
|
$assetId = (int)$transaction->account_id;
|
||||||
$result[$assetId] = $result[$assetId] ?? '0';
|
$result[$assetId] = $result[$assetId] ?? '0';
|
||||||
$result[$assetId] = bcadd($transaction->transaction_amount, $result[$assetId]);
|
$result[$assetId] = bcadd($transaction->transaction_amount, $result[$assetId]);
|
||||||
}
|
}
|
||||||
@@ -244,8 +244,8 @@ class BudgetController extends Controller
|
|||||||
$chartData = [];
|
$chartData = [];
|
||||||
/** @var Transaction $transaction */
|
/** @var Transaction $transaction */
|
||||||
foreach ($transactions as $transaction) {
|
foreach ($transactions as $transaction) {
|
||||||
$jrnlCatId = intval($transaction->transaction_journal_category_id);
|
$jrnlCatId = (int)$transaction->transaction_journal_category_id;
|
||||||
$transCatId = intval($transaction->transaction_category_id);
|
$transCatId = (int)$transaction->transaction_category_id;
|
||||||
$categoryId = max($jrnlCatId, $transCatId);
|
$categoryId = max($jrnlCatId, $transCatId);
|
||||||
$result[$categoryId] = $result[$categoryId] ?? '0';
|
$result[$categoryId] = $result[$categoryId] ?? '0';
|
||||||
$result[$categoryId] = bcadd($transaction->transaction_amount, $result[$categoryId]);
|
$result[$categoryId] = bcadd($transaction->transaction_amount, $result[$categoryId]);
|
||||||
@@ -290,7 +290,7 @@ class BudgetController extends Controller
|
|||||||
$chartData = [];
|
$chartData = [];
|
||||||
/** @var Transaction $transaction */
|
/** @var Transaction $transaction */
|
||||||
foreach ($transactions as $transaction) {
|
foreach ($transactions as $transaction) {
|
||||||
$opposingId = intval($transaction->opposing_account_id);
|
$opposingId = (int)$transaction->opposing_account_id;
|
||||||
$result[$opposingId] = $result[$opposingId] ?? '0';
|
$result[$opposingId] = $result[$opposingId] ?? '0';
|
||||||
$result[$opposingId] = bcadd($transaction->transaction_amount, $result[$opposingId]);
|
$result[$opposingId] = bcadd($transaction->transaction_amount, $result[$opposingId]);
|
||||||
}
|
}
|
||||||
@@ -329,9 +329,9 @@ class BudgetController extends Controller
|
|||||||
}
|
}
|
||||||
$budgets = $this->repository->getActiveBudgets();
|
$budgets = $this->repository->getActiveBudgets();
|
||||||
$chartData = [
|
$chartData = [
|
||||||
['label' => strval(trans('firefly.spent_in_budget')), 'entries' => [], 'type' => 'bar'],
|
['label' => (string)trans('firefly.spent_in_budget'), 'entries' => [], 'type' => 'bar'],
|
||||||
['label' => strval(trans('firefly.left_to_spend')), 'entries' => [], 'type' => 'bar'],
|
['label' => (string)trans('firefly.left_to_spend'), 'entries' => [], 'type' => 'bar'],
|
||||||
['label' => strval(trans('firefly.overspent')), 'entries' => [], 'type' => 'bar'],
|
['label' => (string)trans('firefly.overspent'), 'entries' => [], 'type' => 'bar'],
|
||||||
];
|
];
|
||||||
|
|
||||||
/** @var Budget $budget */
|
/** @var Budget $budget */
|
||||||
@@ -348,7 +348,7 @@ class BudgetController extends Controller
|
|||||||
}
|
}
|
||||||
// for no budget:
|
// for no budget:
|
||||||
$spent = $this->spentInPeriodWithout($start, $end);
|
$spent = $this->spentInPeriodWithout($start, $end);
|
||||||
$name = strval(trans('firefly.no_budget'));
|
$name = (string)trans('firefly.no_budget');
|
||||||
if (0 !== bccomp($spent, '0')) {
|
if (0 !== bccomp($spent, '0')) {
|
||||||
$chartData[0]['entries'][$name] = bcmul($spent, '-1');
|
$chartData[0]['entries'][$name] = bcmul($spent, '-1');
|
||||||
$chartData[1]['entries'][$name] = '0';
|
$chartData[1]['entries'][$name] = '0';
|
||||||
@@ -389,14 +389,14 @@ class BudgetController extends Controller
|
|||||||
|
|
||||||
// join them into one set of data:
|
// join them into one set of data:
|
||||||
$chartData = [
|
$chartData = [
|
||||||
['label' => strval(trans('firefly.spent')), 'type' => 'bar', 'entries' => []],
|
['label' => (string)trans('firefly.spent'), 'type' => 'bar', 'entries' => []],
|
||||||
['label' => strval(trans('firefly.budgeted')), 'type' => 'bar', 'entries' => []],
|
['label' => (string)trans('firefly.budgeted'), 'type' => 'bar', 'entries' => []],
|
||||||
];
|
];
|
||||||
|
|
||||||
foreach (array_keys($periods) as $period) {
|
foreach (array_keys($periods) as $period) {
|
||||||
$label = $periods[$period];
|
$label = $periods[$period];
|
||||||
$spent = isset($entries[$budget->id]['entries'][$period]) ? $entries[$budget->id]['entries'][$period] : '0';
|
$spent = $entries[$budget->id]['entries'][$period] ?? '0';
|
||||||
$limit = isset($budgeted[$period]) ? $budgeted[$period] : 0;
|
$limit = (int)($budgeted[$period] ?? 0);
|
||||||
$chartData[0]['entries'][$label] = round(bcmul($spent, '-1'), 12);
|
$chartData[0]['entries'][$label] = round(bcmul($spent, '-1'), 12);
|
||||||
$chartData[1]['entries'][$label] = $limit;
|
$chartData[1]['entries'][$label] = $limit;
|
||||||
}
|
}
|
||||||
@@ -433,10 +433,10 @@ class BudgetController extends Controller
|
|||||||
// join them:
|
// join them:
|
||||||
foreach (array_keys($periods) as $period) {
|
foreach (array_keys($periods) as $period) {
|
||||||
$label = $periods[$period];
|
$label = $periods[$period];
|
||||||
$spent = isset($entries['entries'][$period]) ? $entries['entries'][$period] : '0';
|
$spent = $entries['entries'][$period] ?? '0';
|
||||||
$chartData[$label] = bcmul($spent, '-1');
|
$chartData[$label] = bcmul($spent, '-1');
|
||||||
}
|
}
|
||||||
$data = $this->generator->singleSet(strval(trans('firefly.spent')), $chartData);
|
$data = $this->generator->singleSet((string)trans('firefly.spent'), $chartData);
|
||||||
$cache->store($data);
|
$cache->store($data);
|
||||||
|
|
||||||
return response()->json($data);
|
return response()->json($data);
|
||||||
@@ -568,7 +568,7 @@ class BudgetController extends Controller
|
|||||||
private function spentInPeriodMulti(Budget $budget, Collection $limits): array
|
private function spentInPeriodMulti(Budget $budget, Collection $limits): array
|
||||||
{
|
{
|
||||||
$return = [];
|
$return = [];
|
||||||
$format = strval(trans('config.month_and_day'));
|
$format = (string)trans('config.month_and_day');
|
||||||
$name = $budget->name;
|
$name = $budget->name;
|
||||||
/** @var BudgetLimit $budgetLimit */
|
/** @var BudgetLimit $budgetLimit */
|
||||||
foreach ($limits as $budgetLimit) {
|
foreach ($limits as $budgetLimit) {
|
||||||
|
@@ -83,7 +83,7 @@ class BudgetReportController extends Controller
|
|||||||
$helper->setBudgets($budgets);
|
$helper->setBudgets($budgets);
|
||||||
$helper->setStart($start);
|
$helper->setStart($start);
|
||||||
$helper->setEnd($end);
|
$helper->setEnd($end);
|
||||||
$helper->setCollectOtherObjects(1 === intval($others));
|
$helper->setCollectOtherObjects(1 === (int)$others);
|
||||||
$chartData = $helper->generate('expense', 'account');
|
$chartData = $helper->generate('expense', 'account');
|
||||||
$data = $this->generator->pieChart($chartData);
|
$data = $this->generator->pieChart($chartData);
|
||||||
|
|
||||||
@@ -107,7 +107,7 @@ class BudgetReportController extends Controller
|
|||||||
$helper->setBudgets($budgets);
|
$helper->setBudgets($budgets);
|
||||||
$helper->setStart($start);
|
$helper->setStart($start);
|
||||||
$helper->setEnd($end);
|
$helper->setEnd($end);
|
||||||
$helper->setCollectOtherObjects(1 === intval($others));
|
$helper->setCollectOtherObjects(1 === (int)$others);
|
||||||
$chartData = $helper->generate('expense', 'budget');
|
$chartData = $helper->generate('expense', 'budget');
|
||||||
$data = $this->generator->pieChart($chartData);
|
$data = $this->generator->pieChart($chartData);
|
||||||
|
|
||||||
@@ -141,20 +141,20 @@ class BudgetReportController extends Controller
|
|||||||
// prep chart data:
|
// prep chart data:
|
||||||
foreach ($budgets as $budget) {
|
foreach ($budgets as $budget) {
|
||||||
$chartData[$budget->id] = [
|
$chartData[$budget->id] = [
|
||||||
'label' => strval(trans('firefly.spent_in_specific_budget', ['budget' => $budget->name])),
|
'label' => (string)trans('firefly.spent_in_specific_budget', ['budget' => $budget->name]),
|
||||||
'type' => 'bar',
|
'type' => 'bar',
|
||||||
'yAxisID' => 'y-axis-0',
|
'yAxisID' => 'y-axis-0',
|
||||||
'entries' => [],
|
'entries' => [],
|
||||||
];
|
];
|
||||||
$chartData[$budget->id . '-sum'] = [
|
$chartData[$budget->id . '-sum'] = [
|
||||||
'label' => strval(trans('firefly.sum_of_expenses_in_budget', ['budget' => $budget->name])),
|
'label' => (string)trans('firefly.sum_of_expenses_in_budget', ['budget' => $budget->name]),
|
||||||
'type' => 'line',
|
'type' => 'line',
|
||||||
'fill' => false,
|
'fill' => false,
|
||||||
'yAxisID' => 'y-axis-1',
|
'yAxisID' => 'y-axis-1',
|
||||||
'entries' => [],
|
'entries' => [],
|
||||||
];
|
];
|
||||||
$chartData[$budget->id . '-left'] = [
|
$chartData[$budget->id . '-left'] = [
|
||||||
'label' => strval(trans('firefly.left_in_budget_limit', ['budget' => $budget->name])),
|
'label' => (string)trans('firefly.left_in_budget_limit', ['budget' => $budget->name]),
|
||||||
'type' => 'bar',
|
'type' => 'bar',
|
||||||
'fill' => false,
|
'fill' => false,
|
||||||
'yAxisID' => 'y-axis-0',
|
'yAxisID' => 'y-axis-0',
|
||||||
@@ -182,7 +182,7 @@ class BudgetReportController extends Controller
|
|||||||
|
|
||||||
if (count($budgetLimits) > 0) {
|
if (count($budgetLimits) > 0) {
|
||||||
$budgetLimitId = $budgetLimits->first()->id;
|
$budgetLimitId = $budgetLimits->first()->id;
|
||||||
$leftOfLimits[$budgetLimitId] = $leftOfLimits[$budgetLimitId] ?? strval($budgetLimits->sum('amount'));
|
$leftOfLimits[$budgetLimitId] = $leftOfLimits[$budgetLimitId] ?? (string)$budgetLimits->sum('amount');
|
||||||
$leftOfLimits[$budgetLimitId] = bcadd($leftOfLimits[$budgetLimitId], $currentExpenses);
|
$leftOfLimits[$budgetLimitId] = bcadd($leftOfLimits[$budgetLimitId], $currentExpenses);
|
||||||
$chartData[$budget->id . '-left']['entries'][$label] = $leftOfLimits[$budgetLimitId];
|
$chartData[$budget->id . '-left']['entries'][$label] = $leftOfLimits[$budgetLimitId];
|
||||||
}
|
}
|
||||||
@@ -244,9 +244,7 @@ class BudgetReportController extends Controller
|
|||||||
$collector->addFilter(OpposingAccountFilter::class);
|
$collector->addFilter(OpposingAccountFilter::class);
|
||||||
$collector->addFilter(PositiveAmountFilter::class);
|
$collector->addFilter(PositiveAmountFilter::class);
|
||||||
|
|
||||||
$transactions = $collector->getJournals();
|
return $collector->getJournals();
|
||||||
|
|
||||||
return $transactions;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -260,8 +258,8 @@ class BudgetReportController extends Controller
|
|||||||
$grouped = [];
|
$grouped = [];
|
||||||
/** @var Transaction $transaction */
|
/** @var Transaction $transaction */
|
||||||
foreach ($set as $transaction) {
|
foreach ($set as $transaction) {
|
||||||
$jrnlBudId = intval($transaction->transaction_journal_budget_id);
|
$jrnlBudId = (int)$transaction->transaction_journal_budget_id;
|
||||||
$transBudId = intval($transaction->transaction_budget_id);
|
$transBudId = (int)$transaction->transaction_budget_id;
|
||||||
$budgetId = max($jrnlBudId, $transBudId);
|
$budgetId = max($jrnlBudId, $transBudId);
|
||||||
$grouped[$budgetId] = $grouped[$budgetId] ?? '0';
|
$grouped[$budgetId] = $grouped[$budgetId] ?? '0';
|
||||||
$grouped[$budgetId] = bcadd($transaction->transaction_amount, $grouped[$budgetId]);
|
$grouped[$budgetId] = bcadd($transaction->transaction_amount, $grouped[$budgetId]);
|
||||||
|
@@ -81,17 +81,17 @@ class CategoryController extends Controller
|
|||||||
$accounts = $accountRepository->getAccountsByType([AccountType::DEFAULT, AccountType::ASSET]);
|
$accounts = $accountRepository->getAccountsByType([AccountType::DEFAULT, AccountType::ASSET]);
|
||||||
$chartData = [
|
$chartData = [
|
||||||
[
|
[
|
||||||
'label' => strval(trans('firefly.spent')),
|
'label' => (string)trans('firefly.spent'),
|
||||||
'entries' => [],
|
'entries' => [],
|
||||||
'type' => 'bar',
|
'type' => 'bar',
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'label' => strval(trans('firefly.earned')),
|
'label' => (string)trans('firefly.earned'),
|
||||||
'entries' => [],
|
'entries' => [],
|
||||||
'type' => 'bar',
|
'type' => 'bar',
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'label' => strval(trans('firefly.sum')),
|
'label' => (string)trans('firefly.sum'),
|
||||||
'entries' => [],
|
'entries' => [],
|
||||||
'type' => 'line',
|
'type' => 'line',
|
||||||
'fill' => false,
|
'fill' => false,
|
||||||
@@ -145,12 +145,12 @@ class CategoryController extends Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$chartData[strval(trans('firefly.no_category'))] = bcmul($repository->spentInPeriodWithoutCategory(new Collection, $start, $end), '-1');
|
$chartData[(string)trans('firefly.no_category')] = bcmul($repository->spentInPeriodWithoutCategory(new Collection, $start, $end), '-1');
|
||||||
|
|
||||||
// sort
|
// sort
|
||||||
arsort($chartData);
|
arsort($chartData);
|
||||||
|
|
||||||
$data = $this->generator->singleSet(strval(trans('firefly.spent')), $chartData);
|
$data = $this->generator->singleSet((string)trans('firefly.spent'), $chartData);
|
||||||
$cache->store($data);
|
$cache->store($data);
|
||||||
|
|
||||||
return response()->json($data);
|
return response()->json($data);
|
||||||
@@ -181,17 +181,17 @@ class CategoryController extends Controller
|
|||||||
$periods = app('navigation')->listOfPeriods($start, $end);
|
$periods = app('navigation')->listOfPeriods($start, $end);
|
||||||
$chartData = [
|
$chartData = [
|
||||||
[
|
[
|
||||||
'label' => strval(trans('firefly.spent')),
|
'label' => (string)trans('firefly.spent'),
|
||||||
'entries' => [],
|
'entries' => [],
|
||||||
'type' => 'bar',
|
'type' => 'bar',
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'label' => strval(trans('firefly.earned')),
|
'label' => (string)trans('firefly.earned'),
|
||||||
'entries' => [],
|
'entries' => [],
|
||||||
'type' => 'bar',
|
'type' => 'bar',
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'label' => strval(trans('firefly.sum')),
|
'label' => (string)trans('firefly.sum'),
|
||||||
'entries' => [],
|
'entries' => [],
|
||||||
'type' => 'line',
|
'type' => 'line',
|
||||||
'fill' => false,
|
'fill' => false,
|
||||||
@@ -237,17 +237,17 @@ class CategoryController extends Controller
|
|||||||
$periods = app('navigation')->listOfPeriods($start, $end);
|
$periods = app('navigation')->listOfPeriods($start, $end);
|
||||||
$chartData = [
|
$chartData = [
|
||||||
[
|
[
|
||||||
'label' => strval(trans('firefly.spent')),
|
'label' => (string)trans('firefly.spent'),
|
||||||
'entries' => [],
|
'entries' => [],
|
||||||
'type' => 'bar',
|
'type' => 'bar',
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'label' => strval(trans('firefly.earned')),
|
'label' => (string)trans('firefly.earned'),
|
||||||
'entries' => [],
|
'entries' => [],
|
||||||
'type' => 'bar',
|
'type' => 'bar',
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'label' => strval(trans('firefly.sum')),
|
'label' => (string)trans('firefly.sum'),
|
||||||
'entries' => [],
|
'entries' => [],
|
||||||
'type' => 'line',
|
'type' => 'line',
|
||||||
'fill' => false,
|
'fill' => false,
|
||||||
@@ -313,17 +313,17 @@ class CategoryController extends Controller
|
|||||||
// chart data
|
// chart data
|
||||||
$chartData = [
|
$chartData = [
|
||||||
[
|
[
|
||||||
'label' => strval(trans('firefly.spent')),
|
'label' => (string)trans('firefly.spent'),
|
||||||
'entries' => [],
|
'entries' => [],
|
||||||
'type' => 'bar',
|
'type' => 'bar',
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'label' => strval(trans('firefly.earned')),
|
'label' => (string)trans('firefly.earned'),
|
||||||
'entries' => [],
|
'entries' => [],
|
||||||
'type' => 'bar',
|
'type' => 'bar',
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'label' => strval(trans('firefly.sum')),
|
'label' => (string)trans('firefly.sum'),
|
||||||
'entries' => [],
|
'entries' => [],
|
||||||
'type' => 'line',
|
'type' => 'line',
|
||||||
'fill' => false,
|
'fill' => false,
|
||||||
|
@@ -75,7 +75,7 @@ class CategoryReportController extends Controller
|
|||||||
{
|
{
|
||||||
/** @var MetaPieChartInterface $helper */
|
/** @var MetaPieChartInterface $helper */
|
||||||
$helper = app(MetaPieChartInterface::class);
|
$helper = app(MetaPieChartInterface::class);
|
||||||
$helper->setAccounts($accounts)->setCategories($categories)->setStart($start)->setEnd($end)->setCollectOtherObjects(1 === intval($others));
|
$helper->setAccounts($accounts)->setCategories($categories)->setStart($start)->setEnd($end)->setCollectOtherObjects(1 === (int)$others);
|
||||||
|
|
||||||
$chartData = $helper->generate('expense', 'account');
|
$chartData = $helper->generate('expense', 'account');
|
||||||
$data = $this->generator->pieChart($chartData);
|
$data = $this->generator->pieChart($chartData);
|
||||||
@@ -100,7 +100,7 @@ class CategoryReportController extends Controller
|
|||||||
$helper->setCategories($categories);
|
$helper->setCategories($categories);
|
||||||
$helper->setStart($start);
|
$helper->setStart($start);
|
||||||
$helper->setEnd($end);
|
$helper->setEnd($end);
|
||||||
$helper->setCollectOtherObjects(1 === intval($others));
|
$helper->setCollectOtherObjects(1 === (int)$others);
|
||||||
$chartData = $helper->generate('income', 'account');
|
$chartData = $helper->generate('income', 'account');
|
||||||
$data = $this->generator->pieChart($chartData);
|
$data = $this->generator->pieChart($chartData);
|
||||||
|
|
||||||
@@ -124,7 +124,7 @@ class CategoryReportController extends Controller
|
|||||||
$helper->setCategories($categories);
|
$helper->setCategories($categories);
|
||||||
$helper->setStart($start);
|
$helper->setStart($start);
|
||||||
$helper->setEnd($end);
|
$helper->setEnd($end);
|
||||||
$helper->setCollectOtherObjects(1 === intval($others));
|
$helper->setCollectOtherObjects(1 === (int)$others);
|
||||||
$chartData = $helper->generate('expense', 'category');
|
$chartData = $helper->generate('expense', 'category');
|
||||||
$data = $this->generator->pieChart($chartData);
|
$data = $this->generator->pieChart($chartData);
|
||||||
|
|
||||||
@@ -148,7 +148,7 @@ class CategoryReportController extends Controller
|
|||||||
$helper->setCategories($categories);
|
$helper->setCategories($categories);
|
||||||
$helper->setStart($start);
|
$helper->setStart($start);
|
||||||
$helper->setEnd($end);
|
$helper->setEnd($end);
|
||||||
$helper->setCollectOtherObjects(1 === intval($others));
|
$helper->setCollectOtherObjects(1 === (int)$others);
|
||||||
$chartData = $helper->generate('income', 'category');
|
$chartData = $helper->generate('income', 'category');
|
||||||
$data = $this->generator->pieChart($chartData);
|
$data = $this->generator->pieChart($chartData);
|
||||||
|
|
||||||
@@ -183,27 +183,27 @@ class CategoryReportController extends Controller
|
|||||||
// prep chart data:
|
// prep chart data:
|
||||||
foreach ($categories as $category) {
|
foreach ($categories as $category) {
|
||||||
$chartData[$category->id . '-in'] = [
|
$chartData[$category->id . '-in'] = [
|
||||||
'label' => $category->name . ' (' . strtolower(strval(trans('firefly.income'))) . ')',
|
'label' => $category->name . ' (' . strtolower((string)trans('firefly.income')) . ')',
|
||||||
'type' => 'bar',
|
'type' => 'bar',
|
||||||
'yAxisID' => 'y-axis-0',
|
'yAxisID' => 'y-axis-0',
|
||||||
'entries' => [],
|
'entries' => [],
|
||||||
];
|
];
|
||||||
$chartData[$category->id . '-out'] = [
|
$chartData[$category->id . '-out'] = [
|
||||||
'label' => $category->name . ' (' . strtolower(strval(trans('firefly.expenses'))) . ')',
|
'label' => $category->name . ' (' . strtolower((string)trans('firefly.expenses')) . ')',
|
||||||
'type' => 'bar',
|
'type' => 'bar',
|
||||||
'yAxisID' => 'y-axis-0',
|
'yAxisID' => 'y-axis-0',
|
||||||
'entries' => [],
|
'entries' => [],
|
||||||
];
|
];
|
||||||
// total in, total out:
|
// total in, total out:
|
||||||
$chartData[$category->id . '-total-in'] = [
|
$chartData[$category->id . '-total-in'] = [
|
||||||
'label' => $category->name . ' (' . strtolower(strval(trans('firefly.sum_of_income'))) . ')',
|
'label' => $category->name . ' (' . strtolower((string)trans('firefly.sum_of_income')) . ')',
|
||||||
'type' => 'line',
|
'type' => 'line',
|
||||||
'fill' => false,
|
'fill' => false,
|
||||||
'yAxisID' => 'y-axis-1',
|
'yAxisID' => 'y-axis-1',
|
||||||
'entries' => [],
|
'entries' => [],
|
||||||
];
|
];
|
||||||
$chartData[$category->id . '-total-out'] = [
|
$chartData[$category->id . '-total-out'] = [
|
||||||
'label' => $category->name . ' (' . strtolower(strval(trans('firefly.sum_of_expenses'))) . ')',
|
'label' => $category->name . ' (' . strtolower((string)trans('firefly.sum_of_expenses')) . ')',
|
||||||
'type' => 'line',
|
'type' => 'line',
|
||||||
'fill' => false,
|
'fill' => false,
|
||||||
'yAxisID' => 'y-axis-1',
|
'yAxisID' => 'y-axis-1',
|
||||||
@@ -279,9 +279,7 @@ class CategoryReportController extends Controller
|
|||||||
$collector->addFilter(OpposingAccountFilter::class);
|
$collector->addFilter(OpposingAccountFilter::class);
|
||||||
$collector->addFilter(PositiveAmountFilter::class);
|
$collector->addFilter(PositiveAmountFilter::class);
|
||||||
|
|
||||||
$transactions = $collector->getJournals();
|
return $collector->getJournals();
|
||||||
|
|
||||||
return $transactions;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -302,9 +300,7 @@ class CategoryReportController extends Controller
|
|||||||
$collector->addFilter(OpposingAccountFilter::class);
|
$collector->addFilter(OpposingAccountFilter::class);
|
||||||
$collector->addFilter(NegativeAmountFilter::class);
|
$collector->addFilter(NegativeAmountFilter::class);
|
||||||
|
|
||||||
$transactions = $collector->getJournals();
|
return $collector->getJournals();
|
||||||
|
|
||||||
return $transactions;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -318,8 +314,8 @@ class CategoryReportController extends Controller
|
|||||||
$grouped = [];
|
$grouped = [];
|
||||||
/** @var Transaction $transaction */
|
/** @var Transaction $transaction */
|
||||||
foreach ($set as $transaction) {
|
foreach ($set as $transaction) {
|
||||||
$jrnlCatId = intval($transaction->transaction_journal_category_id);
|
$jrnlCatId = (int)$transaction->transaction_journal_category_id;
|
||||||
$transCatId = intval($transaction->transaction_category_id);
|
$transCatId = (int)$transaction->transaction_category_id;
|
||||||
$categoryId = max($jrnlCatId, $transCatId);
|
$categoryId = max($jrnlCatId, $transCatId);
|
||||||
$grouped[$categoryId] = $grouped[$categoryId] ?? '0';
|
$grouped[$categoryId] = $grouped[$categoryId] ?? '0';
|
||||||
$grouped[$categoryId] = bcadd($transaction->transaction_amount, $grouped[$categoryId]);
|
$grouped[$categoryId] = bcadd($transaction->transaction_amount, $grouped[$categoryId]);
|
||||||
|
@@ -100,27 +100,27 @@ class ExpenseReportController extends Controller
|
|||||||
/** @var Account $exp */
|
/** @var Account $exp */
|
||||||
$exp = $combi->first();
|
$exp = $combi->first();
|
||||||
$chartData[$exp->id . '-in'] = [
|
$chartData[$exp->id . '-in'] = [
|
||||||
'label' => $name . ' (' . strtolower(strval(trans('firefly.income'))) . ')',
|
'label' => $name . ' (' . strtolower((string)trans('firefly.income')) . ')',
|
||||||
'type' => 'bar',
|
'type' => 'bar',
|
||||||
'yAxisID' => 'y-axis-0',
|
'yAxisID' => 'y-axis-0',
|
||||||
'entries' => [],
|
'entries' => [],
|
||||||
];
|
];
|
||||||
$chartData[$exp->id . '-out'] = [
|
$chartData[$exp->id . '-out'] = [
|
||||||
'label' => $name . ' (' . strtolower(strval(trans('firefly.expenses'))) . ')',
|
'label' => $name . ' (' . strtolower((string)trans('firefly.expenses')) . ')',
|
||||||
'type' => 'bar',
|
'type' => 'bar',
|
||||||
'yAxisID' => 'y-axis-0',
|
'yAxisID' => 'y-axis-0',
|
||||||
'entries' => [],
|
'entries' => [],
|
||||||
];
|
];
|
||||||
// total in, total out:
|
// total in, total out:
|
||||||
$chartData[$exp->id . '-total-in'] = [
|
$chartData[$exp->id . '-total-in'] = [
|
||||||
'label' => $name . ' (' . strtolower(strval(trans('firefly.sum_of_income'))) . ')',
|
'label' => $name . ' (' . strtolower((string)trans('firefly.sum_of_income')) . ')',
|
||||||
'type' => 'line',
|
'type' => 'line',
|
||||||
'fill' => false,
|
'fill' => false,
|
||||||
'yAxisID' => 'y-axis-1',
|
'yAxisID' => 'y-axis-1',
|
||||||
'entries' => [],
|
'entries' => [],
|
||||||
];
|
];
|
||||||
$chartData[$exp->id . '-total-out'] = [
|
$chartData[$exp->id . '-total-out'] = [
|
||||||
'label' => $name . ' (' . strtolower(strval(trans('firefly.sum_of_expenses'))) . ')',
|
'label' => $name . ' (' . strtolower((string)trans('firefly.sum_of_expenses')) . ')',
|
||||||
'type' => 'line',
|
'type' => 'line',
|
||||||
'fill' => false,
|
'fill' => false,
|
||||||
'yAxisID' => 'y-axis-1',
|
'yAxisID' => 'y-axis-1',
|
||||||
@@ -196,7 +196,7 @@ class ExpenseReportController extends Controller
|
|||||||
$collection->push($expenseAccount);
|
$collection->push($expenseAccount);
|
||||||
|
|
||||||
$revenue = $this->accountRepository->findByName($expenseAccount->name, [AccountType::REVENUE]);
|
$revenue = $this->accountRepository->findByName($expenseAccount->name, [AccountType::REVENUE]);
|
||||||
if (!is_null($revenue)) {
|
if (null !== $revenue) {
|
||||||
$collection->push($revenue);
|
$collection->push($revenue);
|
||||||
}
|
}
|
||||||
$combined[$expenseAccount->name] = $collection;
|
$combined[$expenseAccount->name] = $collection;
|
||||||
@@ -219,9 +219,7 @@ class ExpenseReportController extends Controller
|
|||||||
$collector = app(JournalCollectorInterface::class);
|
$collector = app(JournalCollectorInterface::class);
|
||||||
$collector->setAccounts($accounts)->setRange($start, $end)->setTypes([TransactionType::WITHDRAWAL])->setOpposingAccounts($opposing);
|
$collector->setAccounts($accounts)->setRange($start, $end)->setTypes([TransactionType::WITHDRAWAL])->setOpposingAccounts($opposing);
|
||||||
|
|
||||||
$transactions = $collector->getJournals();
|
return $collector->getJournals();
|
||||||
|
|
||||||
return $transactions;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -239,9 +237,7 @@ class ExpenseReportController extends Controller
|
|||||||
$collector = app(JournalCollectorInterface::class);
|
$collector = app(JournalCollectorInterface::class);
|
||||||
$collector->setAccounts($accounts)->setRange($start, $end)->setTypes([TransactionType::DEPOSIT])->setOpposingAccounts($opposing);
|
$collector->setAccounts($accounts)->setRange($start, $end)->setTypes([TransactionType::DEPOSIT])->setOpposingAccounts($opposing);
|
||||||
|
|
||||||
$transactions = $collector->getJournals();
|
return $collector->getJournals();
|
||||||
|
|
||||||
return $transactions;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -71,7 +71,7 @@ class PiggyBankController extends Controller
|
|||||||
$sum = '0';
|
$sum = '0';
|
||||||
/** @var PiggyBankEvent $entry */
|
/** @var PiggyBankEvent $entry */
|
||||||
foreach ($set as $entry) {
|
foreach ($set as $entry) {
|
||||||
$label = $entry->date->formatLocalized(strval(trans('config.month_and_day')));
|
$label = $entry->date->formatLocalized((string)trans('config.month_and_day'));
|
||||||
$sum = bcadd($sum, $entry->amount);
|
$sum = bcadd($sum, $entry->amount);
|
||||||
$chartData[$label] = $sum;
|
$chartData[$label] = $sum;
|
||||||
}
|
}
|
||||||
|
@@ -75,12 +75,12 @@ class ReportController extends Controller
|
|||||||
while ($current < $end) {
|
while ($current < $end) {
|
||||||
$balances = Steam::balancesByAccounts($accounts, $current);
|
$balances = Steam::balancesByAccounts($accounts, $current);
|
||||||
$sum = $this->arraySum($balances);
|
$sum = $this->arraySum($balances);
|
||||||
$label = $current->formatLocalized(strval(trans('config.month_and_day')));
|
$label = $current->formatLocalized((string)trans('config.month_and_day'));
|
||||||
$chartData[$label] = $sum;
|
$chartData[$label] = $sum;
|
||||||
$current->addDays(7);
|
$current->addDays(7);
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = $this->generator->singleSet(strval(trans('firefly.net_worth')), $chartData);
|
$data = $this->generator->singleSet((string)trans('firefly.net_worth'), $chartData);
|
||||||
$cache->store($data);
|
$cache->store($data);
|
||||||
|
|
||||||
return response()->json($data);
|
return response()->json($data);
|
||||||
@@ -188,19 +188,19 @@ class ReportController extends Controller
|
|||||||
|
|
||||||
$chartData = [
|
$chartData = [
|
||||||
[
|
[
|
||||||
'label' => strval(trans('firefly.income')),
|
'label' => (string)trans('firefly.income'),
|
||||||
'type' => 'bar',
|
'type' => 'bar',
|
||||||
'entries' => [
|
'entries' => [
|
||||||
strval(trans('firefly.sum_of_period')) => $numbers['sum_earned'],
|
(string)trans('firefly.sum_of_period') => $numbers['sum_earned'],
|
||||||
strval(trans('firefly.average_in_period')) => $numbers['avg_earned'],
|
(string)trans('firefly.average_in_period') => $numbers['avg_earned'],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'label' => trans('firefly.expenses'),
|
'label' => trans('firefly.expenses'),
|
||||||
'type' => 'bar',
|
'type' => 'bar',
|
||||||
'entries' => [
|
'entries' => [
|
||||||
strval(trans('firefly.sum_of_period')) => $numbers['sum_spent'],
|
(string)trans('firefly.sum_of_period') => $numbers['sum_spent'],
|
||||||
strval(trans('firefly.average_in_period')) => $numbers['avg_spent'],
|
(string)trans('firefly.average_in_period') => $numbers['avg_spent'],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
@@ -255,26 +255,22 @@ class ReportController extends Controller
|
|||||||
|
|
||||||
while ($currentStart <= $end) {
|
while ($currentStart <= $end) {
|
||||||
$currentEnd = app('navigation')->endOfPeriod($currentStart, '1M');
|
$currentEnd = app('navigation')->endOfPeriod($currentStart, '1M');
|
||||||
$earned = strval(
|
$earned = (string)array_sum(
|
||||||
array_sum(
|
|
||||||
array_map(
|
array_map(
|
||||||
function ($item) {
|
function ($item) {
|
||||||
return $item['sum'];
|
return $item['sum'];
|
||||||
},
|
},
|
||||||
$tasker->getIncomeReport($currentStart, $currentEnd, $accounts)
|
$tasker->getIncomeReport($currentStart, $currentEnd, $accounts)
|
||||||
)
|
)
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
$spent = strval(
|
$spent = (string)array_sum(
|
||||||
array_sum(
|
|
||||||
array_map(
|
array_map(
|
||||||
function ($item) {
|
function ($item) {
|
||||||
return $item['sum'];
|
return $item['sum'];
|
||||||
},
|
},
|
||||||
$tasker->getExpenseReport($currentStart, $currentEnd, $accounts)
|
$tasker->getExpenseReport($currentStart, $currentEnd, $accounts)
|
||||||
)
|
)
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
$label = $currentStart->format('Y-m') . '-01';
|
$label = $currentStart->format('Y-m') . '-01';
|
||||||
|
@@ -72,7 +72,7 @@ class TagReportController extends Controller
|
|||||||
$helper->setTags($tags);
|
$helper->setTags($tags);
|
||||||
$helper->setStart($start);
|
$helper->setStart($start);
|
||||||
$helper->setEnd($end);
|
$helper->setEnd($end);
|
||||||
$helper->setCollectOtherObjects(1 === intval($others));
|
$helper->setCollectOtherObjects(1 === (int)$others);
|
||||||
$chartData = $helper->generate('expense', 'account');
|
$chartData = $helper->generate('expense', 'account');
|
||||||
$data = $this->generator->pieChart($chartData);
|
$data = $this->generator->pieChart($chartData);
|
||||||
|
|
||||||
@@ -96,7 +96,7 @@ class TagReportController extends Controller
|
|||||||
$helper->setTags($tags);
|
$helper->setTags($tags);
|
||||||
$helper->setStart($start);
|
$helper->setStart($start);
|
||||||
$helper->setEnd($end);
|
$helper->setEnd($end);
|
||||||
$helper->setCollectOtherObjects(1 === intval($others));
|
$helper->setCollectOtherObjects(1 === (int)$others);
|
||||||
$chartData = $helper->generate('income', 'account');
|
$chartData = $helper->generate('income', 'account');
|
||||||
$data = $this->generator->pieChart($chartData);
|
$data = $this->generator->pieChart($chartData);
|
||||||
|
|
||||||
@@ -177,27 +177,27 @@ class TagReportController extends Controller
|
|||||||
// prep chart data:
|
// prep chart data:
|
||||||
foreach ($tags as $tag) {
|
foreach ($tags as $tag) {
|
||||||
$chartData[$tag->id . '-in'] = [
|
$chartData[$tag->id . '-in'] = [
|
||||||
'label' => $tag->tag . ' (' . strtolower(strval(trans('firefly.income'))) . ')',
|
'label' => $tag->tag . ' (' . strtolower((string)trans('firefly.income')) . ')',
|
||||||
'type' => 'bar',
|
'type' => 'bar',
|
||||||
'yAxisID' => 'y-axis-0',
|
'yAxisID' => 'y-axis-0',
|
||||||
'entries' => [],
|
'entries' => [],
|
||||||
];
|
];
|
||||||
$chartData[$tag->id . '-out'] = [
|
$chartData[$tag->id . '-out'] = [
|
||||||
'label' => $tag->tag . ' (' . strtolower(strval(trans('firefly.expenses'))) . ')',
|
'label' => $tag->tag . ' (' . strtolower((string)trans('firefly.expenses')) . ')',
|
||||||
'type' => 'bar',
|
'type' => 'bar',
|
||||||
'yAxisID' => 'y-axis-0',
|
'yAxisID' => 'y-axis-0',
|
||||||
'entries' => [],
|
'entries' => [],
|
||||||
];
|
];
|
||||||
// total in, total out:
|
// total in, total out:
|
||||||
$chartData[$tag->id . '-total-in'] = [
|
$chartData[$tag->id . '-total-in'] = [
|
||||||
'label' => $tag->tag . ' (' . strtolower(strval(trans('firefly.sum_of_income'))) . ')',
|
'label' => $tag->tag . ' (' . strtolower((string)trans('firefly.sum_of_income')) . ')',
|
||||||
'type' => 'line',
|
'type' => 'line',
|
||||||
'fill' => false,
|
'fill' => false,
|
||||||
'yAxisID' => 'y-axis-1',
|
'yAxisID' => 'y-axis-1',
|
||||||
'entries' => [],
|
'entries' => [],
|
||||||
];
|
];
|
||||||
$chartData[$tag->id . '-total-out'] = [
|
$chartData[$tag->id . '-total-out'] = [
|
||||||
'label' => $tag->tag . ' (' . strtolower(strval(trans('firefly.sum_of_expenses'))) . ')',
|
'label' => $tag->tag . ' (' . strtolower((string)trans('firefly.sum_of_expenses')) . ')',
|
||||||
'type' => 'line',
|
'type' => 'line',
|
||||||
'fill' => false,
|
'fill' => false,
|
||||||
'yAxisID' => 'y-axis-1',
|
'yAxisID' => 'y-axis-1',
|
||||||
@@ -271,7 +271,7 @@ class TagReportController extends Controller
|
|||||||
$helper->setTags($tags);
|
$helper->setTags($tags);
|
||||||
$helper->setStart($start);
|
$helper->setStart($start);
|
||||||
$helper->setEnd($end);
|
$helper->setEnd($end);
|
||||||
$helper->setCollectOtherObjects(1 === intval($others));
|
$helper->setCollectOtherObjects(1 === (int)$others);
|
||||||
$chartData = $helper->generate('expense', 'tag');
|
$chartData = $helper->generate('expense', 'tag');
|
||||||
$data = $this->generator->pieChart($chartData);
|
$data = $this->generator->pieChart($chartData);
|
||||||
|
|
||||||
@@ -295,7 +295,7 @@ class TagReportController extends Controller
|
|||||||
$helper->setTags($tags);
|
$helper->setTags($tags);
|
||||||
$helper->setStart($start);
|
$helper->setStart($start);
|
||||||
$helper->setEnd($end);
|
$helper->setEnd($end);
|
||||||
$helper->setCollectOtherObjects(1 === intval($others));
|
$helper->setCollectOtherObjects(1 === (int)$others);
|
||||||
$chartData = $helper->generate('income', 'tag');
|
$chartData = $helper->generate('income', 'tag');
|
||||||
$data = $this->generator->pieChart($chartData);
|
$data = $this->generator->pieChart($chartData);
|
||||||
|
|
||||||
@@ -321,9 +321,7 @@ class TagReportController extends Controller
|
|||||||
$collector->addFilter(OpposingAccountFilter::class);
|
$collector->addFilter(OpposingAccountFilter::class);
|
||||||
$collector->addFilter(PositiveAmountFilter::class);
|
$collector->addFilter(PositiveAmountFilter::class);
|
||||||
|
|
||||||
$transactions = $collector->getJournals();
|
return $collector->getJournals();
|
||||||
|
|
||||||
return $transactions;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -344,9 +342,7 @@ class TagReportController extends Controller
|
|||||||
$collector->addFilter(OpposingAccountFilter::class);
|
$collector->addFilter(OpposingAccountFilter::class);
|
||||||
$collector->addFilter(NegativeAmountFilter::class);
|
$collector->addFilter(NegativeAmountFilter::class);
|
||||||
|
|
||||||
$transactions = $collector->getJournals();
|
return $collector->getJournals();
|
||||||
|
|
||||||
return $transactions;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -121,7 +121,7 @@ class Controller extends BaseController
|
|||||||
*/
|
*/
|
||||||
protected function getPreviousUri(string $identifier): string
|
protected function getPreviousUri(string $identifier): string
|
||||||
{
|
{
|
||||||
$uri = strval(session($identifier));
|
$uri = (string)session($identifier);
|
||||||
if (!(false === strpos($identifier, 'delete')) && !(false === strpos($uri, '/show/'))) {
|
if (!(false === strpos($identifier, 'delete')) && !(false === strpos($uri, '/show/'))) {
|
||||||
$uri = $this->redirectUri;
|
$uri = $this->redirectUri;
|
||||||
}
|
}
|
||||||
@@ -159,7 +159,7 @@ class Controller extends BaseController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// @codeCoverageIgnoreStart
|
// @codeCoverageIgnoreStart
|
||||||
Session::flash('error', strval(trans('firefly.cannot_redirect_to_account')));
|
Session::flash('error', (string)trans('firefly.cannot_redirect_to_account'));
|
||||||
|
|
||||||
return redirect(route('index'));
|
return redirect(route('index'));
|
||||||
// @codeCoverageIgnoreEnd
|
// @codeCoverageIgnoreEnd
|
||||||
|
@@ -67,7 +67,6 @@ class CurrencyController extends Controller
|
|||||||
* @param Request $request
|
* @param Request $request
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|View
|
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|View
|
||||||
* @throws \RuntimeException
|
|
||||||
*/
|
*/
|
||||||
public function create(Request $request)
|
public function create(Request $request)
|
||||||
{
|
{
|
||||||
@@ -94,7 +93,6 @@ class CurrencyController extends Controller
|
|||||||
* @param TransactionCurrency $currency
|
* @param TransactionCurrency $currency
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
||||||
* @throws \RuntimeException
|
|
||||||
*/
|
*/
|
||||||
public function defaultCurrency(Request $request, TransactionCurrency $currency)
|
public function defaultCurrency(Request $request, TransactionCurrency $currency)
|
||||||
{
|
{
|
||||||
@@ -113,7 +111,6 @@ class CurrencyController extends Controller
|
|||||||
* @param TransactionCurrency $currency
|
* @param TransactionCurrency $currency
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|View
|
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|View
|
||||||
* @throws \RuntimeException
|
|
||||||
*/
|
*/
|
||||||
public function delete(Request $request, TransactionCurrency $currency)
|
public function delete(Request $request, TransactionCurrency $currency)
|
||||||
{
|
{
|
||||||
@@ -143,7 +140,6 @@ class CurrencyController extends Controller
|
|||||||
* @param TransactionCurrency $currency
|
* @param TransactionCurrency $currency
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
||||||
* @throws \RuntimeException
|
|
||||||
*/
|
*/
|
||||||
public function destroy(Request $request, TransactionCurrency $currency)
|
public function destroy(Request $request, TransactionCurrency $currency)
|
||||||
{
|
{
|
||||||
@@ -172,7 +168,6 @@ class CurrencyController extends Controller
|
|||||||
* @param TransactionCurrency $currency
|
* @param TransactionCurrency $currency
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|View
|
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|View
|
||||||
* @throws \RuntimeException
|
|
||||||
*/
|
*/
|
||||||
public function edit(Request $request, TransactionCurrency $currency)
|
public function edit(Request $request, TransactionCurrency $currency)
|
||||||
{
|
{
|
||||||
@@ -201,12 +196,11 @@ class CurrencyController extends Controller
|
|||||||
* @param Request $request
|
* @param Request $request
|
||||||
*
|
*
|
||||||
* @return View
|
* @return View
|
||||||
* @throws \RuntimeException
|
|
||||||
*/
|
*/
|
||||||
public function index(Request $request)
|
public function index(Request $request)
|
||||||
{
|
{
|
||||||
$page = 0 === intval($request->get('page')) ? 1 : intval($request->get('page'));
|
$page = 0 === (int)$request->get('page') ? 1 : (int)$request->get('page');
|
||||||
$pageSize = intval(Preferences::get('listPageSize', 50)->data);
|
$pageSize = (int)Preferences::get('listPageSize', 50)->data;
|
||||||
$collection = $this->repository->get();
|
$collection = $this->repository->get();
|
||||||
$total = $collection->count();
|
$total = $collection->count();
|
||||||
$collection = $collection->sortBy(
|
$collection = $collection->sortBy(
|
||||||
@@ -232,7 +226,6 @@ class CurrencyController extends Controller
|
|||||||
* @param CurrencyFormRequest $request
|
* @param CurrencyFormRequest $request
|
||||||
*
|
*
|
||||||
* @return $this|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
* @return $this|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
||||||
* @throws \RuntimeException
|
|
||||||
*/
|
*/
|
||||||
public function store(CurrencyFormRequest $request)
|
public function store(CurrencyFormRequest $request)
|
||||||
{
|
{
|
||||||
@@ -248,7 +241,7 @@ class CurrencyController extends Controller
|
|||||||
$currency = $this->repository->store($data);
|
$currency = $this->repository->store($data);
|
||||||
$request->session()->flash('success', trans('firefly.created_currency', ['name' => $currency->name]));
|
$request->session()->flash('success', trans('firefly.created_currency', ['name' => $currency->name]));
|
||||||
|
|
||||||
if (1 === intval($request->get('create_another'))) {
|
if (1 === (int)$request->get('create_another')) {
|
||||||
// @codeCoverageIgnoreStart
|
// @codeCoverageIgnoreStart
|
||||||
$request->session()->put('currencies.create.fromStore', true);
|
$request->session()->put('currencies.create.fromStore', true);
|
||||||
|
|
||||||
@@ -264,7 +257,6 @@ class CurrencyController extends Controller
|
|||||||
* @param TransactionCurrency $currency
|
* @param TransactionCurrency $currency
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
||||||
* @throws \RuntimeException
|
|
||||||
*/
|
*/
|
||||||
public function update(CurrencyFormRequest $request, TransactionCurrency $currency)
|
public function update(CurrencyFormRequest $request, TransactionCurrency $currency)
|
||||||
{
|
{
|
||||||
@@ -281,7 +273,7 @@ class CurrencyController extends Controller
|
|||||||
$request->session()->flash('success', trans('firefly.updated_currency', ['name' => $currency->name]));
|
$request->session()->flash('success', trans('firefly.updated_currency', ['name' => $currency->name]));
|
||||||
Preferences::mark();
|
Preferences::mark();
|
||||||
|
|
||||||
if (1 === intval($request->get('return_to_edit'))) {
|
if (1 === (int)$request->get('return_to_edit')) {
|
||||||
// @codeCoverageIgnoreStart
|
// @codeCoverageIgnoreStart
|
||||||
$request->session()->put('currencies.edit.fromUpdate', true);
|
$request->session()->put('currencies.edit.fromUpdate', true);
|
||||||
|
|
||||||
|
@@ -50,7 +50,6 @@ class DebugController extends Controller
|
|||||||
* @param Request $request
|
* @param Request $request
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||||
* @throws \InvalidArgumentException
|
|
||||||
*/
|
*/
|
||||||
public function index(Request $request)
|
public function index(Request $request)
|
||||||
{
|
{
|
||||||
@@ -69,7 +68,7 @@ class DebugController extends Controller
|
|||||||
$isDocker = var_export(env('IS_DOCKER', 'unknown'), true);
|
$isDocker = var_export(env('IS_DOCKER', 'unknown'), true);
|
||||||
$trustedProxies = env('TRUSTED_PROXIES', '(none)');
|
$trustedProxies = env('TRUSTED_PROXIES', '(none)');
|
||||||
$displayErrors = ini_get('display_errors');
|
$displayErrors = ini_get('display_errors');
|
||||||
$errorReporting = $this->errorReporting(intval(ini_get('error_reporting')));
|
$errorReporting = $this->errorReporting((int)ini_get('error_reporting'));
|
||||||
$appEnv = env('APP_ENV', '');
|
$appEnv = env('APP_ENV', '');
|
||||||
$appDebug = var_export(env('APP_DEBUG', false), true);
|
$appDebug = var_export(env('APP_DEBUG', false), true);
|
||||||
$appLog = env('APP_LOG', '');
|
$appLog = env('APP_LOG', '');
|
||||||
@@ -156,7 +155,7 @@ class DebugController extends Controller
|
|||||||
return $array[$value];
|
return $array[$value];
|
||||||
}
|
}
|
||||||
|
|
||||||
return strval($value); // @codeCoverageIgnore
|
return (string)$value; // @codeCoverageIgnore
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -111,7 +111,6 @@ class ExportController extends Controller
|
|||||||
* @param ExportJobRepositoryInterface $jobs
|
* @param ExportJobRepositoryInterface $jobs
|
||||||
*
|
*
|
||||||
* @return View
|
* @return View
|
||||||
* @throws \InvalidArgumentException
|
|
||||||
*/
|
*/
|
||||||
public function index(AccountRepositoryInterface $repository, ExportJobRepositoryInterface $jobs)
|
public function index(AccountRepositoryInterface $repository, ExportJobRepositoryInterface $jobs)
|
||||||
{
|
{
|
||||||
|
@@ -72,7 +72,7 @@ class HelpController extends Controller
|
|||||||
private function getHelpText(string $route, string $language): string
|
private function getHelpText(string $route, string $language): string
|
||||||
{
|
{
|
||||||
// get language and default variables.
|
// get language and default variables.
|
||||||
$content = '<p>' . strval(trans('firefly.route_has_no_help')) . '</p>';
|
$content = '<p>' . (string)trans('firefly.route_has_no_help') . '</p>';
|
||||||
|
|
||||||
// if no such route, log error and return default text.
|
// if no such route, log error and return default text.
|
||||||
if (!$this->help->hasRoute($route)) {
|
if (!$this->help->hasRoute($route)) {
|
||||||
@@ -114,6 +114,6 @@ class HelpController extends Controller
|
|||||||
return $content;
|
return $content;
|
||||||
}
|
}
|
||||||
|
|
||||||
return '<p>' . strval(trans('firefly.route_has_no_help')) . '</p>';
|
return '<p>' . (string)trans('firefly.route_has_no_help') . '</p>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -62,7 +62,6 @@ class HomeController extends Controller
|
|||||||
* @param Request $request
|
* @param Request $request
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Http\JsonResponse
|
* @return \Illuminate\Http\JsonResponse
|
||||||
* @throws \RuntimeException
|
|
||||||
*/
|
*/
|
||||||
public function dateRange(Request $request)
|
public function dateRange(Request $request)
|
||||||
{
|
{
|
||||||
@@ -75,7 +74,7 @@ class HomeController extends Controller
|
|||||||
|
|
||||||
// check if the label is "everything" or "Custom range" which will betray
|
// check if the label is "everything" or "Custom range" which will betray
|
||||||
// a possible problem with the budgets.
|
// a possible problem with the budgets.
|
||||||
if ($label === strval(trans('firefly.everything')) || $label === strval(trans('firefly.customRange'))) {
|
if ($label === (string)trans('firefly.everything') || $label === (string)trans('firefly.customRange')) {
|
||||||
$isCustomRange = true;
|
$isCustomRange = true;
|
||||||
Log::debug('Range is now marked as "custom".');
|
Log::debug('Range is now marked as "custom".');
|
||||||
}
|
}
|
||||||
@@ -83,7 +82,7 @@ class HomeController extends Controller
|
|||||||
$diff = $start->diffInDays($end);
|
$diff = $start->diffInDays($end);
|
||||||
|
|
||||||
if ($diff > 50) {
|
if ($diff > 50) {
|
||||||
$request->session()->flash('warning', strval(trans('firefly.warning_much_data', ['days' => $diff])));
|
$request->session()->flash('warning', (string)trans('firefly.warning_much_data', ['days' => $diff]));
|
||||||
}
|
}
|
||||||
|
|
||||||
$request->session()->put('is_custom_range', $isCustomRange);
|
$request->session()->put('is_custom_range', $isCustomRange);
|
||||||
@@ -117,7 +116,6 @@ class HomeController extends Controller
|
|||||||
* @param Request $request
|
* @param Request $request
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
||||||
* @throws \RuntimeException
|
|
||||||
*/
|
*/
|
||||||
public function flush(Request $request)
|
public function flush(Request $request)
|
||||||
{
|
{
|
||||||
@@ -232,7 +230,6 @@ class HomeController extends Controller
|
|||||||
* @param Request $request
|
* @param Request $request
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
||||||
* @throws \RuntimeException
|
|
||||||
*/
|
*/
|
||||||
public function testFlash(Request $request)
|
public function testFlash(Request $request)
|
||||||
{
|
{
|
||||||
|
@@ -97,7 +97,6 @@ class ConfigurationController extends Controller
|
|||||||
*
|
*
|
||||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
||||||
*
|
*
|
||||||
* @throws \RuntimeException
|
|
||||||
* @throws FireflyException
|
* @throws FireflyException
|
||||||
*/
|
*/
|
||||||
public function post(Request $request, ImportJob $job)
|
public function post(Request $request, ImportJob $job)
|
||||||
|
@@ -69,7 +69,7 @@ class PrerequisitesController extends Controller
|
|||||||
if (true === !config(sprintf('import.enabled.%s', $bank))) {
|
if (true === !config(sprintf('import.enabled.%s', $bank))) {
|
||||||
throw new FireflyException(sprintf('Cannot import from "%s" at this time.', $bank)); // @codeCoverageIgnore
|
throw new FireflyException(sprintf('Cannot import from "%s" at this time.', $bank)); // @codeCoverageIgnore
|
||||||
}
|
}
|
||||||
$class = strval(config(sprintf('import.prerequisites.%s', $bank)));
|
$class = (string)config(sprintf('import.prerequisites.%s', $bank));
|
||||||
if (!class_exists($class)) {
|
if (!class_exists($class)) {
|
||||||
throw new FireflyException(sprintf('No class to handle "%s".', $bank)); // @codeCoverageIgnore
|
throw new FireflyException(sprintf('No class to handle "%s".', $bank)); // @codeCoverageIgnore
|
||||||
}
|
}
|
||||||
@@ -80,7 +80,7 @@ class PrerequisitesController extends Controller
|
|||||||
|
|
||||||
if ($object->hasPrerequisites()) {
|
if ($object->hasPrerequisites()) {
|
||||||
$view = $object->getView();
|
$view = $object->getView();
|
||||||
$parameters = ['title' => strval(trans('firefly.import_index_title')), 'mainTitleIcon' => 'fa-archive'];
|
$parameters = ['title' => (string)trans('firefly.import_index_title'), 'mainTitleIcon' => 'fa-archive'];
|
||||||
$parameters = array_merge($object->getViewParameters(), $parameters);
|
$parameters = array_merge($object->getViewParameters(), $parameters);
|
||||||
|
|
||||||
return view($view, $parameters);
|
return view($view, $parameters);
|
||||||
@@ -103,7 +103,6 @@ class PrerequisitesController extends Controller
|
|||||||
*
|
*
|
||||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
||||||
*
|
*
|
||||||
* @throws \RuntimeException
|
|
||||||
* @throws FireflyException
|
* @throws FireflyException
|
||||||
*/
|
*/
|
||||||
public function post(Request $request, string $bank)
|
public function post(Request $request, string $bank)
|
||||||
@@ -114,7 +113,7 @@ class PrerequisitesController extends Controller
|
|||||||
throw new FireflyException(sprintf('Cannot import from "%s" at this time.', $bank)); // @codeCoverageIgnore
|
throw new FireflyException(sprintf('Cannot import from "%s" at this time.', $bank)); // @codeCoverageIgnore
|
||||||
}
|
}
|
||||||
|
|
||||||
$class = strval(config(sprintf('import.prerequisites.%s', $bank)));
|
$class = (string)config(sprintf('import.prerequisites.%s', $bank));
|
||||||
if (!class_exists($class)) {
|
if (!class_exists($class)) {
|
||||||
throw new FireflyException(sprintf('Cannot find class %s', $class)); // @codeCoverageIgnore
|
throw new FireflyException(sprintf('Cannot find class %s', $class)); // @codeCoverageIgnore
|
||||||
}
|
}
|
||||||
|
@@ -97,7 +97,7 @@ class StatusController extends Controller
|
|||||||
}
|
}
|
||||||
if ('finished' === $job->status) {
|
if ('finished' === $job->status) {
|
||||||
$result['finished'] = true;
|
$result['finished'] = true;
|
||||||
$tagId = intval($job->extended_status['tag']);
|
$tagId = (int)$job->extended_status['tag'];
|
||||||
if ($tagId !== 0) {
|
if ($tagId !== 0) {
|
||||||
/** @var TagRepositoryInterface $repository */
|
/** @var TagRepositoryInterface $repository */
|
||||||
$repository = app(TagRepositoryInterface::class);
|
$repository = app(TagRepositoryInterface::class);
|
||||||
|
@@ -54,7 +54,7 @@ class JavascriptController extends Controller
|
|||||||
/** @var Account $account */
|
/** @var Account $account */
|
||||||
foreach ($accounts as $account) {
|
foreach ($accounts as $account) {
|
||||||
$accountId = $account->id;
|
$accountId = $account->id;
|
||||||
$currency = intval($repository->getMetaValue($account, 'currency_id'));
|
$currency = (int)$repository->getMetaValue($account, 'currency_id');
|
||||||
$currency = 0 === $currency ? $default->id : $currency;
|
$currency = 0 === $currency ? $default->id : $currency;
|
||||||
$entry = ['preferredCurrency' => $currency, 'name' => $account->name];
|
$entry = ['preferredCurrency' => $currency, 'name' => $account->name];
|
||||||
$data['accounts'][$accountId] = $entry;
|
$data['accounts'][$accountId] = $entry;
|
||||||
@@ -92,14 +92,13 @@ class JavascriptController extends Controller
|
|||||||
* @param CurrencyRepositoryInterface $currencyRepository
|
* @param CurrencyRepositoryInterface $currencyRepository
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Http\Response
|
* @return \Illuminate\Http\Response
|
||||||
* @throws \RuntimeException
|
|
||||||
*/
|
*/
|
||||||
public function variables(Request $request, AccountRepositoryInterface $repository, CurrencyRepositoryInterface $currencyRepository)
|
public function variables(Request $request, AccountRepositoryInterface $repository, CurrencyRepositoryInterface $currencyRepository)
|
||||||
{
|
{
|
||||||
$account = $repository->findNull(intval($request->get('account')));
|
$account = $repository->findNull((int)$request->get('account'));
|
||||||
$currencyId = 0;
|
$currencyId = 0;
|
||||||
if (null !== $account) {
|
if (null !== $account) {
|
||||||
$currencyId = intval($repository->getMetaValue($account, 'currency_id'));
|
$currencyId = (int)$repository->getMetaValue($account, 'currency_id');
|
||||||
}
|
}
|
||||||
/** @var TransactionCurrency $currency */
|
/** @var TransactionCurrency $currency */
|
||||||
$currency = $currencyRepository->findNull($currencyId);
|
$currency = $currencyRepository->findNull($currencyId);
|
||||||
@@ -175,21 +174,21 @@ class JavascriptController extends Controller
|
|||||||
$todayStart = app('navigation')->startOfPeriod($today, $viewRange);
|
$todayStart = app('navigation')->startOfPeriod($today, $viewRange);
|
||||||
$todayEnd = app('navigation')->endOfPeriod($todayStart, $viewRange);
|
$todayEnd = app('navigation')->endOfPeriod($todayStart, $viewRange);
|
||||||
if ($todayStart->ne($start) || $todayEnd->ne($end)) {
|
if ($todayStart->ne($start) || $todayEnd->ne($end)) {
|
||||||
$ranges[ucfirst(strval(trans('firefly.today')))] = [$todayStart, $todayEnd];
|
$ranges[ucfirst((string)trans('firefly.today'))] = [$todayStart, $todayEnd];
|
||||||
}
|
}
|
||||||
|
|
||||||
// everything
|
// everything
|
||||||
$index = strval(trans('firefly.everything'));
|
$index = (string)trans('firefly.everything');
|
||||||
$ranges[$index] = [$first, new Carbon];
|
$ranges[$index] = [$first, new Carbon];
|
||||||
|
|
||||||
$return = [
|
$return = [
|
||||||
'title' => $title,
|
'title' => $title,
|
||||||
'configuration' => [
|
'configuration' => [
|
||||||
'apply' => strval(trans('firefly.apply')),
|
'apply' => (string)trans('firefly.apply'),
|
||||||
'cancel' => strval(trans('firefly.cancel')),
|
'cancel' => (string)trans('firefly.cancel'),
|
||||||
'from' => strval(trans('firefly.from')),
|
'from' => (string)trans('firefly.from'),
|
||||||
'to' => strval(trans('firefly.to')),
|
'to' => (string)trans('firefly.to'),
|
||||||
'customRange' => strval(trans('firefly.customRange')),
|
'customRange' => (string)trans('firefly.customRange'),
|
||||||
'start' => $start->format('Y-m-d'),
|
'start' => $start->format('Y-m-d'),
|
||||||
'end' => $end->format('Y-m-d'),
|
'end' => $end->format('Y-m-d'),
|
||||||
'ranges' => $ranges,
|
'ranges' => $ranges,
|
||||||
|
@@ -113,7 +113,7 @@ class AutoCompleteController extends Controller
|
|||||||
$set = $collector->getJournals()->pluck('description', 'journal_id')->toArray();
|
$set = $collector->getJournals()->pluck('description', 'journal_id')->toArray();
|
||||||
$return = [];
|
$return = [];
|
||||||
foreach ($set as $id => $description) {
|
foreach ($set as $id => $description) {
|
||||||
$id = intval($id);
|
$id = (int)$id;
|
||||||
if ($id !== $except->id) {
|
if ($id !== $except->id) {
|
||||||
$return[] = [
|
$return[] = [
|
||||||
'id' => $id,
|
'id' => $id,
|
||||||
|
@@ -123,7 +123,7 @@ class BoxController extends Controller
|
|||||||
$set = $collector->getJournals();
|
$set = $collector->getJournals();
|
||||||
/** @var Transaction $transaction */
|
/** @var Transaction $transaction */
|
||||||
foreach ($set as $transaction) {
|
foreach ($set as $transaction) {
|
||||||
$currencyId = intval($transaction->transaction_currency_id);
|
$currencyId = (int)$transaction->transaction_currency_id;
|
||||||
$incomes[$currencyId] = $incomes[$currencyId] ?? '0';
|
$incomes[$currencyId] = $incomes[$currencyId] ?? '0';
|
||||||
$incomes[$currencyId] = bcadd($incomes[$currencyId], $transaction->transaction_amount);
|
$incomes[$currencyId] = bcadd($incomes[$currencyId], $transaction->transaction_amount);
|
||||||
$sums[$currencyId] = $sums[$currencyId] ?? '0';
|
$sums[$currencyId] = $sums[$currencyId] ?? '0';
|
||||||
|
@@ -50,9 +50,6 @@ class ExchangeController extends Controller
|
|||||||
$rate = $repository->getExchangeRate($fromCurrency, $toCurrency, $date);
|
$rate = $repository->getExchangeRate($fromCurrency, $toCurrency, $date);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (null === $rate->id) {
|
if (null === $rate->id) {
|
||||||
Log::debug(sprintf('No cached exchange rate in database for %s to %s on %s', $fromCurrency->code, $toCurrency->code, $date->format('Y-m-d')));
|
Log::debug(sprintf('No cached exchange rate in database for %s to %s on %s', $fromCurrency->code, $toCurrency->code, $date->format('Y-m-d')));
|
||||||
|
|
||||||
@@ -69,7 +66,7 @@ class ExchangeController extends Controller
|
|||||||
$return['amount'] = null;
|
$return['amount'] = null;
|
||||||
if (null !== $request->get('amount')) {
|
if (null !== $request->get('amount')) {
|
||||||
// assume amount is in "from" currency:
|
// assume amount is in "from" currency:
|
||||||
$return['amount'] = bcmul($request->get('amount'), strval($rate->rate), 12);
|
$return['amount'] = bcmul($request->get('amount'), (string)$rate->rate, 12);
|
||||||
// round to toCurrency decimal places:
|
// round to toCurrency decimal places:
|
||||||
$return['amount'] = round($return['amount'], $toCurrency->decimal_places);
|
$return['amount'] = round($return['amount'], $toCurrency->decimal_places);
|
||||||
}
|
}
|
||||||
|
@@ -36,7 +36,7 @@ class FrontpageController extends Controller
|
|||||||
*
|
*
|
||||||
* @return \Illuminate\Http\JsonResponse
|
* @return \Illuminate\Http\JsonResponse
|
||||||
*
|
*
|
||||||
* @throws \Throwable
|
|
||||||
*/
|
*/
|
||||||
public function piggyBanks(PiggyBankRepositoryInterface $repository)
|
public function piggyBanks(PiggyBankRepositoryInterface $repository)
|
||||||
{
|
{
|
||||||
|
@@ -76,14 +76,17 @@ class IntroController
|
|||||||
$routeKey = str_replace('.', '_', $route);
|
$routeKey = str_replace('.', '_', $route);
|
||||||
Log::debug(sprintf('Has outro step for route %s', $routeKey));
|
Log::debug(sprintf('Has outro step for route %s', $routeKey));
|
||||||
$elements = config(sprintf('intro.%s', $routeKey));
|
$elements = config(sprintf('intro.%s', $routeKey));
|
||||||
if (!is_array($elements)) {
|
if (!\is_array($elements)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$hasStep = array_key_exists('outro', $elements);
|
||||||
|
|
||||||
Log::debug('Elements is array', $elements);
|
Log::debug('Elements is array', $elements);
|
||||||
Log::debug('Keys is', array_keys($elements));
|
Log::debug('Keys is', array_keys($elements));
|
||||||
Log::debug(sprintf('Keys has "outro": %s', var_export(in_array('outro', array_keys($elements)), true)));
|
Log::debug(sprintf('Keys has "outro": %s', var_export($hasStep, true)));
|
||||||
|
|
||||||
return in_array('outro', array_keys($elements));
|
return $hasStep;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -33,24 +33,16 @@ use Illuminate\Http\Request;
|
|||||||
*/
|
*/
|
||||||
class JsonController extends Controller
|
class JsonController extends Controller
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* JsonController constructor.
|
|
||||||
*/
|
|
||||||
public function __construct()
|
|
||||||
{
|
|
||||||
parent::__construct();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Http\JsonResponse
|
* @return \Illuminate\Http\JsonResponse
|
||||||
*
|
*
|
||||||
* @throws \Throwable
|
|
||||||
*/
|
*/
|
||||||
public function action(Request $request)
|
public function action(Request $request)
|
||||||
{
|
{
|
||||||
$count = intval($request->get('count')) > 0 ? intval($request->get('count')) : 1;
|
$count = (int)$request->get('count') > 0 ? (int)$request->get('count') : 1;
|
||||||
$keys = array_keys(config('firefly.rule-actions'));
|
$keys = array_keys(config('firefly.rule-actions'));
|
||||||
$actions = [];
|
$actions = [];
|
||||||
foreach ($keys as $key) {
|
foreach ($keys as $key) {
|
||||||
@@ -122,11 +114,11 @@ class JsonController extends Controller
|
|||||||
*
|
*
|
||||||
* @return \Illuminate\Http\JsonResponse
|
* @return \Illuminate\Http\JsonResponse
|
||||||
*
|
*
|
||||||
* @throws \Throwable
|
|
||||||
*/
|
*/
|
||||||
public function trigger(Request $request)
|
public function trigger(Request $request)
|
||||||
{
|
{
|
||||||
$count = intval($request->get('count')) > 0 ? intval($request->get('count')) : 1;
|
$count = (int)$request->get('count') > 0 ? (int)$request->get('count') : 1;
|
||||||
$keys = array_keys(config('firefly.rule-triggers'));
|
$keys = array_keys(config('firefly.rule-triggers'));
|
||||||
$triggers = [];
|
$triggers = [];
|
||||||
foreach ($keys as $key) {
|
foreach ($keys as $key) {
|
||||||
|
@@ -85,7 +85,7 @@ class NewUserController extends Controller
|
|||||||
$this->createSavingsAccount($request, $repository);
|
$this->createSavingsAccount($request, $repository);
|
||||||
|
|
||||||
// also store currency preference from input:
|
// also store currency preference from input:
|
||||||
$currency = $currencyRepository->findNull(intval($request->input('amount_currency_id_bank_balance')));
|
$currency = $currencyRepository->findNull((int)$request->input('amount_currency_id_bank_balance'));
|
||||||
|
|
||||||
if (null !== $currency) {
|
if (null !== $currency) {
|
||||||
// store currency preference:
|
// store currency preference:
|
||||||
@@ -107,7 +107,7 @@ class NewUserController extends Controller
|
|||||||
];
|
];
|
||||||
Preferences::set('transaction_journal_optional_fields', $visibleFields);
|
Preferences::set('transaction_journal_optional_fields', $visibleFields);
|
||||||
|
|
||||||
Session::flash('success', strval(trans('firefly.stored_new_accounts_new_user')));
|
Session::flash('success', (string)trans('firefly.stored_new_accounts_new_user'));
|
||||||
Preferences::mark();
|
Preferences::mark();
|
||||||
|
|
||||||
return redirect(route('index'));
|
return redirect(route('index'));
|
||||||
@@ -131,7 +131,7 @@ class NewUserController extends Controller
|
|||||||
'accountRole' => 'defaultAsset',
|
'accountRole' => 'defaultAsset',
|
||||||
'openingBalance' => $request->input('bank_balance'),
|
'openingBalance' => $request->input('bank_balance'),
|
||||||
'openingBalanceDate' => new Carbon,
|
'openingBalanceDate' => new Carbon,
|
||||||
'currency_id' => intval($request->input('amount_currency_id_bank_balance')),
|
'currency_id' => (int)$request->input('amount_currency_id_bank_balance'),
|
||||||
];
|
];
|
||||||
|
|
||||||
$repository->store($assetAccount);
|
$repository->store($assetAccount);
|
||||||
@@ -157,7 +157,7 @@ class NewUserController extends Controller
|
|||||||
'accountRole' => 'savingAsset',
|
'accountRole' => 'savingAsset',
|
||||||
'openingBalance' => $request->input('savings_balance'),
|
'openingBalance' => $request->input('savings_balance'),
|
||||||
'openingBalanceDate' => new Carbon,
|
'openingBalanceDate' => new Carbon,
|
||||||
'currency_id' => intval($request->input('amount_currency_id_bank_balance')),
|
'currency_id' => (int)$request->input('amount_currency_id_bank_balance'),
|
||||||
];
|
];
|
||||||
$repository->store($savingsAccount);
|
$repository->store($savingsAccount);
|
||||||
|
|
||||||
|
@@ -83,6 +83,7 @@ class PiggyBankController extends Controller
|
|||||||
* @param PiggyBank $piggyBank
|
* @param PiggyBank $piggyBank
|
||||||
*
|
*
|
||||||
* @param PiggyBankRepositoryInterface $repository
|
* @param PiggyBankRepositoryInterface $repository
|
||||||
|
*
|
||||||
* @return View
|
* @return View
|
||||||
*/
|
*/
|
||||||
public function addMobile(PiggyBank $piggyBank, PiggyBankRepositoryInterface $repository)
|
public function addMobile(PiggyBank $piggyBank, PiggyBankRepositoryInterface $repository)
|
||||||
@@ -137,7 +138,7 @@ class PiggyBankController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function destroy(PiggyBankRepositoryInterface $repository, PiggyBank $piggyBank)
|
public function destroy(PiggyBankRepositoryInterface $repository, PiggyBank $piggyBank)
|
||||||
{
|
{
|
||||||
Session::flash('success', strval(trans('firefly.deleted_piggy_bank', ['name' => $piggyBank->name])));
|
Session::flash('success', (string)trans('firefly.deleted_piggy_bank', ['name' => $piggyBank->name]));
|
||||||
Preferences::mark();
|
Preferences::mark();
|
||||||
$repository->destroy($piggyBank);
|
$repository->destroy($piggyBank);
|
||||||
|
|
||||||
@@ -192,8 +193,8 @@ class PiggyBankController extends Controller
|
|||||||
{
|
{
|
||||||
$collection = $piggyRepository->getPiggyBanks();
|
$collection = $piggyRepository->getPiggyBanks();
|
||||||
$total = $collection->count();
|
$total = $collection->count();
|
||||||
$page = 0 === intval($request->get('page')) ? 1 : intval($request->get('page'));
|
$page = 0 === (int)$request->get('page') ? 1 : (int)$request->get('page');
|
||||||
$pageSize = intval(Preferences::get('listPageSize', 50)->data);
|
$pageSize = (int)Preferences::get('listPageSize', 50)->data;
|
||||||
/** @var Carbon $end */
|
/** @var Carbon $end */
|
||||||
$end = session('end', Carbon::now()->endOfMonth());
|
$end = session('end', Carbon::now()->endOfMonth());
|
||||||
|
|
||||||
@@ -203,8 +204,8 @@ class PiggyBankController extends Controller
|
|||||||
foreach ($collection as $piggyBank) {
|
foreach ($collection as $piggyBank) {
|
||||||
|
|
||||||
$piggyBank->savedSoFar = $piggyRepository->getCurrentAmount($piggyBank);
|
$piggyBank->savedSoFar = $piggyRepository->getCurrentAmount($piggyBank);
|
||||||
$piggyBank->percentage = 0 !== bccomp('0', $piggyBank->savedSoFar) ? intval($piggyBank->savedSoFar / $piggyBank->targetamount * 100) : 0;
|
$piggyBank->percentage = 0 !== bccomp('0', $piggyBank->savedSoFar) ? (int)$piggyBank->savedSoFar / $piggyBank->targetamount * 100 : 0;
|
||||||
$piggyBank->leftToSave = bcsub($piggyBank->targetamount, strval($piggyBank->savedSoFar));
|
$piggyBank->leftToSave = bcsub($piggyBank->targetamount, (string)$piggyBank->savedSoFar);
|
||||||
$piggyBank->percentage = $piggyBank->percentage > 100 ? 100 : $piggyBank->percentage;
|
$piggyBank->percentage = $piggyBank->percentage > 100 ? 100 : $piggyBank->percentage;
|
||||||
|
|
||||||
// Fill account information:
|
// Fill account information:
|
||||||
@@ -216,13 +217,13 @@ class PiggyBankController extends Controller
|
|||||||
'name' => $account->name,
|
'name' => $account->name,
|
||||||
'balance' => Steam::balanceIgnoreVirtual($account, $end),
|
'balance' => Steam::balanceIgnoreVirtual($account, $end),
|
||||||
'leftForPiggyBanks' => $piggyBank->leftOnAccount($end),
|
'leftForPiggyBanks' => $piggyBank->leftOnAccount($end),
|
||||||
'sumOfSaved' => strval($piggyBank->savedSoFar),
|
'sumOfSaved' => (string)$piggyBank->savedSoFar,
|
||||||
'sumOfTargets' => $piggyBank->targetamount,
|
'sumOfTargets' => $piggyBank->targetamount,
|
||||||
'leftToSave' => $piggyBank->leftToSave,
|
'leftToSave' => $piggyBank->leftToSave,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
if (isset($accounts[$account->id]) && false === $new) {
|
if (isset($accounts[$account->id]) && false === $new) {
|
||||||
$accounts[$account->id]['sumOfSaved'] = bcadd($accounts[$account->id]['sumOfSaved'], strval($piggyBank->savedSoFar));
|
$accounts[$account->id]['sumOfSaved'] = bcadd($accounts[$account->id]['sumOfSaved'], (string)$piggyBank->savedSoFar);
|
||||||
$accounts[$account->id]['sumOfTargets'] = bcadd($accounts[$account->id]['sumOfTargets'], $piggyBank->targetamount);
|
$accounts[$account->id]['sumOfTargets'] = bcadd($accounts[$account->id]['sumOfTargets'], $piggyBank->targetamount);
|
||||||
$accounts[$account->id]['leftToSave'] = bcadd($accounts[$account->id]['leftToSave'], $piggyBank->leftToSave);
|
$accounts[$account->id]['leftToSave'] = bcadd($accounts[$account->id]['leftToSave'], $piggyBank->leftToSave);
|
||||||
}
|
}
|
||||||
@@ -251,7 +252,7 @@ class PiggyBankController extends Controller
|
|||||||
|
|
||||||
if (is_array($data)) {
|
if (is_array($data)) {
|
||||||
foreach ($data as $order => $id) {
|
foreach ($data as $order => $id) {
|
||||||
$repository->setOrder(intval($id), $order + 1);
|
$repository->setOrder((int)$id, $order + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -273,12 +274,10 @@ class PiggyBankController extends Controller
|
|||||||
$repository->addAmount($piggyBank, $amount);
|
$repository->addAmount($piggyBank, $amount);
|
||||||
Session::flash(
|
Session::flash(
|
||||||
'success',
|
'success',
|
||||||
strval(
|
(string)trans(
|
||||||
trans(
|
|
||||||
'firefly.added_amount_to_piggy',
|
'firefly.added_amount_to_piggy',
|
||||||
['amount' => app('amount')->formatAnything($currency, $amount, false), 'name' => $piggyBank->name]
|
['amount' => app('amount')->formatAnything($currency, $amount, false), 'name' => $piggyBank->name]
|
||||||
)
|
)
|
||||||
)
|
|
||||||
);
|
);
|
||||||
Preferences::mark();
|
Preferences::mark();
|
||||||
|
|
||||||
@@ -288,12 +287,10 @@ class PiggyBankController extends Controller
|
|||||||
Log::error('Cannot add ' . $amount . ' because canAddAmount returned false.');
|
Log::error('Cannot add ' . $amount . ' because canAddAmount returned false.');
|
||||||
Session::flash(
|
Session::flash(
|
||||||
'error',
|
'error',
|
||||||
strval(
|
(string)trans(
|
||||||
trans(
|
|
||||||
'firefly.cannot_add_amount_piggy',
|
'firefly.cannot_add_amount_piggy',
|
||||||
['amount' => app('amount')->formatAnything($currency, $amount, false), 'name' => $piggyBank->name]
|
['amount' => app('amount')->formatAnything($currency, $amount, false), 'name' => $piggyBank->name]
|
||||||
)
|
)
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
return redirect(route('piggy-banks.index'));
|
return redirect(route('piggy-banks.index'));
|
||||||
@@ -314,28 +311,24 @@ class PiggyBankController extends Controller
|
|||||||
$repository->removeAmount($piggyBank, $amount);
|
$repository->removeAmount($piggyBank, $amount);
|
||||||
Session::flash(
|
Session::flash(
|
||||||
'success',
|
'success',
|
||||||
strval(
|
(string)trans(
|
||||||
trans(
|
|
||||||
'firefly.removed_amount_from_piggy',
|
'firefly.removed_amount_from_piggy',
|
||||||
['amount' => app('amount')->formatAnything($currency, $amount, false), 'name' => $piggyBank->name]
|
['amount' => app('amount')->formatAnything($currency, $amount, false), 'name' => $piggyBank->name]
|
||||||
)
|
)
|
||||||
)
|
|
||||||
);
|
);
|
||||||
Preferences::mark();
|
Preferences::mark();
|
||||||
|
|
||||||
return redirect(route('piggy-banks.index'));
|
return redirect(route('piggy-banks.index'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$amount = strval(round($request->get('amount'), 12));
|
$amount = (string)round($request->get('amount'), 12);
|
||||||
|
|
||||||
Session::flash(
|
Session::flash(
|
||||||
'error',
|
'error',
|
||||||
strval(
|
(string)trans(
|
||||||
trans(
|
|
||||||
'firefly.cannot_remove_from_piggy',
|
'firefly.cannot_remove_from_piggy',
|
||||||
['amount' => app('amount')->formatAnything($currency, $amount, false), 'name' => $piggyBank->name]
|
['amount' => app('amount')->formatAnything($currency, $amount, false), 'name' => $piggyBank->name]
|
||||||
)
|
)
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
return redirect(route('piggy-banks.index'));
|
return redirect(route('piggy-banks.index'));
|
||||||
@@ -392,10 +385,10 @@ class PiggyBankController extends Controller
|
|||||||
}
|
}
|
||||||
$piggyBank = $repository->store($data);
|
$piggyBank = $repository->store($data);
|
||||||
|
|
||||||
Session::flash('success', strval(trans('firefly.stored_piggy_bank', ['name' => $piggyBank->name])));
|
Session::flash('success', (string)trans('firefly.stored_piggy_bank', ['name' => $piggyBank->name]));
|
||||||
Preferences::mark();
|
Preferences::mark();
|
||||||
|
|
||||||
if (1 === intval($request->get('create_another'))) {
|
if (1 === (int)$request->get('create_another')) {
|
||||||
// @codeCoverageIgnoreStart
|
// @codeCoverageIgnoreStart
|
||||||
Session::put('piggy-banks.create.fromStore', true);
|
Session::put('piggy-banks.create.fromStore', true);
|
||||||
|
|
||||||
@@ -418,10 +411,10 @@ class PiggyBankController extends Controller
|
|||||||
$data = $request->getPiggyBankData();
|
$data = $request->getPiggyBankData();
|
||||||
$piggyBank = $repository->update($piggyBank, $data);
|
$piggyBank = $repository->update($piggyBank, $data);
|
||||||
|
|
||||||
Session::flash('success', strval(trans('firefly.updated_piggy_bank', ['name' => $piggyBank->name])));
|
Session::flash('success', (string)trans('firefly.updated_piggy_bank', ['name' => $piggyBank->name]));
|
||||||
Preferences::mark();
|
Preferences::mark();
|
||||||
|
|
||||||
if (1 === intval($request->get('return_to_edit'))) {
|
if (1 === (int)$request->get('return_to_edit')) {
|
||||||
// @codeCoverageIgnoreStart
|
// @codeCoverageIgnoreStart
|
||||||
Session::put('piggy-banks.edit.fromUpdate', true);
|
Session::put('piggy-banks.edit.fromUpdate', true);
|
||||||
|
|
||||||
|
@@ -81,11 +81,6 @@ class ReportController extends Controller
|
|||||||
* @return \Illuminate\Http\JsonResponse
|
* @return \Illuminate\Http\JsonResponse
|
||||||
*
|
*
|
||||||
* @throws FireflyException
|
* @throws FireflyException
|
||||||
* @throws \Throwable
|
|
||||||
* @throws \Throwable
|
|
||||||
* @throws \Throwable
|
|
||||||
* @throws \Throwable
|
|
||||||
* @throws \Throwable
|
|
||||||
*/
|
*/
|
||||||
public function general(Request $request)
|
public function general(Request $request)
|
||||||
{
|
{
|
||||||
@@ -124,13 +119,12 @@ class ReportController extends Controller
|
|||||||
* @return string
|
* @return string
|
||||||
*
|
*
|
||||||
* @throws FireflyException
|
* @throws FireflyException
|
||||||
* @throws \Throwable
|
|
||||||
*/
|
*/
|
||||||
private function balanceAmount(array $attributes): string
|
private function balanceAmount(array $attributes): string
|
||||||
{
|
{
|
||||||
$role = intval($attributes['role']);
|
$role = (int)$attributes['role'];
|
||||||
$budget = $this->budgetRepository->findNull(intval($attributes['budgetId']));
|
$budget = $this->budgetRepository->findNull((int)$attributes['budgetId']);
|
||||||
$account = $this->accountRepository->findNull(intval($attributes['accountId']));
|
$account = $this->accountRepository->findNull((int)$attributes['accountId']);
|
||||||
|
|
||||||
switch (true) {
|
switch (true) {
|
||||||
case BalanceLine::ROLE_DEFAULTROLE === $role && null !== $budget->id:
|
case BalanceLine::ROLE_DEFAULTROLE === $role && null !== $budget->id:
|
||||||
@@ -140,11 +134,11 @@ class ReportController extends Controller
|
|||||||
case BalanceLine::ROLE_DEFAULTROLE === $role && null === $budget->id:
|
case BalanceLine::ROLE_DEFAULTROLE === $role && null === $budget->id:
|
||||||
// normal row without a budget:
|
// normal row without a budget:
|
||||||
$journals = $this->popupHelper->balanceForNoBudget($account, $attributes);
|
$journals = $this->popupHelper->balanceForNoBudget($account, $attributes);
|
||||||
$budget->name = strval(trans('firefly.no_budget'));
|
$budget->name = (string)trans('firefly.no_budget');
|
||||||
break;
|
break;
|
||||||
case BalanceLine::ROLE_DIFFROLE === $role:
|
case BalanceLine::ROLE_DIFFROLE === $role:
|
||||||
$journals = $this->popupHelper->balanceDifference($account, $attributes);
|
$journals = $this->popupHelper->balanceDifference($account, $attributes);
|
||||||
$budget->name = strval(trans('firefly.leftUnbalanced'));
|
$budget->name = (string)trans('firefly.leftUnbalanced');
|
||||||
break;
|
break;
|
||||||
case BalanceLine::ROLE_TAGROLE === $role:
|
case BalanceLine::ROLE_TAGROLE === $role:
|
||||||
// row with tag info.
|
// row with tag info.
|
||||||
@@ -162,11 +156,11 @@ class ReportController extends Controller
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*
|
*
|
||||||
* @throws \Throwable
|
|
||||||
*/
|
*/
|
||||||
private function budgetSpentAmount(array $attributes): string
|
private function budgetSpentAmount(array $attributes): string
|
||||||
{
|
{
|
||||||
$budget = $this->budgetRepository->findNull(intval($attributes['budgetId']));
|
$budget = $this->budgetRepository->findNull((int)$attributes['budgetId']);
|
||||||
$journals = $this->popupHelper->byBudget($budget, $attributes);
|
$journals = $this->popupHelper->byBudget($budget, $attributes);
|
||||||
$view = view('popup.report.budget-spent-amount', compact('journals', 'budget'))->render();
|
$view = view('popup.report.budget-spent-amount', compact('journals', 'budget'))->render();
|
||||||
|
|
||||||
@@ -180,11 +174,11 @@ class ReportController extends Controller
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*
|
*
|
||||||
* @throws \Throwable
|
|
||||||
*/
|
*/
|
||||||
private function categoryEntry(array $attributes): string
|
private function categoryEntry(array $attributes): string
|
||||||
{
|
{
|
||||||
$category = $this->categoryRepository->findNull(intval($attributes['categoryId']));
|
$category = $this->categoryRepository->findNull((int)$attributes['categoryId']);
|
||||||
$journals = $this->popupHelper->byCategory($category, $attributes);
|
$journals = $this->popupHelper->byCategory($category, $attributes);
|
||||||
$view = view('popup.report.category-entry', compact('journals', 'category'))->render();
|
$view = view('popup.report.category-entry', compact('journals', 'category'))->render();
|
||||||
|
|
||||||
@@ -198,11 +192,11 @@ class ReportController extends Controller
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*
|
*
|
||||||
* @throws \Throwable
|
|
||||||
*/
|
*/
|
||||||
private function expenseEntry(array $attributes): string
|
private function expenseEntry(array $attributes): string
|
||||||
{
|
{
|
||||||
$account = $this->accountRepository->findNull(intval($attributes['accountId']));
|
$account = $this->accountRepository->findNull((int)$attributes['accountId']);
|
||||||
$journals = $this->popupHelper->byExpenses($account, $attributes);
|
$journals = $this->popupHelper->byExpenses($account, $attributes);
|
||||||
$view = view('popup.report.expense-entry', compact('journals', 'account'))->render();
|
$view = view('popup.report.expense-entry', compact('journals', 'account'))->render();
|
||||||
|
|
||||||
@@ -216,11 +210,11 @@ class ReportController extends Controller
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*
|
*
|
||||||
* @throws \Throwable
|
|
||||||
*/
|
*/
|
||||||
private function incomeEntry(array $attributes): string
|
private function incomeEntry(array $attributes): string
|
||||||
{
|
{
|
||||||
$account = $this->accountRepository->findNull(intval($attributes['accountId']));
|
$account = $this->accountRepository->findNull((int)$attributes['accountId']);
|
||||||
$journals = $this->popupHelper->byIncome($account, $attributes);
|
$journals = $this->popupHelper->byIncome($account, $attributes);
|
||||||
$view = view('popup.report.income-entry', compact('journals', 'account'))->render();
|
$view = view('popup.report.income-entry', compact('journals', 'account'))->render();
|
||||||
|
|
||||||
|
@@ -97,7 +97,7 @@ class PreferencesController extends Controller
|
|||||||
$frontPageAccounts = [];
|
$frontPageAccounts = [];
|
||||||
if (is_array($request->get('frontPageAccounts'))) {
|
if (is_array($request->get('frontPageAccounts'))) {
|
||||||
foreach ($request->get('frontPageAccounts') as $id) {
|
foreach ($request->get('frontPageAccounts') as $id) {
|
||||||
$frontPageAccounts[] = intval($id);
|
$frontPageAccounts[] = (int)$id;
|
||||||
}
|
}
|
||||||
Preferences::set('frontPageAccounts', $frontPageAccounts);
|
Preferences::set('frontPageAccounts', $frontPageAccounts);
|
||||||
}
|
}
|
||||||
@@ -110,21 +110,21 @@ class PreferencesController extends Controller
|
|||||||
Session::forget('range');
|
Session::forget('range');
|
||||||
|
|
||||||
// custom fiscal year
|
// custom fiscal year
|
||||||
$customFiscalYear = 1 === intval($request->get('customFiscalYear'));
|
$customFiscalYear = 1 === (int)$request->get('customFiscalYear');
|
||||||
$fiscalYearStart = date('m-d', strtotime(strval($request->get('fiscalYearStart'))));
|
$fiscalYearStart = date('m-d', strtotime((string)$request->get('fiscalYearStart')));
|
||||||
Preferences::set('customFiscalYear', $customFiscalYear);
|
Preferences::set('customFiscalYear', $customFiscalYear);
|
||||||
Preferences::set('fiscalYearStart', $fiscalYearStart);
|
Preferences::set('fiscalYearStart', $fiscalYearStart);
|
||||||
|
|
||||||
// save page size:
|
// save page size:
|
||||||
Preferences::set('listPageSize', 50);
|
Preferences::set('listPageSize', 50);
|
||||||
$listPageSize = intval($request->get('listPageSize'));
|
$listPageSize = (int)$request->get('listPageSize');
|
||||||
if ($listPageSize > 0 && $listPageSize < 1337) {
|
if ($listPageSize > 0 && $listPageSize < 1337) {
|
||||||
Preferences::set('listPageSize', $listPageSize);
|
Preferences::set('listPageSize', $listPageSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
// language:
|
// language:
|
||||||
$lang = $request->get('language');
|
$lang = $request->get('language');
|
||||||
if (in_array($lang, array_keys(config('firefly.languages')))) {
|
if (array_key_exists($lang, config('firefly.languages'))) {
|
||||||
Preferences::set('language', $lang);
|
Preferences::set('language', $lang);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -143,7 +143,7 @@ class PreferencesController extends Controller
|
|||||||
];
|
];
|
||||||
Preferences::set('transaction_journal_optional_fields', $optionalTj);
|
Preferences::set('transaction_journal_optional_fields', $optionalTj);
|
||||||
|
|
||||||
Session::flash('success', strval(trans('firefly.saved_preferences')));
|
Session::flash('success', (string)trans('firefly.saved_preferences'));
|
||||||
Preferences::mark();
|
Preferences::mark();
|
||||||
|
|
||||||
return redirect(route('preferences.index'));
|
return redirect(route('preferences.index'));
|
||||||
|
@@ -76,7 +76,7 @@ class ProfileController extends Controller
|
|||||||
{
|
{
|
||||||
$title = auth()->user()->email;
|
$title = auth()->user()->email;
|
||||||
$email = auth()->user()->email;
|
$email = auth()->user()->email;
|
||||||
$subTitle = strval(trans('firefly.change_your_email'));
|
$subTitle = (string)trans('firefly.change_your_email');
|
||||||
$subTitleIcon = 'fa-envelope';
|
$subTitleIcon = 'fa-envelope';
|
||||||
|
|
||||||
return view('profile.change-email', compact('title', 'subTitle', 'subTitleIcon', 'email'));
|
return view('profile.change-email', compact('title', 'subTitle', 'subTitleIcon', 'email'));
|
||||||
@@ -88,7 +88,7 @@ class ProfileController extends Controller
|
|||||||
public function changePassword()
|
public function changePassword()
|
||||||
{
|
{
|
||||||
$title = auth()->user()->email;
|
$title = auth()->user()->email;
|
||||||
$subTitle = strval(trans('firefly.change_your_password'));
|
$subTitle = (string)trans('firefly.change_your_password');
|
||||||
$subTitleIcon = 'fa-key';
|
$subTitleIcon = 'fa-key';
|
||||||
|
|
||||||
return view('profile.change-password', compact('title', 'subTitle', 'subTitleIcon'));
|
return view('profile.change-password', compact('title', 'subTitle', 'subTitleIcon'));
|
||||||
@@ -139,7 +139,7 @@ class ProfileController extends Controller
|
|||||||
$repository->unblockUser($user);
|
$repository->unblockUser($user);
|
||||||
|
|
||||||
// return to login.
|
// return to login.
|
||||||
Session::flash('success', strval(trans('firefly.login_with_new_email')));
|
Session::flash('success', (string)trans('firefly.login_with_new_email'));
|
||||||
|
|
||||||
return redirect(route('login'));
|
return redirect(route('login'));
|
||||||
}
|
}
|
||||||
@@ -150,7 +150,7 @@ class ProfileController extends Controller
|
|||||||
public function deleteAccount()
|
public function deleteAccount()
|
||||||
{
|
{
|
||||||
$title = auth()->user()->email;
|
$title = auth()->user()->email;
|
||||||
$subTitle = strval(trans('firefly.delete_account'));
|
$subTitle = (string)trans('firefly.delete_account');
|
||||||
$subTitleIcon = 'fa-trash';
|
$subTitleIcon = 'fa-trash';
|
||||||
|
|
||||||
return view('profile.delete-account', compact('title', 'subTitle', 'subTitleIcon'));
|
return view('profile.delete-account', compact('title', 'subTitle', 'subTitleIcon'));
|
||||||
@@ -163,8 +163,8 @@ class ProfileController extends Controller
|
|||||||
{
|
{
|
||||||
Preferences::delete('twoFactorAuthEnabled');
|
Preferences::delete('twoFactorAuthEnabled');
|
||||||
Preferences::delete('twoFactorAuthSecret');
|
Preferences::delete('twoFactorAuthSecret');
|
||||||
Session::flash('success', strval(trans('firefly.pref_two_factor_auth_disabled')));
|
Session::flash('success', (string)trans('firefly.pref_two_factor_auth_disabled'));
|
||||||
Session::flash('info', strval(trans('firefly.pref_two_factor_auth_remove_it')));
|
Session::flash('info', (string)trans('firefly.pref_two_factor_auth_remove_it'));
|
||||||
|
|
||||||
return redirect(route('profile.index'));
|
return redirect(route('profile.index'));
|
||||||
}
|
}
|
||||||
@@ -201,7 +201,7 @@ class ProfileController extends Controller
|
|||||||
{
|
{
|
||||||
$subTitle = auth()->user()->email;
|
$subTitle = auth()->user()->email;
|
||||||
$userId = auth()->user()->id;
|
$userId = auth()->user()->id;
|
||||||
$enabled2FA = intval(Preferences::get('twoFactorAuthEnabled', 0)->data) === 1;
|
$enabled2FA = (int)Preferences::get('twoFactorAuthEnabled', 0)->data === 1;
|
||||||
|
|
||||||
// get access token or create one.
|
// get access token or create one.
|
||||||
$accessToken = Preferences::get('access_token', null);
|
$accessToken = Preferences::get('access_token', null);
|
||||||
@@ -218,7 +218,6 @@ class ProfileController extends Controller
|
|||||||
* @param UserRepositoryInterface $repository
|
* @param UserRepositoryInterface $repository
|
||||||
*
|
*
|
||||||
* @return $this|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
* @return $this|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
||||||
* @throws \RuntimeException
|
|
||||||
*/
|
*/
|
||||||
public function postChangeEmail(EmailFormRequest $request, UserRepositoryInterface $repository)
|
public function postChangeEmail(EmailFormRequest $request, UserRepositoryInterface $repository)
|
||||||
{
|
{
|
||||||
@@ -227,7 +226,7 @@ class ProfileController extends Controller
|
|||||||
$newEmail = $request->string('email');
|
$newEmail = $request->string('email');
|
||||||
$oldEmail = $user->email;
|
$oldEmail = $user->email;
|
||||||
if ($newEmail === $user->email) {
|
if ($newEmail === $user->email) {
|
||||||
Session::flash('error', strval(trans('firefly.email_not_changed')));
|
Session::flash('error', (string)trans('firefly.email_not_changed'));
|
||||||
|
|
||||||
return redirect(route('profile.change-email'))->withInput();
|
return redirect(route('profile.change-email'))->withInput();
|
||||||
}
|
}
|
||||||
@@ -237,7 +236,7 @@ class ProfileController extends Controller
|
|||||||
Auth::guard()->logout();
|
Auth::guard()->logout();
|
||||||
$request->session()->invalidate();
|
$request->session()->invalidate();
|
||||||
|
|
||||||
Session::flash('success', strval(trans('firefly.email_changed')));
|
Session::flash('success', (string)trans('firefly.email_changed'));
|
||||||
|
|
||||||
return redirect(route('index'));
|
return redirect(route('index'));
|
||||||
}
|
}
|
||||||
@@ -252,7 +251,7 @@ class ProfileController extends Controller
|
|||||||
// force user logout.
|
// force user logout.
|
||||||
Auth::guard()->logout();
|
Auth::guard()->logout();
|
||||||
$request->session()->invalidate();
|
$request->session()->invalidate();
|
||||||
Session::flash('success', strval(trans('firefly.email_changed')));
|
Session::flash('success', (string)trans('firefly.email_changed'));
|
||||||
|
|
||||||
return redirect(route('index'));
|
return redirect(route('index'));
|
||||||
}
|
}
|
||||||
@@ -278,7 +277,7 @@ class ProfileController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
$repository->changePassword(auth()->user(), $request->get('new_password'));
|
$repository->changePassword(auth()->user(), $request->get('new_password'));
|
||||||
Session::flash('success', strval(trans('firefly.password_changed')));
|
Session::flash('success', (string)trans('firefly.password_changed'));
|
||||||
|
|
||||||
return redirect(route('profile.index'));
|
return redirect(route('profile.index'));
|
||||||
}
|
}
|
||||||
@@ -294,7 +293,7 @@ class ProfileController extends Controller
|
|||||||
Preferences::set('twoFactorAuthEnabled', 1);
|
Preferences::set('twoFactorAuthEnabled', 1);
|
||||||
Preferences::set('twoFactorAuthSecret', Session::get('two-factor-secret'));
|
Preferences::set('twoFactorAuthSecret', Session::get('two-factor-secret'));
|
||||||
|
|
||||||
Session::flash('success', strval(trans('firefly.saved_preferences')));
|
Session::flash('success', (string)trans('firefly.saved_preferences'));
|
||||||
Preferences::mark();
|
Preferences::mark();
|
||||||
|
|
||||||
return redirect(route('profile.index'));
|
return redirect(route('profile.index'));
|
||||||
@@ -309,7 +308,7 @@ class ProfileController extends Controller
|
|||||||
public function postDeleteAccount(UserRepositoryInterface $repository, DeleteAccountFormRequest $request)
|
public function postDeleteAccount(UserRepositoryInterface $repository, DeleteAccountFormRequest $request)
|
||||||
{
|
{
|
||||||
if (!Hash::check($request->get('password'), auth()->user()->password)) {
|
if (!Hash::check($request->get('password'), auth()->user()->password)) {
|
||||||
Session::flash('error', strval(trans('firefly.invalid_password')));
|
Session::flash('error', (string)trans('firefly.invalid_password'));
|
||||||
|
|
||||||
return redirect(route('profile.delete-account'));
|
return redirect(route('profile.delete-account'));
|
||||||
}
|
}
|
||||||
@@ -330,7 +329,7 @@ class ProfileController extends Controller
|
|||||||
{
|
{
|
||||||
$token = auth()->user()->generateAccessToken();
|
$token = auth()->user()->generateAccessToken();
|
||||||
Preferences::set('access_token', $token);
|
Preferences::set('access_token', $token);
|
||||||
Session::flash('success', strval(trans('firefly.token_regenerated')));
|
Session::flash('success', (string)trans('firefly.token_regenerated'));
|
||||||
|
|
||||||
return redirect(route('profile.index'));
|
return redirect(route('profile.index'));
|
||||||
}
|
}
|
||||||
@@ -380,7 +379,7 @@ class ProfileController extends Controller
|
|||||||
$repository->unblockUser($user);
|
$repository->unblockUser($user);
|
||||||
|
|
||||||
// return to login.
|
// return to login.
|
||||||
Session::flash('success', strval(trans('firefly.login_with_old_email')));
|
Session::flash('success', (string)trans('firefly.login_with_old_email'));
|
||||||
|
|
||||||
return redirect(route('login'));
|
return redirect(route('login'));
|
||||||
}
|
}
|
||||||
@@ -397,11 +396,11 @@ class ProfileController extends Controller
|
|||||||
protected function validatePassword(User $user, string $current, string $new): bool
|
protected function validatePassword(User $user, string $current, string $new): bool
|
||||||
{
|
{
|
||||||
if (!Hash::check($current, $user->password)) {
|
if (!Hash::check($current, $user->password)) {
|
||||||
throw new ValidationException(strval(trans('firefly.invalid_current_password')));
|
throw new ValidationException((string)trans('firefly.invalid_current_password'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($current === $new) {
|
if ($current === $new) {
|
||||||
throw new ValidationException(strval(trans('firefly.should_change')));
|
throw new ValidationException((string)trans('firefly.should_change'));
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@@ -40,7 +40,7 @@ class AccountController extends Controller
|
|||||||
*
|
*
|
||||||
* @return mixed|string
|
* @return mixed|string
|
||||||
*
|
*
|
||||||
* @throws \Throwable
|
|
||||||
*/
|
*/
|
||||||
public function general(Collection $accounts, Carbon $start, Carbon $end)
|
public function general(Collection $accounts, Carbon $start, Carbon $end)
|
||||||
{
|
{
|
||||||
|
@@ -41,7 +41,7 @@ class BalanceController extends Controller
|
|||||||
*
|
*
|
||||||
* @return mixed|string
|
* @return mixed|string
|
||||||
*
|
*
|
||||||
* @throws \Throwable
|
|
||||||
*/
|
*/
|
||||||
public function general(BalanceReportHelperInterface $helper, Collection $accounts, Carbon $start, Carbon $end)
|
public function general(BalanceReportHelperInterface $helper, Collection $accounts, Carbon $start, Carbon $end)
|
||||||
{
|
{
|
||||||
|
@@ -42,7 +42,7 @@ class BudgetController extends Controller
|
|||||||
*
|
*
|
||||||
* @return mixed|string
|
* @return mixed|string
|
||||||
*
|
*
|
||||||
* @throws \Throwable
|
|
||||||
*/
|
*/
|
||||||
public function general(BudgetReportHelperInterface $helper, Collection $accounts, Carbon $start, Carbon $end)
|
public function general(BudgetReportHelperInterface $helper, Collection $accounts, Carbon $start, Carbon $end)
|
||||||
{
|
{
|
||||||
@@ -71,7 +71,7 @@ class BudgetController extends Controller
|
|||||||
*
|
*
|
||||||
* @return mixed|string
|
* @return mixed|string
|
||||||
*
|
*
|
||||||
* @throws \Throwable
|
|
||||||
*/
|
*/
|
||||||
public function period(Collection $accounts, Carbon $start, Carbon $end)
|
public function period(Collection $accounts, Carbon $start, Carbon $end)
|
||||||
{
|
{
|
||||||
|
@@ -41,7 +41,7 @@ class CategoryController extends Controller
|
|||||||
*
|
*
|
||||||
* @return mixed|string
|
* @return mixed|string
|
||||||
*
|
*
|
||||||
* @throws \Throwable
|
|
||||||
*/
|
*/
|
||||||
public function expenses(Collection $accounts, Carbon $start, Carbon $end)
|
public function expenses(Collection $accounts, Carbon $start, Carbon $end)
|
||||||
{
|
{
|
||||||
@@ -74,7 +74,7 @@ class CategoryController extends Controller
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*
|
*
|
||||||
* @throws \Throwable
|
|
||||||
*/
|
*/
|
||||||
public function income(Collection $accounts, Carbon $start, Carbon $end)
|
public function income(Collection $accounts, Carbon $start, Carbon $end)
|
||||||
{
|
{
|
||||||
@@ -109,7 +109,7 @@ class CategoryController extends Controller
|
|||||||
*
|
*
|
||||||
* @internal param ReportHelperInterface $helper
|
* @internal param ReportHelperInterface $helper
|
||||||
*
|
*
|
||||||
* @throws \Throwable
|
|
||||||
*/
|
*/
|
||||||
public function operations(Collection $accounts, Carbon $start, Carbon $end)
|
public function operations(Collection $accounts, Carbon $start, Carbon $end)
|
||||||
{
|
{
|
||||||
@@ -139,7 +139,7 @@ class CategoryController extends Controller
|
|||||||
// Obtain a list of columns
|
// Obtain a list of columns
|
||||||
$sum = [];
|
$sum = [];
|
||||||
foreach ($report as $categoryId => $row) {
|
foreach ($report as $categoryId => $row) {
|
||||||
$sum[$categoryId] = floatval($row['spent']);
|
$sum[$categoryId] = (float)$row['spent'];
|
||||||
}
|
}
|
||||||
|
|
||||||
array_multisort($sum, SORT_ASC, $report);
|
array_multisort($sum, SORT_ASC, $report);
|
||||||
|
@@ -68,7 +68,7 @@ class ExpenseController extends Controller
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*
|
*
|
||||||
* @throws \Throwable
|
|
||||||
*/
|
*/
|
||||||
public function budget(Collection $accounts, Collection $expense, Carbon $start, Carbon $end)
|
public function budget(Collection $accounts, Collection $expense, Carbon $start, Carbon $end)
|
||||||
{
|
{
|
||||||
@@ -116,7 +116,7 @@ class ExpenseController extends Controller
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*
|
*
|
||||||
* @throws \Throwable
|
|
||||||
*/
|
*/
|
||||||
public function category(Collection $accounts, Collection $expense, Carbon $start, Carbon $end)
|
public function category(Collection $accounts, Collection $expense, Carbon $start, Carbon $end)
|
||||||
{
|
{
|
||||||
@@ -174,7 +174,7 @@ class ExpenseController extends Controller
|
|||||||
*
|
*
|
||||||
* @return array|mixed|string
|
* @return array|mixed|string
|
||||||
*
|
*
|
||||||
* @throws \Throwable
|
|
||||||
*/
|
*/
|
||||||
public function spent(Collection $accounts, Collection $expense, Carbon $start, Carbon $end)
|
public function spent(Collection $accounts, Collection $expense, Carbon $start, Carbon $end)
|
||||||
{
|
{
|
||||||
@@ -219,7 +219,7 @@ class ExpenseController extends Controller
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*
|
*
|
||||||
* @throws \Throwable
|
|
||||||
*/
|
*/
|
||||||
public function topExpense(Collection $accounts, Collection $expense, Carbon $start, Carbon $end)
|
public function topExpense(Collection $accounts, Collection $expense, Carbon $start, Carbon $end)
|
||||||
{
|
{
|
||||||
@@ -246,7 +246,7 @@ class ExpenseController extends Controller
|
|||||||
$set = $collector->getJournals();
|
$set = $collector->getJournals();
|
||||||
$sorted = $set->sortBy(
|
$sorted = $set->sortBy(
|
||||||
function (Transaction $transaction) {
|
function (Transaction $transaction) {
|
||||||
return floatval($transaction->transaction_amount);
|
return (float)$transaction->transaction_amount;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
$result = view('reports.partials.top-transactions', compact('sorted'))->render();
|
$result = view('reports.partials.top-transactions', compact('sorted'))->render();
|
||||||
@@ -263,7 +263,7 @@ class ExpenseController extends Controller
|
|||||||
*
|
*
|
||||||
* @return mixed|string
|
* @return mixed|string
|
||||||
*
|
*
|
||||||
* @throws \Throwable
|
|
||||||
*/
|
*/
|
||||||
public function topIncome(Collection $accounts, Collection $expense, Carbon $start, Carbon $end)
|
public function topIncome(Collection $accounts, Collection $expense, Carbon $start, Carbon $end)
|
||||||
{
|
{
|
||||||
@@ -290,7 +290,7 @@ class ExpenseController extends Controller
|
|||||||
$set = $collector->getJournals();
|
$set = $collector->getJournals();
|
||||||
$sorted = $set->sortByDesc(
|
$sorted = $set->sortByDesc(
|
||||||
function (Transaction $transaction) {
|
function (Transaction $transaction) {
|
||||||
return floatval($transaction->transaction_amount);
|
return (float)$transaction->transaction_amount;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
$result = view('reports.partials.top-transactions', compact('sorted'))->render();
|
$result = view('reports.partials.top-transactions', compact('sorted'))->render();
|
||||||
@@ -313,7 +313,7 @@ class ExpenseController extends Controller
|
|||||||
$collection->push($expenseAccount);
|
$collection->push($expenseAccount);
|
||||||
|
|
||||||
$revenue = $this->accountRepository->findByName($expenseAccount->name, [AccountType::REVENUE]);
|
$revenue = $this->accountRepository->findByName($expenseAccount->name, [AccountType::REVENUE]);
|
||||||
if (!is_null($revenue)) {
|
if (null !== $revenue) {
|
||||||
$collection->push($revenue);
|
$collection->push($revenue);
|
||||||
}
|
}
|
||||||
$combined[$expenseAccount->name] = $collection;
|
$combined[$expenseAccount->name] = $collection;
|
||||||
@@ -342,11 +342,11 @@ class ExpenseController extends Controller
|
|||||||
foreach ($set as $transaction) {
|
foreach ($set as $transaction) {
|
||||||
$currencyId = $transaction->transaction_currency_id;
|
$currencyId = $transaction->transaction_currency_id;
|
||||||
$categoryName = $transaction->transaction_category_name;
|
$categoryName = $transaction->transaction_category_name;
|
||||||
$categoryId = intval($transaction->transaction_category_id);
|
$categoryId = (int)$transaction->transaction_category_id;
|
||||||
// if null, grab from journal:
|
// if null, grab from journal:
|
||||||
if (0 === $categoryId) {
|
if (0 === $categoryId) {
|
||||||
$categoryName = $transaction->transaction_journal_category_name;
|
$categoryName = $transaction->transaction_journal_category_name;
|
||||||
$categoryId = intval($transaction->transaction_journal_category_id);
|
$categoryId = (int)$transaction->transaction_journal_category_id;
|
||||||
}
|
}
|
||||||
if (0 !== $categoryId) {
|
if (0 !== $categoryId) {
|
||||||
$categoryName = app('steam')->tryDecrypt($categoryName);
|
$categoryName = app('steam')->tryDecrypt($categoryName);
|
||||||
@@ -445,11 +445,11 @@ class ExpenseController extends Controller
|
|||||||
foreach ($set as $transaction) {
|
foreach ($set as $transaction) {
|
||||||
$currencyId = $transaction->transaction_currency_id;
|
$currencyId = $transaction->transaction_currency_id;
|
||||||
$budgetName = $transaction->transaction_budget_name;
|
$budgetName = $transaction->transaction_budget_name;
|
||||||
$budgetId = intval($transaction->transaction_budget_id);
|
$budgetId = (int)$transaction->transaction_budget_id;
|
||||||
// if null, grab from journal:
|
// if null, grab from journal:
|
||||||
if (0 === $budgetId) {
|
if (0 === $budgetId) {
|
||||||
$budgetName = $transaction->transaction_journal_budget_name;
|
$budgetName = $transaction->transaction_journal_budget_name;
|
||||||
$budgetId = intval($transaction->transaction_journal_budget_id);
|
$budgetId = (int)$transaction->transaction_journal_budget_id;
|
||||||
}
|
}
|
||||||
if (0 !== $budgetId) {
|
if (0 !== $budgetId) {
|
||||||
$budgetName = app('steam')->tryDecrypt($budgetName);
|
$budgetName = app('steam')->tryDecrypt($budgetName);
|
||||||
@@ -506,11 +506,11 @@ class ExpenseController extends Controller
|
|||||||
foreach ($set as $transaction) {
|
foreach ($set as $transaction) {
|
||||||
$currencyId = $transaction->transaction_currency_id;
|
$currencyId = $transaction->transaction_currency_id;
|
||||||
$categoryName = $transaction->transaction_category_name;
|
$categoryName = $transaction->transaction_category_name;
|
||||||
$categoryId = intval($transaction->transaction_category_id);
|
$categoryId = (int)$transaction->transaction_category_id;
|
||||||
// if null, grab from journal:
|
// if null, grab from journal:
|
||||||
if (0 === $categoryId) {
|
if (0 === $categoryId) {
|
||||||
$categoryName = $transaction->transaction_journal_category_name;
|
$categoryName = $transaction->transaction_journal_category_name;
|
||||||
$categoryId = intval($transaction->transaction_journal_category_id);
|
$categoryId = (int)$transaction->transaction_journal_category_id;
|
||||||
}
|
}
|
||||||
if (0 !== $categoryId) {
|
if (0 !== $categoryId) {
|
||||||
$categoryName = app('steam')->tryDecrypt($categoryName);
|
$categoryName = app('steam')->tryDecrypt($categoryName);
|
||||||
@@ -568,7 +568,7 @@ class ExpenseController extends Controller
|
|||||||
];
|
];
|
||||||
// loop to support multi currency
|
// loop to support multi currency
|
||||||
foreach ($set as $transaction) {
|
foreach ($set as $transaction) {
|
||||||
$currencyId = intval($transaction->transaction_currency_id);
|
$currencyId = (int)$transaction->transaction_currency_id;
|
||||||
|
|
||||||
// if not set, set to zero:
|
// if not set, set to zero:
|
||||||
if (!isset($sum['per_currency'][$currencyId])) {
|
if (!isset($sum['per_currency'][$currencyId])) {
|
||||||
|
@@ -41,7 +41,7 @@ class OperationsController extends Controller
|
|||||||
*
|
*
|
||||||
* @return mixed|string
|
* @return mixed|string
|
||||||
*
|
*
|
||||||
* @throws \Throwable
|
|
||||||
*/
|
*/
|
||||||
public function expenses(AccountTaskerInterface $tasker, Collection $accounts, Carbon $start, Carbon $end)
|
public function expenses(AccountTaskerInterface $tasker, Collection $accounts, Carbon $start, Carbon $end)
|
||||||
{
|
{
|
||||||
@@ -70,7 +70,7 @@ class OperationsController extends Controller
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*
|
*
|
||||||
* @throws \Throwable
|
|
||||||
*/
|
*/
|
||||||
public function income(AccountTaskerInterface $tasker, Collection $accounts, Carbon $start, Carbon $end)
|
public function income(AccountTaskerInterface $tasker, Collection $accounts, Carbon $start, Carbon $end)
|
||||||
{
|
{
|
||||||
@@ -100,7 +100,7 @@ class OperationsController extends Controller
|
|||||||
*
|
*
|
||||||
* @return mixed|string
|
* @return mixed|string
|
||||||
*
|
*
|
||||||
* @throws \Throwable
|
|
||||||
*/
|
*/
|
||||||
public function operations(AccountTaskerInterface $tasker, Collection $accounts, Carbon $start, Carbon $end)
|
public function operations(AccountTaskerInterface $tasker, Collection $accounts, Carbon $start, Carbon $end)
|
||||||
{
|
{
|
||||||
|
@@ -175,9 +175,8 @@ class ReportController extends Controller
|
|||||||
$generator = ReportGeneratorFactory::reportGenerator('Budget', $start, $end);
|
$generator = ReportGeneratorFactory::reportGenerator('Budget', $start, $end);
|
||||||
$generator->setAccounts($accounts);
|
$generator->setAccounts($accounts);
|
||||||
$generator->setBudgets($budgets);
|
$generator->setBudgets($budgets);
|
||||||
$result = $generator->generate();
|
|
||||||
|
|
||||||
return $result;
|
return $generator->generate();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -214,9 +213,8 @@ class ReportController extends Controller
|
|||||||
$generator = ReportGeneratorFactory::reportGenerator('Category', $start, $end);
|
$generator = ReportGeneratorFactory::reportGenerator('Category', $start, $end);
|
||||||
$generator->setAccounts($accounts);
|
$generator->setAccounts($accounts);
|
||||||
$generator->setCategories($categories);
|
$generator->setCategories($categories);
|
||||||
$result = $generator->generate();
|
|
||||||
|
|
||||||
return $result;
|
return $generator->generate();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -252,9 +250,8 @@ class ReportController extends Controller
|
|||||||
|
|
||||||
$generator = ReportGeneratorFactory::reportGenerator('Standard', $start, $end);
|
$generator = ReportGeneratorFactory::reportGenerator('Standard', $start, $end);
|
||||||
$generator->setAccounts($accounts);
|
$generator->setAccounts($accounts);
|
||||||
$result = $generator->generate();
|
|
||||||
|
|
||||||
return $result;
|
return $generator->generate();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -269,7 +266,7 @@ class ReportController extends Controller
|
|||||||
$months = $this->helper->listOfMonths($start);
|
$months = $this->helper->listOfMonths($start);
|
||||||
$customFiscalYear = Preferences::get('customFiscalYear', 0)->data;
|
$customFiscalYear = Preferences::get('customFiscalYear', 0)->data;
|
||||||
$accounts = $repository->getAccountsByType([AccountType::DEFAULT, AccountType::ASSET]);
|
$accounts = $repository->getAccountsByType([AccountType::DEFAULT, AccountType::ASSET]);
|
||||||
$accountList = join(',', $accounts->pluck('id')->toArray());
|
$accountList = implode(',', $accounts->pluck('id')->toArray());
|
||||||
$this->repository->cleanupBudgets();
|
$this->repository->cleanupBudgets();
|
||||||
|
|
||||||
return view('reports.index', compact('months', 'accounts', 'start', 'accountList', 'customFiscalYear'));
|
return view('reports.index', compact('months', 'accounts', 'start', 'accountList', 'customFiscalYear'));
|
||||||
@@ -280,7 +277,7 @@ class ReportController extends Controller
|
|||||||
*
|
*
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*
|
*
|
||||||
* @throws \Throwable
|
|
||||||
*/
|
*/
|
||||||
public function options(string $reportType)
|
public function options(string $reportType)
|
||||||
{
|
{
|
||||||
@@ -319,11 +316,11 @@ class ReportController extends Controller
|
|||||||
$reportType = $request->get('report_type');
|
$reportType = $request->get('report_type');
|
||||||
$start = $request->getStartDate()->format('Ymd');
|
$start = $request->getStartDate()->format('Ymd');
|
||||||
$end = $request->getEndDate()->format('Ymd');
|
$end = $request->getEndDate()->format('Ymd');
|
||||||
$accounts = join(',', $request->getAccountList()->pluck('id')->toArray());
|
$accounts = implode(',', $request->getAccountList()->pluck('id')->toArray());
|
||||||
$categories = join(',', $request->getCategoryList()->pluck('id')->toArray());
|
$categories = implode(',', $request->getCategoryList()->pluck('id')->toArray());
|
||||||
$budgets = join(',', $request->getBudgetList()->pluck('id')->toArray());
|
$budgets = implode(',', $request->getBudgetList()->pluck('id')->toArray());
|
||||||
$tags = join(',', $request->getTagList()->pluck('tag')->toArray());
|
$tags = implode(',', $request->getTagList()->pluck('tag')->toArray());
|
||||||
$expense = join(',', $request->getExpenseList()->pluck('id')->toArray());
|
$expense = implode(',', $request->getExpenseList()->pluck('id')->toArray());
|
||||||
$uri = route('reports.index');
|
$uri = route('reports.index');
|
||||||
|
|
||||||
if (0 === $request->getAccountList()->count()) {
|
if (0 === $request->getAccountList()->count()) {
|
||||||
@@ -413,15 +410,14 @@ class ReportController extends Controller
|
|||||||
$generator = ReportGeneratorFactory::reportGenerator('Tag', $start, $end);
|
$generator = ReportGeneratorFactory::reportGenerator('Tag', $start, $end);
|
||||||
$generator->setAccounts($accounts);
|
$generator->setAccounts($accounts);
|
||||||
$generator->setTags($tags);
|
$generator->setTags($tags);
|
||||||
$result = $generator->generate();
|
|
||||||
|
|
||||||
return $result;
|
return $generator->generate();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
*
|
*
|
||||||
* @throws \Throwable
|
|
||||||
*/
|
*/
|
||||||
private function accountReportOptions(): string
|
private function accountReportOptions(): string
|
||||||
{
|
{
|
||||||
@@ -437,45 +433,41 @@ class ReportController extends Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = view('reports.options.account', compact('set'))->render();
|
return view('reports.options.account', compact('set'))->render();
|
||||||
|
|
||||||
return $result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
*
|
*
|
||||||
* @throws \Throwable
|
|
||||||
*/
|
*/
|
||||||
private function budgetReportOptions(): string
|
private function budgetReportOptions(): string
|
||||||
{
|
{
|
||||||
/** @var BudgetRepositoryInterface $repository */
|
/** @var BudgetRepositoryInterface $repository */
|
||||||
$repository = app(BudgetRepositoryInterface::class);
|
$repository = app(BudgetRepositoryInterface::class);
|
||||||
$budgets = $repository->getBudgets();
|
$budgets = $repository->getBudgets();
|
||||||
$result = view('reports.options.budget', compact('budgets'))->render();
|
|
||||||
|
|
||||||
return $result;
|
return view('reports.options.budget', compact('budgets'))->render();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
*
|
*
|
||||||
* @throws \Throwable
|
|
||||||
*/
|
*/
|
||||||
private function categoryReportOptions(): string
|
private function categoryReportOptions(): string
|
||||||
{
|
{
|
||||||
/** @var CategoryRepositoryInterface $repository */
|
/** @var CategoryRepositoryInterface $repository */
|
||||||
$repository = app(CategoryRepositoryInterface::class);
|
$repository = app(CategoryRepositoryInterface::class);
|
||||||
$categories = $repository->getCategories();
|
$categories = $repository->getCategories();
|
||||||
$result = view('reports.options.category', compact('categories'))->render();
|
|
||||||
|
|
||||||
return $result;
|
return view('reports.options.category', compact('categories'))->render();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
*
|
*
|
||||||
* @throws \Throwable
|
|
||||||
*/
|
*/
|
||||||
private function noReportOptions(): string
|
private function noReportOptions(): string
|
||||||
{
|
{
|
||||||
@@ -485,7 +477,7 @@ class ReportController extends Controller
|
|||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
*
|
*
|
||||||
* @throws \Throwable
|
|
||||||
*/
|
*/
|
||||||
private function tagReportOptions(): string
|
private function tagReportOptions(): string
|
||||||
{
|
{
|
||||||
@@ -496,8 +488,7 @@ class ReportController extends Controller
|
|||||||
return $tag->tag;
|
return $tag->tag;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
$result = view('reports.options.tag', compact('tags'))->render();
|
|
||||||
|
|
||||||
return $result;
|
return view('reports.options.tag', compact('tags'))->render();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -72,8 +72,8 @@ class RuleController extends Controller
|
|||||||
*
|
*
|
||||||
* @return View
|
* @return View
|
||||||
*
|
*
|
||||||
* @throws \Throwable
|
|
||||||
* @throws \Throwable
|
|
||||||
*/
|
*/
|
||||||
public function create(Request $request, RuleGroup $ruleGroup)
|
public function create(Request $request, RuleGroup $ruleGroup)
|
||||||
{
|
{
|
||||||
@@ -167,10 +167,10 @@ class RuleController extends Controller
|
|||||||
*
|
*
|
||||||
* @return View
|
* @return View
|
||||||
*
|
*
|
||||||
* @throws \Throwable
|
|
||||||
* @throws \Throwable
|
|
||||||
* @throws \Throwable
|
|
||||||
* @throws \Throwable
|
|
||||||
*/
|
*/
|
||||||
public function edit(Request $request, RuleRepositoryInterface $repository, Rule $rule)
|
public function edit(Request $request, RuleRepositoryInterface $repository, Rule $rule)
|
||||||
{
|
{
|
||||||
@@ -253,7 +253,7 @@ class RuleController extends Controller
|
|||||||
$this->dispatch($job);
|
$this->dispatch($job);
|
||||||
|
|
||||||
// Tell the user that the job is queued
|
// Tell the user that the job is queued
|
||||||
Session::flash('success', strval(trans('firefly.applied_rule_selection', ['title' => $rule->title])));
|
Session::flash('success', (string)trans('firefly.applied_rule_selection', ['title' => $rule->title]));
|
||||||
|
|
||||||
return redirect()->route('rules.index');
|
return redirect()->route('rules.index');
|
||||||
}
|
}
|
||||||
@@ -311,7 +311,6 @@ class RuleController extends Controller
|
|||||||
* @param Rule $rule
|
* @param Rule $rule
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||||
* @throws \InvalidArgumentException
|
|
||||||
*/
|
*/
|
||||||
public function selectTransactions(AccountRepositoryInterface $repository, Rule $rule)
|
public function selectTransactions(AccountRepositoryInterface $repository, Rule $rule)
|
||||||
{
|
{
|
||||||
@@ -342,7 +341,7 @@ class RuleController extends Controller
|
|||||||
Session::flash('success', trans('firefly.stored_new_rule', ['title' => $rule->title]));
|
Session::flash('success', trans('firefly.stored_new_rule', ['title' => $rule->title]));
|
||||||
Preferences::mark();
|
Preferences::mark();
|
||||||
|
|
||||||
if (1 === intval($request->get('create_another'))) {
|
if (1 === (int)$request->get('create_another')) {
|
||||||
// @codeCoverageIgnoreStart
|
// @codeCoverageIgnoreStart
|
||||||
Session::put('rules.create.fromStore', true);
|
Session::put('rules.create.fromStore', true);
|
||||||
|
|
||||||
@@ -365,7 +364,7 @@ class RuleController extends Controller
|
|||||||
*
|
*
|
||||||
* @return \Illuminate\Http\JsonResponse
|
* @return \Illuminate\Http\JsonResponse
|
||||||
*
|
*
|
||||||
* @throws \Throwable
|
|
||||||
*/
|
*/
|
||||||
public function testTriggers(TestRuleFormRequest $request)
|
public function testTriggers(TestRuleFormRequest $request)
|
||||||
{
|
{
|
||||||
@@ -376,8 +375,8 @@ class RuleController extends Controller
|
|||||||
return response()->json(['html' => '', 'warning' => trans('firefly.warning_no_valid_triggers')]); // @codeCoverageIgnore
|
return response()->json(['html' => '', 'warning' => trans('firefly.warning_no_valid_triggers')]); // @codeCoverageIgnore
|
||||||
}
|
}
|
||||||
|
|
||||||
$limit = intval(config('firefly.test-triggers.limit'));
|
$limit = (int)config('firefly.test-triggers.limit');
|
||||||
$range = intval(config('firefly.test-triggers.range'));
|
$range = (int)config('firefly.test-triggers.range');
|
||||||
|
|
||||||
/** @var TransactionMatcher $matcher */
|
/** @var TransactionMatcher $matcher */
|
||||||
$matcher = app(TransactionMatcher::class);
|
$matcher = app(TransactionMatcher::class);
|
||||||
@@ -414,7 +413,7 @@ class RuleController extends Controller
|
|||||||
*
|
*
|
||||||
* @return \Illuminate\Http\JsonResponse
|
* @return \Illuminate\Http\JsonResponse
|
||||||
*
|
*
|
||||||
* @throws \Throwable
|
|
||||||
*/
|
*/
|
||||||
public function testTriggersByRule(Rule $rule)
|
public function testTriggersByRule(Rule $rule)
|
||||||
{
|
{
|
||||||
@@ -424,8 +423,8 @@ class RuleController extends Controller
|
|||||||
return response()->json(['html' => '', 'warning' => trans('firefly.warning_no_valid_triggers')]); // @codeCoverageIgnore
|
return response()->json(['html' => '', 'warning' => trans('firefly.warning_no_valid_triggers')]); // @codeCoverageIgnore
|
||||||
}
|
}
|
||||||
|
|
||||||
$limit = intval(config('firefly.test-triggers.limit'));
|
$limit = (int)config('firefly.test-triggers.limit');
|
||||||
$range = intval(config('firefly.test-triggers.range'));
|
$range = (int)config('firefly.test-triggers.range');
|
||||||
|
|
||||||
/** @var TransactionMatcher $matcher */
|
/** @var TransactionMatcher $matcher */
|
||||||
$matcher = app(TransactionMatcher::class);
|
$matcher = app(TransactionMatcher::class);
|
||||||
@@ -477,7 +476,7 @@ class RuleController extends Controller
|
|||||||
Session::flash('success', trans('firefly.updated_rule', ['title' => $rule->title]));
|
Session::flash('success', trans('firefly.updated_rule', ['title' => $rule->title]));
|
||||||
Preferences::mark();
|
Preferences::mark();
|
||||||
|
|
||||||
if (1 === intval($request->get('return_to_edit'))) {
|
if (1 === (int)$request->get('return_to_edit')) {
|
||||||
// @codeCoverageIgnoreStart
|
// @codeCoverageIgnoreStart
|
||||||
Session::put('rules.edit.fromUpdate', true);
|
Session::put('rules.edit.fromUpdate', true);
|
||||||
|
|
||||||
@@ -540,7 +539,7 @@ class RuleController extends Controller
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*
|
*
|
||||||
* @throws \Throwable
|
|
||||||
*/
|
*/
|
||||||
private function getCurrentActions(Rule $rule)
|
private function getCurrentActions(Rule $rule)
|
||||||
{
|
{
|
||||||
@@ -570,7 +569,7 @@ class RuleController extends Controller
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*
|
*
|
||||||
* @throws \Throwable
|
|
||||||
*/
|
*/
|
||||||
private function getCurrentTriggers(Rule $rule)
|
private function getCurrentTriggers(Rule $rule)
|
||||||
{
|
{
|
||||||
@@ -602,7 +601,7 @@ class RuleController extends Controller
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*
|
*
|
||||||
* @throws \Throwable
|
|
||||||
*/
|
*/
|
||||||
private function getPreviousActions(Request $request)
|
private function getPreviousActions(Request $request)
|
||||||
{
|
{
|
||||||
@@ -633,7 +632,7 @@ class RuleController extends Controller
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*
|
*
|
||||||
* @throws \Throwable
|
|
||||||
*/
|
*/
|
||||||
private function getPreviousTriggers(Request $request)
|
private function getPreviousTriggers(Request $request)
|
||||||
{
|
{
|
||||||
@@ -674,7 +673,7 @@ class RuleController extends Controller
|
|||||||
];
|
];
|
||||||
if (is_array($data['rule-triggers'])) {
|
if (is_array($data['rule-triggers'])) {
|
||||||
foreach ($data['rule-triggers'] as $index => $triggerType) {
|
foreach ($data['rule-triggers'] as $index => $triggerType) {
|
||||||
$data['rule-trigger-stop'][$index] = $data['rule-trigger-stop'][$index] ?? 0;
|
$data['rule-trigger-stop'][$index] = (int)($data['rule-trigger-stop'][$index] ?? 0.0);
|
||||||
$triggers[] = [
|
$triggers[] = [
|
||||||
'type' => $triggerType,
|
'type' => $triggerType,
|
||||||
'value' => $data['rule-trigger-values'][$index],
|
'value' => $data['rule-trigger-values'][$index],
|
||||||
|
@@ -104,11 +104,11 @@ class RuleGroupController extends Controller
|
|||||||
public function destroy(Request $request, RuleGroupRepositoryInterface $repository, RuleGroup $ruleGroup)
|
public function destroy(Request $request, RuleGroupRepositoryInterface $repository, RuleGroup $ruleGroup)
|
||||||
{
|
{
|
||||||
$title = $ruleGroup->title;
|
$title = $ruleGroup->title;
|
||||||
$moveTo = auth()->user()->ruleGroups()->find(intval($request->get('move_rules_before_delete')));
|
$moveTo = auth()->user()->ruleGroups()->find((int)$request->get('move_rules_before_delete'));
|
||||||
|
|
||||||
$repository->destroy($ruleGroup, $moveTo);
|
$repository->destroy($ruleGroup, $moveTo);
|
||||||
|
|
||||||
Session::flash('success', strval(trans('firefly.deleted_rule_group', ['title' => $title])));
|
Session::flash('success', (string)trans('firefly.deleted_rule_group', ['title' => $title]));
|
||||||
Preferences::mark();
|
Preferences::mark();
|
||||||
|
|
||||||
return redirect($this->getPreviousUri('rule-groups.delete.uri'));
|
return redirect($this->getPreviousUri('rule-groups.delete.uri'));
|
||||||
@@ -174,7 +174,7 @@ class RuleGroupController extends Controller
|
|||||||
$this->dispatch($job);
|
$this->dispatch($job);
|
||||||
|
|
||||||
// Tell the user that the job is queued
|
// Tell the user that the job is queued
|
||||||
Session::flash('success', strval(trans('firefly.applied_rule_group_selection', ['title' => $ruleGroup->title])));
|
Session::flash('success', (string)trans('firefly.applied_rule_group_selection', ['title' => $ruleGroup->title]));
|
||||||
|
|
||||||
return redirect()->route('rules.index');
|
return redirect()->route('rules.index');
|
||||||
}
|
}
|
||||||
@@ -184,7 +184,6 @@ class RuleGroupController extends Controller
|
|||||||
* @param RuleGroup $ruleGroup
|
* @param RuleGroup $ruleGroup
|
||||||
*
|
*
|
||||||
* @return View
|
* @return View
|
||||||
* @throws \InvalidArgumentException
|
|
||||||
*/
|
*/
|
||||||
public function selectTransactions(AccountRepositoryInterface $repository, RuleGroup $ruleGroup)
|
public function selectTransactions(AccountRepositoryInterface $repository, RuleGroup $ruleGroup)
|
||||||
{
|
{
|
||||||
@@ -210,10 +209,10 @@ class RuleGroupController extends Controller
|
|||||||
$data = $request->getRuleGroupData();
|
$data = $request->getRuleGroupData();
|
||||||
$ruleGroup = $repository->store($data);
|
$ruleGroup = $repository->store($data);
|
||||||
|
|
||||||
Session::flash('success', strval(trans('firefly.created_new_rule_group', ['title' => $ruleGroup->title])));
|
Session::flash('success', (string)trans('firefly.created_new_rule_group', ['title' => $ruleGroup->title]));
|
||||||
Preferences::mark();
|
Preferences::mark();
|
||||||
|
|
||||||
if (1 === intval($request->get('create_another'))) {
|
if (1 === (int)$request->get('create_another')) {
|
||||||
// @codeCoverageIgnoreStart
|
// @codeCoverageIgnoreStart
|
||||||
Session::put('rule-groups.create.fromStore', true);
|
Session::put('rule-groups.create.fromStore', true);
|
||||||
|
|
||||||
@@ -249,15 +248,15 @@ class RuleGroupController extends Controller
|
|||||||
$data = [
|
$data = [
|
||||||
'title' => $request->input('title'),
|
'title' => $request->input('title'),
|
||||||
'description' => $request->input('description'),
|
'description' => $request->input('description'),
|
||||||
'active' => 1 === intval($request->input('active')),
|
'active' => 1 === (int)$request->input('active'),
|
||||||
];
|
];
|
||||||
|
|
||||||
$repository->update($ruleGroup, $data);
|
$repository->update($ruleGroup, $data);
|
||||||
|
|
||||||
Session::flash('success', strval(trans('firefly.updated_rule_group', ['title' => $ruleGroup->title])));
|
Session::flash('success', (string)trans('firefly.updated_rule_group', ['title' => $ruleGroup->title]));
|
||||||
Preferences::mark();
|
Preferences::mark();
|
||||||
|
|
||||||
if (1 === intval($request->get('return_to_edit'))) {
|
if (1 === (int)$request->get('return_to_edit')) {
|
||||||
// @codeCoverageIgnoreStart
|
// @codeCoverageIgnoreStart
|
||||||
Session::put('rule-groups.edit.fromUpdate', true);
|
Session::put('rule-groups.edit.fromUpdate', true);
|
||||||
|
|
||||||
|
@@ -58,7 +58,7 @@ class SearchController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function index(Request $request, SearchInterface $searcher)
|
public function index(Request $request, SearchInterface $searcher)
|
||||||
{
|
{
|
||||||
$fullQuery = strval($request->get('q'));
|
$fullQuery = (string)$request->get('q');
|
||||||
|
|
||||||
// parse search terms:
|
// parse search terms:
|
||||||
$searcher->parseQuery($fullQuery);
|
$searcher->parseQuery($fullQuery);
|
||||||
@@ -74,11 +74,11 @@ class SearchController extends Controller
|
|||||||
*
|
*
|
||||||
* @return \Illuminate\Http\JsonResponse
|
* @return \Illuminate\Http\JsonResponse
|
||||||
*
|
*
|
||||||
* @throws \Throwable
|
|
||||||
*/
|
*/
|
||||||
public function search(Request $request, SearchInterface $searcher)
|
public function search(Request $request, SearchInterface $searcher)
|
||||||
{
|
{
|
||||||
$fullQuery = strval($request->get('query'));
|
$fullQuery = (string)$request->get('query');
|
||||||
$transactions = new Collection;
|
$transactions = new Collection;
|
||||||
// cache
|
// cache
|
||||||
$cache = new CacheProperties;
|
$cache = new CacheProperties;
|
||||||
@@ -92,7 +92,7 @@ class SearchController extends Controller
|
|||||||
if (!$cache->has()) {
|
if (!$cache->has()) {
|
||||||
// parse search terms:
|
// parse search terms:
|
||||||
$searcher->parseQuery($fullQuery);
|
$searcher->parseQuery($fullQuery);
|
||||||
$searcher->setLimit(intval(env('SEARCH_RESULT_LIMIT', 50)));
|
$searcher->setLimit((int)env('SEARCH_RESULT_LIMIT', 50));
|
||||||
$transactions = $searcher->searchTransactions();
|
$transactions = $searcher->searchTransactions();
|
||||||
$cache->store($transactions);
|
$cache->store($transactions);
|
||||||
}
|
}
|
||||||
|
@@ -36,6 +36,7 @@ use phpseclib\Crypt\RSA;
|
|||||||
class InstallController extends Controller
|
class InstallController extends Controller
|
||||||
{
|
{
|
||||||
/** @noinspection MagicMethodsValidityInspection */
|
/** @noinspection MagicMethodsValidityInspection */
|
||||||
|
/** @noinspection PhpMissingParentConstructorInspection */
|
||||||
/**
|
/**
|
||||||
* InstallController constructor.
|
* InstallController constructor.
|
||||||
*/
|
*/
|
||||||
@@ -62,7 +63,7 @@ class InstallController extends Controller
|
|||||||
$rsa = new RSA();
|
$rsa = new RSA();
|
||||||
$keys = $rsa->createKey(4096);
|
$keys = $rsa->createKey(4096);
|
||||||
|
|
||||||
list($publicKey, $privateKey) = [
|
[$publicKey, $privateKey] = [
|
||||||
Passport::keyPath('oauth-public.key'),
|
Passport::keyPath('oauth-public.key'),
|
||||||
Passport::keyPath('oauth-private.key'),
|
Passport::keyPath('oauth-private.key'),
|
||||||
];
|
];
|
||||||
|
@@ -63,7 +63,7 @@ class TagController extends Controller
|
|||||||
$this->middleware(
|
$this->middleware(
|
||||||
function ($request, $next) {
|
function ($request, $next) {
|
||||||
$this->repository = app(TagRepositoryInterface::class);
|
$this->repository = app(TagRepositoryInterface::class);
|
||||||
app('view')->share('title', strval(trans('firefly.tags')));
|
app('view')->share('title', (string)trans('firefly.tags'));
|
||||||
app('view')->share('mainTitleIcon', 'fa-tags');
|
app('view')->share('mainTitleIcon', 'fa-tags');
|
||||||
|
|
||||||
return $next($request);
|
return $next($request);
|
||||||
@@ -118,7 +118,7 @@ class TagController extends Controller
|
|||||||
$tagName = $tag->tag;
|
$tagName = $tag->tag;
|
||||||
$this->repository->destroy($tag);
|
$this->repository->destroy($tag);
|
||||||
|
|
||||||
Session::flash('success', strval(trans('firefly.deleted_tag', ['tag' => $tagName])));
|
Session::flash('success', (string)trans('firefly.deleted_tag', ['tag' => $tagName]));
|
||||||
Preferences::mark();
|
Preferences::mark();
|
||||||
|
|
||||||
return redirect($this->getPreviousUri('tags.delete.uri'));
|
return redirect($this->getPreviousUri('tags.delete.uri'));
|
||||||
@@ -195,8 +195,8 @@ class TagController extends Controller
|
|||||||
// default values:
|
// default values:
|
||||||
$subTitle = $tag->tag;
|
$subTitle = $tag->tag;
|
||||||
$subTitleIcon = 'fa-tag';
|
$subTitleIcon = 'fa-tag';
|
||||||
$page = intval($request->get('page'));
|
$page = (int)$request->get('page');
|
||||||
$pageSize = intval(Preferences::get('listPageSize', 50)->data);
|
$pageSize = (int)Preferences::get('listPageSize', 50)->data;
|
||||||
$range = Preferences::get('viewRange', '1M')->data;
|
$range = Preferences::get('viewRange', '1M')->data;
|
||||||
$start = null;
|
$start = null;
|
||||||
$end = null;
|
$end = null;
|
||||||
@@ -260,10 +260,10 @@ class TagController extends Controller
|
|||||||
$data = $request->collectTagData();
|
$data = $request->collectTagData();
|
||||||
$this->repository->store($data);
|
$this->repository->store($data);
|
||||||
|
|
||||||
Session::flash('success', strval(trans('firefly.created_tag', ['tag' => $data['tag']])));
|
Session::flash('success', (string)trans('firefly.created_tag', ['tag' => $data['tag']]));
|
||||||
Preferences::mark();
|
Preferences::mark();
|
||||||
|
|
||||||
if (1 === intval($request->get('create_another'))) {
|
if (1 === (int)$request->get('create_another')) {
|
||||||
// @codeCoverageIgnoreStart
|
// @codeCoverageIgnoreStart
|
||||||
Session::put('tags.create.fromStore', true);
|
Session::put('tags.create.fromStore', true);
|
||||||
|
|
||||||
@@ -285,10 +285,10 @@ class TagController extends Controller
|
|||||||
$data = $request->collectTagData();
|
$data = $request->collectTagData();
|
||||||
$this->repository->update($tag, $data);
|
$this->repository->update($tag, $data);
|
||||||
|
|
||||||
Session::flash('success', strval(trans('firefly.updated_tag', ['tag' => $data['tag']])));
|
Session::flash('success', (string)trans('firefly.updated_tag', ['tag' => $data['tag']]));
|
||||||
Preferences::mark();
|
Preferences::mark();
|
||||||
|
|
||||||
if (1 === intval($request->get('return_to_edit'))) {
|
if (1 === (int)$request->get('return_to_edit')) {
|
||||||
// @codeCoverageIgnoreStart
|
// @codeCoverageIgnoreStart
|
||||||
Session::put('tags.edit.fromUpdate', true);
|
Session::put('tags.edit.fromUpdate', true);
|
||||||
|
|
||||||
|
@@ -70,7 +70,6 @@ class BulkController extends Controller
|
|||||||
* @param Collection $journals
|
* @param Collection $journals
|
||||||
*
|
*
|
||||||
* @return View
|
* @return View
|
||||||
* @throws \RuntimeException
|
|
||||||
*/
|
*/
|
||||||
public function edit(Request $request, Collection $journals)
|
public function edit(Request $request, Collection $journals)
|
||||||
{
|
{
|
||||||
@@ -140,22 +139,21 @@ class BulkController extends Controller
|
|||||||
* @param JournalRepositoryInterface $repository
|
* @param JournalRepositoryInterface $repository
|
||||||
*
|
*
|
||||||
* @return mixed
|
* @return mixed
|
||||||
* @throws \RuntimeException
|
|
||||||
*/
|
*/
|
||||||
public function update(BulkEditJournalRequest $request, JournalRepositoryInterface $repository)
|
public function update(BulkEditJournalRequest $request, JournalRepositoryInterface $repository)
|
||||||
{
|
{
|
||||||
/** @var JournalUpdateService $service */
|
/** @var JournalUpdateService $service */
|
||||||
$service = app(JournalUpdateService::class);
|
$service = app(JournalUpdateService::class);
|
||||||
$journalIds = $request->get('journals');
|
$journalIds = $request->get('journals');
|
||||||
$ignoreCategory = intval($request->get('ignore_category')) === 1;
|
$ignoreCategory = (int)$request->get('ignore_category') === 1;
|
||||||
$ignoreBudget = intval($request->get('ignore_budget')) === 1;
|
$ignoreBudget = (int)$request->get('ignore_budget') === 1;
|
||||||
$ignoreTags = intval($request->get('ignore_tags')) === 1;
|
$ignoreTags = (int)$request->get('ignore_tags') === 1;
|
||||||
$count = 0;
|
$count = 0;
|
||||||
|
|
||||||
if (is_array($journalIds)) {
|
if (is_array($journalIds)) {
|
||||||
foreach ($journalIds as $journalId) {
|
foreach ($journalIds as $journalId) {
|
||||||
$journal = $repository->find(intval($journalId));
|
$journal = $repository->find((int)$journalId);
|
||||||
if (!is_null($journal)) {
|
if (null !== $journal) {
|
||||||
$count++;
|
$count++;
|
||||||
Log::debug(sprintf('Found journal #%d', $journal->id));
|
Log::debug(sprintf('Found journal #%d', $journal->id));
|
||||||
// update category if not told to ignore
|
// update category if not told to ignore
|
||||||
|
@@ -191,7 +191,7 @@ class ConvertController extends Controller
|
|||||||
break;
|
break;
|
||||||
case TransactionType::WITHDRAWAL . '-' . TransactionType::TRANSFER:
|
case TransactionType::WITHDRAWAL . '-' . TransactionType::TRANSFER:
|
||||||
// two
|
// two
|
||||||
$destination = $accountRepository->findNull(intval($data['destination_account_asset']));
|
$destination = $accountRepository->findNull((int)$data['destination_account_asset']);
|
||||||
break;
|
break;
|
||||||
case TransactionType::DEPOSIT . '-' . TransactionType::WITHDRAWAL:
|
case TransactionType::DEPOSIT . '-' . TransactionType::WITHDRAWAL:
|
||||||
case TransactionType::TRANSFER . '-' . TransactionType::WITHDRAWAL:
|
case TransactionType::TRANSFER . '-' . TransactionType::WITHDRAWAL:
|
||||||
@@ -266,7 +266,7 @@ class ConvertController extends Controller
|
|||||||
$source = $destinationAccount;
|
$source = $destinationAccount;
|
||||||
break;
|
break;
|
||||||
case TransactionType::DEPOSIT . '-' . TransactionType::TRANSFER:
|
case TransactionType::DEPOSIT . '-' . TransactionType::TRANSFER:
|
||||||
$source = $accountRepository->findNull(intval($data['source_account_asset']));
|
$source = $accountRepository->findNull((int)$data['source_account_asset']);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -86,10 +86,10 @@ class LinkController extends Controller
|
|||||||
{
|
{
|
||||||
$this->repository->destroyLink($link);
|
$this->repository->destroyLink($link);
|
||||||
|
|
||||||
Session::flash('success', strval(trans('firefly.deleted_link')));
|
Session::flash('success', (string)trans('firefly.deleted_link'));
|
||||||
Preferences::mark();
|
Preferences::mark();
|
||||||
|
|
||||||
return redirect(strval(session('journal_links.delete.uri')));
|
return redirect((string)session('journal_links.delete.uri'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -111,7 +111,7 @@ class LinkController extends Controller
|
|||||||
$other = $this->journalRepository->find($linkInfo['transaction_journal_id']);
|
$other = $this->journalRepository->find($linkInfo['transaction_journal_id']);
|
||||||
$alreadyLinked = $this->repository->findLink($journal, $other);
|
$alreadyLinked = $this->repository->findLink($journal, $other);
|
||||||
|
|
||||||
if($other->id === $journal->id) {
|
if ($other->id === $journal->id) {
|
||||||
Session::flash('error', trans('firefly.journals_link_to_self'));
|
Session::flash('error', trans('firefly.journals_link_to_self'));
|
||||||
|
|
||||||
return redirect(route('transactions.show', [$journal->id]));
|
return redirect(route('transactions.show', [$journal->id]));
|
||||||
|
@@ -92,8 +92,8 @@ class MassController extends Controller
|
|||||||
/** @var int $journalId */
|
/** @var int $journalId */
|
||||||
foreach ($ids as $journalId) {
|
foreach ($ids as $journalId) {
|
||||||
/** @var TransactionJournal $journal */
|
/** @var TransactionJournal $journal */
|
||||||
$journal = $this->repository->find(intval($journalId));
|
$journal = $this->repository->find((int)$journalId);
|
||||||
if (null !== $journal->id && intval($journalId) === $journal->id) {
|
if (null !== $journal->id && (int)$journalId === $journal->id) {
|
||||||
$set->push($journal);
|
$set->push($journal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -174,14 +174,14 @@ class MassController extends Controller
|
|||||||
function (TransactionJournal $journal) {
|
function (TransactionJournal $journal) {
|
||||||
$transaction = $this->repository->getFirstPosTransaction($journal);
|
$transaction = $this->repository->getFirstPosTransaction($journal);
|
||||||
$currency = $transaction->transactionCurrency;
|
$currency = $transaction->transactionCurrency;
|
||||||
$journal->amount = floatval($transaction->amount);
|
$journal->amount = (float)$transaction->amount;
|
||||||
$sources = $this->repository->getJournalSourceAccounts($journal);
|
$sources = $this->repository->getJournalSourceAccounts($journal);
|
||||||
$destinations = $this->repository->getJournalDestinationAccounts($journal);
|
$destinations = $this->repository->getJournalDestinationAccounts($journal);
|
||||||
$journal->transaction_count = $journal->transactions()->count();
|
$journal->transaction_count = $journal->transactions()->count();
|
||||||
$journal->currency_symbol = $currency->symbol;
|
$journal->currency_symbol = $currency->symbol;
|
||||||
$journal->transaction_type_type = $journal->transactionType->type;
|
$journal->transaction_type_type = $journal->transactionType->type;
|
||||||
|
|
||||||
$journal->foreign_amount = floatval($transaction->foreign_amount);
|
$journal->foreign_amount = (float)$transaction->foreign_amount;
|
||||||
$journal->foreign_currency = $transaction->foreignCurrency;
|
$journal->foreign_currency = $transaction->foreignCurrency;
|
||||||
|
|
||||||
if (null !== $sources->first()) {
|
if (null !== $sources->first()) {
|
||||||
@@ -216,8 +216,8 @@ class MassController extends Controller
|
|||||||
$count = 0;
|
$count = 0;
|
||||||
if (is_array($journalIds)) {
|
if (is_array($journalIds)) {
|
||||||
foreach ($journalIds as $journalId) {
|
foreach ($journalIds as $journalId) {
|
||||||
$journal = $repository->find(intval($journalId));
|
$journal = $repository->find((int)$journalId);
|
||||||
if (!is_null($journal)) {
|
if (null !== $journal) {
|
||||||
// get optional fields:
|
// get optional fields:
|
||||||
$what = strtolower($this->repository->getTransactionType($journal));
|
$what = strtolower($this->repository->getTransactionType($journal));
|
||||||
$sourceAccountId = $request->get('source_account_id')[$journal->id] ?? null;
|
$sourceAccountId = $request->get('source_account_id')[$journal->id] ?? null;
|
||||||
@@ -225,13 +225,13 @@ class MassController extends Controller
|
|||||||
$sourceAccountName = $request->get('source_account_name')[$journal->id] ?? null;
|
$sourceAccountName = $request->get('source_account_name')[$journal->id] ?? null;
|
||||||
$destAccountId = $request->get('destination_account_id')[$journal->id] ?? null;
|
$destAccountId = $request->get('destination_account_id')[$journal->id] ?? null;
|
||||||
$destAccountName = $request->get('destination_account_name')[$journal->id] ?? null;
|
$destAccountName = $request->get('destination_account_name')[$journal->id] ?? null;
|
||||||
$budgetId = $request->get('budget_id')[$journal->id] ?? 0;
|
$budgetId = (int)($request->get('budget_id')[$journal->id] ?? 0.0);
|
||||||
$category = $request->get('category')[$journal->id];
|
$category = $request->get('category')[$journal->id];
|
||||||
$tags = $journal->tags->pluck('tag')->toArray();
|
$tags = $journal->tags->pluck('tag')->toArray();
|
||||||
$amount = round($request->get('amount')[$journal->id], 12);
|
$amount = round($request->get('amount')[$journal->id], 12);
|
||||||
$foreignAmount = isset($request->get('foreign_amount')[$journal->id]) ? round($request->get('foreign_amount')[$journal->id], 12) : null;
|
$foreignAmount = isset($request->get('foreign_amount')[$journal->id]) ? round($request->get('foreign_amount')[$journal->id], 12) : null;
|
||||||
$foreignCurrencyId = isset($request->get('foreign_currency_id')[$journal->id]) ?
|
$foreignCurrencyId = isset($request->get('foreign_currency_id')[$journal->id]) ?
|
||||||
intval($request->get('foreign_currency_id')[$journal->id]) : null;
|
(int)$request->get('foreign_currency_id')[$journal->id] : null;
|
||||||
// build data array
|
// build data array
|
||||||
$data = [
|
$data = [
|
||||||
'id' => $journal->id,
|
'id' => $journal->id,
|
||||||
@@ -245,16 +245,16 @@ class MassController extends Controller
|
|||||||
|
|
||||||
'category_id' => null,
|
'category_id' => null,
|
||||||
'category_name' => $category,
|
'category_name' => $category,
|
||||||
'budget_id' => intval($budgetId),
|
'budget_id' => (int)$budgetId,
|
||||||
'budget_name' => null,
|
'budget_name' => null,
|
||||||
'source_id' => intval($sourceAccountId),
|
'source_id' => (int)$sourceAccountId,
|
||||||
'source_name' => $sourceAccountName,
|
'source_name' => $sourceAccountName,
|
||||||
'destination_id' => intval($destAccountId),
|
'destination_id' => (int)$destAccountId,
|
||||||
'destination_name' => $destAccountName,
|
'destination_name' => $destAccountName,
|
||||||
'amount' => $amount,
|
'amount' => $amount,
|
||||||
'identifier' => 0,
|
'identifier' => 0,
|
||||||
'reconciled' => false,
|
'reconciled' => false,
|
||||||
'currency_id' => intval($currencyId),
|
'currency_id' => (int)$currencyId,
|
||||||
'currency_code' => null,
|
'currency_code' => null,
|
||||||
'description' => null,
|
'description' => null,
|
||||||
'foreign_amount' => $foreignAmount,
|
'foreign_amount' => $foreignAmount,
|
||||||
|
@@ -162,7 +162,7 @@ class SingleController extends Controller
|
|||||||
$subTitle = trans('form.add_new_' . $what);
|
$subTitle = trans('form.add_new_' . $what);
|
||||||
$subTitleIcon = 'fa-plus';
|
$subTitleIcon = 'fa-plus';
|
||||||
$optionalFields = Preferences::get('transaction_journal_optional_fields', [])->data;
|
$optionalFields = Preferences::get('transaction_journal_optional_fields', [])->data;
|
||||||
$source = intval($request->get('source'));
|
$source = (int)$request->get('source');
|
||||||
|
|
||||||
if (($what === 'withdrawal' || $what === 'transfer') && $source > 0) {
|
if (($what === 'withdrawal' || $what === 'transfer') && $source > 0) {
|
||||||
$preFilled['source_account_id'] = $source;
|
$preFilled['source_account_id'] = $source;
|
||||||
@@ -227,7 +227,7 @@ class SingleController extends Controller
|
|||||||
}
|
}
|
||||||
// @codeCoverageIgnoreEnd
|
// @codeCoverageIgnoreEnd
|
||||||
$type = $transactionJournal->transactionTypeStr();
|
$type = $transactionJournal->transactionTypeStr();
|
||||||
Session::flash('success', strval(trans('firefly.deleted_' . strtolower($type), ['description' => $transactionJournal->description])));
|
Session::flash('success', (string)trans('firefly.deleted_' . strtolower($type), ['description' => $transactionJournal->description]));
|
||||||
|
|
||||||
$this->repository->destroy($transactionJournal);
|
$this->repository->destroy($transactionJournal);
|
||||||
|
|
||||||
@@ -272,7 +272,7 @@ class SingleController extends Controller
|
|||||||
$destinationAccounts = $repository->getJournalDestinationAccounts($journal);
|
$destinationAccounts = $repository->getJournalDestinationAccounts($journal);
|
||||||
$optionalFields = Preferences::get('transaction_journal_optional_fields', [])->data;
|
$optionalFields = Preferences::get('transaction_journal_optional_fields', [])->data;
|
||||||
$pTransaction = $repository->getFirstPosTransaction($journal);
|
$pTransaction = $repository->getFirstPosTransaction($journal);
|
||||||
$foreignCurrency = null !== $pTransaction->foreignCurrency ? $pTransaction->foreignCurrency : $pTransaction->transactionCurrency;
|
$foreignCurrency = $pTransaction->foreignCurrency ?? $pTransaction->transactionCurrency;
|
||||||
$preFilled = [
|
$preFilled = [
|
||||||
'date' => $repository->getJournalDate($journal, null), // $journal->dateAsString()
|
'date' => $repository->getJournalDate($journal, null), // $journal->dateAsString()
|
||||||
'interest_date' => $repository->getJournalDate($journal, 'interest_date'),
|
'interest_date' => $repository->getJournalDate($journal, 'interest_date'),
|
||||||
@@ -334,16 +334,16 @@ class SingleController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function store(JournalFormRequest $request, JournalRepositoryInterface $repository)
|
public function store(JournalFormRequest $request, JournalRepositoryInterface $repository)
|
||||||
{
|
{
|
||||||
$doSplit = 1 === intval($request->get('split_journal'));
|
$doSplit = 1 === (int)$request->get('split_journal');
|
||||||
$createAnother = 1 === intval($request->get('create_another'));
|
$createAnother = 1 === (int)$request->get('create_another');
|
||||||
$data = $request->getJournalData();
|
$data = $request->getJournalData();
|
||||||
$journal = $repository->store($data);
|
$journal = $repository->store($data);
|
||||||
|
|
||||||
|
|
||||||
if (null === $journal->id) {
|
if (null === $journal->id) {
|
||||||
// error!
|
// error!
|
||||||
Log::error('Could not store transaction journal: ', $journal->getErrors()->toArray());
|
Log::error('Could not store transaction journal.');
|
||||||
Session::flash('error', $journal->getErrors()->first());
|
Session::flash('error', (string)trans('firefly.unknown_journal_error'));
|
||||||
|
|
||||||
return redirect(route('transactions.create', [$request->input('what')]))->withInput();
|
return redirect(route('transactions.create', [$request->input('what')]))->withInput();
|
||||||
}
|
}
|
||||||
@@ -354,17 +354,17 @@ class SingleController extends Controller
|
|||||||
|
|
||||||
// store the journal only, flash the rest.
|
// store the journal only, flash the rest.
|
||||||
Log::debug(sprintf('Count of error messages is %d', $this->attachments->getErrors()->count()));
|
Log::debug(sprintf('Count of error messages is %d', $this->attachments->getErrors()->count()));
|
||||||
if (count($this->attachments->getErrors()->get('attachments')) > 0) {
|
if (\count($this->attachments->getErrors()->get('attachments')) > 0) {
|
||||||
Session::flash('error', $this->attachments->getErrors()->get('attachments'));
|
Session::flash('error', $this->attachments->getErrors()->get('attachments'));
|
||||||
}
|
}
|
||||||
// flash messages
|
// flash messages
|
||||||
if (count($this->attachments->getMessages()->get('attachments')) > 0) {
|
if (\count($this->attachments->getMessages()->get('attachments')) > 0) {
|
||||||
Session::flash('info', $this->attachments->getMessages()->get('attachments'));
|
Session::flash('info', $this->attachments->getMessages()->get('attachments'));
|
||||||
}
|
}
|
||||||
|
|
||||||
event(new StoredTransactionJournal($journal, $data['piggy_bank_id']));
|
event(new StoredTransactionJournal($journal, $data['piggy_bank_id']));
|
||||||
|
|
||||||
Session::flash('success', strval(trans('firefly.stored_journal', ['description' => $journal->description])));
|
Session::flash('success', (string)trans('firefly.stored_journal', ['description' => $journal->description]));
|
||||||
Preferences::mark();
|
Preferences::mark();
|
||||||
|
|
||||||
// @codeCoverageIgnoreStart
|
// @codeCoverageIgnoreStart
|
||||||
@@ -417,11 +417,11 @@ class SingleController extends Controller
|
|||||||
// update, get events by date and sort DESC
|
// update, get events by date and sort DESC
|
||||||
|
|
||||||
$type = strtolower($this->repository->getTransactionType($journal));
|
$type = strtolower($this->repository->getTransactionType($journal));
|
||||||
Session::flash('success', strval(trans('firefly.updated_' . $type, ['description' => $data['description']])));
|
Session::flash('success', (string)trans('firefly.updated_' . $type, ['description' => $data['description']]));
|
||||||
Preferences::mark();
|
Preferences::mark();
|
||||||
|
|
||||||
// @codeCoverageIgnoreStart
|
// @codeCoverageIgnoreStart
|
||||||
if (1 === intval($request->get('return_to_edit'))) {
|
if (1 === (int)$request->get('return_to_edit')) {
|
||||||
Session::put('transactions.edit.fromUpdate', true);
|
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]);
|
||||||
|
@@ -114,7 +114,7 @@ class SplitController extends Controller
|
|||||||
/** @var Account $account */
|
/** @var Account $account */
|
||||||
foreach ($accountList as $account) {
|
foreach ($accountList as $account) {
|
||||||
$accountArray[$account->id] = $account;
|
$accountArray[$account->id] = $account;
|
||||||
$accountArray[$account->id]['currency_id'] = intval($account->getMeta('currency_id'));
|
$accountArray[$account->id]['currency_id'] = (int)$account->getMeta('currency_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
// put previous url in session if not redirect from store (not "return_to_edit").
|
// put previous url in session if not redirect from store (not "return_to_edit").
|
||||||
@@ -126,8 +126,7 @@ class SplitController extends Controller
|
|||||||
return view(
|
return view(
|
||||||
'transactions.split.edit', compact(
|
'transactions.split.edit', compact(
|
||||||
'subTitleIcon', 'currencies', 'optionalFields', 'preFilled', 'subTitle', 'uploadSize', 'budgets',
|
'subTitleIcon', 'currencies', 'optionalFields', 'preFilled', 'subTitle', 'uploadSize', 'budgets',
|
||||||
'journal', 'accountArray',
|
'journal', 'accountArray'
|
||||||
'previous'
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -160,11 +159,11 @@ class SplitController extends Controller
|
|||||||
// @codeCoverageIgnoreEnd
|
// @codeCoverageIgnoreEnd
|
||||||
|
|
||||||
$type = strtolower($this->repository->getTransactionType($journal));
|
$type = strtolower($this->repository->getTransactionType($journal));
|
||||||
Session::flash('success', strval(trans('firefly.updated_' . $type, ['description' => $journal->description])));
|
Session::flash('success', (string)trans('firefly.updated_' . $type, ['description' => $journal->description]));
|
||||||
Preferences::mark();
|
Preferences::mark();
|
||||||
|
|
||||||
// @codeCoverageIgnoreStart
|
// @codeCoverageIgnoreStart
|
||||||
if (1 === intval($request->get('return_to_edit'))) {
|
if (1 === (int)$request->get('return_to_edit')) {
|
||||||
// set value so edit routine will not overwrite URL:
|
// set value so edit routine will not overwrite URL:
|
||||||
Session::put('transactions.edit-split.fromUpdate', true);
|
Session::put('transactions.edit-split.fromUpdate', true);
|
||||||
|
|
||||||
|
@@ -94,7 +94,7 @@ class TransactionController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($end < $start) {
|
if ($end < $start) {
|
||||||
list($start, $end) = [$end, $start];
|
[$start, $end] = [$end, $start];
|
||||||
}
|
}
|
||||||
$startStr = $start->formatLocalized($this->monthAndDayFormat);
|
$startStr = $start->formatLocalized($this->monthAndDayFormat);
|
||||||
$endStr = $end->formatLocalized($this->monthAndDayFormat);
|
$endStr = $end->formatLocalized($this->monthAndDayFormat);
|
||||||
@@ -241,7 +241,7 @@ class TransactionController extends Controller
|
|||||||
private function getPeriodOverview(string $what, Carbon $date): Collection
|
private function getPeriodOverview(string $what, Carbon $date): Collection
|
||||||
{
|
{
|
||||||
$range = Preferences::get('viewRange', '1M')->data;
|
$range = Preferences::get('viewRange', '1M')->data;
|
||||||
$first = $this->repository->first();
|
$first = $this->repository->firstNull();
|
||||||
$start = new Carbon;
|
$start = new Carbon;
|
||||||
$start->subYear();
|
$start->subYear();
|
||||||
$types = config('firefly.transactionTypesByWhat.' . $what);
|
$types = config('firefly.transactionTypesByWhat.' . $what);
|
||||||
@@ -250,7 +250,7 @@ class TransactionController extends Controller
|
|||||||
$start = $first->date;
|
$start = $first->date;
|
||||||
}
|
}
|
||||||
if ($date < $start) {
|
if ($date < $start) {
|
||||||
list($start, $date) = [$date, $start]; // @codeCoverageIgnore
|
[$start, $date] = [$date, $start]; // @codeCoverageIgnore
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @var array $dates */
|
/** @var array $dates */
|
||||||
|
@@ -84,10 +84,10 @@ class Authenticate
|
|||||||
if ($this->auth->check()) {
|
if ($this->auth->check()) {
|
||||||
// do an extra check on user object.
|
// do an extra check on user object.
|
||||||
$user = $this->auth->authenticate();
|
$user = $this->auth->authenticate();
|
||||||
if (1 === intval($user->blocked)) {
|
if (1 === (int)$user->blocked) {
|
||||||
$message = strval(trans('firefly.block_account_logout'));
|
$message = (string)trans('firefly.block_account_logout');
|
||||||
if ('email_changed' === $user->blocked_code) {
|
if ('email_changed' === $user->blocked_code) {
|
||||||
$message = strval(trans('firefly.email_changed_logout'));
|
$message = (string)trans('firefly.email_changed_logout');
|
||||||
}
|
}
|
||||||
app('session')->flash('logoutMessage', $message);
|
app('session')->flash('logoutMessage', $message);
|
||||||
$this->auth->logout();
|
$this->auth->logout();
|
||||||
|
@@ -58,7 +58,6 @@ class AuthenticateTwoFactor
|
|||||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|mixed
|
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|mixed
|
||||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||||
* @throws \Psr\Container\ContainerExceptionInterface
|
* @throws \Psr\Container\ContainerExceptionInterface
|
||||||
* @throws \Illuminate\Container\EntryNotFoundException
|
|
||||||
*/
|
*/
|
||||||
public function handle($request, Closure $next, ...$guards)
|
public function handle($request, Closure $next, ...$guards)
|
||||||
{
|
{
|
||||||
|
@@ -63,7 +63,7 @@ class Binder
|
|||||||
*
|
*
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*
|
*
|
||||||
* @throws \LogicException
|
|
||||||
*/
|
*/
|
||||||
public function handle($request, Closure $next, ...$guards)
|
public function handle($request, Closure $next, ...$guards)
|
||||||
{
|
{
|
||||||
|
@@ -58,8 +58,8 @@ class Installer
|
|||||||
}
|
}
|
||||||
|
|
||||||
// older version in config than database?
|
// older version in config than database?
|
||||||
$configVersion = intval(config('firefly.db_version'));
|
$configVersion = (int)config('firefly.db_version');
|
||||||
$dbVersion = intval(FireflyConfig::getFresh('db_version', 1)->data);
|
$dbVersion = (int)FireflyConfig::getFresh('db_version', 1)->data;
|
||||||
if ($configVersion > $dbVersion) {
|
if ($configVersion > $dbVersion) {
|
||||||
Log::warning(
|
Log::warning(
|
||||||
sprintf(
|
sprintf(
|
||||||
|
@@ -39,18 +39,17 @@ class IsDemoUser
|
|||||||
* @param \Closure $next
|
* @param \Closure $next
|
||||||
*
|
*
|
||||||
* @return mixed
|
* @return mixed
|
||||||
* @throws \RuntimeException
|
|
||||||
*/
|
*/
|
||||||
public function handle(Request $request, Closure $next)
|
public function handle(Request $request, Closure $next)
|
||||||
{
|
{
|
||||||
/** @var User $user */
|
/** @var User $user */
|
||||||
$user = $request->user();
|
$user = $request->user();
|
||||||
if (is_null($user)) {
|
if (null === $user) {
|
||||||
return $next($request);
|
return $next($request);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($user->hasRole('demo')) {
|
if ($user->hasRole('demo')) {
|
||||||
$request->session()->flash('info', strval(trans('firefly.not_available_demo_user')));
|
$request->session()->flash('info', (string)trans('firefly.not_available_demo_user'));
|
||||||
$current = $request->url();
|
$current = $request->url();
|
||||||
$previous = $request->session()->previousUrl();
|
$previous = $request->session()->previousUrl();
|
||||||
if ($current !== $previous) {
|
if ($current !== $previous) {
|
||||||
|
@@ -48,8 +48,8 @@ class IsSandStormUser
|
|||||||
return $next($request);
|
return $next($request);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (1 === intval(getenv('SANDSTORM'))) {
|
if (1 === (int)getenv('SANDSTORM')) {
|
||||||
Session::flash('warning', strval(trans('firefly.sandstorm_not_available')));
|
Session::flash('warning', (string)trans('firefly.sandstorm_not_available'));
|
||||||
|
|
||||||
return response()->redirectTo(route('index'));
|
return response()->redirectTo(route('index'));
|
||||||
}
|
}
|
||||||
|
@@ -52,7 +52,7 @@ class Sandstorm
|
|||||||
public function handle(Request $request, Closure $next, $guard = null)
|
public function handle(Request $request, Closure $next, $guard = null)
|
||||||
{
|
{
|
||||||
// is in Sandstorm environment?
|
// is in Sandstorm environment?
|
||||||
$sandstorm = 1 === intval(getenv('SANDSTORM'));
|
$sandstorm = 1 === (int)getenv('SANDSTORM');
|
||||||
View::share('SANDSTORM', $sandstorm);
|
View::share('SANDSTORM', $sandstorm);
|
||||||
if (!$sandstorm) {
|
if (!$sandstorm) {
|
||||||
return $next($request);
|
return $next($request);
|
||||||
@@ -62,7 +62,7 @@ class Sandstorm
|
|||||||
if (Auth::guard($guard)->guest()) {
|
if (Auth::guard($guard)->guest()) {
|
||||||
/** @var UserRepositoryInterface $repository */
|
/** @var UserRepositoryInterface $repository */
|
||||||
$repository = app(UserRepositoryInterface::class);
|
$repository = app(UserRepositoryInterface::class);
|
||||||
$userId = strval($request->header('X-Sandstorm-User-Id'));
|
$userId = (string)$request->header('X-Sandstorm-User-Id');
|
||||||
Log::debug(sprintf('Sandstorm user ID is "%s"', $userId));
|
Log::debug(sprintf('Sandstorm user ID is "%s"', $userId));
|
||||||
$count = $repository->count();
|
$count = $repository->count();
|
||||||
|
|
||||||
@@ -120,7 +120,7 @@ class Sandstorm
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// if in Sandstorm, user logged in, still must check if user is anon.
|
// if in Sandstorm, user logged in, still must check if user is anon.
|
||||||
$userId = strval($request->header('X-Sandstorm-User-Id'));
|
$userId = (string)$request->header('X-Sandstorm-User-Id');
|
||||||
if (strlen($userId) === 0) {
|
if (strlen($userId) === 0) {
|
||||||
View::share('SANDSTORM_ANON', true);
|
View::share('SANDSTORM_ANON', true);
|
||||||
|
|
||||||
|
@@ -51,7 +51,7 @@ class TrustProxies extends Middleware
|
|||||||
{
|
{
|
||||||
$trustedProxies = env('TRUSTED_PROXIES', null);
|
$trustedProxies = env('TRUSTED_PROXIES', null);
|
||||||
if (false !== $trustedProxies && null !== $trustedProxies && strlen($trustedProxies) > 0) {
|
if (false !== $trustedProxies && null !== $trustedProxies && strlen($trustedProxies) > 0) {
|
||||||
$this->proxies = strval($trustedProxies);
|
$this->proxies = (string)$trustedProxies;
|
||||||
}
|
}
|
||||||
|
|
||||||
parent::__construct($config);
|
parent::__construct($config);
|
||||||
|
@@ -91,10 +91,10 @@ class AccountFormRequest extends Request
|
|||||||
|
|
||||||
/** @var Account $account */
|
/** @var Account $account */
|
||||||
$account = $this->route()->parameter('account');
|
$account = $this->route()->parameter('account');
|
||||||
if (!is_null($account)) {
|
if (null !== $account) {
|
||||||
// add rules:
|
// add rules:
|
||||||
$rules['id'] = 'belongsToUser:accounts';
|
$rules['id'] = 'belongsToUser:accounts';
|
||||||
$rules['name'] = 'required|min:1|uniqueAccountForUser:' . intval($this->get('id'));
|
$rules['name'] = 'required|min:1|uniqueAccountForUser:' . (int)$this->get('id');
|
||||||
$rules['iban'] = ['iban', 'nullable', new UniqueIban($account, $account->accountType->type)];
|
$rules['iban'] = ['iban', 'nullable', new UniqueIban($account, $account->accountType->type)];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -58,8 +58,8 @@ class BudgetFormRequest extends Request
|
|||||||
/** @var BudgetRepositoryInterface $repository */
|
/** @var BudgetRepositoryInterface $repository */
|
||||||
$repository = app(BudgetRepositoryInterface::class);
|
$repository = app(BudgetRepositoryInterface::class);
|
||||||
$nameRule = 'required|between:1,100|uniqueObjectForUser:budgets,name';
|
$nameRule = 'required|between:1,100|uniqueObjectForUser:budgets,name';
|
||||||
if (null !== $repository->findNull(intval($this->get('id')))) {
|
if (null !== $repository->findNull((int)$this->get('id'))) {
|
||||||
$nameRule = 'required|between:1,100|uniqueObjectForUser:budgets,name,' . intval($this->get('id'));
|
$nameRule = 'required|between:1,100|uniqueObjectForUser:budgets,name,' . (int)$this->get('id');
|
||||||
}
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
@@ -40,7 +40,6 @@ class ExportFormRequest extends Request
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @return array
|
* @return array
|
||||||
* @throws \InvalidArgumentException
|
|
||||||
*/
|
*/
|
||||||
public function rules()
|
public function rules()
|
||||||
{
|
{
|
||||||
|
@@ -58,7 +58,7 @@ class ReportFormRequest extends Request
|
|||||||
$collection = new Collection;
|
$collection = new Collection;
|
||||||
if (is_array($set)) {
|
if (is_array($set)) {
|
||||||
foreach ($set as $accountId) {
|
foreach ($set as $accountId) {
|
||||||
$account = $repository->findNull(intval($accountId));
|
$account = $repository->findNull((int)$accountId);
|
||||||
if (null !== $account) {
|
if (null !== $account) {
|
||||||
$collection->push($account);
|
$collection->push($account);
|
||||||
}
|
}
|
||||||
@@ -79,7 +79,7 @@ class ReportFormRequest extends Request
|
|||||||
$collection = new Collection;
|
$collection = new Collection;
|
||||||
if (is_array($set)) {
|
if (is_array($set)) {
|
||||||
foreach ($set as $budgetId) {
|
foreach ($set as $budgetId) {
|
||||||
$budget = $repository->findNull(intval($budgetId));
|
$budget = $repository->findNull((int)$budgetId);
|
||||||
if (null !== $budget) {
|
if (null !== $budget) {
|
||||||
$collection->push($budget);
|
$collection->push($budget);
|
||||||
}
|
}
|
||||||
@@ -100,7 +100,7 @@ class ReportFormRequest extends Request
|
|||||||
$collection = new Collection;
|
$collection = new Collection;
|
||||||
if (is_array($set)) {
|
if (is_array($set)) {
|
||||||
foreach ($set as $categoryId) {
|
foreach ($set as $categoryId) {
|
||||||
$category = $repository->findNull(intval($categoryId));
|
$category = $repository->findNull((int)$categoryId);
|
||||||
if (null !== $category) {
|
if (null !== $category) {
|
||||||
$collection->push($category);
|
$collection->push($category);
|
||||||
}
|
}
|
||||||
@@ -119,7 +119,7 @@ class ReportFormRequest extends Request
|
|||||||
{
|
{
|
||||||
$date = new Carbon;
|
$date = new Carbon;
|
||||||
$range = $this->get('daterange');
|
$range = $this->get('daterange');
|
||||||
$parts = explode(' - ', strval($range));
|
$parts = explode(' - ', (string)$range);
|
||||||
if (2 === count($parts)) {
|
if (2 === count($parts)) {
|
||||||
try {
|
try {
|
||||||
$date = new Carbon($parts[1]);
|
$date = new Carbon($parts[1]);
|
||||||
@@ -147,7 +147,7 @@ class ReportFormRequest extends Request
|
|||||||
$collection = new Collection;
|
$collection = new Collection;
|
||||||
if (is_array($set)) {
|
if (is_array($set)) {
|
||||||
foreach ($set as $accountId) {
|
foreach ($set as $accountId) {
|
||||||
$account = $repository->findNull(intval($accountId));
|
$account = $repository->findNull((int)$accountId);
|
||||||
if (null !== $account) {
|
if (null !== $account) {
|
||||||
$collection->push($account);
|
$collection->push($account);
|
||||||
}
|
}
|
||||||
@@ -166,7 +166,7 @@ class ReportFormRequest extends Request
|
|||||||
{
|
{
|
||||||
$date = new Carbon;
|
$date = new Carbon;
|
||||||
$range = $this->get('daterange');
|
$range = $this->get('daterange');
|
||||||
$parts = explode(' - ', strval($range));
|
$parts = explode(' - ', (string)$range);
|
||||||
if (2 === count($parts)) {
|
if (2 === count($parts)) {
|
||||||
try {
|
try {
|
||||||
$date = new Carbon($parts[0]);
|
$date = new Carbon($parts[0]);
|
||||||
|
@@ -37,7 +37,7 @@ class Request extends FormRequest
|
|||||||
*/
|
*/
|
||||||
public function boolean(string $field): bool
|
public function boolean(string $field): bool
|
||||||
{
|
{
|
||||||
return 1 === intval($this->input($field));
|
return 1 === (int)$this->input($field);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -47,7 +47,7 @@ class Request extends FormRequest
|
|||||||
*/
|
*/
|
||||||
public function integer(string $field): int
|
public function integer(string $field): int
|
||||||
{
|
{
|
||||||
return intval($this->get($field));
|
return (int)$this->get($field);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -73,8 +73,8 @@ class RuleFormRequest extends Request
|
|||||||
$contextActions = implode(',', config('firefly.rule-actions-text'));
|
$contextActions = implode(',', config('firefly.rule-actions-text'));
|
||||||
|
|
||||||
$titleRule = 'required|between:1,100|uniqueObjectForUser:rules,title';
|
$titleRule = 'required|between:1,100|uniqueObjectForUser:rules,title';
|
||||||
if (null !== $repository->find(intval($this->get('id')))->id) {
|
if (null !== $repository->find((int)$this->get('id'))->id) {
|
||||||
$titleRule = 'required|between:1,100|uniqueObjectForUser:rules,title,' . intval($this->get('id'));
|
$titleRule = 'required|between:1,100|uniqueObjectForUser:rules,title,' . (int)$this->get('id');
|
||||||
}
|
}
|
||||||
$rules = [
|
$rules = [
|
||||||
'title' => $titleRule,
|
'title' => $titleRule,
|
||||||
|
@@ -58,8 +58,8 @@ class RuleGroupFormRequest extends Request
|
|||||||
/** @var RuleGroupRepositoryInterface $repository */
|
/** @var RuleGroupRepositoryInterface $repository */
|
||||||
$repository = app(RuleGroupRepositoryInterface::class);
|
$repository = app(RuleGroupRepositoryInterface::class);
|
||||||
$titleRule = 'required|between:1,100|uniqueObjectForUser:rule_groups,title';
|
$titleRule = 'required|between:1,100|uniqueObjectForUser:rule_groups,title';
|
||||||
if (null !== $repository->find(intval($this->get('id')))->id) {
|
if (null !== $repository->find((int)$this->get('id'))->id) {
|
||||||
$titleRule = 'required|between:1,100|uniqueObjectForUser:rule_groups,title,' . intval($this->get('id'));
|
$titleRule = 'required|between:1,100|uniqueObjectForUser:rule_groups,title,' . (int)$this->get('id');
|
||||||
}
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
@@ -41,7 +41,6 @@ class SelectTransactionsRequest extends Request
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @return array
|
* @return array
|
||||||
* @throws \InvalidArgumentException
|
|
||||||
*/
|
*/
|
||||||
public function rules()
|
public function rules()
|
||||||
{
|
{
|
||||||
|
@@ -77,7 +77,7 @@ class SplitJournalFormRequest extends Request
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$foreignAmount = $transaction['foreign_amount'] ?? null;
|
$foreignAmount = $transaction['foreign_amount'] ?? null;
|
||||||
$foreignCurrencyId = intval($transaction['foreign_currency_id'] ?? 0);
|
$foreignCurrencyId = (int)($transaction['foreign_currency_id'] ?? 0.0);
|
||||||
$set = [
|
$set = [
|
||||||
'source_id' => $sourceId,
|
'source_id' => $sourceId,
|
||||||
'source_name' => $sourceName,
|
'source_name' => $sourceName,
|
||||||
@@ -92,7 +92,7 @@ class SplitJournalFormRequest extends Request
|
|||||||
'currency_code' => null,
|
'currency_code' => null,
|
||||||
'description' => $transaction['transaction_description'],
|
'description' => $transaction['transaction_description'],
|
||||||
'amount' => $transaction['amount'],
|
'amount' => $transaction['amount'],
|
||||||
'budget_id' => intval($transaction['budget_id'] ?? 0),
|
'budget_id' => (int)($transaction['budget_id'] ?? 0.0),
|
||||||
'budget_name' => null,
|
'budget_name' => null,
|
||||||
'category_id' => null,
|
'category_id' => null,
|
||||||
'category_name' => $transaction['category_name'],
|
'category_name' => $transaction['category_name'],
|
||||||
|
@@ -74,7 +74,7 @@ class TagFormRequest extends Request
|
|||||||
$repository = app(TagRepositoryInterface::class);
|
$repository = app(TagRepositoryInterface::class);
|
||||||
$idRule = '';
|
$idRule = '';
|
||||||
$tagRule = 'required|min:1|uniqueObjectForUser:tags,tag';
|
$tagRule = 'required|min:1|uniqueObjectForUser:tags,tag';
|
||||||
if (null !== $repository->find(intval($this->get('id')))->id) {
|
if (null !== $repository->find((int)$this->get('id'))->id) {
|
||||||
$idRule = 'belongsToUser:tags';
|
$idRule = 'belongsToUser:tags';
|
||||||
$tagRule = 'required|min:1|uniqueObjectForUser:tags,tag,' . $this->get('id');
|
$tagRule = 'required|min:1|uniqueObjectForUser:tags,tag,' . $this->get('id');
|
||||||
}
|
}
|
||||||
|
@@ -60,7 +60,7 @@ class BunqConfigurator implements ConfiguratorInterface
|
|||||||
*/
|
*/
|
||||||
public function configureJob(array $data): bool
|
public function configureJob(array $data): bool
|
||||||
{
|
{
|
||||||
if (is_null($this->job)) {
|
if (null === $this->job) {
|
||||||
throw new FireflyException('Cannot call configureJob() without a job.');
|
throw new FireflyException('Cannot call configureJob() without a job.');
|
||||||
}
|
}
|
||||||
$stage = $this->getConfig()['stage'] ?? 'initial';
|
$stage = $this->getConfig()['stage'] ?? 'initial';
|
||||||
@@ -94,7 +94,7 @@ class BunqConfigurator implements ConfiguratorInterface
|
|||||||
*/
|
*/
|
||||||
public function getNextData(): array
|
public function getNextData(): array
|
||||||
{
|
{
|
||||||
if (is_null($this->job)) {
|
if (null === $this->job) {
|
||||||
throw new FireflyException('Cannot call configureJob() without a job.');
|
throw new FireflyException('Cannot call configureJob() without a job.');
|
||||||
}
|
}
|
||||||
$config = $this->getConfig();
|
$config = $this->getConfig();
|
||||||
@@ -107,9 +107,8 @@ class BunqConfigurator implements ConfiguratorInterface
|
|||||||
/** @var HaveAccounts $class */
|
/** @var HaveAccounts $class */
|
||||||
$class = app(HaveAccounts::class);
|
$class = app(HaveAccounts::class);
|
||||||
$class->setJob($this->job);
|
$class->setJob($this->job);
|
||||||
$data = $class->getData();
|
|
||||||
|
|
||||||
return $data;
|
return $class->getData();
|
||||||
default:
|
default:
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
@@ -122,7 +121,7 @@ class BunqConfigurator implements ConfiguratorInterface
|
|||||||
*/
|
*/
|
||||||
public function getNextView(): string
|
public function getNextView(): string
|
||||||
{
|
{
|
||||||
if (is_null($this->job)) {
|
if (null === $this->job) {
|
||||||
throw new FireflyException('Cannot call configureJob() without a job.');
|
throw new FireflyException('Cannot call configureJob() without a job.');
|
||||||
}
|
}
|
||||||
$stage = $this->getConfig()['stage'] ?? 'initial';
|
$stage = $this->getConfig()['stage'] ?? 'initial';
|
||||||
@@ -153,7 +152,7 @@ class BunqConfigurator implements ConfiguratorInterface
|
|||||||
*/
|
*/
|
||||||
public function isJobConfigured(): bool
|
public function isJobConfigured(): bool
|
||||||
{
|
{
|
||||||
if (is_null($this->job)) {
|
if (null === $this->job) {
|
||||||
throw new FireflyException('Cannot call configureJob() without a job.');
|
throw new FireflyException('Cannot call configureJob() without a job.');
|
||||||
}
|
}
|
||||||
$stage = $this->getConfig()['stage'] ?? 'initial';
|
$stage = $this->getConfig()['stage'] ?? 'initial';
|
||||||
|
@@ -84,7 +84,7 @@ class FileConfigurator implements ConfiguratorInterface
|
|||||||
*/
|
*/
|
||||||
public function configureJob(array $data): bool
|
public function configureJob(array $data): bool
|
||||||
{
|
{
|
||||||
if (is_null($this->job)) {
|
if (null === $this->job) {
|
||||||
throw new FireflyException('Cannot call configureJob() without a job.');
|
throw new FireflyException('Cannot call configureJob() without a job.');
|
||||||
}
|
}
|
||||||
/** @var ConfigurationInterface $object */
|
/** @var ConfigurationInterface $object */
|
||||||
@@ -105,7 +105,7 @@ class FileConfigurator implements ConfiguratorInterface
|
|||||||
*/
|
*/
|
||||||
public function getNextData(): array
|
public function getNextData(): array
|
||||||
{
|
{
|
||||||
if (is_null($this->job)) {
|
if (null === $this->job) {
|
||||||
throw new FireflyException('Cannot call getNextData() without a job.');
|
throw new FireflyException('Cannot call getNextData() without a job.');
|
||||||
}
|
}
|
||||||
/** @var ConfigurationInterface $object */
|
/** @var ConfigurationInterface $object */
|
||||||
@@ -122,7 +122,7 @@ class FileConfigurator implements ConfiguratorInterface
|
|||||||
*/
|
*/
|
||||||
public function getNextView(): string
|
public function getNextView(): string
|
||||||
{
|
{
|
||||||
if (is_null($this->job)) {
|
if (null === $this->job) {
|
||||||
throw new FireflyException('Cannot call getNextView() without a job.');
|
throw new FireflyException('Cannot call getNextView() without a job.');
|
||||||
}
|
}
|
||||||
$config = $this->getConfig();
|
$config = $this->getConfig();
|
||||||
@@ -149,7 +149,7 @@ class FileConfigurator implements ConfiguratorInterface
|
|||||||
*/
|
*/
|
||||||
public function getWarningMessage(): string
|
public function getWarningMessage(): string
|
||||||
{
|
{
|
||||||
if (is_null($this->job)) {
|
if (null === $this->job) {
|
||||||
throw new FireflyException('Cannot call getWarningMessage() without a job.');
|
throw new FireflyException('Cannot call getWarningMessage() without a job.');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -163,7 +163,7 @@ class FileConfigurator implements ConfiguratorInterface
|
|||||||
*/
|
*/
|
||||||
public function isJobConfigured(): bool
|
public function isJobConfigured(): bool
|
||||||
{
|
{
|
||||||
if (is_null($this->job)) {
|
if (null === $this->job) {
|
||||||
throw new FireflyException('Cannot call isJobConfigured() without a job.');
|
throw new FireflyException('Cannot call isJobConfigured() without a job.');
|
||||||
}
|
}
|
||||||
$config = $this->getConfig();
|
$config = $this->getConfig();
|
||||||
|
@@ -60,7 +60,7 @@ class SpectreConfigurator implements ConfiguratorInterface
|
|||||||
*/
|
*/
|
||||||
public function configureJob(array $data): bool
|
public function configureJob(array $data): bool
|
||||||
{
|
{
|
||||||
if (is_null($this->job)) {
|
if (null === $this->job) {
|
||||||
throw new FireflyException('Cannot call configureJob() without a job.');
|
throw new FireflyException('Cannot call configureJob() without a job.');
|
||||||
}
|
}
|
||||||
$stage = $this->getConfig()['stage'] ?? 'initial';
|
$stage = $this->getConfig()['stage'] ?? 'initial';
|
||||||
@@ -93,7 +93,7 @@ class SpectreConfigurator implements ConfiguratorInterface
|
|||||||
*/
|
*/
|
||||||
public function getNextData(): array
|
public function getNextData(): array
|
||||||
{
|
{
|
||||||
if (is_null($this->job)) {
|
if (null === $this->job) {
|
||||||
throw new FireflyException('Cannot call configureJob() without a job.');
|
throw new FireflyException('Cannot call configureJob() without a job.');
|
||||||
}
|
}
|
||||||
$config = $this->getConfig();
|
$config = $this->getConfig();
|
||||||
@@ -116,9 +116,8 @@ class SpectreConfigurator implements ConfiguratorInterface
|
|||||||
/** @var HaveAccounts $class */
|
/** @var HaveAccounts $class */
|
||||||
$class = app(HaveAccounts::class);
|
$class = app(HaveAccounts::class);
|
||||||
$class->setJob($this->job);
|
$class->setJob($this->job);
|
||||||
$data = $class->getData();
|
|
||||||
|
|
||||||
return $data;
|
return $class->getData();
|
||||||
default:
|
default:
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
@@ -131,7 +130,7 @@ class SpectreConfigurator implements ConfiguratorInterface
|
|||||||
*/
|
*/
|
||||||
public function getNextView(): string
|
public function getNextView(): string
|
||||||
{
|
{
|
||||||
if (is_null($this->job)) {
|
if (null === $this->job) {
|
||||||
throw new FireflyException('Cannot call configureJob() without a job.');
|
throw new FireflyException('Cannot call configureJob() without a job.');
|
||||||
}
|
}
|
||||||
$stage = $this->getConfig()['stage'] ?? 'initial';
|
$stage = $this->getConfig()['stage'] ?? 'initial';
|
||||||
@@ -166,7 +165,7 @@ class SpectreConfigurator implements ConfiguratorInterface
|
|||||||
*/
|
*/
|
||||||
public function isJobConfigured(): bool
|
public function isJobConfigured(): bool
|
||||||
{
|
{
|
||||||
if (is_null($this->job)) {
|
if (null === $this->job) {
|
||||||
throw new FireflyException('Cannot call configureJob() without a job.');
|
throw new FireflyException('Cannot call configureJob() without a job.');
|
||||||
}
|
}
|
||||||
$stage = $this->getConfig()['stage'] ?? 'initial';
|
$stage = $this->getConfig()['stage'] ?? 'initial';
|
||||||
|
@@ -47,7 +47,7 @@ class Amount implements ConverterInterface
|
|||||||
}
|
}
|
||||||
Log::debug(sprintf('Start with amount "%s"', $value));
|
Log::debug(sprintf('Start with amount "%s"', $value));
|
||||||
$original = $value;
|
$original = $value;
|
||||||
$value = strval($value);
|
$value = (string)$value;
|
||||||
$value = $this->stripAmount($value);
|
$value = $this->stripAmount($value);
|
||||||
$len = strlen($value);
|
$len = strlen($value);
|
||||||
$decimalPosition = $len - 3;
|
$decimalPosition = $len - 3;
|
||||||
@@ -69,7 +69,7 @@ class Amount implements ConverterInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
// decimal character still null? Search from the left for '.',',' or ' '.
|
// decimal character still null? Search from the left for '.',',' or ' '.
|
||||||
if (is_null($decimal)) {
|
if (null === $decimal) {
|
||||||
Log::debug('Decimal is still NULL, probably number with >2 decimals. Search for a dot.');
|
Log::debug('Decimal is still NULL, probably number with >2 decimals. Search for a dot.');
|
||||||
$res = strrpos($value, '.');
|
$res = strrpos($value, '.');
|
||||||
if (!(false === $res)) {
|
if (!(false === $res)) {
|
||||||
@@ -99,9 +99,7 @@ class Amount implements ConverterInterface
|
|||||||
Log::debug(sprintf('No decimal character found. Converted amount from "%s" to "%s".', $original, $value));
|
Log::debug(sprintf('No decimal character found. Converted amount from "%s" to "%s".', $original, $value));
|
||||||
}
|
}
|
||||||
|
|
||||||
$number = strval(number_format(round(floatval($value), 12), 12, '.', ''));
|
return strval(number_format(round(floatval($value), 12), 12, '.', ''));
|
||||||
|
|
||||||
return $number;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -46,9 +46,9 @@ class CsvProcessor implements FileProcessorInterface
|
|||||||
/** @var ImportJobRepositoryInterface */
|
/** @var ImportJobRepositoryInterface */
|
||||||
private $repository;
|
private $repository;
|
||||||
/** @var array */
|
/** @var array */
|
||||||
private $validConverters = [];
|
private $validConverters;
|
||||||
/** @var array */
|
/** @var array */
|
||||||
private $validSpecifics = [];
|
private $validSpecifics;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FileProcessorInterface constructor.
|
* FileProcessorInterface constructor.
|
||||||
@@ -67,7 +67,7 @@ class CsvProcessor implements FileProcessorInterface
|
|||||||
*/
|
*/
|
||||||
public function getObjects(): Collection
|
public function getObjects(): Collection
|
||||||
{
|
{
|
||||||
if (is_null($this->job)) {
|
if (null === $this->job) {
|
||||||
throw new FireflyException('Cannot call getObjects() without a job.');
|
throw new FireflyException('Cannot call getObjects() without a job.');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -84,7 +84,7 @@ class CsvProcessor implements FileProcessorInterface
|
|||||||
*/
|
*/
|
||||||
public function run(): bool
|
public function run(): bool
|
||||||
{
|
{
|
||||||
if (is_null($this->job)) {
|
if (null === $this->job) {
|
||||||
throw new FireflyException('Cannot call run() without a job.');
|
throw new FireflyException('Cannot call run() without a job.');
|
||||||
}
|
}
|
||||||
Log::debug('Now in CsvProcessor run(). Job is now running...');
|
Log::debug('Now in CsvProcessor run(). Job is now running...');
|
||||||
@@ -128,7 +128,7 @@ class CsvProcessor implements FileProcessorInterface
|
|||||||
*
|
*
|
||||||
* @param array $array
|
* @param array $array
|
||||||
*/
|
*/
|
||||||
public function setExtendedStatus(array $array)
|
public function setExtendedStatus(array $array): void
|
||||||
{
|
{
|
||||||
$this->repository->setExtendedStatus($this->job, $array);
|
$this->repository->setExtendedStatus($this->job, $array);
|
||||||
}
|
}
|
||||||
@@ -213,7 +213,7 @@ class CsvProcessor implements FileProcessorInterface
|
|||||||
$config = $this->getConfig();
|
$config = $this->getConfig();
|
||||||
$reader = Reader::createFromString($content);
|
$reader = Reader::createFromString($content);
|
||||||
$delimiter = $config['delimiter'] ?? ',';
|
$delimiter = $config['delimiter'] ?? ',';
|
||||||
$hasHeaders = isset($config['has-headers']) ? $config['has-headers'] : false;
|
$hasHeaders = $config['has-headers'] ?? false;
|
||||||
$offset = 0;
|
$offset = 0;
|
||||||
if ('tab' === $delimiter) {
|
if ('tab' === $delimiter) {
|
||||||
$delimiter = "\t"; // @codeCoverageIgnore
|
$delimiter = "\t"; // @codeCoverageIgnore
|
||||||
@@ -312,7 +312,7 @@ class CsvProcessor implements FileProcessorInterface
|
|||||||
* @var string $value
|
* @var string $value
|
||||||
*/
|
*/
|
||||||
foreach ($row as $rowIndex => $value) {
|
foreach ($row as $rowIndex => $value) {
|
||||||
$value = trim(strval($value));
|
$value = trim((string)$value);
|
||||||
if (strlen($value) > 0) {
|
if (strlen($value) > 0) {
|
||||||
$annotated = $this->annotateValue($rowIndex, $value);
|
$annotated = $this->annotateValue($rowIndex, $value);
|
||||||
Log::debug('Annotated value', $annotated);
|
Log::debug('Annotated value', $annotated);
|
||||||
@@ -320,7 +320,7 @@ class CsvProcessor implements FileProcessorInterface
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// set some extra info:
|
// set some extra info:
|
||||||
$importAccount = intval($config['import-account'] ?? 0);
|
$importAccount = (int)($config['import-account'] ?? 0.0);
|
||||||
$journal->asset->setDefaultAccountId($importAccount);
|
$journal->asset->setDefaultAccountId($importAccount);
|
||||||
|
|
||||||
return $journal;
|
return $journal;
|
||||||
|
@@ -45,7 +45,7 @@ class AssetAccountIbans implements MapperInterface
|
|||||||
/** @var Account $account */
|
/** @var Account $account */
|
||||||
foreach ($set as $account) {
|
foreach ($set as $account) {
|
||||||
$iban = $account->iban ?? '';
|
$iban = $account->iban ?? '';
|
||||||
$accountId = intval($account->id);
|
$accountId = (int)$account->id;
|
||||||
if (strlen($iban) > 0) {
|
if (strlen($iban) > 0) {
|
||||||
$topList[$accountId] = $account->iban . ' (' . $account->name . ')';
|
$topList[$accountId] = $account->iban . ' (' . $account->name . ')';
|
||||||
}
|
}
|
||||||
|
@@ -43,7 +43,7 @@ class AssetAccounts implements MapperInterface
|
|||||||
|
|
||||||
/** @var Account $account */
|
/** @var Account $account */
|
||||||
foreach ($set as $account) {
|
foreach ($set as $account) {
|
||||||
$accountId = intval($account->id);
|
$accountId = (int)$account->id;
|
||||||
$name = $account->name;
|
$name = $account->name;
|
||||||
$iban = $account->iban ?? '';
|
$iban = $account->iban ?? '';
|
||||||
if (strlen($iban) > 0) {
|
if (strlen($iban) > 0) {
|
||||||
|
@@ -42,7 +42,7 @@ class Bills implements MapperInterface
|
|||||||
|
|
||||||
/** @var Bill $bill */
|
/** @var Bill $bill */
|
||||||
foreach ($result as $bill) {
|
foreach ($result as $bill) {
|
||||||
$billId = intval($bill->id);
|
$billId = (int)$bill->id;
|
||||||
$list[$billId] = $bill->name . ' [' . $bill->match . ']';
|
$list[$billId] = $bill->name . ' [' . $bill->match . ']';
|
||||||
}
|
}
|
||||||
asort($list);
|
asort($list);
|
||||||
|
@@ -42,7 +42,7 @@ class Budgets implements MapperInterface
|
|||||||
|
|
||||||
/** @var Budget $budget */
|
/** @var Budget $budget */
|
||||||
foreach ($result as $budget) {
|
foreach ($result as $budget) {
|
||||||
$budgetId = intval($budget->id);
|
$budgetId = (int)$budget->id;
|
||||||
$list[$budgetId] = $budget->name;
|
$list[$budgetId] = $budget->name;
|
||||||
}
|
}
|
||||||
asort($list);
|
asort($list);
|
||||||
|
@@ -42,7 +42,7 @@ class Categories implements MapperInterface
|
|||||||
|
|
||||||
/** @var Category $category */
|
/** @var Category $category */
|
||||||
foreach ($result as $category) {
|
foreach ($result as $category) {
|
||||||
$categoryId = intval($category->id);
|
$categoryId = (int)$category->id;
|
||||||
$list[$categoryId] = $category->name;
|
$list[$categoryId] = $category->name;
|
||||||
}
|
}
|
||||||
asort($list);
|
asort($list);
|
||||||
|
@@ -51,7 +51,7 @@ class OpposingAccountIbans implements MapperInterface
|
|||||||
/** @var Account $account */
|
/** @var Account $account */
|
||||||
foreach ($set as $account) {
|
foreach ($set as $account) {
|
||||||
$iban = $account->iban ?? '';
|
$iban = $account->iban ?? '';
|
||||||
$accountId = intval($account->id);
|
$accountId = (int)$account->id;
|
||||||
if (strlen($iban) > 0) {
|
if (strlen($iban) > 0) {
|
||||||
$topList[$accountId] = $account->iban . ' (' . $account->name . ')';
|
$topList[$accountId] = $account->iban . ' (' . $account->name . ')';
|
||||||
}
|
}
|
||||||
|
@@ -49,7 +49,7 @@ class OpposingAccounts implements MapperInterface
|
|||||||
|
|
||||||
/** @var Account $account */
|
/** @var Account $account */
|
||||||
foreach ($set as $account) {
|
foreach ($set as $account) {
|
||||||
$accountId = intval($account->id);
|
$accountId = (int)$account->id;
|
||||||
$name = $account->name;
|
$name = $account->name;
|
||||||
$iban = $account->iban ?? '';
|
$iban = $account->iban ?? '';
|
||||||
if (strlen($iban) > 0) {
|
if (strlen($iban) > 0) {
|
||||||
|
@@ -42,7 +42,7 @@ class Tags implements MapperInterface
|
|||||||
|
|
||||||
/** @var Tag $tag */
|
/** @var Tag $tag */
|
||||||
foreach ($result as $tag) {
|
foreach ($result as $tag) {
|
||||||
$tagId = intval($tag->id);
|
$tagId = (int)$tag->id;
|
||||||
$list[$tagId] = $tag->tag;
|
$list[$tagId] = $tag->tag;
|
||||||
}
|
}
|
||||||
asort($list);
|
asort($list);
|
||||||
|
@@ -39,7 +39,7 @@ class TransactionCurrencies implements MapperInterface
|
|||||||
$currencies = $repository->get();
|
$currencies = $repository->get();
|
||||||
$list = [];
|
$list = [];
|
||||||
foreach ($currencies as $currency) {
|
foreach ($currencies as $currency) {
|
||||||
$currencyId = intval($currency->id);
|
$currencyId = (int)$currency->id;
|
||||||
$list[$currencyId] = $currency->name . ' (' . $currency->code . ')';
|
$list[$currencyId] = $currency->name . ' (' . $currency->code . ')';
|
||||||
}
|
}
|
||||||
asort($list);
|
asort($list);
|
||||||
|
@@ -37,8 +37,7 @@ class TagsComma implements PreProcessorInterface
|
|||||||
$set = explode(',', $value);
|
$set = explode(',', $value);
|
||||||
$set = array_map('trim', $set);
|
$set = array_map('trim', $set);
|
||||||
$set = array_filter($set, 'strlen');
|
$set = array_filter($set, 'strlen');
|
||||||
$return = array_values($set);
|
|
||||||
|
|
||||||
return $return;
|
return array_values($set);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -37,8 +37,7 @@ class TagsSpace implements PreProcessorInterface
|
|||||||
$set = explode(' ', $value);
|
$set = explode(' ', $value);
|
||||||
$set = array_map('trim', $set);
|
$set = array_map('trim', $set);
|
||||||
$set = array_filter($set, 'strlen');
|
$set = array_filter($set, 'strlen');
|
||||||
$return = array_values($set);
|
|
||||||
|
|
||||||
return $return;
|
return array_values($set);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -49,7 +49,7 @@ class ImportAccount
|
|||||||
/** @var int */
|
/** @var int */
|
||||||
private $defaultAccountId = 0;
|
private $defaultAccountId = 0;
|
||||||
/** @var string */
|
/** @var string */
|
||||||
private $expectedType = '';
|
private $expectedType;
|
||||||
/**
|
/**
|
||||||
* This value is used to indicate the other account ID (the opposing transaction's account),
|
* This value is used to indicate the other account ID (the opposing transaction's account),
|
||||||
* if it is know. If so, this particular import account may never return an Account with this ID.
|
* if it is know. If so, this particular import account may never return an Account with this ID.
|
||||||
@@ -299,19 +299,19 @@ class ImportAccount
|
|||||||
/** @var AccountType $accountType */
|
/** @var AccountType $accountType */
|
||||||
$accountType = $this->repository->getAccountType($this->expectedType);
|
$accountType = $this->repository->getAccountType($this->expectedType);
|
||||||
$result = $this->findById($accountType);
|
$result = $this->findById($accountType);
|
||||||
if (!is_null($result)) {
|
if (null !== $result) {
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $this->findByIBAN($accountType);
|
$result = $this->findByIBAN($accountType);
|
||||||
|
|
||||||
if (!is_null($result)) {
|
if (null !== $result) {
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $this->findByName($accountType);
|
$result = $this->findByName($accountType);
|
||||||
|
|
||||||
if (!is_null($result)) {
|
if (null !== $result) {
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -365,7 +365,7 @@ class ImportAccount
|
|||||||
|
|
||||||
Log::debug('Finding a mapped account based on', $array);
|
Log::debug('Finding a mapped account based on', $array);
|
||||||
|
|
||||||
$search = intval($array['mapped'] ?? 0);
|
$search = (int)($array['mapped'] ?? 0.0);
|
||||||
$account = $this->repository->findNull($search);
|
$account = $this->repository->findNull($search);
|
||||||
|
|
||||||
if (null === $account) {
|
if (null === $account) {
|
||||||
@@ -401,10 +401,10 @@ class ImportAccount
|
|||||||
*/
|
*/
|
||||||
private function store(): bool
|
private function store(): bool
|
||||||
{
|
{
|
||||||
if (is_null($this->user)) {
|
if (null === $this->user) {
|
||||||
throw new FireflyException('ImportAccount cannot continue without user.');
|
throw new FireflyException('ImportAccount cannot continue without user.');
|
||||||
}
|
}
|
||||||
if ((is_null($this->defaultAccountId) || 0 === intval($this->defaultAccountId)) && AccountType::ASSET === $this->expectedType) {
|
if ((null === $this->defaultAccountId || 0 === (int)$this->defaultAccountId) && AccountType::ASSET === $this->expectedType) {
|
||||||
throw new FireflyException('ImportAccount cannot continue without a default account to fall back on.');
|
throw new FireflyException('ImportAccount cannot continue without a default account to fall back on.');
|
||||||
}
|
}
|
||||||
// 1: find mapped object:
|
// 1: find mapped object:
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user