mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-29 18:20:01 +00:00
Merge branch 'release/4.1.7'
This commit is contained in:
@@ -35,8 +35,7 @@ MAIL_PASSWORD=null
|
|||||||
MAIL_ENCRYPTION=null
|
MAIL_ENCRYPTION=null
|
||||||
|
|
||||||
SEND_REGISTRATION_MAIL=true
|
SEND_REGISTRATION_MAIL=true
|
||||||
MUST_CONFIRM_ACCOUNT=false
|
SEND_ERROR_MESSAGE=true
|
||||||
|
|
||||||
SHOW_INCOMPLETE_TRANSLATIONS=false
|
SHOW_INCOMPLETE_TRANSLATIONS=false
|
||||||
|
|
||||||
ANALYTICS_ID=
|
ANALYTICS_ID=
|
||||||
|
45
.env.testing
Executable file
45
.env.testing
Executable file
@@ -0,0 +1,45 @@
|
|||||||
|
APP_ENV=testing
|
||||||
|
APP_DEBUG=true
|
||||||
|
APP_FORCE_SSL=false
|
||||||
|
APP_FORCE_ROOT=
|
||||||
|
APP_KEY=TestTestTestTestTestTestTestTest
|
||||||
|
APP_LOG_LEVEL=debug
|
||||||
|
APP_URL=http://localhost
|
||||||
|
|
||||||
|
DB_CONNECTION=sqlite
|
||||||
|
DB_HOST=127.0.0.1
|
||||||
|
DB_PORT=3306
|
||||||
|
DB_USERNAME=homestead
|
||||||
|
DB_PASSWORD=secret
|
||||||
|
|
||||||
|
BROADCAST_DRIVER=log
|
||||||
|
CACHE_DRIVER=file
|
||||||
|
SESSION_DRIVER=file
|
||||||
|
QUEUE_DRIVER=sync
|
||||||
|
|
||||||
|
COOKIE_PATH="/"
|
||||||
|
COOKIE_DOMAIN=
|
||||||
|
COOKIE_SECURE=false
|
||||||
|
|
||||||
|
REDIS_HOST=127.0.0.1
|
||||||
|
REDIS_PASSWORD=null
|
||||||
|
REDIS_PORT=6379
|
||||||
|
|
||||||
|
MAIL_DRIVER=smtp
|
||||||
|
MAIL_HOST=mailtrap.io
|
||||||
|
MAIL_PORT=2525
|
||||||
|
MAIL_FROM=changeme@example.com
|
||||||
|
MAIL_USERNAME=null
|
||||||
|
MAIL_PASSWORD=null
|
||||||
|
MAIL_ENCRYPTION=null
|
||||||
|
|
||||||
|
SEND_REGISTRATION_MAIL=true
|
||||||
|
SEND_ERROR_MESSAGE=true
|
||||||
|
SHOW_INCOMPLETE_TRANSLATIONS=false
|
||||||
|
|
||||||
|
ANALYTICS_ID=
|
||||||
|
SITE_OWNER=mail@example.com
|
||||||
|
|
||||||
|
PUSHER_KEY=
|
||||||
|
PUSHER_SECRET=
|
||||||
|
PUSHER_APP_ID=
|
2
.gitignore
vendored
2
.gitignore
vendored
@@ -11,3 +11,5 @@ result.html
|
|||||||
test-import.sh
|
test-import.sh
|
||||||
test-import-report.txt
|
test-import-report.txt
|
||||||
public/google*.html
|
public/google*.html
|
||||||
|
_ide_helper_models.php
|
||||||
|
.env.backup
|
||||||
|
18
.travis.yml
Normal file
18
.travis.yml
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
language: php
|
||||||
|
sudo: false
|
||||||
|
php:
|
||||||
|
- '7.0'
|
||||||
|
|
||||||
|
install:
|
||||||
|
- phpenv config-rm xdebug.ini
|
||||||
|
- composer selfupdate
|
||||||
|
- rm composer.lock
|
||||||
|
- composer update --no-scripts
|
||||||
|
- php artisan clear-compiled
|
||||||
|
- php artisan optimize
|
||||||
|
- php artisan env
|
||||||
|
- ./test.sh -r
|
||||||
|
- php artisan env
|
||||||
|
|
||||||
|
script:
|
||||||
|
- phpunit
|
23
CHANGELOG.md
23
CHANGELOG.md
@@ -2,6 +2,29 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
This project adheres to [Semantic Versioning](http://semver.org/).
|
This project adheres to [Semantic Versioning](http://semver.org/).
|
||||||
|
|
||||||
|
## [4.1.7] - 2015-05-25
|
||||||
|
### Added
|
||||||
|
- Check for database table presence in console commands.
|
||||||
|
- Category report
|
||||||
|
- Reinstated old test routines.
|
||||||
|
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
- Confirm account setting is no longer in `.env` file.
|
||||||
|
- Titles are now in reverse (current page > parent > firefly iii)
|
||||||
|
- Easier update of language files thanks to Github implementation.
|
||||||
|
- Uniform colours for charts.
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- Made all pages more mobile friendly.
|
||||||
|
- Fixed #395 found by @marcoveeneman.
|
||||||
|
- Fixed #398 found by @marcoveeneman.
|
||||||
|
- Fixed #401 found by @marcoveeneman.
|
||||||
|
- Many optimizations.
|
||||||
|
- Updated many libraries.
|
||||||
|
- Various bugs found by myself.
|
||||||
|
|
||||||
|
|
||||||
## [4.1.6] - 2016-11-06
|
## [4.1.6] - 2016-11-06
|
||||||
### Added
|
### Added
|
||||||
- New budget table for multi year report.
|
- New budget table for multi year report.
|
||||||
|
@@ -1,5 +1,7 @@
|
|||||||
# Firefly III [](https://secure.php.net/downloads.php#v7.0.4) [](https://packagist.org/packages/grumpydictator/firefly-iii) [](https://scrutinizer-ci.com/g/JC5/firefly-iii/?branch=master)
|
# Firefly III [](https://secure.php.net/downloads.php#v7.0.4) [](https://packagist.org/packages/grumpydictator/firefly-iii) [](https://scrutinizer-ci.com/g/JC5/firefly-iii/?branch=master)
|
||||||
|
|
||||||
|
[](https://travis-ci.org/JC5/firefly-iii)
|
||||||
|
|
||||||
## A personal finances manager
|
## A personal finances manager
|
||||||
|
|
||||||
[](https://i.nder.be/hhfv03hp) [](https://i.nder.be/hhmwmqw9)
|
[](https://i.nder.be/hhfv03hp) [](https://i.nder.be/hhmwmqw9)
|
||||||
@@ -10,7 +12,7 @@
|
|||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
To install Firefly III, you'll need a web server (preferrably on Linux) and access to the command line. Then, please read the [installation guide](https://jc5.github.io/firefly-iii/installation-guide/).
|
To install Firefly III, you'll need a web server (preferrably on Linux) and access to the command line. Then, please read the [installation guide](https://firefly-iii.github.io/installation-guide/).
|
||||||
|
|
||||||
## More about Firefly III
|
## More about Firefly III
|
||||||
|
|
||||||
@@ -25,6 +27,6 @@ Firefly works on the principle that if you know where you're money is going, you
|
|||||||
- Firefly has lots of features without becoming fancy or bloated.
|
- Firefly has lots of features without becoming fancy or bloated.
|
||||||
- If you feel you're missing something you can just ask me and I'll add it!
|
- If you feel you're missing something you can just ask me and I'll add it!
|
||||||
|
|
||||||
Firefly is pretty awesome. [You can read more about Firefly III, and its features, on the Github Pages](https://jc5.github.io/firefly-iii/).
|
Firefly is pretty awesome. [You can read more about Firefly III, and its features, on the Github Pages](https://firefly-iii.github.io/).
|
||||||
|
|
||||||
If you want to contact me, please open an issue or [email me](mailto:thegrumpydictator@gmail.com).
|
If you want to contact me, please open an issue or [email me](mailto:thegrumpydictator@gmail.com).
|
||||||
|
@@ -20,6 +20,7 @@ use FireflyIII\Models\TransactionJournal;
|
|||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
use Illuminate\Database\QueryException;
|
use Illuminate\Database\QueryException;
|
||||||
use Log;
|
use Log;
|
||||||
|
use Schema;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class UpgradeDatabase
|
* Class UpgradeDatabase
|
||||||
@@ -65,6 +66,12 @@ class UpgradeDatabase extends Command
|
|||||||
*/
|
*/
|
||||||
private function setTransactionIdentifier()
|
private function setTransactionIdentifier()
|
||||||
{
|
{
|
||||||
|
// if table does not exist, return false
|
||||||
|
if (!Schema::hasTable('transaction_journals')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$subQuery = TransactionJournal
|
$subQuery = TransactionJournal
|
||||||
::leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')
|
::leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')
|
||||||
->whereNull('transaction_journals.deleted_at')
|
->whereNull('transaction_journals.deleted_at')
|
||||||
|
@@ -26,6 +26,7 @@ use FireflyIII\Repositories\User\UserRepositoryInterface;
|
|||||||
use FireflyIII\User;
|
use FireflyIII\User;
|
||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
|
use Schema;
|
||||||
use stdClass;
|
use stdClass;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -61,6 +62,11 @@ class VerifyDatabase extends Command
|
|||||||
*/
|
*/
|
||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
|
// if table does not exist, return false
|
||||||
|
if (!Schema::hasTable('users')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// accounts with no transactions.
|
// accounts with no transactions.
|
||||||
$this->reportAccounts();
|
$this->reportAccounts();
|
||||||
// budgets with no limits
|
// budgets with no limits
|
||||||
|
@@ -77,7 +77,8 @@ class Handler extends ExceptionHandler
|
|||||||
*/
|
*/
|
||||||
public function report(Exception $exception)
|
public function report(Exception $exception)
|
||||||
{
|
{
|
||||||
if ($exception instanceof FireflyException || $exception instanceof ErrorException) {
|
$doMailError = env('SEND_ERROR_MESSAGE', true);
|
||||||
|
if (($exception instanceof FireflyException || $exception instanceof ErrorException) && $doMailError) {
|
||||||
$userData = [
|
$userData = [
|
||||||
'id' => 0,
|
'id' => 0,
|
||||||
'email' => 'unknown@example.com',
|
'email' => 'unknown@example.com',
|
||||||
|
@@ -15,6 +15,7 @@ namespace FireflyIII\Generator\Chart\Bill;
|
|||||||
|
|
||||||
use FireflyIII\Models\Bill;
|
use FireflyIII\Models\Bill;
|
||||||
use FireflyIII\Models\Transaction;
|
use FireflyIII\Models\Transaction;
|
||||||
|
use FireflyIII\Support\ChartColour;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -37,7 +38,7 @@ class ChartJsBillChartGenerator implements BillChartGeneratorInterface
|
|||||||
'datasets' => [
|
'datasets' => [
|
||||||
[
|
[
|
||||||
'data' => [round($unpaid, 2), round(bcmul($paid, '-1'), 2)],
|
'data' => [round($unpaid, 2), round(bcmul($paid, '-1'), 2)],
|
||||||
'backgroundColor' => ['rgba(53, 124, 165,0.7)', 'rgba(0, 141, 76, 0.7)',],
|
'backgroundColor' => [ChartColour::getColour(0), ChartColour::getColour(1)],
|
||||||
],
|
],
|
||||||
|
|
||||||
],
|
],
|
||||||
|
@@ -39,12 +39,11 @@ interface BudgetChartGeneratorInterface
|
|||||||
public function frontpage(Collection $entries): array;
|
public function frontpage(Collection $entries): array;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Collection $entries
|
* @param array $entries
|
||||||
* @param string $viewRange
|
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function period(Collection $entries, string $viewRange) : array;
|
public function period(array $entries) : array;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Collection $budgets
|
* @param Collection $budgets
|
||||||
|
@@ -101,15 +101,15 @@ class ChartJsBudgetChartGenerator implements BudgetChartGeneratorInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Collection $entries
|
* @param array $entries
|
||||||
* @param string $viewRange
|
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function period(Collection $entries, string $viewRange) : array
|
public function period(array $entries) : array
|
||||||
{
|
{
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'labels' => [],
|
'labels' => array_keys($entries),
|
||||||
'datasets' => [
|
'datasets' => [
|
||||||
0 => [
|
0 => [
|
||||||
'label' => trans('firefly.budgeted'),
|
'label' => trans('firefly.budgeted'),
|
||||||
@@ -122,9 +122,8 @@ class ChartJsBudgetChartGenerator implements BudgetChartGeneratorInterface
|
|||||||
],
|
],
|
||||||
'count' => 2,
|
'count' => 2,
|
||||||
];
|
];
|
||||||
foreach ($entries as $entry) {
|
|
||||||
$label = Navigation::periodShow($entry['date'], $viewRange);
|
foreach ($entries as $label => $entry) {
|
||||||
$data['labels'][] = $label;
|
|
||||||
// data set 0 is budgeted
|
// data set 0 is budgeted
|
||||||
// data set 1 is spent:
|
// data set 1 is spent:
|
||||||
$data['datasets'][0]['data'][] = $entry['budgeted'];
|
$data['datasets'][0]['data'][] = $entry['budgeted'];
|
||||||
|
@@ -23,6 +23,13 @@ use Illuminate\Support\Collection;
|
|||||||
interface CategoryChartGeneratorInterface
|
interface CategoryChartGeneratorInterface
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array $data
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function pieChart(array $data): array;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Collection $entries
|
* @param Collection $entries
|
||||||
*
|
*
|
||||||
@@ -30,6 +37,13 @@ interface CategoryChartGeneratorInterface
|
|||||||
*/
|
*/
|
||||||
public function all(Collection $entries): array;
|
public function all(Collection $entries): array;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array $entries
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function mainReportChart(array $entries): array;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Collection $categories
|
* @param Collection $categories
|
||||||
* @param Collection $entries
|
* @param Collection $entries
|
||||||
|
@@ -12,6 +12,7 @@
|
|||||||
declare(strict_types = 1);
|
declare(strict_types = 1);
|
||||||
namespace FireflyIII\Generator\Chart\Category;
|
namespace FireflyIII\Generator\Chart\Category;
|
||||||
|
|
||||||
|
use FireflyIII\Support\ChartColour;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
|
|
||||||
|
|
||||||
@@ -117,6 +118,51 @@ class ChartJsCategoryChartGenerator implements CategoryChartGeneratorInterface
|
|||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array $entries
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function mainReportChart(array $entries): array
|
||||||
|
{
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
'count' => 0,
|
||||||
|
'labels' => array_keys($entries),
|
||||||
|
'datasets' => [],
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
foreach ($entries as $row) {
|
||||||
|
foreach ($row['in'] as $categoryId => $amount) {
|
||||||
|
// get in:
|
||||||
|
$data['datasets'][$categoryId . 'in']['data'][] = round($amount, 2);
|
||||||
|
|
||||||
|
// get out:
|
||||||
|
$opposite = $row['out'][$categoryId];
|
||||||
|
$data['datasets'][$categoryId . 'out']['data'][] = round($opposite, 2);
|
||||||
|
|
||||||
|
// set name:
|
||||||
|
$data['datasets'][$categoryId . 'out']['label'] = $row['name'][$categoryId] . ' (' . strtolower(strval(trans('firefly.expenses'))) . ')';
|
||||||
|
$data['datasets'][$categoryId . 'in']['label'] = $row['name'][$categoryId] . ' (' . strtolower(strval(trans('firefly.income'))) . ')';
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// remove empty rows:
|
||||||
|
foreach ($data['datasets'] as $key => $content) {
|
||||||
|
if (array_sum($content['data']) === 0.0) {
|
||||||
|
unset($data['datasets'][$key]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// re-key the datasets array:
|
||||||
|
$data['datasets'] = array_values($data['datasets']);
|
||||||
|
$data['count'] = count($data['datasets']);
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param Collection $entries
|
* @param Collection $entries
|
||||||
@@ -129,6 +175,35 @@ class ChartJsCategoryChartGenerator implements CategoryChartGeneratorInterface
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array $entries
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function pieChart(array $entries): array
|
||||||
|
{
|
||||||
|
$data = [
|
||||||
|
'datasets' => [
|
||||||
|
0 => [],
|
||||||
|
],
|
||||||
|
'labels' => [],
|
||||||
|
];
|
||||||
|
$index = 0;
|
||||||
|
foreach ($entries as $entry) {
|
||||||
|
|
||||||
|
if (bccomp($entry['amount'], '0') === -1) {
|
||||||
|
$entry['amount'] = bcmul($entry['amount'], '-1');
|
||||||
|
}
|
||||||
|
|
||||||
|
$data['datasets'][0]['data'][] = round($entry['amount'], 2);
|
||||||
|
$data['datasets'][0]['backgroundColor'][] = ChartColour::getColour($index);
|
||||||
|
$data['labels'][] = $entry['name'];
|
||||||
|
$index++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Collection $categories
|
* @param Collection $categories
|
||||||
* @param Collection $entries
|
* @param Collection $entries
|
||||||
|
147
app/Generator/Report/Audit/MonthReportGenerator.php
Normal file
147
app/Generator/Report/Audit/MonthReportGenerator.php
Normal file
@@ -0,0 +1,147 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* MonthReportGenerator.php
|
||||||
|
* Copyright (C) 2016 thegrumpydictator@gmail.com
|
||||||
|
*
|
||||||
|
* This software may be modified and distributed under the terms of the
|
||||||
|
* Creative Commons Attribution-ShareAlike 4.0 International License.
|
||||||
|
*
|
||||||
|
* See the LICENSE file for details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types = 1);
|
||||||
|
|
||||||
|
namespace FireflyIII\Generator\Report\Audit;
|
||||||
|
|
||||||
|
|
||||||
|
use Carbon\Carbon;
|
||||||
|
use FireflyIII\Generator\Report\ReportGeneratorInterface;
|
||||||
|
use FireflyIII\Helpers\Collector\JournalCollector;
|
||||||
|
use FireflyIII\Models\Account;
|
||||||
|
use FireflyIII\Models\Transaction;
|
||||||
|
use Illuminate\Support\Collection;
|
||||||
|
use Steam;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class MonthReportGenerator
|
||||||
|
*
|
||||||
|
* @package FireflyIII\Generator\Report\Standard
|
||||||
|
*/
|
||||||
|
class MonthReportGenerator implements ReportGeneratorInterface
|
||||||
|
{
|
||||||
|
/** @var Collection */
|
||||||
|
private $accounts;
|
||||||
|
/** @var Carbon */
|
||||||
|
private $end;
|
||||||
|
/** @var Carbon */
|
||||||
|
private $start;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function generate(): string
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
$auditData = [];
|
||||||
|
$dayBefore = clone $this->start;
|
||||||
|
$dayBefore->subDay();
|
||||||
|
/** @var Account $account */
|
||||||
|
foreach ($this->accounts as $account) {
|
||||||
|
// balance the day before:
|
||||||
|
$id = $account->id;
|
||||||
|
$dayBeforeBalance = Steam::balance($account, $dayBefore);
|
||||||
|
$collector = new JournalCollector(auth()->user());
|
||||||
|
$collector->setAccounts(new Collection([$account]))->setRange($this->start, $this->end);
|
||||||
|
$journals = $collector->getJournals();
|
||||||
|
$journals = $journals->reverse();
|
||||||
|
$startBalance = $dayBeforeBalance;
|
||||||
|
|
||||||
|
|
||||||
|
/** @var Transaction $journal */
|
||||||
|
foreach ($journals as $transaction) {
|
||||||
|
$transaction->before = $startBalance;
|
||||||
|
$transactionAmount = $transaction->transaction_amount;
|
||||||
|
$newBalance = bcadd($startBalance, $transactionAmount);
|
||||||
|
$transaction->after = $newBalance;
|
||||||
|
$startBalance = $newBalance;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Reverse set again.
|
||||||
|
*/
|
||||||
|
$auditData[$id]['journals'] = $journals->reverse();
|
||||||
|
$auditData[$id]['exists'] = $journals->count() > 0;
|
||||||
|
$auditData[$id]['end'] = $this->end->formatLocalized(strval(trans('config.month_and_day')));
|
||||||
|
$auditData[$id]['endBalance'] = Steam::balance($account, $this->end);
|
||||||
|
$auditData[$id]['dayBefore'] = $dayBefore->formatLocalized(strval(trans('config.month_and_day')));
|
||||||
|
$auditData[$id]['dayBeforeBalance'] = $dayBeforeBalance;
|
||||||
|
}
|
||||||
|
|
||||||
|
$reportType = 'audit';
|
||||||
|
$accountIds = join(',', $this->accounts->pluck('id')->toArray());
|
||||||
|
|
||||||
|
$hideable = ['buttons', 'icon', 'description', 'balance_before', 'amount', 'balance_after', 'date',
|
||||||
|
'interest_date', 'book_date', 'process_date',
|
||||||
|
// three new optional fields.
|
||||||
|
'due_date', 'payment_date', 'invoice_date',
|
||||||
|
'from', 'to', 'budget', 'category', 'bill',
|
||||||
|
// more new optional fields
|
||||||
|
'internal_reference', 'notes',
|
||||||
|
|
||||||
|
'create_date', 'update_date',
|
||||||
|
];
|
||||||
|
$defaultShow = ['icon', 'description', 'balance_before', 'amount', 'balance_after', 'date', 'to'];
|
||||||
|
|
||||||
|
return view('reports.audit.report', compact('reportType', 'accountIds', 'auditData', 'hideable', 'defaultShow'))
|
||||||
|
->with('start', $this->start)->with('end', $this->end)->with('accounts', $this->accounts)
|
||||||
|
->render();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Collection $accounts
|
||||||
|
*
|
||||||
|
* @return ReportGeneratorInterface
|
||||||
|
*/
|
||||||
|
public function setAccounts(Collection $accounts): ReportGeneratorInterface
|
||||||
|
{
|
||||||
|
$this->accounts = $accounts;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Collection $categories
|
||||||
|
*
|
||||||
|
* @return ReportGeneratorInterface
|
||||||
|
*/
|
||||||
|
public function setCategories(Collection $categories): ReportGeneratorInterface
|
||||||
|
{
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Carbon $date
|
||||||
|
*
|
||||||
|
* @return ReportGeneratorInterface
|
||||||
|
*/
|
||||||
|
public function setEndDate(Carbon $date): ReportGeneratorInterface
|
||||||
|
{
|
||||||
|
$this->end = $date;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Carbon $date
|
||||||
|
*
|
||||||
|
* @return ReportGeneratorInterface
|
||||||
|
*/
|
||||||
|
public function setStartDate(Carbon $date): ReportGeneratorInterface
|
||||||
|
{
|
||||||
|
$this->start = $date;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
}
|
27
app/Generator/Report/Audit/MultiYearReportGenerator.php
Normal file
27
app/Generator/Report/Audit/MultiYearReportGenerator.php
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* MultiYearReportGenerator.php
|
||||||
|
* Copyright (C) 2016 thegrumpydictator@gmail.com
|
||||||
|
*
|
||||||
|
* This software may be modified and distributed under the terms of the
|
||||||
|
* Creative Commons Attribution-ShareAlike 4.0 International License.
|
||||||
|
*
|
||||||
|
* See the LICENSE file for details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types = 1);
|
||||||
|
|
||||||
|
namespace FireflyIII\Generator\Report\Audit;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class MultiYearReportGenerator
|
||||||
|
*
|
||||||
|
* @package FireflyIII\Generator\Report\Audit
|
||||||
|
*/
|
||||||
|
class MultiYearReportGenerator extends MonthReportGenerator
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Doesn't do anything different.
|
||||||
|
*/
|
||||||
|
}
|
28
app/Generator/Report/Audit/YearReportGenerator.php
Normal file
28
app/Generator/Report/Audit/YearReportGenerator.php
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* YearReportGenerator.php
|
||||||
|
* Copyright (C) 2016 thegrumpydictator@gmail.com
|
||||||
|
*
|
||||||
|
* This software may be modified and distributed under the terms of the
|
||||||
|
* Creative Commons Attribution-ShareAlike 4.0 International License.
|
||||||
|
*
|
||||||
|
* See the LICENSE file for details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types = 1);
|
||||||
|
|
||||||
|
namespace FireflyIII\Generator\Report\Audit;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class YearReportGenerator
|
||||||
|
*
|
||||||
|
* @package FireflyIII\Generator\Report\Audit
|
||||||
|
*/
|
||||||
|
class YearReportGenerator extends MonthReportGenerator
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Doesn't do anything different.
|
||||||
|
*/
|
||||||
|
}
|
449
app/Generator/Report/Category/MonthReportGenerator.php
Normal file
449
app/Generator/Report/Category/MonthReportGenerator.php
Normal file
@@ -0,0 +1,449 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* MonthReportGenerator.php
|
||||||
|
* Copyright (C) 2016 thegrumpydictator@gmail.com
|
||||||
|
*
|
||||||
|
* This software may be modified and distributed under the terms of the
|
||||||
|
* Creative Commons Attribution-ShareAlike 4.0 International License.
|
||||||
|
*
|
||||||
|
* See the LICENSE file for details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types = 1);
|
||||||
|
|
||||||
|
namespace FireflyIII\Generator\Report\Category;
|
||||||
|
|
||||||
|
|
||||||
|
use Carbon\Carbon;
|
||||||
|
use Crypt;
|
||||||
|
use FireflyIII\Generator\Report\ReportGeneratorInterface;
|
||||||
|
use FireflyIII\Helpers\Collector\JournalCollector;
|
||||||
|
use FireflyIII\Models\Transaction;
|
||||||
|
use FireflyIII\Models\TransactionType;
|
||||||
|
use Illuminate\Support\Collection;
|
||||||
|
use Log;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class MonthReportGenerator
|
||||||
|
*
|
||||||
|
* @package FireflyIII\Generator\Report\Category
|
||||||
|
*/
|
||||||
|
class MonthReportGenerator extends Support implements ReportGeneratorInterface
|
||||||
|
{
|
||||||
|
/** @var Collection */
|
||||||
|
private $accounts;
|
||||||
|
/** @var Collection */
|
||||||
|
private $categories;
|
||||||
|
/** @var Carbon */
|
||||||
|
private $end;
|
||||||
|
/** @var Collection */
|
||||||
|
private $expenses;
|
||||||
|
/** @var Collection */
|
||||||
|
private $income;
|
||||||
|
/** @var Carbon */
|
||||||
|
private $start;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MonthReportGenerator constructor.
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->income = new Collection;
|
||||||
|
$this->expenses = new Collection;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function generate(): string
|
||||||
|
{
|
||||||
|
$accountIds = join(',', $this->accounts->pluck('id')->toArray());
|
||||||
|
$categoryIds = join(',', $this->categories->pluck('id')->toArray());
|
||||||
|
$reportType = 'category';
|
||||||
|
$accountSummary = $this->getAccountSummary();
|
||||||
|
$categorySummary = $this->getCategorySummary();
|
||||||
|
$averageExpenses = $this->getAverageExpenses();
|
||||||
|
$averageIncome = $this->getAverageIncome();
|
||||||
|
$topExpenses = $this->getTopExpenses();
|
||||||
|
$topIncome = $this->getTopIncome();
|
||||||
|
|
||||||
|
|
||||||
|
// render!
|
||||||
|
return view(
|
||||||
|
'reports.category.month',
|
||||||
|
compact(
|
||||||
|
'accountIds', 'categoryIds', 'topIncome', 'reportType', 'accountSummary', 'categorySummary', 'averageExpenses', 'averageIncome', 'topExpenses'
|
||||||
|
)
|
||||||
|
)
|
||||||
|
->with('start', $this->start)->with('end', $this->end)
|
||||||
|
->with('categories', $this->categories)
|
||||||
|
->with('accounts', $this->accounts)
|
||||||
|
->render();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Collection $accounts
|
||||||
|
*
|
||||||
|
* @return ReportGeneratorInterface
|
||||||
|
*/
|
||||||
|
public function setAccounts(Collection $accounts): ReportGeneratorInterface
|
||||||
|
{
|
||||||
|
$this->accounts = $accounts;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Collection $categories
|
||||||
|
*
|
||||||
|
* @return ReportGeneratorInterface
|
||||||
|
*/
|
||||||
|
public function setCategories(Collection $categories): ReportGeneratorInterface
|
||||||
|
{
|
||||||
|
$this->categories = $categories;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Carbon $date
|
||||||
|
*
|
||||||
|
* @return ReportGeneratorInterface
|
||||||
|
*/
|
||||||
|
public function setEndDate(Carbon $date): ReportGeneratorInterface
|
||||||
|
{
|
||||||
|
$this->end = $date;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Carbon $date
|
||||||
|
*
|
||||||
|
* @return ReportGeneratorInterface
|
||||||
|
*/
|
||||||
|
public function setStartDate(Carbon $date): ReportGeneratorInterface
|
||||||
|
{
|
||||||
|
$this->start = $date;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
private function getAccountSummary(): array
|
||||||
|
{
|
||||||
|
$spent = $this->getSpentAccountSummary();
|
||||||
|
$earned = $this->getEarnedAccountSummary();
|
||||||
|
$return = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int $accountId
|
||||||
|
* @var string $entry
|
||||||
|
*/
|
||||||
|
foreach ($spent as $accountId => $entry) {
|
||||||
|
if (!isset($return[$accountId])) {
|
||||||
|
$return[$accountId] = ['spent' => 0, 'earned' => 0];
|
||||||
|
}
|
||||||
|
|
||||||
|
$return[$accountId]['spent'] = $entry;
|
||||||
|
}
|
||||||
|
unset($entry);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int $accountId
|
||||||
|
* @var string $entry
|
||||||
|
*/
|
||||||
|
foreach ($earned as $accountId => $entry) {
|
||||||
|
if (!isset($return[$accountId])) {
|
||||||
|
$return[$accountId] = ['spent' => 0, 'earned' => 0];
|
||||||
|
}
|
||||||
|
|
||||||
|
$return[$accountId]['earned'] = $entry;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return $return;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
private function getAverageExpenses(): array
|
||||||
|
{
|
||||||
|
$expenses = $this->getExpenses();
|
||||||
|
$result = [];
|
||||||
|
/** @var Transaction $transaction */
|
||||||
|
foreach ($expenses as $transaction) {
|
||||||
|
// opposing name and ID:
|
||||||
|
$opposingId = $transaction->opposing_account_id;
|
||||||
|
|
||||||
|
// is not set?
|
||||||
|
if (!isset($result[$opposingId])) {
|
||||||
|
$name = $transaction->opposing_account_name;
|
||||||
|
$encrypted = intval($transaction->opposing_account_encrypted);
|
||||||
|
$name = $encrypted === 1 ? Crypt::decrypt($name) : $name;
|
||||||
|
$result[$opposingId] = [
|
||||||
|
'name' => $name,
|
||||||
|
'count' => 1,
|
||||||
|
'id' => $opposingId,
|
||||||
|
'average' => $transaction->transaction_amount,
|
||||||
|
'sum' => $transaction->transaction_amount,
|
||||||
|
];
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$result[$opposingId]['count']++;
|
||||||
|
$result[$opposingId]['sum'] = bcadd($result[$opposingId]['sum'], $transaction->transaction_amount);
|
||||||
|
$result[$opposingId]['average'] = bcdiv($result[$opposingId]['sum'], strval($result[$opposingId]['count']));
|
||||||
|
}
|
||||||
|
|
||||||
|
// sort result by average:
|
||||||
|
$average = [];
|
||||||
|
foreach ($result as $key => $row) {
|
||||||
|
$average[$key] = floatval($row['average']);
|
||||||
|
}
|
||||||
|
|
||||||
|
array_multisort($average, SORT_ASC, $result);
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
private function getAverageIncome(): array
|
||||||
|
{
|
||||||
|
$expenses = $this->getIncome();
|
||||||
|
$result = [];
|
||||||
|
/** @var Transaction $transaction */
|
||||||
|
foreach ($expenses as $transaction) {
|
||||||
|
// opposing name and ID:
|
||||||
|
$opposingId = $transaction->opposing_account_id;
|
||||||
|
|
||||||
|
// is not set?
|
||||||
|
if (!isset($result[$opposingId])) {
|
||||||
|
$name = $transaction->opposing_account_name;
|
||||||
|
$encrypted = intval($transaction->opposing_account_encrypted);
|
||||||
|
$name = $encrypted === 1 ? Crypt::decrypt($name) : $name;
|
||||||
|
$result[$opposingId] = [
|
||||||
|
'name' => $name,
|
||||||
|
'count' => 1,
|
||||||
|
'id' => $opposingId,
|
||||||
|
'average' => $transaction->transaction_amount,
|
||||||
|
'sum' => $transaction->transaction_amount,
|
||||||
|
];
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$result[$opposingId]['count']++;
|
||||||
|
$result[$opposingId]['sum'] = bcadd($result[$opposingId]['sum'], $transaction->transaction_amount);
|
||||||
|
$result[$opposingId]['average'] = bcdiv($result[$opposingId]['sum'], strval($result[$opposingId]['count']));
|
||||||
|
}
|
||||||
|
|
||||||
|
// sort result by average:
|
||||||
|
$average = [];
|
||||||
|
foreach ($result as $key => $row) {
|
||||||
|
$average[$key] = floatval($row['average']);
|
||||||
|
}
|
||||||
|
|
||||||
|
array_multisort($average, SORT_DESC, $result);
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
private function getCategorySummary(): array
|
||||||
|
{
|
||||||
|
$spent = $this->getSpentCategorySummary();
|
||||||
|
$earned = $this->getEarnedCategorySummary();
|
||||||
|
$return = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int $categoryId
|
||||||
|
* @var string $entry
|
||||||
|
*/
|
||||||
|
foreach ($spent as $categoryId => $entry) {
|
||||||
|
if (!isset($return[$categoryId])) {
|
||||||
|
$return[$categoryId] = ['spent' => 0, 'earned' => 0];
|
||||||
|
}
|
||||||
|
|
||||||
|
$return[$categoryId]['spent'] = $entry;
|
||||||
|
}
|
||||||
|
unset($entry);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int $categoryId
|
||||||
|
* @var string $entry
|
||||||
|
*/
|
||||||
|
foreach ($earned as $categoryId => $entry) {
|
||||||
|
if (!isset($return[$categoryId])) {
|
||||||
|
$return[$categoryId] = ['spent' => 0, 'earned' => 0];
|
||||||
|
}
|
||||||
|
|
||||||
|
$return[$categoryId]['earned'] = $entry;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
private function getEarnedAccountSummary(): array
|
||||||
|
{
|
||||||
|
$transactions = $this->getIncome();
|
||||||
|
$result = [];
|
||||||
|
/** @var Transaction $transaction */
|
||||||
|
foreach ($transactions as $transaction) {
|
||||||
|
$accountId = $transaction->account_id;
|
||||||
|
$result[$accountId] = $result[$accountId] ?? '0';
|
||||||
|
$result[$accountId] = bcadd($transaction->transaction_amount, $result[$accountId]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
private function getEarnedCategorySummary(): array
|
||||||
|
{
|
||||||
|
$transactions = $this->getIncome();
|
||||||
|
$result = [];
|
||||||
|
/** @var Transaction $transaction */
|
||||||
|
foreach ($transactions as $transaction) {
|
||||||
|
$jrnlCatId = intval($transaction->transaction_journal_category_id);
|
||||||
|
$transCatId = intval($transaction->transaction_category_id);
|
||||||
|
$categoryId = max($jrnlCatId, $transCatId);
|
||||||
|
|
||||||
|
$result[$categoryId] = $result[$categoryId] ?? '0';
|
||||||
|
$result[$categoryId] = bcadd($transaction->transaction_amount, $result[$categoryId]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Collection
|
||||||
|
*/
|
||||||
|
private function getExpenses(): Collection
|
||||||
|
{
|
||||||
|
if ($this->expenses->count() > 0) {
|
||||||
|
Log::debug('Return previous set of expenses.');
|
||||||
|
|
||||||
|
return $this->expenses;
|
||||||
|
}
|
||||||
|
|
||||||
|
$collector = new JournalCollector(auth()->user());
|
||||||
|
$collector->setAccounts($this->accounts)->setRange($this->start, $this->end)
|
||||||
|
->setTypes([TransactionType::WITHDRAWAL, TransactionType::TRANSFER])
|
||||||
|
->setCategories($this->categories)->withOpposingAccount()->disableFilter();
|
||||||
|
|
||||||
|
$accountIds = $this->accounts->pluck('id')->toArray();
|
||||||
|
$transactions = $collector->getJournals();
|
||||||
|
$transactions = self::filterExpenses($transactions, $accountIds);
|
||||||
|
$this->expenses = $transactions;
|
||||||
|
|
||||||
|
return $transactions;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Collection
|
||||||
|
*/
|
||||||
|
private function getIncome(): Collection
|
||||||
|
{
|
||||||
|
if ($this->income->count() > 0) {
|
||||||
|
return $this->income;
|
||||||
|
}
|
||||||
|
|
||||||
|
$collector = new JournalCollector(auth()->user());
|
||||||
|
$collector->setAccounts($this->accounts)->setRange($this->start, $this->end)
|
||||||
|
->setTypes([TransactionType::DEPOSIT, TransactionType::TRANSFER])
|
||||||
|
->setCategories($this->categories)->withOpposingAccount();
|
||||||
|
$accountIds = $this->accounts->pluck('id')->toArray();
|
||||||
|
$transactions = $collector->getJournals();
|
||||||
|
$transactions = self::filterIncome($transactions, $accountIds);
|
||||||
|
$this->income = $transactions;
|
||||||
|
|
||||||
|
return $transactions;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
private function getSpentAccountSummary(): array
|
||||||
|
{
|
||||||
|
$transactions = $this->getExpenses();
|
||||||
|
$result = [];
|
||||||
|
/** @var Transaction $transaction */
|
||||||
|
foreach ($transactions as $transaction) {
|
||||||
|
$accountId = $transaction->account_id;
|
||||||
|
$result[$accountId] = $result[$accountId] ?? '0';
|
||||||
|
$result[$accountId] = bcadd($transaction->transaction_amount, $result[$accountId]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
private function getSpentCategorySummary(): array
|
||||||
|
{
|
||||||
|
$transactions = $this->getExpenses();
|
||||||
|
$result = [];
|
||||||
|
/** @var Transaction $transaction */
|
||||||
|
foreach ($transactions as $transaction) {
|
||||||
|
$jrnlCatId = intval($transaction->transaction_journal_category_id);
|
||||||
|
$transCatId = intval($transaction->transaction_category_id);
|
||||||
|
$categoryId = max($jrnlCatId, $transCatId);
|
||||||
|
|
||||||
|
$result[$categoryId] = $result[$categoryId] ?? '0';
|
||||||
|
$result[$categoryId] = bcadd($transaction->transaction_amount, $result[$categoryId]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Collection
|
||||||
|
*/
|
||||||
|
private function getTopExpenses(): Collection
|
||||||
|
{
|
||||||
|
$transactions = $this->getExpenses()->sortBy('transaction_amount');
|
||||||
|
|
||||||
|
$transactions = $transactions->each(
|
||||||
|
function (Transaction $transaction) {
|
||||||
|
if (intval($transaction->opposing_account_encrypted) === 1) {
|
||||||
|
$transaction->opposing_account_name = Crypt::decrypt($transaction->opposing_account_name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
return $transactions;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Collection
|
||||||
|
*/
|
||||||
|
private function getTopIncome(): Collection
|
||||||
|
{
|
||||||
|
$transactions = $this->getIncome()->sortByDesc('transaction_amount');
|
||||||
|
|
||||||
|
$transactions = $transactions->each(
|
||||||
|
function (Transaction $transaction) {
|
||||||
|
if (intval($transaction->opposing_account_encrypted) === 1) {
|
||||||
|
$transaction->opposing_account_name = Crypt::decrypt($transaction->opposing_account_name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
return $transactions;
|
||||||
|
}
|
||||||
|
}
|
27
app/Generator/Report/Category/MultiYearReportGenerator.php
Normal file
27
app/Generator/Report/Category/MultiYearReportGenerator.php
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* MultiYearReportGenerator.php
|
||||||
|
* Copyright (C) 2016 thegrumpydictator@gmail.com
|
||||||
|
*
|
||||||
|
* This software may be modified and distributed under the terms of the
|
||||||
|
* Creative Commons Attribution-ShareAlike 4.0 International License.
|
||||||
|
*
|
||||||
|
* See the LICENSE file for details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types = 1);
|
||||||
|
|
||||||
|
namespace FireflyIII\Generator\Report\Category;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class MultiYearReportGenerator
|
||||||
|
*
|
||||||
|
* @package FireflyIII\Generator\Report\Audit
|
||||||
|
*/
|
||||||
|
class MultiYearReportGenerator extends MonthReportGenerator
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Doesn't do anything different.
|
||||||
|
*/
|
||||||
|
}
|
91
app/Generator/Report/Category/Support.php
Normal file
91
app/Generator/Report/Category/Support.php
Normal file
@@ -0,0 +1,91 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Support.php
|
||||||
|
* Copyright (C) 2016 thegrumpydictator@gmail.com
|
||||||
|
*
|
||||||
|
* This software may be modified and distributed under the terms of the
|
||||||
|
* Creative Commons Attribution-ShareAlike 4.0 International License.
|
||||||
|
*
|
||||||
|
* See the LICENSE file for details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types = 1);
|
||||||
|
|
||||||
|
namespace FireflyIII\Generator\Report\Category;
|
||||||
|
|
||||||
|
use FireflyIII\Models\Transaction;
|
||||||
|
use Illuminate\Support\Collection;
|
||||||
|
use Log;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class Support
|
||||||
|
*
|
||||||
|
* @package FireflyIII\Generator\Report\Category
|
||||||
|
*/
|
||||||
|
class Support
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Collection $collection
|
||||||
|
* @param array $accounts
|
||||||
|
*
|
||||||
|
* @return Collection
|
||||||
|
*/
|
||||||
|
public static function filterExpenses(Collection $collection, array $accounts): Collection
|
||||||
|
{
|
||||||
|
$result = $collection->filter(
|
||||||
|
function (Transaction $transaction) use ($accounts) {
|
||||||
|
$opposing = $transaction->opposing_account_id;
|
||||||
|
// remove internal transfer
|
||||||
|
if (in_array($opposing, $accounts)) {
|
||||||
|
Log::debug(sprintf('Filtered #%d because its opposite is in accounts.', $transaction->id));
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
// remove positive amount
|
||||||
|
if (bccomp($transaction->transaction_amount, '0') === 1) {
|
||||||
|
Log::debug(sprintf('Filtered #%d because amount is %f.', $transaction->id, $transaction->transaction_amount));
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $transaction;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Collection $collection
|
||||||
|
* @param array $accounts
|
||||||
|
*
|
||||||
|
* @return Collection
|
||||||
|
*/
|
||||||
|
public static function filterIncome(Collection $collection, array $accounts): Collection
|
||||||
|
{
|
||||||
|
$result = $collection->filter(
|
||||||
|
function (Transaction $transaction) use ($accounts) {
|
||||||
|
$opposing = $transaction->opposing_account_id;
|
||||||
|
// remove internal transfer
|
||||||
|
if (in_array($opposing, $accounts)) {
|
||||||
|
Log::debug(sprintf('Filtered #%d because its opposite is in accounts.', $transaction->id));
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
// remove positive amount
|
||||||
|
if (bccomp($transaction->transaction_amount, '0') === -1) {
|
||||||
|
Log::debug(sprintf('Filtered #%d because amount is %f.', $transaction->id, $transaction->transaction_amount));
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $transaction;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
28
app/Generator/Report/Category/YearReportGenerator.php
Normal file
28
app/Generator/Report/Category/YearReportGenerator.php
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* YearReportGenerator.php
|
||||||
|
* Copyright (C) 2016 thegrumpydictator@gmail.com
|
||||||
|
*
|
||||||
|
* This software may be modified and distributed under the terms of the
|
||||||
|
* Creative Commons Attribution-ShareAlike 4.0 International License.
|
||||||
|
*
|
||||||
|
* See the LICENSE file for details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types = 1);
|
||||||
|
|
||||||
|
namespace FireflyIII\Generator\Report\Category;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class YearReportGenerator
|
||||||
|
*
|
||||||
|
* @package FireflyIII\Generator\Report\Audit
|
||||||
|
*/
|
||||||
|
class YearReportGenerator extends MonthReportGenerator
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Doesn't do anything different.
|
||||||
|
*/
|
||||||
|
}
|
60
app/Generator/Report/ReportGeneratorFactory.php
Normal file
60
app/Generator/Report/ReportGeneratorFactory.php
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ReportGeneratorFactory.php
|
||||||
|
* Copyright (C) 2016 thegrumpydictator@gmail.com
|
||||||
|
*
|
||||||
|
* This software may be modified and distributed under the terms of the
|
||||||
|
* Creative Commons Attribution-ShareAlike 4.0 International License.
|
||||||
|
*
|
||||||
|
* See the LICENSE file for details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types = 1);
|
||||||
|
|
||||||
|
namespace FireflyIII\Generator\Report;
|
||||||
|
|
||||||
|
use Carbon\Carbon;
|
||||||
|
use FireflyIII\Exceptions\FireflyException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class ReportGeneratorFactory
|
||||||
|
*
|
||||||
|
* @package FireflyIII\Generator\Report
|
||||||
|
*/
|
||||||
|
class ReportGeneratorFactory
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $type
|
||||||
|
* @param Carbon $start
|
||||||
|
* @param Carbon $end
|
||||||
|
*
|
||||||
|
* @return ReportGeneratorInterface
|
||||||
|
* @throws FireflyException
|
||||||
|
*/
|
||||||
|
public static function reportGenerator(string $type, Carbon $start, Carbon $end): ReportGeneratorInterface
|
||||||
|
{
|
||||||
|
$period = 'Month';
|
||||||
|
// more than two months date difference means year report.
|
||||||
|
if ($start->diffInMonths($end) > 1) {
|
||||||
|
$period = 'Year';
|
||||||
|
}
|
||||||
|
|
||||||
|
// more than one year date difference means multi year report.
|
||||||
|
if ($start->diffInMonths($end) > 12) {
|
||||||
|
$period = 'MultiYear';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$class = sprintf('FireflyIII\Generator\Report\%s\%sReportGenerator', $type, $period);
|
||||||
|
if (class_exists($class)) {
|
||||||
|
/** @var ReportGeneratorInterface $obj */
|
||||||
|
$obj = new $class;
|
||||||
|
$obj->setStartDate($start);
|
||||||
|
$obj->setEndDate($end);
|
||||||
|
|
||||||
|
return $obj;
|
||||||
|
}
|
||||||
|
throw new FireflyException(sprintf('Cannot generate report. There is no "%s"-report for period "%s".', $type, $period));
|
||||||
|
}
|
||||||
|
}
|
60
app/Generator/Report/ReportGeneratorInterface.php
Normal file
60
app/Generator/Report/ReportGeneratorInterface.php
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ReportGeneratorInterface.php
|
||||||
|
* Copyright (C) 2016 thegrumpydictator@gmail.com
|
||||||
|
*
|
||||||
|
* This software may be modified and distributed under the terms of the
|
||||||
|
* Creative Commons Attribution-ShareAlike 4.0 International License.
|
||||||
|
*
|
||||||
|
* See the LICENSE file for details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types = 1);
|
||||||
|
|
||||||
|
namespace FireflyIII\Generator\Report;
|
||||||
|
|
||||||
|
|
||||||
|
use Carbon\Carbon;
|
||||||
|
use Illuminate\Support\Collection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interface ReportGeneratorInterface
|
||||||
|
*
|
||||||
|
* @package FireflyIII\Generator\Report
|
||||||
|
*/
|
||||||
|
interface ReportGeneratorInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function generate(): string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Collection $accounts
|
||||||
|
*
|
||||||
|
* @return ReportGeneratorInterface
|
||||||
|
*/
|
||||||
|
public function setAccounts(Collection $accounts): ReportGeneratorInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Collection $categories
|
||||||
|
*
|
||||||
|
* @return ReportGeneratorInterface
|
||||||
|
*/
|
||||||
|
public function setCategories(Collection $categories): ReportGeneratorInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Carbon $date
|
||||||
|
*
|
||||||
|
* @return ReportGeneratorInterface
|
||||||
|
*/
|
||||||
|
public function setEndDate(Carbon $date): ReportGeneratorInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Carbon $date
|
||||||
|
*
|
||||||
|
* @return ReportGeneratorInterface
|
||||||
|
*/
|
||||||
|
public function setStartDate(Carbon $date): ReportGeneratorInterface;
|
||||||
|
|
||||||
|
}
|
100
app/Generator/Report/Standard/MonthReportGenerator.php
Normal file
100
app/Generator/Report/Standard/MonthReportGenerator.php
Normal file
@@ -0,0 +1,100 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* MonthReportGenerator.php
|
||||||
|
* Copyright (C) 2016 thegrumpydictator@gmail.com
|
||||||
|
*
|
||||||
|
* This software may be modified and distributed under the terms of the
|
||||||
|
* Creative Commons Attribution-ShareAlike 4.0 International License.
|
||||||
|
*
|
||||||
|
* See the LICENSE file for details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types = 1);
|
||||||
|
|
||||||
|
namespace FireflyIII\Generator\Report\Standard;
|
||||||
|
|
||||||
|
|
||||||
|
use Carbon\Carbon;
|
||||||
|
use FireflyIII\Generator\Report\ReportGeneratorInterface;
|
||||||
|
use FireflyIII\Helpers\Report\ReportHelperInterface;
|
||||||
|
use Illuminate\Support\Collection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class MonthReportGenerator
|
||||||
|
*
|
||||||
|
* @package FireflyIII\Generator\Report\Standard
|
||||||
|
*/
|
||||||
|
class MonthReportGenerator implements ReportGeneratorInterface
|
||||||
|
{
|
||||||
|
/** @var Collection */
|
||||||
|
private $accounts;
|
||||||
|
/** @var Carbon */
|
||||||
|
private $end;
|
||||||
|
/** @var Carbon */
|
||||||
|
private $start;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function generate(): string
|
||||||
|
{
|
||||||
|
$helper = app(ReportHelperInterface::class);
|
||||||
|
$bills = $helper->getBillReport($this->start, $this->end, $this->accounts);
|
||||||
|
|
||||||
|
// and some id's, joined:
|
||||||
|
$accountIds = join(',', $this->accounts->pluck('id')->toArray());
|
||||||
|
$reportType = 'default';
|
||||||
|
|
||||||
|
// continue!
|
||||||
|
return view(
|
||||||
|
'reports.default.month',
|
||||||
|
compact('bills', 'accountIds', 'reportType')
|
||||||
|
)->with('start', $this->start)->with('end', $this->end)->render();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Collection $accounts
|
||||||
|
*
|
||||||
|
* @return ReportGeneratorInterface
|
||||||
|
*/
|
||||||
|
public function setAccounts(Collection $accounts): ReportGeneratorInterface
|
||||||
|
{
|
||||||
|
$this->accounts = $accounts;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Carbon $date
|
||||||
|
*
|
||||||
|
* @return ReportGeneratorInterface
|
||||||
|
*/
|
||||||
|
public function setEndDate(Carbon $date): ReportGeneratorInterface
|
||||||
|
{
|
||||||
|
$this->end = $date;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Carbon $date
|
||||||
|
*
|
||||||
|
* @return ReportGeneratorInterface
|
||||||
|
*/
|
||||||
|
public function setStartDate(Carbon $date): ReportGeneratorInterface
|
||||||
|
{
|
||||||
|
$this->start = $date;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Collection $categories
|
||||||
|
*
|
||||||
|
* @return ReportGeneratorInterface
|
||||||
|
*/
|
||||||
|
public function setCategories(Collection $categories): ReportGeneratorInterface
|
||||||
|
{
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
}
|
96
app/Generator/Report/Standard/MultiYearReportGenerator.php
Normal file
96
app/Generator/Report/Standard/MultiYearReportGenerator.php
Normal file
@@ -0,0 +1,96 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* MultiYearReportGenerator.php
|
||||||
|
* Copyright (C) 2016 thegrumpydictator@gmail.com
|
||||||
|
*
|
||||||
|
* This software may be modified and distributed under the terms of the
|
||||||
|
* Creative Commons Attribution-ShareAlike 4.0 International License.
|
||||||
|
*
|
||||||
|
* See the LICENSE file for details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types = 1);
|
||||||
|
|
||||||
|
namespace FireflyIII\Generator\Report\Standard;
|
||||||
|
|
||||||
|
|
||||||
|
use Carbon\Carbon;
|
||||||
|
use FireflyIII\Generator\Report\ReportGeneratorInterface;
|
||||||
|
use Illuminate\Support\Collection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class MonthReportGenerator
|
||||||
|
*
|
||||||
|
* @package FireflyIII\Generator\Report\Standard
|
||||||
|
*/
|
||||||
|
class MultiYearReportGenerator implements ReportGeneratorInterface
|
||||||
|
{
|
||||||
|
/** @var Collection */
|
||||||
|
private $accounts;
|
||||||
|
/** @var Carbon */
|
||||||
|
private $end;
|
||||||
|
/** @var Carbon */
|
||||||
|
private $start;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function generate(): string
|
||||||
|
{
|
||||||
|
// and some id's, joined:
|
||||||
|
$accountIds = join(',', $this->accounts->pluck('id')->toArray());
|
||||||
|
$reportType = 'default';
|
||||||
|
|
||||||
|
// continue!
|
||||||
|
return view(
|
||||||
|
'reports.default.multi-year',
|
||||||
|
compact('accountIds', 'reportType')
|
||||||
|
)->with('start', $this->start)->with('end', $this->end)->render();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Collection $accounts
|
||||||
|
*
|
||||||
|
* @return ReportGeneratorInterface
|
||||||
|
*/
|
||||||
|
public function setAccounts(Collection $accounts): ReportGeneratorInterface
|
||||||
|
{
|
||||||
|
$this->accounts = $accounts;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Collection $categories
|
||||||
|
*
|
||||||
|
* @return ReportGeneratorInterface
|
||||||
|
*/
|
||||||
|
public function setCategories(Collection $categories): ReportGeneratorInterface
|
||||||
|
{
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Carbon $date
|
||||||
|
*
|
||||||
|
* @return ReportGeneratorInterface
|
||||||
|
*/
|
||||||
|
public function setEndDate(Carbon $date): ReportGeneratorInterface
|
||||||
|
{
|
||||||
|
$this->end = $date;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Carbon $date
|
||||||
|
*
|
||||||
|
* @return ReportGeneratorInterface
|
||||||
|
*/
|
||||||
|
public function setStartDate(Carbon $date): ReportGeneratorInterface
|
||||||
|
{
|
||||||
|
$this->start = $date;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
}
|
96
app/Generator/Report/Standard/YearReportGenerator.php
Normal file
96
app/Generator/Report/Standard/YearReportGenerator.php
Normal file
@@ -0,0 +1,96 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* YearReportGenerator.php
|
||||||
|
* Copyright (C) 2016 thegrumpydictator@gmail.com
|
||||||
|
*
|
||||||
|
* This software may be modified and distributed under the terms of the
|
||||||
|
* Creative Commons Attribution-ShareAlike 4.0 International License.
|
||||||
|
*
|
||||||
|
* See the LICENSE file for details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types = 1);
|
||||||
|
|
||||||
|
namespace FireflyIII\Generator\Report\Standard;
|
||||||
|
|
||||||
|
|
||||||
|
use Carbon\Carbon;
|
||||||
|
use FireflyIII\Generator\Report\ReportGeneratorInterface;
|
||||||
|
use Illuminate\Support\Collection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class MonthReportGenerator
|
||||||
|
*
|
||||||
|
* @package FireflyIII\Generator\Report\Standard
|
||||||
|
*/
|
||||||
|
class YearReportGenerator implements ReportGeneratorInterface
|
||||||
|
{
|
||||||
|
/** @var Collection */
|
||||||
|
private $accounts;
|
||||||
|
/** @var Carbon */
|
||||||
|
private $end;
|
||||||
|
/** @var Carbon */
|
||||||
|
private $start;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function generate(): string
|
||||||
|
{
|
||||||
|
// and some id's, joined:
|
||||||
|
$accountIds = join(',', $this->accounts->pluck('id')->toArray());
|
||||||
|
$reportType = 'default';
|
||||||
|
|
||||||
|
// continue!
|
||||||
|
return view(
|
||||||
|
'reports.default.year',
|
||||||
|
compact('accountIds', 'reportType')
|
||||||
|
)->with('start', $this->start)->with('end', $this->end)->render();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Collection $accounts
|
||||||
|
*
|
||||||
|
* @return ReportGeneratorInterface
|
||||||
|
*/
|
||||||
|
public function setAccounts(Collection $accounts): ReportGeneratorInterface
|
||||||
|
{
|
||||||
|
$this->accounts = $accounts;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Collection $categories
|
||||||
|
*
|
||||||
|
* @return ReportGeneratorInterface
|
||||||
|
*/
|
||||||
|
public function setCategories(Collection $categories): ReportGeneratorInterface
|
||||||
|
{
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Carbon $date
|
||||||
|
*
|
||||||
|
* @return ReportGeneratorInterface
|
||||||
|
*/
|
||||||
|
public function setEndDate(Carbon $date): ReportGeneratorInterface
|
||||||
|
{
|
||||||
|
$this->end = $date;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Carbon $date
|
||||||
|
*
|
||||||
|
* @return ReportGeneratorInterface
|
||||||
|
*/
|
||||||
|
public function setStartDate(Carbon $date): ReportGeneratorInterface
|
||||||
|
{
|
||||||
|
$this->start = $date;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
}
|
@@ -14,8 +14,10 @@ declare(strict_types = 1);
|
|||||||
namespace FireflyIII\Handlers\Events;
|
namespace FireflyIII\Handlers\Events;
|
||||||
|
|
||||||
|
|
||||||
|
use Carbon\Carbon;
|
||||||
use FireflyIII\Events\StoredBudgetLimit;
|
use FireflyIII\Events\StoredBudgetLimit;
|
||||||
use FireflyIII\Events\UpdatedBudgetLimit;
|
use FireflyIII\Events\UpdatedBudgetLimit;
|
||||||
|
use FireflyIII\Models\BudgetLimit;
|
||||||
use FireflyIII\Models\LimitRepetition;
|
use FireflyIII\Models\LimitRepetition;
|
||||||
use Illuminate\Database\QueryException;
|
use Illuminate\Database\QueryException;
|
||||||
use Log;
|
use Log;
|
||||||
@@ -38,37 +40,9 @@ class BudgetEventHandler
|
|||||||
*/
|
*/
|
||||||
public function storeRepetition(StoredBudgetLimit $event):bool
|
public function storeRepetition(StoredBudgetLimit $event):bool
|
||||||
{
|
{
|
||||||
$budgetLimit = $event->budgetLimit;
|
return $this->processRepetitionChange($event->budgetLimit, $event->end);
|
||||||
$end = $event->end;
|
|
||||||
$set = $budgetLimit->limitrepetitions()
|
|
||||||
->where('startdate', $budgetLimit->startdate->format('Y-m-d 00:00:00'))
|
|
||||||
->where('enddate', $end->format('Y-m-d 00:00:00'))
|
|
||||||
->get();
|
|
||||||
if ($set->count() == 0) {
|
|
||||||
$repetition = new LimitRepetition;
|
|
||||||
$repetition->startdate = $budgetLimit->startdate;
|
|
||||||
$repetition->enddate = $end;
|
|
||||||
$repetition->amount = $budgetLimit->amount;
|
|
||||||
$repetition->budgetLimit()->associate($budgetLimit);
|
|
||||||
|
|
||||||
try {
|
|
||||||
$repetition->save();
|
|
||||||
} catch (QueryException $e) {
|
|
||||||
Log::error('Trying to save new LimitRepetition failed: ' . $e->getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($set->count() == 1) {
|
|
||||||
$repetition = $set->first();
|
|
||||||
$repetition->amount = $budgetLimit->amount;
|
|
||||||
$repetition->save();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates, if present the budget limit repetition part of a budget limit.
|
* Updates, if present the budget limit repetition part of a budget limit.
|
||||||
*
|
*
|
||||||
@@ -78,16 +52,25 @@ class BudgetEventHandler
|
|||||||
*/
|
*/
|
||||||
public function updateRepetition(UpdatedBudgetLimit $event): bool
|
public function updateRepetition(UpdatedBudgetLimit $event): bool
|
||||||
{
|
{
|
||||||
$budgetLimit = $event->budgetLimit;
|
return $this->processRepetitionChange($event->budgetLimit, $event->end);
|
||||||
$end = $event->end;
|
}
|
||||||
$set = $budgetLimit->limitrepetitions()
|
|
||||||
->where('startdate', $budgetLimit->startdate->format('Y-m-d 00:00:00'))
|
/**
|
||||||
->where('enddate', $end->format('Y-m-d 00:00:00'))
|
* @param BudgetLimit $budgetLimit
|
||||||
->get();
|
* @param Carbon $date
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
private function processRepetitionChange(BudgetLimit $budgetLimit, Carbon $date):bool
|
||||||
|
{
|
||||||
|
$set = $budgetLimit->limitrepetitions()
|
||||||
|
->where('startdate', $budgetLimit->startdate->format('Y-m-d 00:00:00'))
|
||||||
|
->where('enddate', $date->format('Y-m-d 00:00:00'))
|
||||||
|
->get();
|
||||||
if ($set->count() == 0) {
|
if ($set->count() == 0) {
|
||||||
$repetition = new LimitRepetition;
|
$repetition = new LimitRepetition;
|
||||||
$repetition->startdate = $budgetLimit->startdate;
|
$repetition->startdate = $budgetLimit->startdate;
|
||||||
$repetition->enddate = $end;
|
$repetition->enddate = $date;
|
||||||
$repetition->amount = $budgetLimit->amount;
|
$repetition->amount = $budgetLimit->amount;
|
||||||
$repetition->budgetLimit()->associate($budgetLimit);
|
$repetition->budgetLimit()->associate($budgetLimit);
|
||||||
|
|
||||||
|
@@ -14,10 +14,12 @@ declare(strict_types = 1);
|
|||||||
namespace FireflyIII\Handlers\Events;
|
namespace FireflyIII\Handlers\Events;
|
||||||
|
|
||||||
use Exception;
|
use Exception;
|
||||||
|
use FireflyConfig;
|
||||||
use FireflyIII\Events\ConfirmedUser;
|
use FireflyIII\Events\ConfirmedUser;
|
||||||
use FireflyIII\Events\RegisteredUser;
|
use FireflyIII\Events\RegisteredUser;
|
||||||
use FireflyIII\Events\ResentConfirmation;
|
use FireflyIII\Events\ResentConfirmation;
|
||||||
use FireflyIII\Repositories\User\UserRepositoryInterface;
|
use FireflyIII\Repositories\User\UserRepositoryInterface;
|
||||||
|
use FireflyIII\User;
|
||||||
use Illuminate\Mail\Message;
|
use Illuminate\Mail\Message;
|
||||||
use Log;
|
use Log;
|
||||||
use Mail;
|
use Mail;
|
||||||
@@ -81,36 +83,7 @@ class UserEventHandler
|
|||||||
*/
|
*/
|
||||||
public function sendConfirmationMessage(RegisteredUser $event): bool
|
public function sendConfirmationMessage(RegisteredUser $event): bool
|
||||||
{
|
{
|
||||||
$user = $event->user;
|
return $this->sendConfirmation($event->user, $event->ipAddress);
|
||||||
$ipAddress = $event->ipAddress;
|
|
||||||
$confirmAccount = env('MUST_CONFIRM_ACCOUNT', false);
|
|
||||||
if ($confirmAccount === false) {
|
|
||||||
Preferences::setForUser($user, 'user_confirmed', true);
|
|
||||||
Preferences::setForUser($user, 'user_confirmed_last_mail', 0);
|
|
||||||
Preferences::mark();
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
$email = $user->email;
|
|
||||||
$code = str_random(16);
|
|
||||||
$route = route('do_confirm_account', [$code]);
|
|
||||||
Preferences::setForUser($user, 'user_confirmed', false);
|
|
||||||
Preferences::setForUser($user, 'user_confirmed_last_mail', time());
|
|
||||||
Preferences::setForUser($user, 'user_confirmed_code', $code);
|
|
||||||
try {
|
|
||||||
Mail::send(
|
|
||||||
['emails.confirm-account-html', 'emails.confirm-account'], ['route' => $route, 'ip' => $ipAddress],
|
|
||||||
function (Message $message) use ($email) {
|
|
||||||
$message->to($email, $email)->subject('Please confirm your Firefly III account');
|
|
||||||
}
|
|
||||||
);
|
|
||||||
} catch (Swift_TransportException $e) {
|
|
||||||
Log::error($e->getMessage());
|
|
||||||
} catch (Exception $e) {
|
|
||||||
Log::error($e->getMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -124,36 +97,7 @@ class UserEventHandler
|
|||||||
*/
|
*/
|
||||||
function sendConfirmationMessageAgain(ResentConfirmation $event): bool
|
function sendConfirmationMessageAgain(ResentConfirmation $event): bool
|
||||||
{
|
{
|
||||||
$user = $event->user;
|
return $this->sendConfirmation($event->user, $event->ipAddress);
|
||||||
$ipAddress = $event->ipAddress;
|
|
||||||
$confirmAccount = env('MUST_CONFIRM_ACCOUNT', false);
|
|
||||||
if ($confirmAccount === false) {
|
|
||||||
Preferences::setForUser($user, 'user_confirmed', true);
|
|
||||||
Preferences::setForUser($user, 'user_confirmed_last_mail', 0);
|
|
||||||
Preferences::mark();
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
$email = $user->email;
|
|
||||||
$code = str_random(16);
|
|
||||||
$route = route('do_confirm_account', [$code]);
|
|
||||||
Preferences::setForUser($user, 'user_confirmed', false);
|
|
||||||
Preferences::setForUser($user, 'user_confirmed_last_mail', time());
|
|
||||||
Preferences::setForUser($user, 'user_confirmed_code', $code);
|
|
||||||
try {
|
|
||||||
Mail::send(
|
|
||||||
['emails.confirm-account-html', 'emails.confirm-account'], ['route' => $route, 'ip' => $ipAddress],
|
|
||||||
function (Message $message) use ($email) {
|
|
||||||
$message->to($email, $email)->subject('Please confirm your Firefly III account');
|
|
||||||
}
|
|
||||||
);
|
|
||||||
} catch (Swift_TransportException $e) {
|
|
||||||
Log::error($e->getMessage());
|
|
||||||
} catch (Exception $e) {
|
|
||||||
Log::error($e->getMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -222,4 +166,43 @@ class UserEventHandler
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param User $user
|
||||||
|
* @param string $ipAddress
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
private function sendConfirmation(User $user, string $ipAddress): bool
|
||||||
|
{
|
||||||
|
$mustConfirmAccount = FireflyConfig::get('must_confirm_account', config('firefly.configuration.must_confirm_account'))->data;
|
||||||
|
if ($mustConfirmAccount === false) {
|
||||||
|
Preferences::setForUser($user, 'user_confirmed', true);
|
||||||
|
Preferences::setForUser($user, 'user_confirmed_last_mail', 0);
|
||||||
|
Preferences::mark();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
$email = $user->email;
|
||||||
|
$code = str_random(16);
|
||||||
|
$route = route('do_confirm_account', [$code]);
|
||||||
|
Preferences::setForUser($user, 'user_confirmed', false);
|
||||||
|
Preferences::setForUser($user, 'user_confirmed_last_mail', time());
|
||||||
|
Preferences::setForUser($user, 'user_confirmed_code', $code);
|
||||||
|
try {
|
||||||
|
Mail::send(
|
||||||
|
['emails.confirm-account-html', 'emails.confirm-account'], ['route' => $route, 'ip' => $ipAddress],
|
||||||
|
function (Message $message) use ($email) {
|
||||||
|
$message->to($email, $email)->subject('Please confirm your Firefly III account');
|
||||||
|
}
|
||||||
|
);
|
||||||
|
} catch (Swift_TransportException $e) {
|
||||||
|
Log::error($e->getMessage());
|
||||||
|
} catch (Exception $e) {
|
||||||
|
Log::error($e->getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -6,6 +6,7 @@ namespace FireflyIII\Helpers\Collector;
|
|||||||
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Crypt;
|
use Crypt;
|
||||||
|
use DB;
|
||||||
use FireflyIII\Exceptions\FireflyException;
|
use FireflyIII\Exceptions\FireflyException;
|
||||||
use FireflyIII\Models\AccountType;
|
use FireflyIII\Models\AccountType;
|
||||||
use FireflyIII\Models\Budget;
|
use FireflyIII\Models\Budget;
|
||||||
@@ -16,6 +17,7 @@ use FireflyIII\Models\TransactionType;
|
|||||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||||
use FireflyIII\User;
|
use FireflyIII\User;
|
||||||
use Illuminate\Database\Eloquent\Builder as EloquentBuilder;
|
use Illuminate\Database\Eloquent\Builder as EloquentBuilder;
|
||||||
|
use Illuminate\Database\Query\JoinClause;
|
||||||
use Illuminate\Pagination\LengthAwarePaginator;
|
use Illuminate\Pagination\LengthAwarePaginator;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
use Log;
|
use Log;
|
||||||
@@ -27,12 +29,13 @@ use Log;
|
|||||||
*
|
*
|
||||||
* @package FireflyIII\Helpers\Collector
|
* @package FireflyIII\Helpers\Collector
|
||||||
*/
|
*/
|
||||||
class JournalCollector
|
class JournalCollector implements JournalCollectorInterface
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/** @var array */
|
||||||
|
private $accountIds = [];
|
||||||
/** @var int */
|
/** @var int */
|
||||||
private $count = 0;
|
private $count = 0;
|
||||||
|
|
||||||
/** @var array */
|
/** @var array */
|
||||||
private $fields
|
private $fields
|
||||||
= [
|
= [
|
||||||
@@ -63,6 +66,8 @@ class JournalCollector
|
|||||||
/** @var bool */
|
/** @var bool */
|
||||||
private $joinedCategory = false;
|
private $joinedCategory = false;
|
||||||
/** @var bool */
|
/** @var bool */
|
||||||
|
private $joinedOpposing = false;
|
||||||
|
/** @var bool */
|
||||||
private $joinedTag = false;
|
private $joinedTag = false;
|
||||||
/** @var int */
|
/** @var int */
|
||||||
private $limit;
|
private $limit;
|
||||||
@@ -112,6 +117,16 @@ class JournalCollector
|
|||||||
return $this->count;
|
return $this->count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return JournalCollectorInterface
|
||||||
|
*/
|
||||||
|
public function disableFilter(): JournalCollectorInterface
|
||||||
|
{
|
||||||
|
$this->filterTransfers = false;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Collection
|
* @return Collection
|
||||||
*/
|
*/
|
||||||
@@ -119,7 +134,9 @@ class JournalCollector
|
|||||||
{
|
{
|
||||||
$this->run = true;
|
$this->run = true;
|
||||||
$set = $this->query->get(array_values($this->fields));
|
$set = $this->query->get(array_values($this->fields));
|
||||||
$set = $this->filterTransfers($set);
|
Log::debug(sprintf('Count of set is %d', $set->count()));
|
||||||
|
$set = $this->filterTransfers($set);
|
||||||
|
Log::debug(sprintf('Count of set after filterTransfers() is %d', $set->count()));
|
||||||
|
|
||||||
// loop for decryption.
|
// loop for decryption.
|
||||||
$set->each(
|
$set->each(
|
||||||
@@ -152,26 +169,29 @@ class JournalCollector
|
|||||||
/**
|
/**
|
||||||
* @param Collection $accounts
|
* @param Collection $accounts
|
||||||
*
|
*
|
||||||
* @return JournalCollector
|
* @return JournalCollectorInterface
|
||||||
*/
|
*/
|
||||||
public function setAccounts(Collection $accounts): JournalCollector
|
public function setAccounts(Collection $accounts): JournalCollectorInterface
|
||||||
{
|
{
|
||||||
if ($accounts->count() > 0) {
|
if ($accounts->count() > 0) {
|
||||||
$accountIds = $accounts->pluck('id')->toArray();
|
$accountIds = $accounts->pluck('id')->toArray();
|
||||||
$this->query->whereIn('transactions.account_id', $accountIds);
|
$this->query->whereIn('transactions.account_id', $accountIds);
|
||||||
|
Log::debug(sprintf('setAccounts: %s', join(', ', $accountIds)));
|
||||||
|
$this->accountIds = $accountIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($accounts->count() > 1) {
|
if ($accounts->count() > 1) {
|
||||||
$this->filterTransfers = true;
|
$this->filterTransfers = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return JournalCollector
|
* @return JournalCollectorInterface
|
||||||
*/
|
*/
|
||||||
public function setAllAssetAccounts(): JournalCollector
|
public function setAllAssetAccounts(): JournalCollectorInterface
|
||||||
{
|
{
|
||||||
/** @var AccountRepositoryInterface $repository */
|
/** @var AccountRepositoryInterface $repository */
|
||||||
$repository = app(AccountRepositoryInterface::class, [$this->user]);
|
$repository = app(AccountRepositoryInterface::class, [$this->user]);
|
||||||
@@ -179,6 +199,7 @@ class JournalCollector
|
|||||||
if ($accounts->count() > 0) {
|
if ($accounts->count() > 0) {
|
||||||
$accountIds = $accounts->pluck('id')->toArray();
|
$accountIds = $accounts->pluck('id')->toArray();
|
||||||
$this->query->whereIn('transactions.account_id', $accountIds);
|
$this->query->whereIn('transactions.account_id', $accountIds);
|
||||||
|
$this->accountIds = $accountIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($accounts->count() > 1) {
|
if ($accounts->count() > 1) {
|
||||||
@@ -191,9 +212,9 @@ class JournalCollector
|
|||||||
/**
|
/**
|
||||||
* @param Collection $bills
|
* @param Collection $bills
|
||||||
*
|
*
|
||||||
* @return JournalCollector
|
* @return JournalCollectorInterface
|
||||||
*/
|
*/
|
||||||
public function setBills(Collection $bills): JournalCollector
|
public function setBills(Collection $bills): JournalCollectorInterface
|
||||||
{
|
{
|
||||||
if ($bills->count() > 0) {
|
if ($bills->count() > 0) {
|
||||||
$billIds = $bills->pluck('id')->toArray();
|
$billIds = $bills->pluck('id')->toArray();
|
||||||
@@ -207,9 +228,9 @@ class JournalCollector
|
|||||||
/**
|
/**
|
||||||
* @param Budget $budget
|
* @param Budget $budget
|
||||||
*
|
*
|
||||||
* @return JournalCollector
|
* @return JournalCollectorInterface
|
||||||
*/
|
*/
|
||||||
public function setBudget(Budget $budget): JournalCollector
|
public function setBudget(Budget $budget): JournalCollectorInterface
|
||||||
{
|
{
|
||||||
$this->joinBudgetTables();
|
$this->joinBudgetTables();
|
||||||
|
|
||||||
@@ -223,12 +244,35 @@ class JournalCollector
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Collection $categories
|
||||||
|
*
|
||||||
|
* @return JournalCollectorInterface
|
||||||
|
*/
|
||||||
|
public function setCategories(Collection $categories): JournalCollectorInterface
|
||||||
|
{
|
||||||
|
$categoryIds = $categories->pluck('id')->toArray();
|
||||||
|
if (count($categoryIds) === 0) {
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
$this->joinCategoryTables();
|
||||||
|
|
||||||
|
$this->query->where(
|
||||||
|
function (EloquentBuilder $q) use ($categoryIds) {
|
||||||
|
$q->whereIn('category_transaction.category_id', $categoryIds);
|
||||||
|
$q->orWhereIn('category_transaction_journal.category_id', $categoryIds);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Category $category
|
* @param Category $category
|
||||||
*
|
*
|
||||||
* @return JournalCollector
|
* @return JournalCollectorInterface
|
||||||
*/
|
*/
|
||||||
public function setCategory(Category $category): JournalCollector
|
public function setCategory(Category $category): JournalCollectorInterface
|
||||||
{
|
{
|
||||||
$this->joinCategoryTables();
|
$this->joinCategoryTables();
|
||||||
|
|
||||||
@@ -245,9 +289,9 @@ class JournalCollector
|
|||||||
/**
|
/**
|
||||||
* @param int $limit
|
* @param int $limit
|
||||||
*
|
*
|
||||||
* @return JournalCollector
|
* @return JournalCollectorInterface
|
||||||
*/
|
*/
|
||||||
public function setLimit(int $limit): JournalCollector
|
public function setLimit(int $limit): JournalCollectorInterface
|
||||||
{
|
{
|
||||||
$this->limit = $limit;
|
$this->limit = $limit;
|
||||||
$this->query->limit($limit);
|
$this->query->limit($limit);
|
||||||
@@ -259,9 +303,9 @@ class JournalCollector
|
|||||||
/**
|
/**
|
||||||
* @param int $offset
|
* @param int $offset
|
||||||
*
|
*
|
||||||
* @return JournalCollector
|
* @return JournalCollectorInterface
|
||||||
*/
|
*/
|
||||||
public function setOffset(int $offset): JournalCollector
|
public function setOffset(int $offset): JournalCollectorInterface
|
||||||
{
|
{
|
||||||
$this->offset = $offset;
|
$this->offset = $offset;
|
||||||
|
|
||||||
@@ -271,9 +315,9 @@ class JournalCollector
|
|||||||
/**
|
/**
|
||||||
* @param int $page
|
* @param int $page
|
||||||
*
|
*
|
||||||
* @return JournalCollector
|
* @return JournalCollectorInterface
|
||||||
*/
|
*/
|
||||||
public function setPage(int $page): JournalCollector
|
public function setPage(int $page): JournalCollectorInterface
|
||||||
{
|
{
|
||||||
$this->page = $page;
|
$this->page = $page;
|
||||||
|
|
||||||
@@ -299,9 +343,9 @@ class JournalCollector
|
|||||||
* @param Carbon $start
|
* @param Carbon $start
|
||||||
* @param Carbon $end
|
* @param Carbon $end
|
||||||
*
|
*
|
||||||
* @return JournalCollector
|
* @return JournalCollectorInterface
|
||||||
*/
|
*/
|
||||||
public function setRange(Carbon $start, Carbon $end): JournalCollector
|
public function setRange(Carbon $start, Carbon $end): JournalCollectorInterface
|
||||||
{
|
{
|
||||||
if ($start <= $end) {
|
if ($start <= $end) {
|
||||||
$this->query->where('transaction_journals.date', '>=', $start->format('Y-m-d'));
|
$this->query->where('transaction_journals.date', '>=', $start->format('Y-m-d'));
|
||||||
@@ -314,9 +358,9 @@ class JournalCollector
|
|||||||
/**
|
/**
|
||||||
* @param Tag $tag
|
* @param Tag $tag
|
||||||
*
|
*
|
||||||
* @return JournalCollector
|
* @return JournalCollectorInterface
|
||||||
*/
|
*/
|
||||||
public function setTag(Tag $tag): JournalCollector
|
public function setTag(Tag $tag): JournalCollectorInterface
|
||||||
{
|
{
|
||||||
$this->joinTagTables();
|
$this->joinTagTables();
|
||||||
$this->query->where('tag_transaction_journal.tag_id', $tag->id);
|
$this->query->where('tag_transaction_journal.tag_id', $tag->id);
|
||||||
@@ -327,11 +371,12 @@ class JournalCollector
|
|||||||
/**
|
/**
|
||||||
* @param array $types
|
* @param array $types
|
||||||
*
|
*
|
||||||
* @return JournalCollector
|
* @return JournalCollectorInterface
|
||||||
*/
|
*/
|
||||||
public function setTypes(array $types): JournalCollector
|
public function setTypes(array $types): JournalCollectorInterface
|
||||||
{
|
{
|
||||||
if (count($types) > 0) {
|
if (count($types) > 0) {
|
||||||
|
Log::debug('Set query collector types', $types);
|
||||||
$this->query->whereIn('transaction_types.type', $types);
|
$this->query->whereIn('transaction_types.type', $types);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -339,9 +384,49 @@ class JournalCollector
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return JournalCollector
|
* @return JournalCollectorInterface
|
||||||
*/
|
*/
|
||||||
public function withoutBudget(): JournalCollector
|
public function withOpposingAccount(): JournalCollectorInterface
|
||||||
|
{
|
||||||
|
$this->joinOpposingTables();
|
||||||
|
|
||||||
|
$accountIds = $this->accountIds;
|
||||||
|
$this->query->where(
|
||||||
|
function (EloquentBuilder $q1) use ($accountIds) {
|
||||||
|
// set 1:
|
||||||
|
// where source is in the set of $accounts
|
||||||
|
// but destination is not.
|
||||||
|
$q1->where(
|
||||||
|
function (EloquentBuilder $q2) use ($accountIds) {
|
||||||
|
// transactions.account_id in set
|
||||||
|
$q2->whereIn('transactions.account_id', $accountIds);
|
||||||
|
// opposing.account_id not in set
|
||||||
|
$q2->whereNotIn('opposing.account_id', $accountIds);
|
||||||
|
|
||||||
|
}
|
||||||
|
);
|
||||||
|
// set 1:
|
||||||
|
// where source is not in the set of $accounts
|
||||||
|
// but destination is.
|
||||||
|
$q1->orWhere(
|
||||||
|
function (EloquentBuilder $q3) use ($accountIds) {
|
||||||
|
// transactions.account_id not in set
|
||||||
|
$q3->whereNotIn('transactions.account_id', $accountIds);
|
||||||
|
// B in set
|
||||||
|
// opposing.account_id not in set
|
||||||
|
$q3->whereIn('opposing.account_id', $accountIds);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return JournalCollectorInterface
|
||||||
|
*/
|
||||||
|
public function withoutBudget(): JournalCollectorInterface
|
||||||
{
|
{
|
||||||
$this->joinBudgetTables();
|
$this->joinBudgetTables();
|
||||||
|
|
||||||
@@ -356,9 +441,9 @@ class JournalCollector
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return JournalCollector
|
* @return JournalCollectorInterface
|
||||||
*/
|
*/
|
||||||
public function withoutCategory(): JournalCollector
|
public function withoutCategory(): JournalCollectorInterface
|
||||||
{
|
{
|
||||||
$this->joinCategoryTables();
|
$this->joinCategoryTables();
|
||||||
|
|
||||||
@@ -389,6 +474,7 @@ class JournalCollector
|
|||||||
$set = $set->filter(
|
$set = $set->filter(
|
||||||
function (Transaction $transaction) {
|
function (Transaction $transaction) {
|
||||||
if (!($transaction->transaction_type_type === TransactionType::TRANSFER && bccomp($transaction->transaction_amount, '0') === -1)) {
|
if (!($transaction->transaction_type_type === TransactionType::TRANSFER && bccomp($transaction->transaction_amount, '0') === -1)) {
|
||||||
|
|
||||||
Log::debug(
|
Log::debug(
|
||||||
sprintf(
|
sprintf(
|
||||||
'Included journal #%d (transaction #%d) because its a %s with amount %f',
|
'Included journal #%d (transaction #%d) because its a %s with amount %f',
|
||||||
@@ -443,6 +529,30 @@ class JournalCollector
|
|||||||
$this->joinedCategory = true;
|
$this->joinedCategory = true;
|
||||||
$this->query->leftJoin('category_transaction_journal', 'category_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id');
|
$this->query->leftJoin('category_transaction_journal', 'category_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id');
|
||||||
$this->query->leftJoin('category_transaction', 'category_transaction.transaction_id', '=', 'transactions.id');
|
$this->query->leftJoin('category_transaction', 'category_transaction.transaction_id', '=', 'transactions.id');
|
||||||
|
$this->fields[] = 'category_transaction_journal.category_id as transaction_journal_category_id';
|
||||||
|
$this->fields[] = 'category_transaction.category_id as transaction_category_id';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private function joinOpposingTables()
|
||||||
|
{
|
||||||
|
if (!$this->joinedOpposing) {
|
||||||
|
// join opposing transaction (hard):
|
||||||
|
$this->query->leftJoin(
|
||||||
|
'transactions as opposing', function (JoinClause $join) {
|
||||||
|
$join->on('opposing.transaction_journal_id', '=', 'transactions.transaction_journal_id')
|
||||||
|
->where('opposing.identifier', '=', 'transactions.identifier')
|
||||||
|
->where('opposing.amount', '=', DB::raw('transactions.amount * -1'));
|
||||||
|
}
|
||||||
|
);
|
||||||
|
$this->query->leftJoin('accounts as opposing_accounts', 'opposing.account_id', '=', 'opposing_accounts.id');
|
||||||
|
$this->query->leftJoin('account_types as opposing_account_types', 'opposing_accounts.account_type_id', '=', 'opposing_account_types.id');
|
||||||
|
|
||||||
|
$this->fields[] = 'opposing.account_id as opposing_account_id';
|
||||||
|
$this->fields[] = 'opposing_accounts.name as opposing_account_name';
|
||||||
|
$this->fields[] = 'opposing_accounts.encrypted as opposing_account_encrypted';
|
||||||
|
$this->fields[] = 'opposing_account_types.type as opposing_account_type';
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -481,5 +591,4 @@ class JournalCollector
|
|||||||
return $query;
|
return $query;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
148
app/Helpers/Collector/JournalCollectorInterface.php
Normal file
148
app/Helpers/Collector/JournalCollectorInterface.php
Normal file
@@ -0,0 +1,148 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* JournalCollectorInterface.php
|
||||||
|
* Copyright (C) 2016 thegrumpydictator@gmail.com
|
||||||
|
*
|
||||||
|
* This software may be modified and distributed under the terms of the
|
||||||
|
* Creative Commons Attribution-ShareAlike 4.0 International License.
|
||||||
|
*
|
||||||
|
* See the LICENSE file for details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types = 1);
|
||||||
|
|
||||||
|
namespace FireflyIII\Helpers\Collector;
|
||||||
|
|
||||||
|
use Carbon\Carbon;
|
||||||
|
use FireflyIII\Models\Budget;
|
||||||
|
use FireflyIII\Models\Category;
|
||||||
|
use FireflyIII\Models\Tag;
|
||||||
|
use Illuminate\Pagination\LengthAwarePaginator;
|
||||||
|
use Illuminate\Support\Collection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interface JournalCollectorInterface
|
||||||
|
*
|
||||||
|
* @package FireflyIII\Helpers\Collector
|
||||||
|
*/
|
||||||
|
interface JournalCollectorInterface
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function count(): int;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return JournalCollectorInterface
|
||||||
|
*/
|
||||||
|
public function disableFilter(): JournalCollectorInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Collection
|
||||||
|
*/
|
||||||
|
public function getJournals(): Collection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return JournalCollectorInterface
|
||||||
|
*/
|
||||||
|
public function withOpposingAccount(): JournalCollectorInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return LengthAwarePaginator
|
||||||
|
*/
|
||||||
|
public function getPaginatedJournals():LengthAwarePaginator;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Collection $accounts
|
||||||
|
*
|
||||||
|
* @return JournalCollectorInterface
|
||||||
|
*/
|
||||||
|
public function setAccounts(Collection $accounts): JournalCollectorInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return JournalCollectorInterface
|
||||||
|
*/
|
||||||
|
public function setAllAssetAccounts(): JournalCollectorInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Collection $bills
|
||||||
|
*
|
||||||
|
* @return JournalCollectorInterface
|
||||||
|
*/
|
||||||
|
public function setBills(Collection $bills): JournalCollectorInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Budget $budget
|
||||||
|
*
|
||||||
|
* @return JournalCollectorInterface
|
||||||
|
*/
|
||||||
|
public function setBudget(Budget $budget): JournalCollectorInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Collection $categories
|
||||||
|
*
|
||||||
|
* @return JournalCollectorInterface
|
||||||
|
*/
|
||||||
|
public function setCategories(Collection $categories): JournalCollectorInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Category $category
|
||||||
|
*
|
||||||
|
* @return JournalCollectorInterface
|
||||||
|
*/
|
||||||
|
public function setCategory(Category $category): JournalCollectorInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param int $limit
|
||||||
|
*
|
||||||
|
* @return JournalCollectorInterface
|
||||||
|
*/
|
||||||
|
public function setLimit(int $limit): JournalCollectorInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param int $offset
|
||||||
|
*
|
||||||
|
* @return JournalCollectorInterface
|
||||||
|
*/
|
||||||
|
public function setOffset(int $offset): JournalCollectorInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param int $page
|
||||||
|
*
|
||||||
|
* @return JournalCollectorInterface
|
||||||
|
*/
|
||||||
|
public function setPage(int $page): JournalCollectorInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Carbon $start
|
||||||
|
* @param Carbon $end
|
||||||
|
*
|
||||||
|
* @return JournalCollectorInterface
|
||||||
|
*/
|
||||||
|
public function setRange(Carbon $start, Carbon $end): JournalCollectorInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Tag $tag
|
||||||
|
*
|
||||||
|
* @return JournalCollectorInterface
|
||||||
|
*/
|
||||||
|
public function setTag(Tag $tag): JournalCollectorInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array $types
|
||||||
|
*
|
||||||
|
* @return JournalCollectorInterface
|
||||||
|
*/
|
||||||
|
public function setTypes(array $types): JournalCollectorInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return JournalCollectorInterface
|
||||||
|
*/
|
||||||
|
public function withoutBudget(): JournalCollectorInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return JournalCollectorInterface
|
||||||
|
*/
|
||||||
|
public function withoutCategory(): JournalCollectorInterface;
|
||||||
|
}
|
@@ -15,16 +15,14 @@ namespace FireflyIII\Helpers\Report;
|
|||||||
|
|
||||||
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use DB;
|
|
||||||
use FireflyIII\Helpers\Collection\Budget as BudgetCollection;
|
use FireflyIII\Helpers\Collection\Budget as BudgetCollection;
|
||||||
use FireflyIII\Helpers\Collection\BudgetLine;
|
use FireflyIII\Helpers\Collection\BudgetLine;
|
||||||
use FireflyIII\Models\Budget;
|
use FireflyIII\Models\Budget;
|
||||||
use FireflyIII\Models\LimitRepetition;
|
use FireflyIII\Models\LimitRepetition;
|
||||||
use FireflyIII\Models\TransactionJournal;
|
use FireflyIII\Models\TransactionJournal;
|
||||||
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
|
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
|
||||||
use FireflyIII\Support\CacheProperties;
|
|
||||||
use Illuminate\Database\Query\JoinClause;
|
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
|
use Navigation;
|
||||||
use stdClass;
|
use stdClass;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -47,60 +45,6 @@ class BudgetReportHelper implements BudgetReportHelperInterface
|
|||||||
$this->repository = $repository;
|
$this->repository = $repository;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @SuppressWarnings(PHPMD.ExcessiveMethodLength) // at 43, its ok.
|
|
||||||
* @SuppressWarnings(PHPMD.CyclomaticComplexity) // it's exactly 5.
|
|
||||||
*
|
|
||||||
* @param Carbon $start
|
|
||||||
* @param Carbon $end
|
|
||||||
* @param Collection $accounts
|
|
||||||
*
|
|
||||||
* @return Collection
|
|
||||||
*/
|
|
||||||
public function budgetYearOverview(Carbon $start, Carbon $end, Collection $accounts): Collection
|
|
||||||
{
|
|
||||||
// chart properties for cache:
|
|
||||||
$cache = new CacheProperties;
|
|
||||||
$cache->addProperty($start);
|
|
||||||
$cache->addProperty($end);
|
|
||||||
$cache->addProperty('budget-year');
|
|
||||||
$cache->addProperty($accounts->pluck('id')->toArray());
|
|
||||||
if ($cache->has()) {
|
|
||||||
return $cache->get();
|
|
||||||
}
|
|
||||||
|
|
||||||
$current = clone $start;
|
|
||||||
$return = new Collection;
|
|
||||||
$set = $this->repository->getBudgets();
|
|
||||||
$budgets = [];
|
|
||||||
$spent = [];
|
|
||||||
$headers = $this->createYearHeaders($current, $end);
|
|
||||||
|
|
||||||
/** @var Budget $budget */
|
|
||||||
foreach ($set as $budget) {
|
|
||||||
$id = $budget->id;
|
|
||||||
$budgets[$id] = $budget->name;
|
|
||||||
$current = clone $start;
|
|
||||||
$budgetData = $this->getBudgetSpentData($current, $end, $budget, $accounts);
|
|
||||||
$sum = $budgetData['sum'];
|
|
||||||
$spent[$id] = $budgetData['spent'];
|
|
||||||
|
|
||||||
if (bccomp('0', $sum) === 0) {
|
|
||||||
// not spent anything.
|
|
||||||
unset($spent[$id]);
|
|
||||||
unset($budgets[$id]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$return->put('headers', $headers);
|
|
||||||
$return->put('budgets', $budgets);
|
|
||||||
$return->put('spent', $spent);
|
|
||||||
|
|
||||||
$cache->store($return);
|
|
||||||
|
|
||||||
return $return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Carbon $start
|
* @param Carbon $start
|
||||||
* @param Carbon $end
|
* @param Carbon $end
|
||||||
@@ -108,37 +52,12 @@ class BudgetReportHelper implements BudgetReportHelperInterface
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getBudgetMultiYear(Carbon $start, Carbon $end, Collection $accounts): array
|
public function getBudgetPeriodReport(Carbon $start, Carbon $end, Collection $accounts): array
|
||||||
{
|
{
|
||||||
$accountIds = $accounts->pluck('id')->toArray();
|
$budgets = $this->repository->getBudgets();
|
||||||
$query = TransactionJournal
|
$queryResult = $this->repository->getBudgetPeriodReport($budgets, $accounts, $start, $end);
|
||||||
::leftJoin('budget_transaction_journal', 'budget_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id')
|
$data = [];
|
||||||
->leftJoin('transaction_types', 'transaction_types.id', '=', 'transaction_journals.transaction_type_id')
|
$periods = Navigation::listOfPeriods($start, $end);
|
||||||
->leftJoin(
|
|
||||||
'transactions', function (JoinClause $join) {
|
|
||||||
$join->on('transaction_journals.id', '=', 'transactions.transaction_journal_id')->where('transactions.amount', '<', 0);
|
|
||||||
}
|
|
||||||
)
|
|
||||||
->whereNull('transaction_journals.deleted_at')
|
|
||||||
->whereNull('transactions.deleted_at')
|
|
||||||
->where('transaction_types.type', 'Withdrawal')
|
|
||||||
->where('transaction_journals.user_id', auth()->user()->id);
|
|
||||||
|
|
||||||
if (count($accountIds) > 0) {
|
|
||||||
$query->whereIn('transactions.account_id', $accountIds);
|
|
||||||
}
|
|
||||||
$query->groupBy(['budget_transaction_journal.budget_id', 'the_year']);
|
|
||||||
$queryResult = $query->get(
|
|
||||||
[
|
|
||||||
'budget_transaction_journal.budget_id',
|
|
||||||
DB::raw('DATE_FORMAT(transaction_journals.date,"%Y") AS the_year'),
|
|
||||||
DB::raw('SUM(transactions.amount) as sum_of_period'),
|
|
||||||
]
|
|
||||||
);
|
|
||||||
|
|
||||||
$data = [];
|
|
||||||
$budgets = $this->repository->getBudgets();
|
|
||||||
$years = $this->listOfYears($start, $end);
|
|
||||||
|
|
||||||
// do budget "zero"
|
// do budget "zero"
|
||||||
$emptyBudget = new Budget;
|
$emptyBudget = new Budget;
|
||||||
@@ -146,17 +65,16 @@ class BudgetReportHelper implements BudgetReportHelperInterface
|
|||||||
$emptyBudget->name = strval(trans('firefly.no_budget'));
|
$emptyBudget->name = strval(trans('firefly.no_budget'));
|
||||||
$budgets->push($emptyBudget);
|
$budgets->push($emptyBudget);
|
||||||
|
|
||||||
|
|
||||||
// get all budgets and years.
|
// get all budgets and years.
|
||||||
foreach ($budgets as $budget) {
|
foreach ($budgets as $budget) {
|
||||||
$data[$budget->id] = [
|
$data[$budget->id] = [
|
||||||
'name' => $budget->name,
|
'name' => $budget->name,
|
||||||
'entries' => $this->filterAmounts($queryResult, $budget->id, $years),
|
'entries' => $this->repository->filterAmounts($queryResult, $budget->id, $periods),
|
||||||
'sum' => '0',
|
'sum' => '0',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
// filter out empty ones and fill sum:
|
// filter out empty ones and fill sum:
|
||||||
$data = $this->getBudgetMultiYearMeta($data);
|
$data = $this->filterBudgetPeriodReport($data);
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
@@ -246,24 +164,6 @@ class BudgetReportHelper implements BudgetReportHelperInterface
|
|||||||
return $set;
|
return $set;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Carbon $start
|
|
||||||
* @param Carbon $end
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
public function listOfYears(Carbon $start, Carbon $end): array
|
|
||||||
{
|
|
||||||
$begin = clone $start;
|
|
||||||
$years = [];
|
|
||||||
while ($begin < $end) {
|
|
||||||
$years[] = $begin->year;
|
|
||||||
$begin->addYear();
|
|
||||||
}
|
|
||||||
|
|
||||||
return $years;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Budget $budget
|
* @param Budget $budget
|
||||||
* @param LimitRepetition $repetition
|
* @param LimitRepetition $repetition
|
||||||
@@ -285,57 +185,13 @@ class BudgetReportHelper implements BudgetReportHelperInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Carbon $current
|
* Filters empty results from getBudgetPeriodReport
|
||||||
* @param Carbon $end
|
|
||||||
*
|
*
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
private function createYearHeaders(Carbon $current, Carbon $end): array
|
|
||||||
{
|
|
||||||
$headers = [];
|
|
||||||
while ($current < $end) {
|
|
||||||
$short = $current->format('m-Y');
|
|
||||||
$headers[$short] = $current->formatLocalized((string)trans('config.month'));
|
|
||||||
$current->addMonth();
|
|
||||||
}
|
|
||||||
|
|
||||||
return $headers;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Collection $set
|
|
||||||
* @param int $budgetId
|
|
||||||
* @param array $years
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
private function filterAmounts(Collection $set, int $budgetId, array $years):array
|
|
||||||
{
|
|
||||||
$arr = [];
|
|
||||||
foreach ($years as $year) {
|
|
||||||
/** @var stdClass $object */
|
|
||||||
$result = $set->filter(
|
|
||||||
function (TransactionJournal $object) use ($budgetId, $year) {
|
|
||||||
return intval($object->the_year) === $year && $budgetId === intval($object->budget_id);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
$amount = '0';
|
|
||||||
if (!is_null($result->first())) {
|
|
||||||
$amount = $result->first()->sum_of_period;
|
|
||||||
}
|
|
||||||
|
|
||||||
$arr[$year] = $amount;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $arr;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param array $data
|
* @param array $data
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
private function getBudgetMultiYearMeta(array $data): array
|
private function filterBudgetPeriodReport(array $data): array
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var int $budgetId
|
* @var int $budgetId
|
||||||
@@ -355,31 +211,4 @@ class BudgetReportHelper implements BudgetReportHelperInterface
|
|||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Carbon $current
|
|
||||||
* @param Carbon $end
|
|
||||||
* @param Budget $budget
|
|
||||||
* @param Collection $accounts
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
private function getBudgetSpentData(Carbon $current, Carbon $end, Budget $budget, Collection $accounts): array
|
|
||||||
{
|
|
||||||
$sum = '0';
|
|
||||||
$spent = [];
|
|
||||||
while ($current < $end) {
|
|
||||||
$currentEnd = clone $current;
|
|
||||||
$currentEnd->endOfMonth();
|
|
||||||
$format = $current->format('m-Y');
|
|
||||||
$budgetSpent = $this->repository->spentInPeriod(new Collection([$budget]), $accounts, $current, $currentEnd);
|
|
||||||
$spent[$format] = $budgetSpent;
|
|
||||||
$sum = bcadd($sum, $budgetSpent);
|
|
||||||
$current->addMonth();
|
|
||||||
}
|
|
||||||
|
|
||||||
return [
|
|
||||||
'spent' => $spent,
|
|
||||||
'sum' => $sum,
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -25,14 +25,6 @@ use Illuminate\Support\Collection;
|
|||||||
*/
|
*/
|
||||||
interface BudgetReportHelperInterface
|
interface BudgetReportHelperInterface
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* @param Carbon $start
|
|
||||||
* @param Carbon $end
|
|
||||||
* @param Collection $accounts
|
|
||||||
*
|
|
||||||
* @return Collection
|
|
||||||
*/
|
|
||||||
public function budgetYearOverview(Carbon $start, Carbon $end, Collection $accounts): Collection;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Carbon $start
|
* @param Carbon $start
|
||||||
@@ -41,7 +33,7 @@ interface BudgetReportHelperInterface
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getBudgetMultiYear(Carbon $start, Carbon $end, Collection $accounts): array;
|
public function getBudgetPeriodReport(Carbon $start, Carbon $end, Collection $accounts): array;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Carbon $start
|
* @param Carbon $start
|
||||||
@@ -61,12 +53,4 @@ interface BudgetReportHelperInterface
|
|||||||
*/
|
*/
|
||||||
public function getBudgetsWithExpenses(Carbon $start, Carbon $end, Collection $accounts): Collection;
|
public function getBudgetsWithExpenses(Carbon $start, Carbon $end, Collection $accounts): Collection;
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Carbon $start
|
|
||||||
* @param Carbon $end
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
public function listOfYears(Carbon $start, Carbon $end): array;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -23,15 +23,11 @@ use FireflyIII\Helpers\Collector\JournalCollector;
|
|||||||
use FireflyIII\Helpers\FiscalHelperInterface;
|
use FireflyIII\Helpers\FiscalHelperInterface;
|
||||||
use FireflyIII\Models\Bill;
|
use FireflyIII\Models\Bill;
|
||||||
use FireflyIII\Models\Category;
|
use FireflyIII\Models\Category;
|
||||||
use FireflyIII\Models\Tag;
|
|
||||||
use FireflyIII\Models\Transaction;
|
use FireflyIII\Models\Transaction;
|
||||||
use FireflyIII\Repositories\Account\AccountTaskerInterface;
|
use FireflyIII\Repositories\Account\AccountTaskerInterface;
|
||||||
use FireflyIII\Repositories\Bill\BillRepositoryInterface;
|
use FireflyIII\Repositories\Bill\BillRepositoryInterface;
|
||||||
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
|
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
|
||||||
use FireflyIII\Repositories\Category\CategoryRepositoryInterface;
|
use FireflyIII\Repositories\Category\CategoryRepositoryInterface;
|
||||||
use FireflyIII\Repositories\Tag\TagRepositoryInterface;
|
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
|
||||||
use Illuminate\Database\Query\JoinClause;
|
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
use stdClass;
|
use stdClass;
|
||||||
|
|
||||||
@@ -45,20 +41,16 @@ class ReportHelper implements ReportHelperInterface
|
|||||||
|
|
||||||
/** @var BudgetRepositoryInterface */
|
/** @var BudgetRepositoryInterface */
|
||||||
protected $budgetRepository;
|
protected $budgetRepository;
|
||||||
/** @var TagRepositoryInterface */
|
|
||||||
protected $tagRepository;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ReportHelper constructor.
|
* ReportHelper constructor.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @param BudgetRepositoryInterface $budgetRepository
|
* @param BudgetRepositoryInterface $budgetRepository
|
||||||
* @param TagRepositoryInterface $tagRepository
|
|
||||||
*/
|
*/
|
||||||
public function __construct(BudgetRepositoryInterface $budgetRepository, TagRepositoryInterface $tagRepository)
|
public function __construct(BudgetRepositoryInterface $budgetRepository)
|
||||||
{
|
{
|
||||||
$this->budgetRepository = $budgetRepository;
|
$this->budgetRepository = $budgetRepository;
|
||||||
$this->tagRepository = $tagRepository;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -234,78 +226,4 @@ class ReportHelper implements ReportHelperInterface
|
|||||||
return $months;
|
return $months;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns an array of tags and their comparitive size with amounts bla bla.
|
|
||||||
*
|
|
||||||
* @param Carbon $start
|
|
||||||
* @param Carbon $end
|
|
||||||
* @param Collection $accounts
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
public function tagReport(Carbon $start, Carbon $end, Collection $accounts): array
|
|
||||||
{
|
|
||||||
$ids = $accounts->pluck('id')->toArray();
|
|
||||||
$set = Tag::
|
|
||||||
leftJoin('tag_transaction_journal', 'tags.id', '=', 'tag_transaction_journal.tag_id')
|
|
||||||
->leftJoin('transaction_journals', 'tag_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id')
|
|
||||||
->leftJoin(
|
|
||||||
'transactions AS source', function (JoinClause $join) {
|
|
||||||
$join->on('source.transaction_journal_id', '=', 'transaction_journals.id')->where('source.amount', '<', '0');
|
|
||||||
}
|
|
||||||
)
|
|
||||||
->leftJoin(
|
|
||||||
'transactions AS destination', function (JoinClause $join) {
|
|
||||||
$join->on('destination.transaction_journal_id', '=', 'transaction_journals.id')->where('destination.amount', '>', '0');
|
|
||||||
}
|
|
||||||
)
|
|
||||||
->where('transaction_journals.date', '>=', $start->format('Y-m-d'))
|
|
||||||
->where('transaction_journals.date', '<=', $end->format('Y-m-d'))
|
|
||||||
->where(
|
|
||||||
// source.account_id in accountIds XOR destination.account_id in accountIds
|
|
||||||
function (Builder $query) use ($ids) {
|
|
||||||
$query->where(
|
|
||||||
function (Builder $q1) use ($ids) {
|
|
||||||
$q1->whereIn('source.account_id', $ids)
|
|
||||||
->whereNotIn('destination.account_id', $ids);
|
|
||||||
}
|
|
||||||
)->orWhere(
|
|
||||||
function (Builder $q2) use ($ids) {
|
|
||||||
$q2->whereIn('destination.account_id', $ids)
|
|
||||||
->whereNotIn('source.account_id', $ids);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
)
|
|
||||||
->get(['tags.id', 'tags.tag', 'transaction_journals.id as journal_id', 'destination.amount']);
|
|
||||||
$collection = [];
|
|
||||||
if ($set->count() === 0) {
|
|
||||||
return $collection;
|
|
||||||
}
|
|
||||||
/** @var Tag $entry */
|
|
||||||
foreach ($set as $entry) {
|
|
||||||
// less than zero? multiply to be above zero.
|
|
||||||
$amount = $entry->amount;
|
|
||||||
$id = intval($entry->id);
|
|
||||||
$previousAmount = $collection[$id]['amount'] ?? '0';
|
|
||||||
$collection[$id] = [
|
|
||||||
'id' => $id,
|
|
||||||
'tag' => $entry->tag,
|
|
||||||
'amount' => bcadd($previousAmount, $amount),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
// cleanup collection (match "fonts")
|
|
||||||
$max = strval(max(array_column($collection, 'amount')));
|
|
||||||
foreach ($collection as $id => $entry) {
|
|
||||||
$size = bcdiv($entry['amount'], $max, 4);
|
|
||||||
if (bccomp($size, '0.25') === -1) {
|
|
||||||
$size = '0.5';
|
|
||||||
}
|
|
||||||
$collection[$id]['fontsize'] = $size;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $collection;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -80,15 +80,4 @@ interface ReportHelperInterface
|
|||||||
*/
|
*/
|
||||||
public function listOfMonths(Carbon $date): array;
|
public function listOfMonths(Carbon $date): array;
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns an array of tags and their comparitive size with amounts bla bla.
|
|
||||||
*
|
|
||||||
* @param Carbon $start
|
|
||||||
* @param Carbon $end
|
|
||||||
* @param Collection $accounts
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
public function tagReport(Carbon $start, Carbon $end, Collection $accounts): array;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -14,7 +14,6 @@ declare(strict_types = 1);
|
|||||||
namespace FireflyIII\Http\Controllers\Admin;
|
namespace FireflyIII\Http\Controllers\Admin;
|
||||||
|
|
||||||
|
|
||||||
use Config;
|
|
||||||
use FireflyIII\Http\Controllers\Controller;
|
use FireflyIII\Http\Controllers\Controller;
|
||||||
use FireflyIII\Http\Requests\ConfigurationRequest;
|
use FireflyIII\Http\Requests\ConfigurationRequest;
|
||||||
use FireflyIII\Support\Facades\FireflyConfig;
|
use FireflyIII\Support\Facades\FireflyConfig;
|
||||||
@@ -59,9 +58,11 @@ class ConfigurationController extends Controller
|
|||||||
|
|
||||||
// all available configuration and their default value in case
|
// all available configuration and their default value in case
|
||||||
// they don't exist yet.
|
// they don't exist yet.
|
||||||
$singleUserMode = FireflyConfig::get('single_user_mode', Config::get('firefly.configuration.single_user_mode'))->data;
|
$singleUserMode = FireflyConfig::get('single_user_mode', config('firefly.configuration.single_user_mode'))->data;
|
||||||
|
$mustConfirmAccount = FireflyConfig::get('must_confirm_account', config('firefly.configuration.must_confirm_account'))->data;
|
||||||
|
$isDemoSite = FireflyConfig::get('is_demo_site', config('firefly.configuration.is_demo_site'))->data;
|
||||||
|
|
||||||
return view('admin.configuration.index', compact('subTitle', 'subTitleIcon', 'singleUserMode'));
|
return view('admin.configuration.index', compact('subTitle', 'subTitleIcon', 'singleUserMode', 'mustConfirmAccount', 'isDemoSite'));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -77,6 +78,8 @@ class ConfigurationController extends Controller
|
|||||||
|
|
||||||
// store config values
|
// store config values
|
||||||
FireflyConfig::set('single_user_mode', $data['single_user_mode']);
|
FireflyConfig::set('single_user_mode', $data['single_user_mode']);
|
||||||
|
FireflyConfig::set('must_confirm_account', $data['must_confirm_account']);
|
||||||
|
FireflyConfig::set('is_demo_site', $data['is_demo_site']);
|
||||||
|
|
||||||
// flash message
|
// flash message
|
||||||
Session::flash('success', strval(trans('firefly.configuration_updated')));
|
Session::flash('success', strval(trans('firefly.configuration_updated')));
|
||||||
|
@@ -14,6 +14,7 @@ declare(strict_types = 1);
|
|||||||
namespace FireflyIII\Http\Controllers\Admin;
|
namespace FireflyIII\Http\Controllers\Admin;
|
||||||
|
|
||||||
|
|
||||||
|
use FireflyConfig;
|
||||||
use FireflyIII\Http\Controllers\Controller;
|
use FireflyIII\Http\Controllers\Controller;
|
||||||
use FireflyIII\Repositories\User\UserRepositoryInterface;
|
use FireflyIII\Repositories\User\UserRepositoryInterface;
|
||||||
use FireflyIII\User;
|
use FireflyIII\User;
|
||||||
@@ -46,20 +47,20 @@ class UserController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function index(UserRepositoryInterface $repository)
|
public function index(UserRepositoryInterface $repository)
|
||||||
{
|
{
|
||||||
$title = strval(trans('firefly.administration'));
|
$title = strval(trans('firefly.administration'));
|
||||||
$mainTitleIcon = 'fa-hand-spock-o';
|
$mainTitleIcon = 'fa-hand-spock-o';
|
||||||
$subTitle = strval(trans('firefly.user_administration'));
|
$subTitle = strval(trans('firefly.user_administration'));
|
||||||
$subTitleIcon = 'fa-users';
|
$subTitleIcon = 'fa-users';
|
||||||
$confirmAccount = env('MUST_CONFIRM_ACCOUNT', false);
|
$mustConfirmAccount = FireflyConfig::get('must_confirm_account', config('firefly.configuration.must_confirm_account'))->data;
|
||||||
$users = $repository->all();
|
$users = $repository->all();
|
||||||
|
|
||||||
// add meta stuff.
|
// add meta stuff.
|
||||||
$users->each(
|
$users->each(
|
||||||
function (User $user) use ($confirmAccount) {
|
function (User $user) use ($mustConfirmAccount) {
|
||||||
// is user activated?
|
// is user activated?
|
||||||
$isConfirmed = Preferences::getForUser($user, 'user_confirmed', false)->data;
|
$isConfirmed = Preferences::getForUser($user, 'user_confirmed', false)->data;
|
||||||
$user->activated = true;
|
$user->activated = true;
|
||||||
if ($isConfirmed === false && $confirmAccount === true) {
|
if ($isConfirmed === false && $mustConfirmAccount === true) {
|
||||||
$user->activated = false;
|
$user->activated = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -123,7 +123,11 @@ class RegisterController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function showRegistrationForm(Request $request)
|
public function showRegistrationForm(Request $request)
|
||||||
{
|
{
|
||||||
$showDemoWarning = config('firefly.show-demo-warning', false);
|
// is demo site?
|
||||||
|
$isDemoSite = FireflyConfig::get('is_demo_site', Config::get('firefly.configuration.is_demo_site'))->data;
|
||||||
|
|
||||||
|
// activate account?
|
||||||
|
$mustConfirmAccount = FireflyConfig::get('must_confirm_account', Config::get('firefly.configuration.must_confirm_account'))->data;
|
||||||
|
|
||||||
// is allowed to?
|
// is allowed to?
|
||||||
$singleUserMode = FireflyConfig::get('single_user_mode', Config::get('firefly.configuration.single_user_mode'))->data;
|
$singleUserMode = FireflyConfig::get('single_user_mode', Config::get('firefly.configuration.single_user_mode'))->data;
|
||||||
@@ -136,7 +140,7 @@ class RegisterController extends Controller
|
|||||||
|
|
||||||
$email = $request->old('email');
|
$email = $request->old('email');
|
||||||
|
|
||||||
return view('auth.register', compact('showDemoWarning', 'email'));
|
return view('auth.register', compact('isDemoSite', 'email', 'mustConfirmAccount'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -108,41 +108,12 @@ class AccountController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function frontpage(AccountRepositoryInterface $repository)
|
public function frontpage(AccountRepositoryInterface $repository)
|
||||||
{
|
{
|
||||||
$start = clone session('start', Carbon::now()->startOfMonth());
|
$start = clone session('start', Carbon::now()->startOfMonth());
|
||||||
$end = clone session('end', Carbon::now()->endOfMonth());
|
$end = clone session('end', Carbon::now()->endOfMonth());
|
||||||
|
|
||||||
|
|
||||||
// chart properties for cache:
|
|
||||||
$cache = new CacheProperties;
|
|
||||||
$cache->addProperty($start);
|
|
||||||
$cache->addProperty($end);
|
|
||||||
$cache->addProperty('frontpage');
|
|
||||||
$cache->addProperty('accounts');
|
|
||||||
if ($cache->has()) {
|
|
||||||
return Response::json($cache->get());
|
|
||||||
}
|
|
||||||
|
|
||||||
$frontPage = Preferences::get('frontPageAccounts', $repository->getAccountsByType([AccountType::DEFAULT, AccountType::ASSET])->pluck('id')->toArray());
|
$frontPage = Preferences::get('frontPageAccounts', $repository->getAccountsByType([AccountType::DEFAULT, AccountType::ASSET])->pluck('id')->toArray());
|
||||||
$accounts = $repository->getAccountsById($frontPage->data);
|
$accounts = $repository->getAccountsById($frontPage->data);
|
||||||
|
|
||||||
foreach ($accounts as $account) {
|
return Response::json($this->accountBalanceChart($start, $end, $accounts));
|
||||||
$balances = [];
|
|
||||||
$current = clone $start;
|
|
||||||
$range = Steam::balanceInRange($account, $start, clone $end);
|
|
||||||
$previous = round(array_values($range)[0], 2);
|
|
||||||
while ($current <= $end) {
|
|
||||||
$format = $current->format('Y-m-d');
|
|
||||||
$balance = isset($range[$format]) ? round($range[$format], 2) : $previous;
|
|
||||||
$previous = $balance;
|
|
||||||
$balances[] = $balance;
|
|
||||||
$current->addDay();
|
|
||||||
}
|
|
||||||
$account->balances = $balances;
|
|
||||||
}
|
|
||||||
$data = $this->generator->frontpage($accounts, $start, $end);
|
|
||||||
$cache->store($data);
|
|
||||||
|
|
||||||
return Response::json($data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -156,38 +127,7 @@ class AccountController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function report(Carbon $start, Carbon $end, Collection $accounts)
|
public function report(Carbon $start, Carbon $end, Collection $accounts)
|
||||||
{
|
{
|
||||||
// chart properties for cache:
|
return Response::json($this->accountBalanceChart($start, $end, $accounts));
|
||||||
$cache = new CacheProperties();
|
|
||||||
$cache->addProperty($start);
|
|
||||||
$cache->addProperty($end);
|
|
||||||
$cache->addProperty('all');
|
|
||||||
$cache->addProperty('accounts');
|
|
||||||
$cache->addProperty('default');
|
|
||||||
$cache->addProperty($accounts);
|
|
||||||
if ($cache->has()) {
|
|
||||||
return Response::json($cache->get());
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($accounts as $account) {
|
|
||||||
$balances = [];
|
|
||||||
$current = clone $start;
|
|
||||||
$range = Steam::balanceInRange($account, $start, clone $end);
|
|
||||||
$previous = round(array_values($range)[0], 2);
|
|
||||||
while ($current <= $end) {
|
|
||||||
$format = $current->format('Y-m-d');
|
|
||||||
$balance = isset($range[$format]) ? round($range[$format], 2) : $previous;
|
|
||||||
$previous = $balance;
|
|
||||||
$balances[] = $balance;
|
|
||||||
$current->addDay();
|
|
||||||
}
|
|
||||||
$account->balances = $balances;
|
|
||||||
}
|
|
||||||
|
|
||||||
// make chart:
|
|
||||||
$data = $this->generator->frontpage($accounts, $start, $end);
|
|
||||||
$cache->store($data);
|
|
||||||
|
|
||||||
return Response::json($data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -340,4 +280,43 @@ class AccountController extends Controller
|
|||||||
return Response::json($data);
|
return Response::json($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Carbon $start
|
||||||
|
* @param Carbon $end
|
||||||
|
* @param Collection $accounts
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
private function accountBalanceChart(Carbon $start, Carbon $end, Collection $accounts): array
|
||||||
|
{
|
||||||
|
// chart properties for cache:
|
||||||
|
$cache = new CacheProperties();
|
||||||
|
$cache->addProperty($start);
|
||||||
|
$cache->addProperty($end);
|
||||||
|
$cache->addProperty('account-balance-chart');
|
||||||
|
$cache->addProperty($accounts);
|
||||||
|
if ($cache->has()) {
|
||||||
|
return $cache->get();
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($accounts as $account) {
|
||||||
|
$balances = [];
|
||||||
|
$current = clone $start;
|
||||||
|
$range = Steam::balanceInRange($account, $start, clone $end);
|
||||||
|
$previous = round(array_values($range)[0], 2);
|
||||||
|
while ($current <= $end) {
|
||||||
|
$format = $current->format('Y-m-d');
|
||||||
|
$balance = isset($range[$format]) ? round($range[$format], 2) : $previous;
|
||||||
|
$previous = $balance;
|
||||||
|
$balances[] = $balance;
|
||||||
|
$current->addDay();
|
||||||
|
}
|
||||||
|
$account->balances = $balances;
|
||||||
|
}
|
||||||
|
$data = $this->generator->frontpage($accounts, $start, $end);
|
||||||
|
$cache->store($data);
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -24,7 +24,6 @@ use FireflyIII\Models\TransactionType;
|
|||||||
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
|
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
|
||||||
use FireflyIII\Support\CacheProperties;
|
use FireflyIII\Support\CacheProperties;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
use Log;
|
|
||||||
use Navigation;
|
use Navigation;
|
||||||
use Preferences;
|
use Preferences;
|
||||||
use Response;
|
use Response;
|
||||||
@@ -147,7 +146,6 @@ class BudgetController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function frontpage(BudgetRepositoryInterface $repository)
|
public function frontpage(BudgetRepositoryInterface $repository)
|
||||||
{
|
{
|
||||||
Log::debug('Hello');
|
|
||||||
$start = session('start', Carbon::now()->startOfMonth());
|
$start = session('start', Carbon::now()->startOfMonth());
|
||||||
$end = session('end', Carbon::now()->endOfMonth());
|
$end = session('end', Carbon::now()->endOfMonth());
|
||||||
// chart properties for cache:
|
// chart properties for cache:
|
||||||
@@ -186,6 +184,10 @@ class BudgetController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
*
|
||||||
|
* TODO use the NEW query that will be in the repository. Because that query will be shared between the budget period report (table for all budgets)
|
||||||
|
* TODO and this chart (a single budget)
|
||||||
|
*
|
||||||
* @param BudgetRepositoryInterface $repository
|
* @param BudgetRepositoryInterface $repository
|
||||||
* @param Budget $budget
|
* @param Budget $budget
|
||||||
* @param Carbon $start
|
* @param Carbon $start
|
||||||
@@ -207,38 +209,58 @@ class BudgetController extends Controller
|
|||||||
if ($cache->has()) {
|
if ($cache->has()) {
|
||||||
return Response::json($cache->get());
|
return Response::json($cache->get());
|
||||||
}
|
}
|
||||||
// loop over period, add by users range:
|
|
||||||
$current = clone $start;
|
// the expenses:
|
||||||
$viewRange = Preferences::get('viewRange', '1M')->data;
|
$periods = Navigation::listOfPeriods($start, $end);
|
||||||
$set = new Collection;
|
$result = $repository->getBudgetPeriodReport(new Collection([$budget]), $accounts, $start, $end);
|
||||||
|
$entries = $repository->filterAmounts($result, $budget->id, $periods);
|
||||||
|
$budgeted = [];
|
||||||
|
|
||||||
|
// the budget limits:
|
||||||
|
$range = '1D';
|
||||||
|
$key = 'Y-m-d';
|
||||||
|
if ($start->diffInMonths($end) > 1) {
|
||||||
|
$range = '1M';
|
||||||
|
$key = 'Y-m';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($start->diffInMonths($end) > 12) {
|
||||||
|
$range = '1Y';
|
||||||
|
$key = 'Y';
|
||||||
|
}
|
||||||
|
|
||||||
$repetitions = $repository->getAllBudgetLimitRepetitions($start, $end);
|
$repetitions = $repository->getAllBudgetLimitRepetitions($start, $end);
|
||||||
|
$current = clone $start;
|
||||||
|
|
||||||
while ($current < $end) {
|
while ($current < $end) {
|
||||||
$currentStart = clone $current;
|
$currentStart = Navigation::startOfPeriod($current, $range);
|
||||||
$currentEnd = Navigation::endOfPeriod($currentStart, $viewRange);
|
$currentEnd = Navigation::endOfPeriod($current, $range);
|
||||||
$reps = $repetitions->filter(
|
$reps = $repetitions->filter(
|
||||||
function (LimitRepetition $repetition) use ($budget, $currentStart) {
|
function (LimitRepetition $repetition) use ($budget, $currentStart, $currentEnd) {
|
||||||
if ($repetition->budget_id === $budget->id && $repetition->startdate == $currentStart) {
|
if ($repetition->budget_id === $budget->id && $repetition->startdate >= $currentStart && $repetition->enddate <= $currentEnd) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
$budgeted = $reps->sum('amount');
|
$index = $currentStart->format($key);
|
||||||
$spent = $repository->spentInPeriod(new Collection([$budget]), $accounts, $currentStart, $currentEnd);
|
$budgeted[$index] = $reps->sum('amount');
|
||||||
$entry = [
|
|
||||||
'date' => clone $currentStart,
|
|
||||||
'budgeted' => $budgeted,
|
|
||||||
'spent' => $spent,
|
|
||||||
];
|
|
||||||
$set->push($entry);
|
|
||||||
$currentEnd->addDay();
|
$currentEnd->addDay();
|
||||||
$current = clone $currentEnd;
|
$current = clone $currentEnd;
|
||||||
|
|
||||||
}
|
}
|
||||||
$data = $this->generator->period($set, $viewRange);
|
|
||||||
|
// join them:
|
||||||
|
$result = [];
|
||||||
|
foreach (array_keys($periods) as $period) {
|
||||||
|
$nice = $periods[$period];
|
||||||
|
$result[$nice] = [
|
||||||
|
'spent' => isset($entries[$period]) ? $entries[$period] : '0',
|
||||||
|
'budgeted' => isset($entries[$period]) ? $budgeted[$period] : 0,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = $this->generator->period($result);
|
||||||
|
|
||||||
$cache->store($data);
|
$cache->store($data);
|
||||||
|
|
||||||
return Response::json($data);
|
return Response::json($data);
|
||||||
@@ -330,7 +352,7 @@ class BudgetController extends Controller
|
|||||||
{
|
{
|
||||||
// collector
|
// collector
|
||||||
$collector = new JournalCollector(auth()->user());
|
$collector = new JournalCollector(auth()->user());
|
||||||
$types = [TransactionType::WITHDRAWAL];
|
$types = [TransactionType::WITHDRAWAL];
|
||||||
$collector->setAllAssetAccounts()->setTypes($types)->setRange($start, $end)->withoutBudget();
|
$collector->setAllAssetAccounts()->setTypes($types)->setRange($start, $end)->withoutBudget();
|
||||||
$journals = $collector->getJournals();
|
$journals = $collector->getJournals();
|
||||||
$sum = '0';
|
$sum = '0';
|
||||||
|
@@ -48,7 +48,6 @@ class CategoryController extends Controller
|
|||||||
$this->generator = app(CategoryChartGeneratorInterface::class);
|
$this->generator = app(CategoryChartGeneratorInterface::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show an overview for a category for all time, per month/week/year.
|
* Show an overview for a category for all time, per month/week/year.
|
||||||
*
|
*
|
||||||
@@ -172,6 +171,7 @@ class CategoryController extends Controller
|
|||||||
return Response::json($data);
|
return Response::json($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param CRI $repository
|
* @param CRI $repository
|
||||||
* @param Category $category
|
* @param Category $category
|
||||||
|
394
app/Http/Controllers/Chart/CategoryReportController.php
Normal file
394
app/Http/Controllers/Chart/CategoryReportController.php
Normal file
@@ -0,0 +1,394 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* CategoryReportController.php
|
||||||
|
* Copyright (C) 2016 thegrumpydictator@gmail.com
|
||||||
|
*
|
||||||
|
* This software may be modified and distributed under the terms of the
|
||||||
|
* Creative Commons Attribution-ShareAlike 4.0 International License.
|
||||||
|
*
|
||||||
|
* See the LICENSE file for details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types = 1);
|
||||||
|
|
||||||
|
namespace FireflyIII\Http\Controllers\Chart;
|
||||||
|
|
||||||
|
|
||||||
|
use Carbon\Carbon;
|
||||||
|
use FireflyIII\Generator\Chart\Category\CategoryChartGeneratorInterface;
|
||||||
|
use FireflyIII\Generator\Report\Category\MonthReportGenerator;
|
||||||
|
use FireflyIII\Helpers\Collector\JournalCollector;
|
||||||
|
use FireflyIII\Http\Controllers\Controller;
|
||||||
|
use FireflyIII\Models\Category;
|
||||||
|
use FireflyIII\Models\Transaction;
|
||||||
|
use FireflyIII\Models\TransactionType;
|
||||||
|
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||||
|
use FireflyIII\Repositories\Category\CategoryRepositoryInterface;
|
||||||
|
use Illuminate\Support\Collection;
|
||||||
|
use Log;
|
||||||
|
use Navigation;
|
||||||
|
use Response;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Separate controller because many helper functions are shared.
|
||||||
|
*
|
||||||
|
* TODO much of this code is actually repeated. First for the object (category, account), then for the direction (in / out).
|
||||||
|
*
|
||||||
|
* Class CategoryReportController
|
||||||
|
*
|
||||||
|
* @package FireflyIII\Http\Controllers\Chart
|
||||||
|
*/
|
||||||
|
class CategoryReportController extends Controller
|
||||||
|
{
|
||||||
|
|
||||||
|
/** @var AccountRepositoryInterface */
|
||||||
|
private $accountRepository;
|
||||||
|
/** @var CategoryRepositoryInterface */
|
||||||
|
private $categoryRepository;
|
||||||
|
/** @var CategoryChartGeneratorInterface */
|
||||||
|
private $generator;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
$this->middleware(
|
||||||
|
function ($request, $next) {
|
||||||
|
$this->generator = app(CategoryChartGeneratorInterface::class);
|
||||||
|
$this->categoryRepository = app(CategoryRepositoryInterface::class);
|
||||||
|
$this->accountRepository = app(AccountRepositoryInterface::class);
|
||||||
|
|
||||||
|
return $next($request);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Collection $accounts
|
||||||
|
* @param Collection $categories
|
||||||
|
* @param Carbon $start
|
||||||
|
* @param Carbon $end
|
||||||
|
* @param string $others
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Http\JsonResponse
|
||||||
|
*/
|
||||||
|
public function accountExpense(Collection $accounts, Collection $categories, Carbon $start, Carbon $end, string $others)
|
||||||
|
{
|
||||||
|
/** @var bool $others */
|
||||||
|
$others = intval($others) === 1;
|
||||||
|
$names = [];
|
||||||
|
|
||||||
|
// collect journals (just like the category report does):
|
||||||
|
$set = $this->getExpenses($accounts, $categories, $start, $end);
|
||||||
|
$grouped = $this->groupByOpposingAccount($set);
|
||||||
|
|
||||||
|
// show the grouped results:
|
||||||
|
$result = [];
|
||||||
|
$total = '0';
|
||||||
|
foreach ($grouped as $accountId => $amount) {
|
||||||
|
if (!isset($names[$accountId])) {
|
||||||
|
$account = $this->accountRepository->find(intval($accountId));
|
||||||
|
$names[$accountId] = $account->name;
|
||||||
|
}
|
||||||
|
$amount = bcmul($amount, '-1');
|
||||||
|
$total = bcadd($total, $amount);
|
||||||
|
$result[] = ['name' => $names[$accountId], 'id' => $accountId, 'amount' => $amount];
|
||||||
|
}
|
||||||
|
|
||||||
|
// also collect all transactions NOT in these categories.
|
||||||
|
// TODO include transfers
|
||||||
|
if ($others) {
|
||||||
|
$collector = new JournalCollector(auth()->user());
|
||||||
|
$collector->setAccounts($accounts)->setRange($start, $end)->setTypes([TransactionType::WITHDRAWAL]);
|
||||||
|
$journals = $collector->getJournals();
|
||||||
|
$sum = strval($journals->sum('transaction_amount'));
|
||||||
|
$sum = bcmul($sum, '-1');
|
||||||
|
Log::debug(sprintf('Sum of others in accountExpense is %f', $sum));
|
||||||
|
$sum = bcsub($sum, $total);
|
||||||
|
$result[] = ['name' => trans('firefly.everything_else'), 'id' => 0, 'amount' => $sum];
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = $this->generator->pieChart($result);
|
||||||
|
|
||||||
|
return Response::json($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Collection $accounts
|
||||||
|
* @param Collection $categories
|
||||||
|
* @param Carbon $start
|
||||||
|
* @param Carbon $end
|
||||||
|
* @param string $others
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Http\JsonResponse
|
||||||
|
*/
|
||||||
|
public function accountIncome(Collection $accounts, Collection $categories, Carbon $start, Carbon $end, string $others)
|
||||||
|
{
|
||||||
|
/** @var bool $others */
|
||||||
|
$others = intval($others) === 1;
|
||||||
|
$names = [];
|
||||||
|
|
||||||
|
// collect journals (just like the category report does):
|
||||||
|
$set = $this->getIncome($accounts, $categories, $start, $end);
|
||||||
|
$grouped = $this->groupByOpposingAccount($set);
|
||||||
|
|
||||||
|
// loop and show the grouped results:
|
||||||
|
$result = [];
|
||||||
|
$total = '0';
|
||||||
|
foreach ($grouped as $accountId => $amount) {
|
||||||
|
if (!isset($names[$accountId])) {
|
||||||
|
$account = $this->accountRepository->find(intval($accountId));
|
||||||
|
$names[$accountId] = $account->name;
|
||||||
|
}
|
||||||
|
$total = bcadd($total, $amount);
|
||||||
|
$result[] = ['name' => $names[$accountId], 'id' => $accountId, 'amount' => $amount];
|
||||||
|
}
|
||||||
|
|
||||||
|
// also collect others?
|
||||||
|
// TODO include transfers
|
||||||
|
if ($others) {
|
||||||
|
$collector = new JournalCollector(auth()->user());
|
||||||
|
$collector->setAccounts($accounts)->setRange($start, $end)->setTypes([TransactionType::DEPOSIT]);
|
||||||
|
$journals = $collector->getJournals();
|
||||||
|
$sum = strval($journals->sum('transaction_amount'));
|
||||||
|
Log::debug(sprintf('Sum of others in accountIncome is %f', $sum));
|
||||||
|
$sum = bcsub($sum, $total);
|
||||||
|
$result[] = ['name' => trans('firefly.everything_else'), 'id' => 0, 'amount' => $sum];
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = $this->generator->pieChart($result);
|
||||||
|
|
||||||
|
return Response::json($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Collection $accounts
|
||||||
|
* @param Collection $categories
|
||||||
|
* @param Carbon $start
|
||||||
|
* @param Carbon $end
|
||||||
|
* @param string $others
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Http\JsonResponse
|
||||||
|
*/
|
||||||
|
public function categoryExpense(Collection $accounts, Collection $categories, Carbon $start, Carbon $end, string $others)
|
||||||
|
{
|
||||||
|
/** @var bool $others */
|
||||||
|
$others = intval($others) === 1;
|
||||||
|
$names = [];
|
||||||
|
|
||||||
|
// collect journals (just like the category report does):
|
||||||
|
$set = $this->getExpenses($accounts, $categories, $start, $end);
|
||||||
|
$grouped = $this->groupByCategory($set);
|
||||||
|
|
||||||
|
// show the grouped results:
|
||||||
|
$result = [];
|
||||||
|
$total = '0';
|
||||||
|
foreach ($grouped as $categoryId => $amount) {
|
||||||
|
if (!isset($names[$categoryId])) {
|
||||||
|
$category = $this->categoryRepository->find(intval($categoryId));
|
||||||
|
$names[$categoryId] = $category->name;
|
||||||
|
}
|
||||||
|
$amount = bcmul($amount, '-1');
|
||||||
|
$total = bcadd($total, $amount);
|
||||||
|
$result[] = ['name' => $names[$categoryId], 'id' => $categoryId, 'amount' => $amount];
|
||||||
|
}
|
||||||
|
|
||||||
|
// also collect all transactions NOT in these categories.
|
||||||
|
// TODO include transfers
|
||||||
|
if ($others) {
|
||||||
|
$collector = new JournalCollector(auth()->user());
|
||||||
|
$collector->setAccounts($accounts)->setRange($start, $end)->setTypes([TransactionType::WITHDRAWAL]);
|
||||||
|
$journals = $collector->getJournals();
|
||||||
|
$sum = strval($journals->sum('transaction_amount'));
|
||||||
|
$sum = bcmul($sum, '-1');
|
||||||
|
Log::debug(sprintf('Sum of others in categoryExpense is %f', $sum));
|
||||||
|
$sum = bcsub($sum, $total);
|
||||||
|
$result[] = ['name' => trans('firefly.everything_else'), 'id' => 0, 'amount' => $sum];
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = $this->generator->pieChart($result);
|
||||||
|
|
||||||
|
return Response::json($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Collection $accounts
|
||||||
|
* @param Collection $categories
|
||||||
|
* @param Carbon $start
|
||||||
|
* @param Carbon $end
|
||||||
|
* @param string $others
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Http\JsonResponse
|
||||||
|
*/
|
||||||
|
public function categoryIncome(Collection $accounts, Collection $categories, Carbon $start, Carbon $end, string $others)
|
||||||
|
{
|
||||||
|
/** @var bool $others */
|
||||||
|
$others = intval($others) === 1;
|
||||||
|
$names = [];
|
||||||
|
|
||||||
|
// collect journals (just like the category report does):
|
||||||
|
$set = $this->getIncome($accounts, $categories, $start, $end);
|
||||||
|
$grouped = $this->groupByCategory($set);
|
||||||
|
|
||||||
|
// loop and show the grouped results:
|
||||||
|
$result = [];
|
||||||
|
$total = '0';
|
||||||
|
foreach ($grouped as $categoryId => $amount) {
|
||||||
|
if (!isset($names[$categoryId])) {
|
||||||
|
$category = $this->categoryRepository->find(intval($categoryId));
|
||||||
|
$names[$categoryId] = $category->name;
|
||||||
|
}
|
||||||
|
$total = bcadd($total, $amount);
|
||||||
|
$result[] = ['name' => $names[$categoryId], 'id' => $categoryId, 'amount' => $amount];
|
||||||
|
}
|
||||||
|
|
||||||
|
// also collect others?
|
||||||
|
// TODO include transfers
|
||||||
|
if ($others) {
|
||||||
|
$collector = new JournalCollector(auth()->user());
|
||||||
|
$collector->setAccounts($accounts)->setRange($start, $end)->setTypes([TransactionType::DEPOSIT]);
|
||||||
|
$journals = $collector->getJournals();
|
||||||
|
$sum = strval($journals->sum('transaction_amount'));
|
||||||
|
Log::debug(sprintf('Sum of others in categoryIncome is %f', $sum));
|
||||||
|
$sum = bcsub($sum, $total);
|
||||||
|
$result[] = ['name' => trans('firefly.everything_else'), 'id' => 0, 'amount' => $sum];
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = $this->generator->pieChart($result);
|
||||||
|
|
||||||
|
return Response::json($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Collection $accounts
|
||||||
|
* @param Collection $categories
|
||||||
|
* @param Carbon $start
|
||||||
|
* @param Carbon $end
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Http\JsonResponse
|
||||||
|
*/
|
||||||
|
public function mainChart(Collection $accounts, Collection $categories, Carbon $start, Carbon $end)
|
||||||
|
{
|
||||||
|
// determin optimal period:
|
||||||
|
$period = '1D';
|
||||||
|
$format = 'month_and_day';
|
||||||
|
if ($start->diffInMonths($end) > 1) {
|
||||||
|
$period = '1M';
|
||||||
|
$format = 'month';
|
||||||
|
}
|
||||||
|
if ($start->diffInMonths($end) > 13) {
|
||||||
|
$period = '1Y';
|
||||||
|
$format = 'year';
|
||||||
|
}
|
||||||
|
Log::debug(sprintf('Period is %s', $period));
|
||||||
|
$data = [];
|
||||||
|
$current = clone $start;
|
||||||
|
while ($current < $end) {
|
||||||
|
$currentEnd = Navigation::endOfPeriod($current, $period);
|
||||||
|
$expenses = $this->groupByCategory($this->getExpenses($accounts, $categories, $current, $currentEnd));
|
||||||
|
$income = $this->groupByCategory($this->getIncome($accounts, $categories, $current, $currentEnd));
|
||||||
|
$label = $current->formatLocalized(strval(trans('config.' . $format)));
|
||||||
|
$data[$label] = [
|
||||||
|
'in' => [],
|
||||||
|
'out' => [],
|
||||||
|
];
|
||||||
|
|
||||||
|
/** @var Category $category */
|
||||||
|
foreach ($categories as $category) {
|
||||||
|
// get sum, and get label:
|
||||||
|
$categoryId = $category->id;
|
||||||
|
$data[$label]['name'][$categoryId] = $category->name;
|
||||||
|
$data[$label]['in'][$categoryId] = $income[$categoryId] ?? '0';
|
||||||
|
$data[$label]['out'][$categoryId] = $expenses[$categoryId] ?? '0';
|
||||||
|
}
|
||||||
|
|
||||||
|
$current = Navigation::addPeriod($current, $period, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = $this->generator->mainReportChart($data);
|
||||||
|
return Response::json($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Collection $accounts
|
||||||
|
* @param Collection $categories
|
||||||
|
* @param Carbon $start
|
||||||
|
* @param Carbon $end
|
||||||
|
*
|
||||||
|
* @return Collection
|
||||||
|
*/
|
||||||
|
private function getExpenses(Collection $accounts, Collection $categories, Carbon $start, Carbon $end): Collection
|
||||||
|
{
|
||||||
|
$collector = new JournalCollector(auth()->user());
|
||||||
|
$collector->setAccounts($accounts)->setRange($start, $end)->setTypes([TransactionType::WITHDRAWAL, TransactionType::TRANSFER])
|
||||||
|
->setCategories($categories)->withOpposingAccount()->disableFilter();
|
||||||
|
$accountIds = $accounts->pluck('id')->toArray();
|
||||||
|
$transactions = $collector->getJournals();
|
||||||
|
$set = MonthReportGenerator::filterExpenses($transactions, $accountIds);
|
||||||
|
|
||||||
|
return $set;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Collection $accounts
|
||||||
|
* @param Collection $categories
|
||||||
|
* @param Carbon $start
|
||||||
|
* @param Carbon $end
|
||||||
|
*
|
||||||
|
* @return Collection
|
||||||
|
*/
|
||||||
|
private function getIncome(Collection $accounts, Collection $categories, Carbon $start, Carbon $end): Collection
|
||||||
|
{
|
||||||
|
$collector = new JournalCollector(auth()->user());
|
||||||
|
$collector->setAccounts($accounts)->setRange($start, $end)->setTypes([TransactionType::DEPOSIT, TransactionType::TRANSFER])
|
||||||
|
->setCategories($categories)->withOpposingAccount();
|
||||||
|
$accountIds = $accounts->pluck('id')->toArray();
|
||||||
|
$transactions = $collector->getJournals();
|
||||||
|
$set = MonthReportGenerator::filterIncome($transactions, $accountIds);
|
||||||
|
|
||||||
|
return $set;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Collection $set
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
private function groupByCategory(Collection $set): array
|
||||||
|
{
|
||||||
|
// group by category ID:
|
||||||
|
$grouped = [];
|
||||||
|
/** @var Transaction $transaction */
|
||||||
|
foreach ($set as $transaction) {
|
||||||
|
$jrnlCatId = intval($transaction->transaction_journal_category_id);
|
||||||
|
$transCatId = intval($transaction->transaction_category_id);
|
||||||
|
$categoryId = max($jrnlCatId, $transCatId);
|
||||||
|
$grouped[$categoryId] = $grouped[$categoryId] ?? '0';
|
||||||
|
$grouped[$categoryId] = bcadd($transaction->transaction_amount, $grouped[$categoryId]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $grouped;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Collection $set
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
private function groupByOpposingAccount(Collection $set): array
|
||||||
|
{
|
||||||
|
$grouped = [];
|
||||||
|
/** @var Transaction $transaction */
|
||||||
|
foreach ($set as $transaction) {
|
||||||
|
$accountId = $transaction->opposing_account_id;
|
||||||
|
$grouped[$accountId] = $grouped[$accountId] ?? '0';
|
||||||
|
$grouped[$accountId] = bcadd($transaction->transaction_amount, $grouped[$accountId]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $grouped;
|
||||||
|
}
|
||||||
|
}
|
@@ -49,20 +49,18 @@ class ReportController extends Controller
|
|||||||
* This chart, by default, is shown on the multi-year and year report pages,
|
* This chart, by default, is shown on the multi-year and year report pages,
|
||||||
* which means that giving it a 2 week "period" should be enough granularity.
|
* which means that giving it a 2 week "period" should be enough granularity.
|
||||||
*
|
*
|
||||||
* @param string $reportType
|
|
||||||
* @param Carbon $start
|
* @param Carbon $start
|
||||||
* @param Carbon $end
|
* @param Carbon $end
|
||||||
* @param Collection $accounts
|
* @param Collection $accounts
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Http\JsonResponse
|
* @return \Illuminate\Http\JsonResponse
|
||||||
*/
|
*/
|
||||||
public function netWorth(string $reportType, Carbon $start, Carbon $end, Collection $accounts)
|
public function netWorth(Carbon $start, Carbon $end, Collection $accounts)
|
||||||
{
|
{
|
||||||
// chart properties for cache:
|
// chart properties for cache:
|
||||||
$cache = new CacheProperties;
|
$cache = new CacheProperties;
|
||||||
$cache->addProperty('netWorth');
|
$cache->addProperty('netWorth');
|
||||||
$cache->addProperty($start);
|
$cache->addProperty($start);
|
||||||
$cache->addProperty($reportType);
|
|
||||||
$cache->addProperty($accounts);
|
$cache->addProperty($accounts);
|
||||||
$cache->addProperty($end);
|
$cache->addProperty($end);
|
||||||
if ($cache->has()) {
|
if ($cache->has()) {
|
||||||
@@ -92,52 +90,36 @@ class ReportController extends Controller
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param AccountTaskerInterface $accountTasker
|
* @param Carbon $start
|
||||||
* @param string $reportType
|
* @param Carbon $end
|
||||||
* @param Carbon $start
|
* @param Collection $accounts
|
||||||
* @param Carbon $end
|
|
||||||
* @param Collection $accounts
|
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Http\JsonResponse
|
* @return \Illuminate\Http\JsonResponse
|
||||||
* @internal param AccountRepositoryInterface $repository
|
|
||||||
*/
|
*/
|
||||||
public function yearInOut(AccountTaskerInterface $accountTasker, string $reportType, Carbon $start, Carbon $end, Collection $accounts)
|
public function yearInOut(Carbon $start, Carbon $end, Collection $accounts)
|
||||||
{
|
{
|
||||||
// chart properties for cache:
|
// chart properties for cache:
|
||||||
$cache = new CacheProperties;
|
$cache = new CacheProperties;
|
||||||
$cache->addProperty('yearInOut');
|
$cache->addProperty('yearInOut');
|
||||||
$cache->addProperty($start);
|
$cache->addProperty($start);
|
||||||
$cache->addProperty($reportType);
|
|
||||||
$cache->addProperty($accounts);
|
$cache->addProperty($accounts);
|
||||||
$cache->addProperty($end);
|
$cache->addProperty($end);
|
||||||
if ($cache->has()) {
|
if ($cache->has()) {
|
||||||
return Response::json($cache->get());
|
return Response::json($cache->get());
|
||||||
}
|
}
|
||||||
|
|
||||||
// always per month.
|
$chartSource = $this->getYearData($accounts, $start, $end);
|
||||||
$currentStart = clone $start;
|
|
||||||
$spentArray = [];
|
|
||||||
$earnedArray = [];
|
|
||||||
while ($currentStart <= $end) {
|
|
||||||
$currentEnd = Navigation::endOfPeriod($currentStart, '1M');
|
|
||||||
$date = $currentStart->format('Y-m');
|
|
||||||
$spent = $accountTasker->amountOutInPeriod($accounts, $accounts, $currentStart, $currentEnd);
|
|
||||||
$earned = $accountTasker->amountInInPeriod($accounts, $accounts, $currentStart, $currentEnd);
|
|
||||||
$spentArray[$date] = bcmul($spent, '-1');
|
|
||||||
$earnedArray[$date] = $earned;
|
|
||||||
$currentStart = Navigation::addPeriod($currentStart, '1M', 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($start->diffInMonths($end) > 12) {
|
if ($start->diffInMonths($end) > 12) {
|
||||||
// data = method X
|
// data = method X
|
||||||
$data = $this->multiYearInOut($earnedArray, $spentArray, $start, $end);
|
$data = $this->multiYearInOut($chartSource['earned'], $chartSource['spent'], $start, $end);
|
||||||
$cache->store($data);
|
$cache->store($data);
|
||||||
|
|
||||||
return Response::json($data);
|
return Response::json($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
// data = method Y
|
// data = method Y
|
||||||
$data = $this->singleYearInOut($earnedArray, $spentArray, $start, $end);
|
$data = $this->singleYearInOut($chartSource['earned'], $chartSource['spent'], $start, $end);
|
||||||
$cache->store($data);
|
$cache->store($data);
|
||||||
|
|
||||||
return Response::json($data);
|
return Response::json($data);
|
||||||
@@ -146,8 +128,6 @@ class ReportController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param AccountTaskerInterface $accountTasker
|
|
||||||
* @param string $reportType
|
|
||||||
* @param Carbon $start
|
* @param Carbon $start
|
||||||
* @param Carbon $end
|
* @param Carbon $end
|
||||||
* @param Collection $accounts
|
* @param Collection $accounts
|
||||||
@@ -155,7 +135,7 @@ class ReportController extends Controller
|
|||||||
* @return \Illuminate\Http\JsonResponse
|
* @return \Illuminate\Http\JsonResponse
|
||||||
* @internal param AccountRepositoryInterface $repository
|
* @internal param AccountRepositoryInterface $repository
|
||||||
*/
|
*/
|
||||||
public function yearInOutSummarized(AccountTaskerInterface $accountTasker, string $reportType, Carbon $start, Carbon $end, Collection $accounts)
|
public function yearInOutSummarized(Carbon $start, Carbon $end, Collection $accounts)
|
||||||
{
|
{
|
||||||
|
|
||||||
// chart properties for cache:
|
// chart properties for cache:
|
||||||
@@ -163,35 +143,21 @@ class ReportController extends Controller
|
|||||||
$cache->addProperty('yearInOutSummarized');
|
$cache->addProperty('yearInOutSummarized');
|
||||||
$cache->addProperty($start);
|
$cache->addProperty($start);
|
||||||
$cache->addProperty($end);
|
$cache->addProperty($end);
|
||||||
$cache->addProperty($reportType);
|
|
||||||
$cache->addProperty($accounts);
|
$cache->addProperty($accounts);
|
||||||
if ($cache->has()) {
|
if ($cache->has()) {
|
||||||
return Response::json($cache->get());
|
return Response::json($cache->get());
|
||||||
}
|
}
|
||||||
|
$chartSource = $this->getYearData($accounts, $start, $end);
|
||||||
// always per month.
|
|
||||||
$currentStart = clone $start;
|
|
||||||
$spentArray = [];
|
|
||||||
$earnedArray = [];
|
|
||||||
while ($currentStart <= $end) {
|
|
||||||
$currentEnd = Navigation::endOfPeriod($currentStart, '1M');
|
|
||||||
$date = $currentStart->format('Y-m');
|
|
||||||
$spent = $accountTasker->amountOutInPeriod($accounts, $accounts, $currentStart, $currentEnd);
|
|
||||||
$earned = $accountTasker->amountInInPeriod($accounts, $accounts, $currentStart, $currentEnd);
|
|
||||||
$spentArray[$date] = bcmul($spent, '-1');
|
|
||||||
$earnedArray[$date] = $earned;
|
|
||||||
$currentStart = Navigation::addPeriod($currentStart, '1M', 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($start->diffInMonths($end) > 12) {
|
if ($start->diffInMonths($end) > 12) {
|
||||||
// per year
|
// per year
|
||||||
$data = $this->multiYearInOutSummarized($earnedArray, $spentArray, $start, $end);
|
$data = $this->multiYearInOutSummarized($chartSource['earned'], $chartSource['spent'], $start, $end);
|
||||||
$cache->store($data);
|
$cache->store($data);
|
||||||
|
|
||||||
return Response::json($data);
|
return Response::json($data);
|
||||||
}
|
}
|
||||||
// per month!
|
// per month!
|
||||||
$data = $this->singleYearInOutSummarized($earnedArray, $spentArray, $start, $end);
|
$data = $this->singleYearInOutSummarized($chartSource['earned'], $chartSource['spent'], $start, $end);
|
||||||
$cache->store($data);
|
$cache->store($data);
|
||||||
|
|
||||||
return Response::json($data);
|
return Response::json($data);
|
||||||
@@ -342,4 +308,33 @@ class ReportController extends Controller
|
|||||||
|
|
||||||
return $sum;
|
return $sum;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Collection $accounts
|
||||||
|
* @param Carbon $start
|
||||||
|
* @param Carbon $end
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
private function getYearData(Collection $accounts, Carbon $start, Carbon $end): array
|
||||||
|
{
|
||||||
|
$tasker = app(AccountTaskerInterface::class);
|
||||||
|
$currentStart = clone $start;
|
||||||
|
$spentArray = [];
|
||||||
|
$earnedArray = [];
|
||||||
|
while ($currentStart <= $end) {
|
||||||
|
$currentEnd = Navigation::endOfPeriod($currentStart, '1M');
|
||||||
|
$date = $currentStart->format('Y-m');
|
||||||
|
$spent = $tasker->amountOutInPeriod($accounts, $accounts, $currentStart, $currentEnd);
|
||||||
|
$earned = $tasker->amountInInPeriod($accounts, $accounts, $currentStart, $currentEnd);
|
||||||
|
$spentArray[$date] = bcmul($spent, '-1');
|
||||||
|
$earnedArray[$date] = $earned;
|
||||||
|
$currentStart = Navigation::addPeriod($currentStart, '1M', 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
return [
|
||||||
|
'spent' => $spentArray,
|
||||||
|
'earned' => $earnedArray,
|
||||||
|
];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -19,6 +19,7 @@ use FireflyIII\Helpers\Report\BudgetReportHelperInterface;
|
|||||||
use FireflyIII\Http\Controllers\Controller;
|
use FireflyIII\Http\Controllers\Controller;
|
||||||
use FireflyIII\Support\CacheProperties;
|
use FireflyIII\Support\CacheProperties;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
|
use Navigation;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class BudgetController
|
* Class BudgetController
|
||||||
@@ -29,6 +30,7 @@ class BudgetController extends Controller
|
|||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
*
|
||||||
* @param BudgetReportHelperInterface $helper
|
* @param BudgetReportHelperInterface $helper
|
||||||
* @param Carbon $start
|
* @param Carbon $start
|
||||||
* @param Carbon $end
|
* @param Carbon $end
|
||||||
@@ -36,22 +38,20 @@ class BudgetController extends Controller
|
|||||||
*
|
*
|
||||||
* @return mixed|string
|
* @return mixed|string
|
||||||
*/
|
*/
|
||||||
public function budgetMultiYear(BudgetReportHelperInterface $helper, Carbon $start, Carbon $end, Collection $accounts)
|
public function budgetPeriodReport(BudgetReportHelperInterface $helper, Carbon $start, Carbon $end, Collection $accounts)
|
||||||
{
|
{
|
||||||
$cache = new CacheProperties;
|
$cache = new CacheProperties;
|
||||||
$cache->addProperty($start);
|
$cache->addProperty($start);
|
||||||
$cache->addProperty($end);
|
$cache->addProperty($end);
|
||||||
$cache->addProperty('budget-mult-year-report');
|
$cache->addProperty('budget-period-report');
|
||||||
$cache->addProperty($accounts->pluck('id')->toArray());
|
$cache->addProperty($accounts->pluck('id')->toArray());
|
||||||
if ($cache->has()) {
|
if ($cache->has()) {
|
||||||
return $cache->get();
|
return $cache->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$periods = Navigation::listOfPeriods($start, $end);
|
||||||
$years = $helper->listOfYears($start, $end);
|
$budgets = $helper->getBudgetPeriodReport($start, $end, $accounts);
|
||||||
$budgetMultiYear = $helper->getBudgetMultiYear($start, $end, $accounts);
|
$result = view('reports.partials.budget-period', compact('budgets', 'periods'))->render();
|
||||||
|
|
||||||
$result = view('reports.partials.budget-multi-year', compact('budgetMultiYear', 'years'))->render();
|
|
||||||
$cache->store($result);
|
$cache->store($result);
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
@@ -86,35 +86,4 @@ class BudgetController extends Controller
|
|||||||
return $result;
|
return $result;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param BudgetReportHelperInterface $helper
|
|
||||||
* @param Carbon $start
|
|
||||||
* @param Carbon $end
|
|
||||||
* @param Collection $accounts
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function budgetYearOverview(BudgetReportHelperInterface $helper, Carbon $start, Carbon $end, Collection $accounts)
|
|
||||||
{
|
|
||||||
|
|
||||||
// chart properties for cache:
|
|
||||||
$cache = new CacheProperties;
|
|
||||||
$cache->addProperty($start);
|
|
||||||
$cache->addProperty($end);
|
|
||||||
$cache->addProperty('budget-year-overview');
|
|
||||||
$cache->addProperty($accounts->pluck('id')->toArray());
|
|
||||||
if ($cache->has()) {
|
|
||||||
return $cache->get();
|
|
||||||
}
|
|
||||||
|
|
||||||
$budgets = $helper->budgetYearOverview($start, $end, $accounts);
|
|
||||||
|
|
||||||
$result = view('reports.partials.budget-year-overview', compact('budgets'))->render();
|
|
||||||
$cache->store($result);
|
|
||||||
|
|
||||||
return $result;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
@@ -15,16 +15,16 @@ namespace FireflyIII\Http\Controllers;
|
|||||||
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use FireflyIII\Exceptions\FireflyException;
|
use FireflyIII\Exceptions\FireflyException;
|
||||||
use FireflyIII\Helpers\Collector\JournalCollector;
|
use FireflyIII\Generator\Report\ReportGeneratorFactory;
|
||||||
use FireflyIII\Helpers\Report\ReportHelperInterface;
|
use FireflyIII\Helpers\Report\ReportHelperInterface;
|
||||||
use FireflyIII\Models\Account;
|
use FireflyIII\Http\Requests\ReportFormRequest;
|
||||||
use FireflyIII\Models\AccountType;
|
use FireflyIII\Models\AccountType;
|
||||||
use FireflyIII\Models\Transaction;
|
|
||||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||||
|
use FireflyIII\Repositories\Category\CategoryRepositoryInterface;
|
||||||
|
use Illuminate\Http\RedirectResponse;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
use Preferences;
|
use Preferences;
|
||||||
use Session;
|
use Response;
|
||||||
use Steam;
|
|
||||||
use View;
|
use View;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -49,6 +49,7 @@ class ReportController extends Controller
|
|||||||
function ($request, $next) {
|
function ($request, $next) {
|
||||||
View::share('title', trans('firefly.reports'));
|
View::share('title', trans('firefly.reports'));
|
||||||
View::share('mainTitleIcon', 'fa-line-chart');
|
View::share('mainTitleIcon', 'fa-line-chart');
|
||||||
|
View::share('subTitleIcon', 'fa-calendar');
|
||||||
|
|
||||||
$this->helper = app(ReportHelperInterface::class);
|
$this->helper = app(ReportHelperInterface::class);
|
||||||
|
|
||||||
@@ -58,6 +59,114 @@ class ReportController extends Controller
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Carbon $start
|
||||||
|
* @param Carbon $end
|
||||||
|
* @param Collection $accounts
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
* @throws FireflyException
|
||||||
|
*/
|
||||||
|
public function auditReport(Carbon $start, Carbon $end, Collection $accounts)
|
||||||
|
{
|
||||||
|
if ($end < $start) {
|
||||||
|
return view('error')->with('message', trans('firefly.end_after_start_date'));
|
||||||
|
}
|
||||||
|
if ($start < session('first')) {
|
||||||
|
$start = session('first');
|
||||||
|
}
|
||||||
|
|
||||||
|
View::share(
|
||||||
|
'subTitle', trans(
|
||||||
|
'firefly.report_audit',
|
||||||
|
[
|
||||||
|
'start' => $start->formatLocalized($this->monthFormat),
|
||||||
|
'end' => $end->formatLocalized($this->monthFormat),
|
||||||
|
]
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
$generator = ReportGeneratorFactory::reportGenerator('Audit', $start, $end);
|
||||||
|
$generator->setAccounts($accounts);
|
||||||
|
$result = $generator->generate();
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Carbon $start
|
||||||
|
* @param Carbon $end
|
||||||
|
* @param Collection $accounts
|
||||||
|
*
|
||||||
|
* @param Collection $categories
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function categoryReport(Carbon $start, Carbon $end, Collection $accounts, Collection $categories)
|
||||||
|
{
|
||||||
|
if ($end < $start) {
|
||||||
|
return view('error')->with('message', trans('firefly.end_after_start_date'));
|
||||||
|
}
|
||||||
|
if ($start < session('first')) {
|
||||||
|
$start = session('first');
|
||||||
|
}
|
||||||
|
|
||||||
|
View::share(
|
||||||
|
'subTitle', trans(
|
||||||
|
'firefly.report_category',
|
||||||
|
[
|
||||||
|
'start' => $start->formatLocalized($this->monthFormat),
|
||||||
|
'end' => $end->formatLocalized($this->monthFormat),
|
||||||
|
]
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
$generator = ReportGeneratorFactory::reportGenerator('Category', $start, $end);
|
||||||
|
$generator->setAccounts($accounts);
|
||||||
|
$generator->setCategories($categories);
|
||||||
|
$result = $generator->generate();
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Carbon $start
|
||||||
|
* @param Carbon $end
|
||||||
|
* @param Collection $accounts
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
* @throws FireflyException
|
||||||
|
*/
|
||||||
|
public function defaultReport(Carbon $start, Carbon $end, Collection $accounts)
|
||||||
|
{
|
||||||
|
if ($end < $start) {
|
||||||
|
return view('error')->with('message', trans('firefly.end_after_start_date'));
|
||||||
|
}
|
||||||
|
if ($start < session('first')) {
|
||||||
|
$start = session('first');
|
||||||
|
}
|
||||||
|
|
||||||
|
View::share(
|
||||||
|
'subTitle', trans(
|
||||||
|
'firefly.report_default',
|
||||||
|
[
|
||||||
|
'start' => $start->formatLocalized($this->monthFormat),
|
||||||
|
'end' => $end->formatLocalized($this->monthFormat),
|
||||||
|
]
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
$generator = ReportGeneratorFactory::reportGenerator('Standard', $start, $end);
|
||||||
|
$generator->setAccounts($accounts);
|
||||||
|
$result = $generator->generate();
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param AccountRepositoryInterface $repository
|
* @param AccountRepositoryInterface $repository
|
||||||
*
|
*
|
||||||
@@ -70,35 +179,49 @@ class ReportController extends Controller
|
|||||||
$start = clone session('first');
|
$start = clone session('first');
|
||||||
$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]);
|
||||||
// does the user have shared accounts?
|
$accountList = join(',', $accounts->pluck('id')->toArray());
|
||||||
$accounts = $repository->getAccountsByType([AccountType::DEFAULT, AccountType::ASSET]);
|
|
||||||
// get id's for quick links:
|
|
||||||
$accountIds = [];
|
|
||||||
/** @var Account $account */
|
|
||||||
foreach ($accounts as $account) {
|
|
||||||
$accountIds [] = $account->id;
|
|
||||||
}
|
|
||||||
$accountList = join(',', $accountIds);
|
|
||||||
|
|
||||||
|
|
||||||
return view('reports.index', compact('months', 'accounts', 'start', 'accountList', 'customFiscalYear'));
|
return view('reports.index', compact('months', 'accounts', 'start', 'accountList', 'customFiscalYear'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $reportType
|
* @param string $reportType
|
||||||
* @param Carbon $start
|
|
||||||
* @param Carbon $end
|
|
||||||
* @param Collection $accounts
|
|
||||||
*
|
*
|
||||||
* @return View
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function options(string $reportType)
|
||||||
|
{
|
||||||
|
switch ($reportType) {
|
||||||
|
default:
|
||||||
|
$result = $this->noReportOptions();
|
||||||
|
break;
|
||||||
|
case 'category':
|
||||||
|
$result = $this->categoryReportOptions();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Response::json(['html' => $result]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param ReportFormRequest $request
|
||||||
|
*
|
||||||
|
* @return RedirectResponse
|
||||||
* @throws FireflyException
|
* @throws FireflyException
|
||||||
*/
|
*/
|
||||||
public function report(string $reportType, Carbon $start, Carbon $end, Collection $accounts)
|
public function postIndex(ReportFormRequest $request): RedirectResponse
|
||||||
{
|
{
|
||||||
// throw an error if necessary.
|
// report type:
|
||||||
|
$reportType = $request->get('report_type');
|
||||||
|
$start = $request->getStartDate()->format('Ymd');
|
||||||
|
$end = $request->getEndDate()->format('Ymd');
|
||||||
|
$accounts = join(',', $request->getAccountList()->pluck('id')->toArray());
|
||||||
|
$categories = join(',', $request->getCategoryList()->pluck('id')->toArray());
|
||||||
|
|
||||||
if ($end < $start) {
|
if ($end < $start) {
|
||||||
throw new FireflyException('End date cannot be before start date, silly!');
|
return view('error')->with('message', trans('firefly.end_after_start_date'));
|
||||||
}
|
}
|
||||||
|
|
||||||
// lower threshold
|
// lower threshold
|
||||||
@@ -106,190 +229,42 @@ class ReportController extends Controller
|
|||||||
$start = session('first');
|
$start = session('first');
|
||||||
}
|
}
|
||||||
|
|
||||||
View::share(
|
|
||||||
'subTitle', trans(
|
|
||||||
'firefly.report_' . $reportType,
|
|
||||||
[
|
|
||||||
'start' => $start->formatLocalized($this->monthFormat),
|
|
||||||
'end' => $end->formatLocalized($this->monthFormat),
|
|
||||||
]
|
|
||||||
)
|
|
||||||
);
|
|
||||||
View::share('subTitleIcon', 'fa-calendar');
|
|
||||||
|
|
||||||
switch ($reportType) {
|
switch ($reportType) {
|
||||||
default:
|
default:
|
||||||
throw new FireflyException('Unfortunately, reports of the type "' . e($reportType) . '" are not available at this time.');
|
throw new FireflyException(sprintf('Firefly does not support the "%s"-report yet.', $reportType));
|
||||||
|
case 'category':
|
||||||
|
$uri = route('reports.report.category', [$start, $end, $accounts, $categories]);
|
||||||
|
break;
|
||||||
case 'default':
|
case 'default':
|
||||||
|
$uri = route('reports.report.default', [$start, $end, $accounts]);
|
||||||
// more than one year date difference means year report.
|
break;
|
||||||
if ($start->diffInMonths($end) > 12) {
|
|
||||||
return $this->defaultMultiYear($reportType, $start, $end, $accounts);
|
|
||||||
}
|
|
||||||
// more than two months date difference means year report.
|
|
||||||
if ($start->diffInMonths($end) > 1) {
|
|
||||||
return $this->defaultYear($reportType, $start, $end, $accounts);
|
|
||||||
}
|
|
||||||
|
|
||||||
// otherwise default
|
|
||||||
return $this->defaultMonth($reportType, $start, $end, $accounts);
|
|
||||||
case 'audit':
|
case 'audit':
|
||||||
// always default
|
$uri = route('reports.report.audit', [$start, $end, $accounts]);
|
||||||
return $this->auditReport($start, $end, $accounts);
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return redirect($uri);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
private function categoryReportOptions(): string
|
||||||
|
{
|
||||||
|
/** @var CategoryRepositoryInterface $repository */
|
||||||
|
$repository = app(CategoryRepositoryInterface::class);
|
||||||
|
$categories = $repository->getCategories();
|
||||||
|
$result = view('reports.options.category', compact('categories'))->render();
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Carbon $start
|
* @return string
|
||||||
* @param Carbon $end
|
|
||||||
* @param Collection $accounts
|
|
||||||
*
|
|
||||||
* @return View
|
|
||||||
*/
|
*/
|
||||||
private function auditReport(Carbon $start, Carbon $end, Collection $accounts)
|
private function noReportOptions(): string
|
||||||
{
|
{
|
||||||
$auditData = [];
|
return view('reports.options.no-options')->render();
|
||||||
$dayBefore = clone $start;
|
|
||||||
$dayBefore->subDay();
|
|
||||||
/** @var Account $account */
|
|
||||||
foreach ($accounts as $account) {
|
|
||||||
// balance the day before:
|
|
||||||
$id = $account->id;
|
|
||||||
$dayBeforeBalance = Steam::balance($account, $dayBefore);
|
|
||||||
$collector = new JournalCollector(auth()->user());
|
|
||||||
$collector->setAccounts(new Collection([$account]))->setRange($start, $end);
|
|
||||||
$journals = $collector->getJournals();
|
|
||||||
$journals = $journals->reverse();
|
|
||||||
$startBalance = $dayBeforeBalance;
|
|
||||||
|
|
||||||
|
|
||||||
/** @var Transaction $journal */
|
|
||||||
foreach ($journals as $transaction) {
|
|
||||||
$transaction->before = $startBalance;
|
|
||||||
$transactionAmount = $transaction->transaction_amount;
|
|
||||||
$newBalance = bcadd($startBalance, $transactionAmount);
|
|
||||||
$transaction->after = $newBalance;
|
|
||||||
$startBalance = $newBalance;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Reverse set again.
|
|
||||||
*/
|
|
||||||
$auditData[$id]['journals'] = $journals->reverse();
|
|
||||||
$auditData[$id]['exists'] = $journals->count() > 0;
|
|
||||||
$auditData[$id]['end'] = $end->formatLocalized(strval(trans('config.month_and_day')));
|
|
||||||
$auditData[$id]['endBalance'] = Steam::balance($account, $end);
|
|
||||||
$auditData[$id]['dayBefore'] = $dayBefore->formatLocalized(strval(trans('config.month_and_day')));
|
|
||||||
$auditData[$id]['dayBeforeBalance'] = $dayBeforeBalance;
|
|
||||||
}
|
|
||||||
|
|
||||||
$reportType = 'audit';
|
|
||||||
$accountIds = join(',', $accounts->pluck('id')->toArray());
|
|
||||||
|
|
||||||
$hideable = ['buttons', 'icon', 'description', 'balance_before', 'amount', 'balance_after', 'date',
|
|
||||||
'interest_date', 'book_date', 'process_date',
|
|
||||||
// three new optional fields.
|
|
||||||
'due_date', 'payment_date', 'invoice_date',
|
|
||||||
'from', 'to', 'budget', 'category', 'bill',
|
|
||||||
// more new optional fields
|
|
||||||
'internal_reference', 'notes',
|
|
||||||
|
|
||||||
'create_date', 'update_date',
|
|
||||||
];
|
|
||||||
$defaultShow = ['icon', 'description', 'balance_before', 'amount', 'balance_after', 'date', 'to'];
|
|
||||||
|
|
||||||
return view('reports.audit.report', compact('start', 'end', 'reportType', 'accountIds', 'accounts', 'auditData', 'hideable', 'defaultShow'));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param $reportType
|
|
||||||
* @param Carbon $start
|
|
||||||
* @param Carbon $end
|
|
||||||
* @param Collection $accounts
|
|
||||||
*
|
|
||||||
* @return View
|
|
||||||
*/
|
|
||||||
private function defaultMonth(string $reportType, Carbon $start, Carbon $end, Collection $accounts)
|
|
||||||
{
|
|
||||||
$bills = $this->helper->getBillReport($start, $end, $accounts);
|
|
||||||
$tags = $this->helper->tagReport($start, $end, $accounts);
|
|
||||||
|
|
||||||
// and some id's, joined:
|
|
||||||
$accountIds = join(',', $accounts->pluck('id')->toArray());
|
|
||||||
|
|
||||||
// continue!
|
|
||||||
return view(
|
|
||||||
'reports.default.month',
|
|
||||||
compact(
|
|
||||||
'start', 'end',
|
|
||||||
'tags',
|
|
||||||
'bills',
|
|
||||||
'accountIds',
|
|
||||||
'reportType'
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param $reportType
|
|
||||||
* @param $start
|
|
||||||
* @param $end
|
|
||||||
* @param $accounts
|
|
||||||
*
|
|
||||||
* @return View
|
|
||||||
*/
|
|
||||||
private function defaultMultiYear(string $reportType, Carbon $start, Carbon $end, Collection $accounts)
|
|
||||||
{
|
|
||||||
// need all budgets
|
|
||||||
// need all years.
|
|
||||||
|
|
||||||
|
|
||||||
// and some id's, joined:
|
|
||||||
$accountIds = [];
|
|
||||||
/** @var Account $account */
|
|
||||||
foreach ($accounts as $account) {
|
|
||||||
$accountIds[] = $account->id;
|
|
||||||
}
|
|
||||||
$accountIds = join(',', $accountIds);
|
|
||||||
|
|
||||||
return view(
|
|
||||||
'reports.default.multi-year',
|
|
||||||
compact(
|
|
||||||
'accounts', 'start', 'end', 'accountIds', 'reportType'
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param $reportType
|
|
||||||
* @param Carbon $start
|
|
||||||
* @param Carbon $end
|
|
||||||
* @param Collection $accounts
|
|
||||||
*
|
|
||||||
* @return View
|
|
||||||
*/
|
|
||||||
private function defaultYear(string $reportType, Carbon $start, Carbon $end, Collection $accounts)
|
|
||||||
{
|
|
||||||
Session::flash('gaEventCategory', 'report');
|
|
||||||
Session::flash('gaEventAction', 'year');
|
|
||||||
Session::flash('gaEventLabel', $start->format('Y'));
|
|
||||||
|
|
||||||
// and some id's, joined:
|
|
||||||
$accountIds = [];
|
|
||||||
/** @var Account $account */
|
|
||||||
foreach ($accounts as $account) {
|
|
||||||
$accountIds[] = $account->id;
|
|
||||||
}
|
|
||||||
$accountIds = join(',', $accountIds);
|
|
||||||
|
|
||||||
return view(
|
|
||||||
'reports.default.year',
|
|
||||||
compact(
|
|
||||||
'start', 'reportType',
|
|
||||||
'accountIds', 'end'
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -35,6 +35,7 @@ class SearchController extends Controller
|
|||||||
/**
|
/**
|
||||||
* Results always come in the form of an array [results, count, fullCount]
|
* Results always come in the form of an array [results, count, fullCount]
|
||||||
*
|
*
|
||||||
|
* @param Request $request
|
||||||
* @param SearchInterface $searcher
|
* @param SearchInterface $searcher
|
||||||
*
|
*
|
||||||
* @return $this
|
* @return $this
|
||||||
|
@@ -196,35 +196,33 @@ class MassController extends Controller
|
|||||||
$journal = $repository->find(intval($journalId));
|
$journal = $repository->find(intval($journalId));
|
||||||
if ($journal) {
|
if ($journal) {
|
||||||
// get optional fields:
|
// get optional fields:
|
||||||
$what = strtolower(TransactionJournal::transactionTypeStr($journal));
|
$what = strtolower(TransactionJournal::transactionTypeStr($journal));
|
||||||
|
|
||||||
$sourceAccountId = $request->get('source_account_id')[$journal->id] ?? 0;
|
$sourceAccountId = $request->get('source_account_id')[$journal->id] ?? 0;
|
||||||
$sourceAccountName = $request->get('source_account_name')[$journal->id] ?? '';
|
$sourceAccountName = $request->get('source_account_name')[$journal->id] ?? '';
|
||||||
$destAccountId = $request->get('destination_account_id')[$journal->id] ?? 0;
|
$destAccountId = $request->get('destination_account_id')[$journal->id] ?? 0;
|
||||||
$destAccountName = $request->get('destination_account_name')[$journal->id] ?? '';
|
$destAccountName = $request->get('destination_account_name')[$journal->id] ?? '';
|
||||||
|
$budgetId = $journal->budgets->first() ? $journal->budgets->first()->id : 0;
|
||||||
$budgetId = $journal->budgets->first() ? $journal->budgets->first()->id : 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();
|
|
||||||
|
|
||||||
// build data array
|
// build data array
|
||||||
$data = [
|
$data = [
|
||||||
'id' => $journal->id,
|
'id' => $journal->id,
|
||||||
'what' => $what,
|
'what' => $what,
|
||||||
'description' => $request->get('description')[$journal->id],
|
'description' => $request->get('description')[$journal->id],
|
||||||
'source_account_id' => intval($sourceAccountId),
|
'source_account_id' => intval($sourceAccountId),
|
||||||
'source_account_name' => $sourceAccountName,
|
'source_account_name' => $sourceAccountName,
|
||||||
'destination_account_id' => intval($destAccountId),
|
'destination_account_id' => intval($destAccountId),
|
||||||
'destination_account_name' => $destAccountName,
|
'destination_account_name' => $destAccountName,
|
||||||
'amount' => round($request->get('amount')[$journal->id], 4),
|
'amount' => round($request->get('amount')[$journal->id], 4),
|
||||||
'amount_currency_id_amount' => intval($request->get('amount_currency_id_amount_' . $journal->id)),
|
'currency_id' => intval($request->get('amount_currency_id_amount_' . $journal->id)),
|
||||||
'date' => new Carbon($request->get('date')[$journal->id]),
|
'date' => new Carbon($request->get('date')[$journal->id]),
|
||||||
'interest_date' => $journal->interest_date,
|
'interest_date' => $journal->interest_date,
|
||||||
'book_date' => $journal->book_date,
|
'book_date' => $journal->book_date,
|
||||||
'process_date' => $journal->process_date,
|
'process_date' => $journal->process_date,
|
||||||
'budget_id' => $budgetId,
|
'budget_id' => $budgetId,
|
||||||
'category' => $category,
|
'category' => $category,
|
||||||
'tags' => $tags,
|
'tags' => $tags,
|
||||||
|
|
||||||
];
|
];
|
||||||
// call repository update function.
|
// call repository update function.
|
||||||
|
@@ -189,9 +189,9 @@ class SingleController extends Controller
|
|||||||
'budget_id' => TransactionJournal::budgetId($journal),
|
'budget_id' => TransactionJournal::budgetId($journal),
|
||||||
'tags' => join(',', $journal->tags->pluck('tag')->toArray()),
|
'tags' => join(',', $journal->tags->pluck('tag')->toArray()),
|
||||||
'source_account_id' => $sourceAccounts->first()->id,
|
'source_account_id' => $sourceAccounts->first()->id,
|
||||||
'source_account_name' => $sourceAccounts->first()->name,
|
'source_account_name' => $sourceAccounts->first()->edit_name,
|
||||||
'destination_account_id' => $destinationAccounts->first()->id,
|
'destination_account_id' => $destinationAccounts->first()->id,
|
||||||
'destination_account_name' => $destinationAccounts->first()->name,
|
'destination_account_name' => $destinationAccounts->first()->edit_name,
|
||||||
'amount' => TransactionJournal::amountPositive($journal),
|
'amount' => TransactionJournal::amountPositive($journal),
|
||||||
|
|
||||||
// new custom fields:
|
// new custom fields:
|
||||||
|
@@ -187,6 +187,7 @@ class SplitController extends Controller
|
|||||||
'transactions' => $this->getTransactionDataFromRequest($request),
|
'transactions' => $this->getTransactionDataFromRequest($request),
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
return $array;
|
return $array;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -19,6 +19,7 @@ use FireflyIII\Models\TransactionJournal;
|
|||||||
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
|
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
|
||||||
use FireflyIII\Repositories\Journal\JournalTaskerInterface;
|
use FireflyIII\Repositories\Journal\JournalTaskerInterface;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
use Log;
|
||||||
use Preferences;
|
use Preferences;
|
||||||
use Response;
|
use Response;
|
||||||
use View;
|
use View;
|
||||||
@@ -65,6 +66,12 @@ class TransactionController extends Controller
|
|||||||
$collector = new JournalCollector(auth()->user());
|
$collector = new JournalCollector(auth()->user());
|
||||||
$collector->setTypes($types)->setLimit($pageSize)->setPage($page)->setAllAssetAccounts();
|
$collector->setTypes($types)->setLimit($pageSize)->setPage($page)->setAllAssetAccounts();
|
||||||
|
|
||||||
|
// do not filter transfers if $what = transfer.
|
||||||
|
if (!in_array($what, ['transfer', 'transfers'])) {
|
||||||
|
Log::debug('Also get opposing account info.');
|
||||||
|
$collector->withOpposingAccount();
|
||||||
|
}
|
||||||
|
|
||||||
$journals = $collector->getPaginatedJournals();
|
$journals = $collector->getPaginatedJournals();
|
||||||
$journals->setPath('transactions/' . $what);
|
$journals->setPath('transactions/' . $what);
|
||||||
|
|
||||||
|
@@ -14,6 +14,7 @@ declare(strict_types = 1);
|
|||||||
namespace FireflyIII\Http\Middleware;
|
namespace FireflyIII\Http\Middleware;
|
||||||
|
|
||||||
use Closure;
|
use Closure;
|
||||||
|
use FireflyConfig;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
use Preferences;
|
use Preferences;
|
||||||
@@ -45,11 +46,11 @@ class IsConfirmed
|
|||||||
return redirect()->guest('login');
|
return redirect()->guest('login');
|
||||||
}
|
}
|
||||||
// must the user be confirmed in the first place?
|
// must the user be confirmed in the first place?
|
||||||
$confirmAccount = env('MUST_CONFIRM_ACCOUNT', false);
|
$mustConfirmAccount = FireflyConfig::get('must_confirm_account', config('firefly.configuration.must_confirm_account'))->data;
|
||||||
// user must be logged in, then continue:
|
// user must be logged in, then continue:
|
||||||
$isConfirmed = Preferences::get('user_confirmed', false)->data;
|
$isConfirmed = Preferences::get('user_confirmed', false)->data;
|
||||||
|
|
||||||
if ($isConfirmed === false && $confirmAccount === true) {
|
if ($isConfirmed === false && $mustConfirmAccount === true) {
|
||||||
|
|
||||||
// user account is not confirmed, redirect to
|
// user account is not confirmed, redirect to
|
||||||
// confirmation page:
|
// confirmation page:
|
||||||
|
@@ -14,6 +14,7 @@ declare(strict_types = 1);
|
|||||||
namespace FireflyIII\Http\Middleware;
|
namespace FireflyIII\Http\Middleware;
|
||||||
|
|
||||||
use Closure;
|
use Closure;
|
||||||
|
use FireflyConfig;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
use Preferences;
|
use Preferences;
|
||||||
@@ -45,10 +46,10 @@ class IsNotConfirmed
|
|||||||
return redirect()->guest('login');
|
return redirect()->guest('login');
|
||||||
}
|
}
|
||||||
// must the user be confirmed in the first place?
|
// must the user be confirmed in the first place?
|
||||||
$confirmAccount = env('MUST_CONFIRM_ACCOUNT', false);
|
$mustConfirmAccount = FireflyConfig::get('must_confirm_account', config('firefly.configuration.must_confirm_account'))->data;
|
||||||
// user must be logged in, then continue:
|
// user must be logged in, then continue:
|
||||||
$isConfirmed = Preferences::get('user_confirmed', false)->data;
|
$isConfirmed = Preferences::get('user_confirmed', false)->data;
|
||||||
if ($isConfirmed || $confirmAccount === false) {
|
if ($isConfirmed || $mustConfirmAccount === false) {
|
||||||
// user account is confirmed, simply send them home.
|
// user account is confirmed, simply send them home.
|
||||||
return redirect(route('home'));
|
return redirect(route('home'));
|
||||||
}
|
}
|
||||||
|
@@ -130,13 +130,29 @@ class Range
|
|||||||
*/
|
*/
|
||||||
private function datePicker()
|
private function datePicker()
|
||||||
{
|
{
|
||||||
$viewRange = Preferences::get('viewRange', '1M')->data;
|
$viewRange = Preferences::get('viewRange', '1M')->data;
|
||||||
$start = Session::get('start');
|
/** @var Carbon $start */
|
||||||
$end = Session::get('end');
|
$start = Session::get('start');
|
||||||
$prevStart = Navigation::subtractPeriod($start, $viewRange);// subtract for previous period
|
/** @var Carbon $end */
|
||||||
$prevEnd = Navigation::endOfPeriod($prevStart, $viewRange);
|
$end = Session::get('end');
|
||||||
$nextStart = Navigation::addPeriod($start, $viewRange, 0); // add for previous period
|
if ($viewRange === 'custom') {
|
||||||
$nextEnd = Navigation::endOfPeriod($nextStart, $viewRange);
|
$days = $start->diffInDays($end);
|
||||||
|
$prevStart = clone $start;
|
||||||
|
$prevStart->subDays($days);
|
||||||
|
$prevEnd = clone $start;
|
||||||
|
$nextStart = clone $end;
|
||||||
|
$nextEnd = clone $end;
|
||||||
|
$nextEnd->addDays($days);
|
||||||
|
unset($days);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($viewRange !== 'custom') {
|
||||||
|
$prevStart = Navigation::subtractPeriod($start, $viewRange);// subtract for previous period
|
||||||
|
$prevEnd = Navigation::endOfPeriod($prevStart, $viewRange);
|
||||||
|
$nextStart = Navigation::addPeriod($start, $viewRange, 0); // add for previous period
|
||||||
|
$nextEnd = Navigation::endOfPeriod($nextStart, $viewRange);
|
||||||
|
}
|
||||||
|
|
||||||
$ranges = [];
|
$ranges = [];
|
||||||
$ranges['current'] = [$start->format('Y-m-d'), $end->format('Y-m-d')];
|
$ranges['current'] = [$start->format('Y-m-d'), $end->format('Y-m-d')];
|
||||||
$ranges['previous'] = [$prevStart->format('Y-m-d'), $prevEnd->format('Y-m-d')];
|
$ranges['previous'] = [$prevStart->format('Y-m-d'), $prevEnd->format('Y-m-d')];
|
||||||
@@ -146,6 +162,7 @@ class Range
|
|||||||
default:
|
default:
|
||||||
throw new FireflyException('The date picker does not yet support "' . $viewRange . '".');
|
throw new FireflyException('The date picker does not yet support "' . $viewRange . '".');
|
||||||
case '1D':
|
case '1D':
|
||||||
|
case 'custom':
|
||||||
$format = (string)trans('config.month_and_day');
|
$format = (string)trans('config.month_and_day');
|
||||||
break;
|
break;
|
||||||
case '3M':
|
case '3M':
|
||||||
|
@@ -36,7 +36,9 @@ class ConfigurationRequest extends Request
|
|||||||
public function getConfigurationData(): array
|
public function getConfigurationData(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'single_user_mode' => intval($this->get('single_user_mode')) === 1,
|
'single_user_mode' => intval($this->get('single_user_mode')) === 1,
|
||||||
|
'must_confirm_account' => intval($this->get('must_confirm_account')) === 1,
|
||||||
|
'is_demo_site' => intval($this->get('is_demo_site')) === 1,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,7 +48,9 @@ class ConfigurationRequest extends Request
|
|||||||
public function rules()
|
public function rules()
|
||||||
{
|
{
|
||||||
$rules = [
|
$rules = [
|
||||||
'single_user_mode' => 'between:0,1|numeric',
|
'single_user_mode' => 'between:0,1|numeric',
|
||||||
|
'must_confirm_account' => 'between:0,1|numeric',
|
||||||
|
'is_demo_site' => 'between:0,1|numeric',
|
||||||
];
|
];
|
||||||
|
|
||||||
return $rules;
|
return $rules;
|
||||||
|
132
app/Http/Requests/ReportFormRequest.php
Normal file
132
app/Http/Requests/ReportFormRequest.php
Normal file
@@ -0,0 +1,132 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ReportFormRequest.php
|
||||||
|
* Copyright (C) 2016 thegrumpydictator@gmail.com
|
||||||
|
*
|
||||||
|
* This software may be modified and distributed under the terms of the
|
||||||
|
* Creative Commons Attribution-ShareAlike 4.0 International License.
|
||||||
|
*
|
||||||
|
* See the LICENSE file for details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types = 1);
|
||||||
|
|
||||||
|
namespace FireflyIII\Http\Requests;
|
||||||
|
|
||||||
|
use Carbon\Carbon;
|
||||||
|
use Exception;
|
||||||
|
use FireflyIII\Exceptions\FireflyException;
|
||||||
|
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||||
|
use FireflyIII\Repositories\Category\CategoryRepositoryInterface;
|
||||||
|
use Illuminate\Support\Collection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class CategoryFormRequest
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @package FireflyIII\Http\Requests
|
||||||
|
*/
|
||||||
|
class ReportFormRequest extends Request
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function authorize()
|
||||||
|
{
|
||||||
|
// Only allow logged in users
|
||||||
|
return auth()->check();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Collection
|
||||||
|
*/
|
||||||
|
public function getAccountList():Collection
|
||||||
|
{
|
||||||
|
/** @var AccountRepositoryInterface $repository */
|
||||||
|
$repository = app(AccountRepositoryInterface::class);
|
||||||
|
$set = $this->get('accounts');
|
||||||
|
$collection = new Collection;
|
||||||
|
if (is_array($set)) {
|
||||||
|
foreach ($set as $accountId) {
|
||||||
|
$account = $repository->find(intval($accountId));
|
||||||
|
if (!is_null($account->id)) {
|
||||||
|
$collection->push($account);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $collection;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Collection
|
||||||
|
*/
|
||||||
|
public function getCategoryList(): Collection
|
||||||
|
{
|
||||||
|
/** @var CategoryRepositoryInterface $repository */
|
||||||
|
$repository = app(CategoryRepositoryInterface::class);
|
||||||
|
$set = $this->get('category');
|
||||||
|
$collection = new Collection;
|
||||||
|
if (is_array($set)) {
|
||||||
|
foreach ($set as $categoryId) {
|
||||||
|
$category = $repository->find(intval($categoryId));
|
||||||
|
if (!is_null($category->id)) {
|
||||||
|
$collection->push($category);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $collection;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Carbon
|
||||||
|
* @throws FireflyException
|
||||||
|
*/
|
||||||
|
public function getEndDate(): Carbon
|
||||||
|
{
|
||||||
|
$date = new Carbon;
|
||||||
|
$range = $this->get('daterange');
|
||||||
|
$parts = explode(' - ', strval($range));
|
||||||
|
if (count($parts) === 2) {
|
||||||
|
try {
|
||||||
|
$date = new Carbon($parts[1]);
|
||||||
|
} catch (Exception $e) {
|
||||||
|
throw new FireflyException(sprintf('"%s" is not a valid date range.', $range));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $date;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Carbon
|
||||||
|
* @throws FireflyException
|
||||||
|
*/
|
||||||
|
public function getStartDate(): Carbon
|
||||||
|
{
|
||||||
|
$date = new Carbon;
|
||||||
|
$range = $this->get('daterange');
|
||||||
|
$parts = explode(' - ', strval($range));
|
||||||
|
if (count($parts) === 2) {
|
||||||
|
try {
|
||||||
|
$date = new Carbon($parts[0]);
|
||||||
|
} catch (Exception $e) {
|
||||||
|
throw new FireflyException(sprintf('"%s" is not a valid date range.', $range));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $date;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function rules(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'report_type' => 'in:audit,default,category',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
83
app/Import/Converter/TagSplit.php
Normal file
83
app/Import/Converter/TagSplit.php
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* TagSplit.php
|
||||||
|
* Copyright (C) 2016 thegrumpydictator@gmail.com
|
||||||
|
*
|
||||||
|
* This software may be modified and distributed under the terms of the
|
||||||
|
* Creative Commons Attribution-ShareAlike 4.0 International License.
|
||||||
|
*
|
||||||
|
* See the LICENSE file for details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types = 1);
|
||||||
|
|
||||||
|
namespace FireflyIII\Import\Converter;
|
||||||
|
|
||||||
|
use FireflyIII\Repositories\Tag\TagRepositoryInterface;
|
||||||
|
use FireflyIII\User;
|
||||||
|
use Illuminate\Support\Collection;
|
||||||
|
use Log;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class TagSplit
|
||||||
|
*
|
||||||
|
* @package FireflyIII\Import\Converter
|
||||||
|
*/
|
||||||
|
class TagSplit
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param User $user
|
||||||
|
* @param array $mapping
|
||||||
|
* @param array $parts
|
||||||
|
*
|
||||||
|
* @return Collection
|
||||||
|
*/
|
||||||
|
public static function createSetFromSplits(User $user, array $mapping, array $parts): Collection {
|
||||||
|
$set = new Collection;
|
||||||
|
Log::debug('Exploded parts.', $parts);
|
||||||
|
|
||||||
|
/** @var TagRepositoryInterface $repository */
|
||||||
|
$repository = app(TagRepositoryInterface::class, [$user]);
|
||||||
|
|
||||||
|
|
||||||
|
/** @var string $part */
|
||||||
|
foreach ($parts as $part) {
|
||||||
|
if (isset($mapping[$part])) {
|
||||||
|
Log::debug('Found tag in mapping. Should exist.', ['value' => $part, 'map' => $mapping[$part]]);
|
||||||
|
$tag = $repository->find(intval($mapping[$part]));
|
||||||
|
if (!is_null($tag->id)) {
|
||||||
|
Log::debug('Found tag by ID', ['id' => $tag->id]);
|
||||||
|
|
||||||
|
$set->push($tag);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// not mapped? Still try to find it first:
|
||||||
|
$tag = $repository->findByTag($part);
|
||||||
|
if (!is_null($tag->id)) {
|
||||||
|
Log::debug('Found tag by name ', ['id' => $tag->id]);
|
||||||
|
|
||||||
|
$set->push($tag);
|
||||||
|
}
|
||||||
|
if (is_null($tag->id)) {
|
||||||
|
// create new tag
|
||||||
|
$tag = $repository->store(
|
||||||
|
[
|
||||||
|
'tag' => $part,
|
||||||
|
'date' => null,
|
||||||
|
'description' => $part,
|
||||||
|
'latitude' => null,
|
||||||
|
'longitude' => null,
|
||||||
|
'zoomLevel' => null,
|
||||||
|
'tagMode' => 'nothing',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
Log::debug('Created new tag', ['name' => $part, 'id' => $tag->id]);
|
||||||
|
$set->push($tag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $set;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -13,7 +13,6 @@ declare(strict_types = 1);
|
|||||||
|
|
||||||
namespace FireflyIII\Import\Converter;
|
namespace FireflyIII\Import\Converter;
|
||||||
|
|
||||||
use FireflyIII\Repositories\Tag\TagRepositoryInterface;
|
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
use Log;
|
use Log;
|
||||||
|
|
||||||
@@ -41,49 +40,7 @@ class TagsComma extends BasicConverter implements ConverterInterface
|
|||||||
return new Collection;
|
return new Collection;
|
||||||
}
|
}
|
||||||
$parts = array_unique(explode(',', $value));
|
$parts = array_unique(explode(',', $value));
|
||||||
$set = new Collection;
|
$set = TagSplit::createSetFromSplits($this->user, $this->mapping, $parts);
|
||||||
Log::debug('Exploded parts.', $parts);
|
|
||||||
|
|
||||||
/** @var TagRepositoryInterface $repository */
|
|
||||||
$repository = app(TagRepositoryInterface::class, [$this->user]);
|
|
||||||
|
|
||||||
|
|
||||||
/** @var string $part */
|
|
||||||
foreach ($parts as $part) {
|
|
||||||
if (isset($this->mapping[$part])) {
|
|
||||||
Log::debug('Found tag in mapping. Should exist.', ['value' => $part, 'map' => $this->mapping[$part]]);
|
|
||||||
$tag = $repository->find(intval($this->mapping[$part]));
|
|
||||||
if (!is_null($tag->id)) {
|
|
||||||
Log::debug('Found tag by ID', ['id' => $tag->id]);
|
|
||||||
|
|
||||||
$set->push($tag);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// not mapped? Still try to find it first:
|
|
||||||
$tag = $repository->findByTag($part);
|
|
||||||
if (!is_null($tag->id)) {
|
|
||||||
Log::debug('Found tag by name ', ['id' => $tag->id]);
|
|
||||||
|
|
||||||
$set->push($tag);
|
|
||||||
}
|
|
||||||
if (is_null($tag->id)) {
|
|
||||||
// create new tag
|
|
||||||
$tag = $repository->store(
|
|
||||||
[
|
|
||||||
'tag' => $part,
|
|
||||||
'date' => null,
|
|
||||||
'description' => $part,
|
|
||||||
'latitude' => null,
|
|
||||||
'longitude' => null,
|
|
||||||
'zoomLevel' => null,
|
|
||||||
'tagMode' => 'nothing',
|
|
||||||
]
|
|
||||||
);
|
|
||||||
Log::debug('Created new tag', ['name' => $part, 'id' => $tag->id]);
|
|
||||||
$set->push($tag);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$this->setCertainty(100);
|
$this->setCertainty(100);
|
||||||
|
|
||||||
return $set;
|
return $set;
|
||||||
|
@@ -13,7 +13,6 @@ declare(strict_types = 1);
|
|||||||
|
|
||||||
namespace FireflyIII\Import\Converter;
|
namespace FireflyIII\Import\Converter;
|
||||||
|
|
||||||
use FireflyIII\Repositories\Tag\TagRepositoryInterface;
|
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
use Log;
|
use Log;
|
||||||
|
|
||||||
@@ -41,49 +40,7 @@ class TagsSpace extends BasicConverter implements ConverterInterface
|
|||||||
return new Collection;
|
return new Collection;
|
||||||
}
|
}
|
||||||
$parts = array_unique(explode(' ', $value));
|
$parts = array_unique(explode(' ', $value));
|
||||||
$set = new Collection;
|
$set = TagSplit::createSetFromSplits($this->user, $this->mapping, $parts);
|
||||||
Log::debug('Exploded parts.', $parts);
|
|
||||||
|
|
||||||
/** @var TagRepositoryInterface $repository */
|
|
||||||
$repository = app(TagRepositoryInterface::class, [$this->user]);
|
|
||||||
|
|
||||||
|
|
||||||
/** @var string $part */
|
|
||||||
foreach ($parts as $part) {
|
|
||||||
if (isset($this->mapping[$part])) {
|
|
||||||
Log::debug('Found tag in mapping. Should exist.', ['value' => $part, 'map' => $this->mapping[$part]]);
|
|
||||||
$tag = $repository->find(intval($this->mapping[$part]));
|
|
||||||
if (!is_null($tag->id)) {
|
|
||||||
Log::debug('Found tag by ID', ['id' => $tag->id]);
|
|
||||||
|
|
||||||
$set->push($tag);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// not mapped? Still try to find it first:
|
|
||||||
$tag = $repository->findByTag($part);
|
|
||||||
if (!is_null($tag->id)) {
|
|
||||||
Log::debug('Found tag by name ', ['id' => $tag->id]);
|
|
||||||
|
|
||||||
$set->push($tag);
|
|
||||||
}
|
|
||||||
if (is_null($tag->id)) {
|
|
||||||
// create new tag
|
|
||||||
$tag = $repository->store(
|
|
||||||
[
|
|
||||||
'tag' => $part,
|
|
||||||
'date' => null,
|
|
||||||
'description' => $part,
|
|
||||||
'latitude' => null,
|
|
||||||
'longitude' => null,
|
|
||||||
'zoomLevel' => null,
|
|
||||||
'tagMode' => 'nothing',
|
|
||||||
]
|
|
||||||
);
|
|
||||||
Log::debug('Created new tag', ['name' => $part, 'id' => $tag->id]);
|
|
||||||
$set->push($tag);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$this->setCertainty(100);
|
$this->setCertainty(100);
|
||||||
|
|
||||||
return $set;
|
return $set;
|
||||||
|
@@ -26,46 +26,11 @@ use Illuminate\Database\Query\JoinClause;
|
|||||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||||
use Watson\Validating\ValidatingTrait;
|
use Watson\Validating\ValidatingTrait;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FireflyIII\Models\Account
|
* Class Account
|
||||||
*
|
*
|
||||||
* @property integer $id
|
* @package FireflyIII\Models
|
||||||
* @property \Carbon\Carbon $created_at
|
|
||||||
* @property \Carbon\Carbon $updated_at
|
|
||||||
* @property \Carbon\Carbon $deleted_at
|
|
||||||
* @property integer $user_id
|
|
||||||
* @property integer $account_type_id
|
|
||||||
* @property string $name
|
|
||||||
* @property boolean $active
|
|
||||||
* @property boolean $encrypted
|
|
||||||
* @property float $virtual_balance
|
|
||||||
* @property string $iban
|
|
||||||
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\AccountMeta[] $accountMeta
|
|
||||||
* @property-read \FireflyIII\Models\AccountType $accountType
|
|
||||||
* @property-read mixed $name_for_editform
|
|
||||||
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\PiggyBank[] $piggyBanks
|
|
||||||
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Transaction[] $transactions
|
|
||||||
* @property-read \FireflyIII\User $user
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Account accountTypeIn($types)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Account hasMetaValue($name, $value)
|
|
||||||
* @property string $startBalance
|
|
||||||
* @property string $endBalance
|
|
||||||
* @property float $difference
|
|
||||||
* @property \Carbon\Carbon $lastActivityDate
|
|
||||||
* @property float $piggyBalance
|
|
||||||
* @property float $percentage
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Account whereId($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Account whereCreatedAt($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Account whereUpdatedAt($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Account whereDeletedAt($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Account whereUserId($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Account whereAccountTypeId($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Account whereName($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Account whereActive($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Account whereEncrypted($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Account whereVirtualBalance($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Account whereIban($value)
|
|
||||||
* @mixin \Eloquent
|
|
||||||
*/
|
*/
|
||||||
class Account extends Model
|
class Account extends Model
|
||||||
{
|
{
|
||||||
@@ -154,6 +119,20 @@ class Account extends Model
|
|||||||
return $this->belongsTo('FireflyIII\Models\AccountType');
|
return $this->belongsTo('FireflyIII\Models\AccountType');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getEditNameAttribute(): string
|
||||||
|
{
|
||||||
|
$name = $this->name;
|
||||||
|
|
||||||
|
if ($this->accountType->type === AccountType::CASH) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $name;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FIxxME can return null
|
* FIxxME can return null
|
||||||
*
|
*
|
||||||
|
@@ -17,22 +17,9 @@ use Illuminate\Database\Eloquent\Model;
|
|||||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FireflyIII\Models\AccountMeta
|
* Class AccountMeta
|
||||||
*
|
*
|
||||||
* @property integer $id
|
* @package FireflyIII\Models
|
||||||
* @property \Carbon\Carbon $created_at
|
|
||||||
* @property \Carbon\Carbon $updated_at
|
|
||||||
* @property integer $account_id
|
|
||||||
* @property string $name
|
|
||||||
* @property string $data
|
|
||||||
* @property-read Account $account
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\AccountMeta whereId($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\AccountMeta whereCreatedAt($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\AccountMeta whereUpdatedAt($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\AccountMeta whereAccountId($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\AccountMeta whereName($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\AccountMeta whereData($value)
|
|
||||||
* @mixin \Eloquent
|
|
||||||
*/
|
*/
|
||||||
class AccountMeta extends Model
|
class AccountMeta extends Model
|
||||||
{
|
{
|
||||||
|
@@ -17,18 +17,9 @@ use Illuminate\Database\Eloquent\Model;
|
|||||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FireflyIII\Models\AccountType
|
* Class AccountType
|
||||||
*
|
*
|
||||||
* @property integer $id
|
* @package FireflyIII\Models
|
||||||
* @property \Carbon\Carbon $created_at
|
|
||||||
* @property \Carbon\Carbon $updated_at
|
|
||||||
* @property string $type
|
|
||||||
* @property-read \Illuminate\Database\Eloquent\Collection|Account[] $accounts
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\AccountType whereId($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\AccountType whereCreatedAt($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\AccountType whereUpdatedAt($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\AccountType whereType($value)
|
|
||||||
* @mixin \Eloquent
|
|
||||||
*/
|
*/
|
||||||
class AccountType extends Model
|
class AccountType extends Model
|
||||||
{
|
{
|
||||||
|
@@ -21,41 +21,9 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
|||||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FireflyIII\Models\Attachment
|
* Class Attachment
|
||||||
*
|
*
|
||||||
* @property integer $id
|
* @package FireflyIII\Models
|
||||||
* @property \Carbon\Carbon $created_at
|
|
||||||
* @property \Carbon\Carbon $updated_at
|
|
||||||
* @property string $deleted_at
|
|
||||||
* @property integer $attachable_id
|
|
||||||
* @property string $attachable_type
|
|
||||||
* @property integer $user_id
|
|
||||||
* @property string $md5
|
|
||||||
* @property string $filename
|
|
||||||
* @property string $title
|
|
||||||
* @property string $description
|
|
||||||
* @property string $notes
|
|
||||||
* @property string $mime
|
|
||||||
* @property integer $size
|
|
||||||
* @property boolean $uploaded
|
|
||||||
* @property-read Attachment $attachable
|
|
||||||
* @property-read \FireflyIII\User $user
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Attachment whereId($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Attachment whereCreatedAt($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Attachment whereUpdatedAt($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Attachment whereDeletedAt($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Attachment whereAttachableId($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Attachment whereAttachableType($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Attachment whereUserId($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Attachment whereMd5($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Attachment whereFilename($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Attachment whereTitle($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Attachment whereDescription($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Attachment whereNotes($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Attachment whereMime($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Attachment whereSize($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Attachment whereUploaded($value)
|
|
||||||
* @mixin \Eloquent
|
|
||||||
*/
|
*/
|
||||||
class Attachment extends Model
|
class Attachment extends Model
|
||||||
{
|
{
|
||||||
|
@@ -21,48 +21,9 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
|||||||
use Watson\Validating\ValidatingTrait;
|
use Watson\Validating\ValidatingTrait;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FireflyIII\Models\Bill
|
* Class Bill
|
||||||
*
|
*
|
||||||
* @property integer $id
|
* @package FireflyIII\Models
|
||||||
* @property \Carbon\Carbon $created_at
|
|
||||||
* @property \Carbon\Carbon $updated_at
|
|
||||||
* @property integer $user_id
|
|
||||||
* @property string $name
|
|
||||||
* @property string $match
|
|
||||||
* @property float $amount_min
|
|
||||||
* @property float $amount_max
|
|
||||||
* @property \Carbon\Carbon $date
|
|
||||||
* @property boolean $active
|
|
||||||
* @property boolean $automatch
|
|
||||||
* @property string $repeat_freq
|
|
||||||
* @property integer $skip
|
|
||||||
* @property boolean $name_encrypted
|
|
||||||
* @property boolean $match_encrypted
|
|
||||||
* @property-read \Illuminate\Database\Eloquent\Collection|TransactionJournal[] $transactionjournals
|
|
||||||
* @property-read \FireflyIII\User $user
|
|
||||||
* @property \Carbon\Carbon $nextExpectedMatch
|
|
||||||
* @property \Carbon\Carbon $lastFoundMatch
|
|
||||||
* @property bool $paidInPeriod
|
|
||||||
* @property string $lastPaidAmount
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Bill whereId($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Bill whereCreatedAt($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Bill whereUpdatedAt($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Bill whereUserId($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Bill whereName($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Bill whereMatch($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Bill whereAmountMin($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Bill whereAmountMax($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Bill whereDate($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Bill whereActive($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Bill whereAutomatch($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Bill whereRepeatFreq($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Bill whereSkip($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Bill whereNameEncrypted($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Bill whereMatchEncrypted($value)
|
|
||||||
* @mixin \Eloquent
|
|
||||||
* @property string $deleted_at
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Bill whereDeletedAt($value)
|
|
||||||
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\TransactionJournal[] $transactionJournals
|
|
||||||
*/
|
*/
|
||||||
class Bill extends Model
|
class Bill extends Model
|
||||||
{
|
{
|
||||||
|
@@ -21,35 +21,9 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
|||||||
use Watson\Validating\ValidatingTrait;
|
use Watson\Validating\ValidatingTrait;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FireflyIII\Models\Budget
|
* Class Budget
|
||||||
*
|
*
|
||||||
* @property integer $id
|
* @package FireflyIII\Models
|
||||||
* @property \Carbon\Carbon $created_at
|
|
||||||
* @property \Carbon\Carbon $updated_at
|
|
||||||
* @property \Carbon\Carbon $deleted_at
|
|
||||||
* @property string $name
|
|
||||||
* @property integer $user_id
|
|
||||||
* @property boolean $active
|
|
||||||
* @property boolean $encrypted
|
|
||||||
* @property-read \Illuminate\Database\Eloquent\Collection|BudgetLimit[] $budgetlimits
|
|
||||||
* @property-read \Illuminate\Database\Eloquent\Collection|TransactionJournal[] $transactionjournals
|
|
||||||
* @property-read \FireflyIII\User $user
|
|
||||||
* @property string $dateFormatted
|
|
||||||
* @property string $budgeted
|
|
||||||
* @property float $amount
|
|
||||||
* @property \Carbon\Carbon $date
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Budget whereId($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Budget whereCreatedAt($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Budget whereUpdatedAt($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Budget whereDeletedAt($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Budget whereName($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Budget whereUserId($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Budget whereActive($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Budget whereEncrypted($value)
|
|
||||||
* @mixin \Eloquent
|
|
||||||
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Transaction[] $transactions
|
|
||||||
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\LimitRepetition[] $limitrepetitions
|
|
||||||
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\TransactionJournal[] $transactionJournals
|
|
||||||
*/
|
*/
|
||||||
class Budget extends Model
|
class Budget extends Model
|
||||||
{
|
{
|
||||||
|
@@ -16,28 +16,9 @@ namespace FireflyIII\Models;
|
|||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FireflyIII\Models\BudgetLimit
|
* Class BudgetLimit
|
||||||
*
|
*
|
||||||
* @property integer $id
|
* @package FireflyIII\Models
|
||||||
* @property \Carbon\Carbon $created_at
|
|
||||||
* @property \Carbon\Carbon $updated_at
|
|
||||||
* @property integer $budget_id
|
|
||||||
* @property \Carbon\Carbon $startdate
|
|
||||||
* @property float $amount
|
|
||||||
* @property boolean $repeats
|
|
||||||
* @property string $repeat_freq
|
|
||||||
* @property-read Budget $budget
|
|
||||||
* @property int $component_id
|
|
||||||
* @property-read \Illuminate\Database\Eloquent\Collection|LimitRepetition[] $limitrepetitions
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\BudgetLimit whereId($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\BudgetLimit whereCreatedAt($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\BudgetLimit whereUpdatedAt($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\BudgetLimit whereBudgetId($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\BudgetLimit whereStartdate($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\BudgetLimit whereAmount($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\BudgetLimit whereRepeats($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\BudgetLimit whereRepeatFreq($value)
|
|
||||||
* @mixin \Eloquent
|
|
||||||
*/
|
*/
|
||||||
class BudgetLimit extends Model
|
class BudgetLimit extends Model
|
||||||
{
|
{
|
||||||
|
@@ -21,31 +21,9 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
|||||||
use Watson\Validating\ValidatingTrait;
|
use Watson\Validating\ValidatingTrait;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FireflyIII\Models\Category
|
* Class Category
|
||||||
*
|
*
|
||||||
* @property integer $id
|
* @package FireflyIII\Models
|
||||||
* @property \Carbon\Carbon $created_at
|
|
||||||
* @property \Carbon\Carbon $updated_at
|
|
||||||
* @property \Carbon\Carbon $deleted_at
|
|
||||||
* @property string $name
|
|
||||||
* @property integer $user_id
|
|
||||||
* @property boolean $encrypted
|
|
||||||
* @property-read \Illuminate\Database\Eloquent\Collection|TransactionJournal[] $transactionjournals
|
|
||||||
* @property-read \FireflyIII\User $user
|
|
||||||
* @property string $dateFormatted
|
|
||||||
* @property string $spent
|
|
||||||
* @property \Carbon\Carbon $lastActivity
|
|
||||||
* @property string $type
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Category whereId($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Category whereCreatedAt($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Category whereUpdatedAt($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Category whereDeletedAt($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Category whereName($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Category whereUserId($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Category whereEncrypted($value)
|
|
||||||
* @mixin \Eloquent
|
|
||||||
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Transaction[] $transactions
|
|
||||||
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\TransactionJournal[] $transactionJournals
|
|
||||||
*/
|
*/
|
||||||
class Category extends Model
|
class Category extends Model
|
||||||
{
|
{
|
||||||
|
@@ -17,21 +17,9 @@ use Illuminate\Database\Eloquent\Model;
|
|||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FireflyIII\Models\Configuration
|
* Class Configuration
|
||||||
*
|
*
|
||||||
* @mixin \Eloquent
|
* @package FireflyIII\Models
|
||||||
* @property integer $id
|
|
||||||
* @property \Carbon\Carbon $created_at
|
|
||||||
* @property \Carbon\Carbon $updated_at
|
|
||||||
* @property \Carbon\Carbon $deleted_at
|
|
||||||
* @property string $name
|
|
||||||
* @property string $data
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Configuration whereId($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Configuration whereCreatedAt($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Configuration whereUpdatedAt($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Configuration whereDeletedAt($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Configuration whereName($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Configuration whereData($value)
|
|
||||||
*/
|
*/
|
||||||
class Configuration extends Model
|
class Configuration extends Model
|
||||||
{
|
{
|
||||||
|
@@ -19,21 +19,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
|||||||
/**
|
/**
|
||||||
* Class ExportJob
|
* Class ExportJob
|
||||||
*
|
*
|
||||||
* @package FireflyIII
|
* @package FireflyIII\Models
|
||||||
* @property integer $id
|
|
||||||
* @property \Carbon\Carbon $created_at
|
|
||||||
* @property \Carbon\Carbon $updated_at
|
|
||||||
* @property integer $user_id
|
|
||||||
* @property string $key
|
|
||||||
* @property string $status
|
|
||||||
* @property-read \FireflyIII\User $user
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\ExportJob whereId($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\ExportJob whereCreatedAt($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\ExportJob whereUpdatedAt($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\ExportJob whereUserId($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\ExportJob whereKey($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\ExportJob whereStatus($value)
|
|
||||||
* @mixin \Eloquent
|
|
||||||
*/
|
*/
|
||||||
class ExportJob extends Model
|
class ExportJob extends Model
|
||||||
{
|
{
|
||||||
|
@@ -18,30 +18,10 @@ use Illuminate\Database\Eloquent\Model;
|
|||||||
use Storage;
|
use Storage;
|
||||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FireflyIII\Models\ImportJob
|
* Class ImportJob
|
||||||
*
|
*
|
||||||
* @property integer $id
|
* @package FireflyIII\Models
|
||||||
* @property \Carbon\Carbon $created_at
|
|
||||||
* @property \Carbon\Carbon $updated_at
|
|
||||||
* @property integer $user_id
|
|
||||||
* @property string $key
|
|
||||||
* @property string $file_type
|
|
||||||
* @property string $status
|
|
||||||
* @property array $configuration
|
|
||||||
* @property-read \FireflyIII\User $user
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\ImportJob whereId($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\ImportJob whereCreatedAt($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\ImportJob whereUpdatedAt($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\ImportJob whereUserId($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\ImportJob whereKey($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\ImportJob whereFileType($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\ImportJob whereStatus($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\ImportJob whereConfiguration($value)
|
|
||||||
* @mixin \Eloquent
|
|
||||||
* @property string $extended_status
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\ImportJob whereExtendedStatus($value)
|
|
||||||
*/
|
*/
|
||||||
class ImportJob extends Model
|
class ImportJob extends Model
|
||||||
{
|
{
|
||||||
|
@@ -19,28 +19,9 @@ use Illuminate\Database\Eloquent\Model;
|
|||||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FireflyIII\Models\LimitRepetition
|
* Class LimitRepetition
|
||||||
*
|
*
|
||||||
* @property integer $id
|
* @package FireflyIII\Models
|
||||||
* @property \Carbon\Carbon $created_at
|
|
||||||
* @property \Carbon\Carbon $updated_at
|
|
||||||
* @property integer $budget_limit_id
|
|
||||||
* @property \Carbon\Carbon $startdate
|
|
||||||
* @property \Carbon\Carbon $enddate
|
|
||||||
* @property float $amount
|
|
||||||
* @property-read BudgetLimit $budgetLimit
|
|
||||||
* @property int $budget_id
|
|
||||||
* @property string $spent
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\LimitRepetition whereId($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\LimitRepetition whereCreatedAt($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\LimitRepetition whereUpdatedAt($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\LimitRepetition whereBudgetLimitId($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\LimitRepetition whereStartdate($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\LimitRepetition whereEnddate($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\LimitRepetition whereAmount($value)
|
|
||||||
* @mixin \Eloquent
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\LimitRepetition after($date)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\LimitRepetition before($date)
|
|
||||||
*/
|
*/
|
||||||
class LimitRepetition extends Model
|
class LimitRepetition extends Model
|
||||||
{
|
{
|
||||||
|
@@ -16,28 +16,10 @@ namespace FireflyIII\Models;
|
|||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use League\CommonMark\CommonMarkConverter;
|
use League\CommonMark\CommonMarkConverter;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FireflyIII\Models\Note
|
* Class Note
|
||||||
*
|
*
|
||||||
* @property integer $id
|
* @package FireflyIII\Models
|
||||||
* @property \Carbon\Carbon $created_at
|
|
||||||
* @property \Carbon\Carbon $updated_at
|
|
||||||
* @property string $deleted_at
|
|
||||||
* @property integer $noteable_id
|
|
||||||
* @property string $noteable_type
|
|
||||||
* @property string $title
|
|
||||||
* @property string $text
|
|
||||||
* @property-read \Illuminate\Database\Eloquent\Model|\Eloquent $noteable
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Note whereId($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Note whereCreatedAt($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Note whereUpdatedAt($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Note whereDeletedAt($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Note whereNoteableId($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Note whereNoteableType($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Note whereTitle($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Note whereText($value)
|
|
||||||
* @mixin \Eloquent
|
|
||||||
*/
|
*/
|
||||||
class Note extends Model
|
class Note extends Model
|
||||||
{
|
{
|
||||||
|
@@ -21,42 +21,9 @@ use Steam;
|
|||||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FireflyIII\Models\PiggyBank
|
* Class PiggyBank
|
||||||
*
|
*
|
||||||
* @property integer $id
|
* @package FireflyIII\Models
|
||||||
* @property \Carbon\Carbon $created_at
|
|
||||||
* @property \Carbon\Carbon $updated_at
|
|
||||||
* @property \Carbon\Carbon $deleted_at
|
|
||||||
* @property integer $account_id
|
|
||||||
* @property string $name
|
|
||||||
* @property float $targetamount
|
|
||||||
* @property \Carbon\Carbon $startdate
|
|
||||||
* @property \Carbon\Carbon $targetdate
|
|
||||||
* @property integer $order
|
|
||||||
* @property boolean $encrypted
|
|
||||||
* @property-read Account $account
|
|
||||||
* @property-read \Illuminate\Database\Eloquent\Collection|PiggyBankRepetition[] $piggyBankRepetitions
|
|
||||||
* @property-read \Illuminate\Database\Eloquent\Collection|PiggyBankEvent[] $piggyBankEvents
|
|
||||||
* @property string $reminder
|
|
||||||
* @property PiggyBankRepetition $currentRep
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBank whereId($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBank whereCreatedAt($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBank whereUpdatedAt($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBank whereAccountId($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBank whereName($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBank whereTargetamount($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBank whereStartdate($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBank whereTargetdate($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBank whereReminder($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBank whereReminderSkip($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBank whereRemindMe($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBank whereOrder($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBank whereDeletedAt($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBank whereEncrypted($value)
|
|
||||||
* @mixin \Eloquent
|
|
||||||
* @property boolean $active
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBank whereActive($value)
|
|
||||||
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Note[] $notes
|
|
||||||
*/
|
*/
|
||||||
class PiggyBank extends Model
|
class PiggyBank extends Model
|
||||||
{
|
{
|
||||||
|
@@ -16,25 +16,9 @@ namespace FireflyIII\Models;
|
|||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FireflyIII\Models\PiggyBankEvent
|
* Class PiggyBankEvent
|
||||||
*
|
*
|
||||||
* @property integer $id
|
* @package FireflyIII\Models
|
||||||
* @property \Carbon\Carbon $created_at
|
|
||||||
* @property \Carbon\Carbon $updated_at
|
|
||||||
* @property integer $piggy_bank_id
|
|
||||||
* @property integer $transaction_journal_id
|
|
||||||
* @property \Carbon\Carbon $date
|
|
||||||
* @property float $amount
|
|
||||||
* @property PiggyBank $piggyBank
|
|
||||||
* @property-read TransactionJournal $transactionJournal
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBankEvent whereId($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBankEvent whereCreatedAt($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBankEvent whereUpdatedAt($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBankEvent wherePiggyBankId($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBankEvent whereTransactionJournalId($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBankEvent whereDate($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBankEvent whereAmount($value)
|
|
||||||
* @mixin \Eloquent
|
|
||||||
*/
|
*/
|
||||||
class PiggyBankEvent extends Model
|
class PiggyBankEvent extends Model
|
||||||
{
|
{
|
||||||
|
@@ -18,26 +18,9 @@ use Illuminate\Database\Eloquent\Builder as EloquentBuilder;
|
|||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FireflyIII\Models\PiggyBankRepetition
|
* Class PiggyBankRepetition
|
||||||
*
|
*
|
||||||
* @property integer $id
|
* @package FireflyIII\Models
|
||||||
* @property \Carbon\Carbon $created_at
|
|
||||||
* @property \Carbon\Carbon $updated_at
|
|
||||||
* @property integer $piggy_bank_id
|
|
||||||
* @property \Carbon\Carbon $startdate
|
|
||||||
* @property \Carbon\Carbon $targetdate
|
|
||||||
* @property float $currentamount
|
|
||||||
* @property-read PiggyBank $piggyBank
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|PiggyBankRepetition onDates($start, $target)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|PiggyBankRepetition relevantOnDate($date)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBankRepetition whereId($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBankRepetition whereCreatedAt($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBankRepetition whereUpdatedAt($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBankRepetition wherePiggyBankId($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBankRepetition whereStartdate($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBankRepetition whereTargetdate($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBankRepetition whereCurrentamount($value)
|
|
||||||
* @mixin \Eloquent
|
|
||||||
*/
|
*/
|
||||||
class PiggyBankRepetition extends Model
|
class PiggyBankRepetition extends Model
|
||||||
{
|
{
|
||||||
|
@@ -20,25 +20,9 @@ use Illuminate\Database\Eloquent\Model;
|
|||||||
use Log;
|
use Log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FireflyIII\Models\Preference
|
* Class Preference
|
||||||
*
|
*
|
||||||
* @property integer $id
|
* @package FireflyIII\Models
|
||||||
* @property \Carbon\Carbon $created_at
|
|
||||||
* @property \Carbon\Carbon $updated_at
|
|
||||||
* @property integer $user_id
|
|
||||||
* @property string $name
|
|
||||||
* @property string $name_encrypted
|
|
||||||
* @property string $data
|
|
||||||
* @property-read \FireflyIII\User $user
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Preference whereId($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Preference whereCreatedAt($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Preference whereUpdatedAt($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Preference whereUserId($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Preference whereName($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Preference whereNameEncrypted($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Preference whereData($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Preference whereDataEncrypted($value)
|
|
||||||
* @mixin \Eloquent
|
|
||||||
*/
|
*/
|
||||||
class Preference extends Model
|
class Preference extends Model
|
||||||
{
|
{
|
||||||
|
@@ -16,25 +16,10 @@ namespace FireflyIII\Models;
|
|||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Role
|
* Class Role
|
||||||
*
|
*
|
||||||
* @package FireflyIII\Models
|
* @package FireflyIII\Models
|
||||||
* @property integer $id
|
|
||||||
* @property string $name
|
|
||||||
* @property string $display_name
|
|
||||||
* @property string $description
|
|
||||||
* @property \Carbon\Carbon $created_at
|
|
||||||
* @property \Carbon\Carbon $updated_at
|
|
||||||
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\User[] $users
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Role whereId($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Role whereName($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Role whereDisplayName($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Role whereDescription($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Role whereCreatedAt($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Role whereUpdatedAt($value)
|
|
||||||
* @mixin \Eloquent
|
|
||||||
*/
|
*/
|
||||||
class Role extends Model
|
class Role extends Model
|
||||||
{
|
{
|
||||||
|
@@ -21,33 +21,6 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
|||||||
* Class Rule
|
* Class Rule
|
||||||
*
|
*
|
||||||
* @package FireflyIII\Models
|
* @package FireflyIII\Models
|
||||||
* @property integer $id
|
|
||||||
* @property \Carbon\Carbon $created_at
|
|
||||||
* @property \Carbon\Carbon $updated_at
|
|
||||||
* @property string $deleted_at
|
|
||||||
* @property integer $user_id
|
|
||||||
* @property integer $rule_group_id
|
|
||||||
* @property integer $order
|
|
||||||
* @property string $title
|
|
||||||
* @property string $description
|
|
||||||
* @property boolean $active
|
|
||||||
* @property boolean $stop_processing
|
|
||||||
* @property-read \FireflyIII\User $user
|
|
||||||
* @property-read \FireflyIII\Models\RuleGroup $ruleGroup
|
|
||||||
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\RuleAction[] $ruleActions
|
|
||||||
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\RuleTrigger[] $ruleTriggers
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Rule whereId($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Rule whereCreatedAt($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Rule whereUpdatedAt($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Rule whereDeletedAt($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Rule whereUserId($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Rule whereRuleGroupId($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Rule whereOrder($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Rule whereActive($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Rule whereStopProcessing($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Rule whereTitle($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Rule whereDescription($value)
|
|
||||||
* @mixin \Eloquent
|
|
||||||
*/
|
*/
|
||||||
class Rule extends Model
|
class Rule extends Model
|
||||||
{
|
{
|
||||||
|
@@ -22,30 +22,10 @@ namespace FireflyIII\Models;
|
|||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FireflyIII\Models\RuleAction
|
* Class RuleAction
|
||||||
*
|
*
|
||||||
* @property integer $id
|
* @package FireflyIII\Models
|
||||||
* @property \Carbon\Carbon $created_at
|
|
||||||
* @property \Carbon\Carbon $updated_at
|
|
||||||
* @property integer $rule_id
|
|
||||||
* @property integer $order
|
|
||||||
* @property boolean $active
|
|
||||||
* @property boolean $stop_processing
|
|
||||||
* @property string $action_type
|
|
||||||
* @property string $action_value
|
|
||||||
* @property-read \FireflyIII\Models\Rule $rule
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\RuleAction whereId($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\RuleAction whereCreatedAt($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\RuleAction whereUpdatedAt($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\RuleAction whereRuleId($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\RuleAction whereOrder($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\RuleAction whereActive($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\RuleAction whereStopProcessing($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\RuleAction whereActionType($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\RuleAction whereActionValue($value)
|
|
||||||
* @mixin \Eloquent
|
|
||||||
*/
|
*/
|
||||||
class RuleAction extends Model
|
class RuleAction extends Model
|
||||||
{
|
{
|
||||||
|
@@ -21,27 +21,6 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
|||||||
* Class RuleGroup
|
* Class RuleGroup
|
||||||
*
|
*
|
||||||
* @package FireflyIII\Models
|
* @package FireflyIII\Models
|
||||||
* @property integer $id
|
|
||||||
* @property \Carbon\Carbon $created_at
|
|
||||||
* @property \Carbon\Carbon $updated_at
|
|
||||||
* @property string $deleted_at
|
|
||||||
* @property integer $user_id
|
|
||||||
* @property integer $order
|
|
||||||
* @property string $title
|
|
||||||
* @property string $description
|
|
||||||
* @property boolean $active
|
|
||||||
* @property-read \FireflyIII\User $user
|
|
||||||
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Rule[] $rules
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\RuleGroup whereId($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\RuleGroup whereCreatedAt($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\RuleGroup whereUpdatedAt($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\RuleGroup whereDeletedAt($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\RuleGroup whereUserId($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\RuleGroup whereOrder($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\RuleGroup whereTitle($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\RuleGroup whereDescription($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\RuleGroup whereActive($value)
|
|
||||||
* @mixin \Eloquent
|
|
||||||
*/
|
*/
|
||||||
class RuleGroup extends Model
|
class RuleGroup extends Model
|
||||||
{
|
{
|
||||||
|
@@ -16,29 +16,9 @@ namespace FireflyIII\Models;
|
|||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FireflyIII\Models\RuleTrigger
|
* Class RuleTrigger
|
||||||
*
|
*
|
||||||
* @property integer $id
|
* @package FireflyIII\Models
|
||||||
* @property \Carbon\Carbon $created_at
|
|
||||||
* @property \Carbon\Carbon $updated_at
|
|
||||||
* @property integer $rule_id
|
|
||||||
* @property integer $order
|
|
||||||
* @property string $title
|
|
||||||
* @property string $trigger_type
|
|
||||||
* @property string $trigger_value
|
|
||||||
* @property boolean $active
|
|
||||||
* @property boolean $stop_processing
|
|
||||||
* @property-read \FireflyIII\Models\Rule $rule
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\RuleTrigger whereId($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\RuleTrigger whereCreatedAt($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\RuleTrigger whereUpdatedAt($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\RuleTrigger whereRuleId($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\RuleTrigger whereOrder($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\RuleTrigger whereActive($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\RuleTrigger whereStopProcessing($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\RuleTrigger whereTriggerType($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\RuleTrigger whereTriggerValue($value)
|
|
||||||
* @mixin \Eloquent
|
|
||||||
*/
|
*/
|
||||||
class RuleTrigger extends Model
|
class RuleTrigger extends Model
|
||||||
{
|
{
|
||||||
|
@@ -19,37 +19,9 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
|||||||
use Watson\Validating\ValidatingTrait;
|
use Watson\Validating\ValidatingTrait;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FireflyIII\Models\Tag
|
* Class Tag
|
||||||
*
|
*
|
||||||
* @property integer $id
|
* @package FireflyIII\Models
|
||||||
* @property \Carbon\Carbon $created_at
|
|
||||||
* @property \Carbon\Carbon $updated_at
|
|
||||||
* @property string $deleted_at
|
|
||||||
* @property integer $user_id
|
|
||||||
* @property string $tag
|
|
||||||
* @property string $tagMode
|
|
||||||
* @property \Carbon\Carbon $date
|
|
||||||
* @property string $description
|
|
||||||
* @property float $latitude
|
|
||||||
* @property float $longitude
|
|
||||||
* @property integer $zoomLevel
|
|
||||||
* @property-read \Illuminate\Database\Eloquent\Collection|TransactionJournal[] $transactionjournals
|
|
||||||
* @property-read \FireflyIII\User $user
|
|
||||||
* @property int $account_id
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Tag whereId($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Tag whereCreatedAt($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Tag whereUpdatedAt($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Tag whereDeletedAt($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Tag whereUserId($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Tag whereTag($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Tag whereTagMode($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Tag whereDate($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Tag whereDescription($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Tag whereLatitude($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Tag whereLongitude($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Tag whereZoomLevel($value)
|
|
||||||
* @mixin \Eloquent
|
|
||||||
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\TransactionJournal[] $transactionJournals
|
|
||||||
*/
|
*/
|
||||||
class Tag extends TagSupport
|
class Tag extends TagSupport
|
||||||
{
|
{
|
||||||
|
@@ -20,36 +20,9 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
|||||||
use Watson\Validating\ValidatingTrait;
|
use Watson\Validating\ValidatingTrait;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FireflyIII\Models\Transaction
|
* Class Transaction
|
||||||
*
|
*
|
||||||
* @property integer $id
|
* @package FireflyIII\Models
|
||||||
* @property \Carbon\Carbon $created_at
|
|
||||||
* @property \Carbon\Carbon $updated_at
|
|
||||||
* @property \Carbon\Carbon $deleted_at
|
|
||||||
* @property integer $account_id
|
|
||||||
* @property integer $transaction_journal_id
|
|
||||||
* @property string $description
|
|
||||||
* @property float $amount
|
|
||||||
* @property-read Account $account
|
|
||||||
* @property-read TransactionJournal $transactionJournal
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|Transaction after($date)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|Transaction before($date)
|
|
||||||
* @property float $before
|
|
||||||
* @property float $after
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Transaction whereId($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Transaction whereCreatedAt($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Transaction whereUpdatedAt($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Transaction whereDeletedAt($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Transaction whereAccountId($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Transaction whereTransactionJournalId($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Transaction whereDescription($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Transaction whereAmount($value)
|
|
||||||
* @mixin \Eloquent
|
|
||||||
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Budget[] $budgets
|
|
||||||
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Category[] $categories
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Transaction transactionTypes($types)
|
|
||||||
* @property integer $identifier
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Transaction whereIdentifier($value)
|
|
||||||
*/
|
*/
|
||||||
class Transaction extends Model
|
class Transaction extends Model
|
||||||
{
|
{
|
||||||
|
@@ -19,24 +19,9 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
|||||||
use Watson\Validating\ValidatingTrait;
|
use Watson\Validating\ValidatingTrait;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FireflyIII\Models\TransactionCurrency
|
* Class TransactionCurrency
|
||||||
*
|
*
|
||||||
* @property integer $id
|
* @package FireflyIII\Models
|
||||||
* @property \Carbon\Carbon $created_at
|
|
||||||
* @property \Carbon\Carbon $updated_at
|
|
||||||
* @property \Carbon\Carbon $deleted_at
|
|
||||||
* @property string $code
|
|
||||||
* @property string $name
|
|
||||||
* @property string $symbol
|
|
||||||
* @property-read \Illuminate\Database\Eloquent\Collection|TransactionJournal[] $transactionJournals
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionCurrency whereId($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionCurrency whereCreatedAt($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionCurrency whereUpdatedAt($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionCurrency whereDeletedAt($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionCurrency whereCode($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionCurrency whereName($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionCurrency whereSymbol($value)
|
|
||||||
* @mixin \Eloquent
|
|
||||||
*/
|
*/
|
||||||
class TransactionCurrency extends Model
|
class TransactionCurrency extends Model
|
||||||
{
|
{
|
||||||
|
@@ -17,24 +17,9 @@ use Illuminate\Database\Eloquent\Model;
|
|||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FireflyIII\Models\TransactionGroup
|
* Class TransactionGroup
|
||||||
*
|
*
|
||||||
* @property integer $id
|
* @package FireflyIII\Models
|
||||||
* @property \Carbon\Carbon $created_at
|
|
||||||
* @property \Carbon\Carbon $updated_at
|
|
||||||
* @property \Carbon\Carbon $deleted_at
|
|
||||||
* @property integer $user_id
|
|
||||||
* @property string $relation
|
|
||||||
* @property-read \Illuminate\Database\Eloquent\Collection|TransactionJournal[] $transactionjournals
|
|
||||||
* @property-read \FireflyIII\User $user
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionGroup whereId($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionGroup whereCreatedAt($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionGroup whereUpdatedAt($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionGroup whereDeletedAt($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionGroup whereUserId($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionGroup whereRelation($value)
|
|
||||||
* @mixin \Eloquent
|
|
||||||
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\TransactionJournal[] $transactionJournals
|
|
||||||
*/
|
*/
|
||||||
class TransactionGroup extends Model
|
class TransactionGroup extends Model
|
||||||
{
|
{
|
||||||
|
@@ -26,75 +26,9 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
|||||||
use Watson\Validating\ValidatingTrait;
|
use Watson\Validating\ValidatingTrait;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FireflyIII\Models\TransactionJournal
|
* Class TransactionJournal
|
||||||
*
|
*
|
||||||
* @property integer $id
|
* @package FireflyIII\Models
|
||||||
* @property \Carbon\Carbon $created_at
|
|
||||||
* @property \Carbon\Carbon $updated_at
|
|
||||||
* @property \Carbon\Carbon $deleted_at
|
|
||||||
* @property integer $user_id
|
|
||||||
* @property integer $transaction_type_id
|
|
||||||
* @property integer $bill_id
|
|
||||||
* @property integer $transaction_currency_id
|
|
||||||
* @property string $description
|
|
||||||
* @property boolean $completed
|
|
||||||
* @property \Carbon\Carbon $date
|
|
||||||
* @property \Carbon\Carbon $interest_date
|
|
||||||
* @property \Carbon\Carbon $book_date
|
|
||||||
* @property boolean $encrypted
|
|
||||||
* @property integer $order
|
|
||||||
* @property integer $tag_count
|
|
||||||
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Attachment[] $attachments
|
|
||||||
* @property-read \FireflyIII\Models\Bill $bill
|
|
||||||
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Budget[] $budgets
|
|
||||||
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Category[] $categories
|
|
||||||
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\PiggyBankEvent[] $piggyBankEvents
|
|
||||||
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Tag[] $tags
|
|
||||||
* @property-read \FireflyIII\Models\TransactionCurrency $transactionCurrency
|
|
||||||
* @property-read \FireflyIII\Models\TransactionType $transactionType
|
|
||||||
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\TransactionGroup[] $transactiongroups
|
|
||||||
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\TransactionJournalMeta[] $transactionjournalmeta
|
|
||||||
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Transaction[] $transactions
|
|
||||||
* @property-read \FireflyIII\User $user
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionJournal after($date)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionJournal before($date)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionJournal transactionTypes($types)
|
|
||||||
* @property string $transaction_type_type
|
|
||||||
* @property-read string $transaction_currency_code
|
|
||||||
* @property-read string $destination_amount
|
|
||||||
* @property string $destination_account_id
|
|
||||||
* @property string $destination_account_name
|
|
||||||
* @property-read string $destination_account_type
|
|
||||||
* @property-read string $source_amount
|
|
||||||
* @property string $source_account_id
|
|
||||||
* @property string $source_account_name
|
|
||||||
* @property-read string $source_account_type
|
|
||||||
* @property \Carbon\Carbon $process_date
|
|
||||||
* @property int $account_id
|
|
||||||
* @property float $journalAmount
|
|
||||||
* @property string $account_name
|
|
||||||
* @property int $budget_id
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionJournal whereId($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionJournal whereCreatedAt($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionJournal whereUpdatedAt($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionJournal whereDeletedAt($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionJournal whereUserId($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionJournal whereTransactionTypeId($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionJournal whereBillId($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionJournal whereTransactionCurrencyId($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionJournal whereDescription($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionJournal whereCompleted($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionJournal whereDate($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionJournal whereInterestDate($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionJournal whereBookDate($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionJournal whereProcessDate($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionJournal whereEncrypted($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionJournal whereOrder($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionJournal whereTagCount($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionJournal expanded()
|
|
||||||
* @mixin \Eloquent
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionJournal sortCorrectly()
|
|
||||||
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\TransactionJournalMeta[] $transactionJournalMeta
|
|
||||||
*/
|
*/
|
||||||
class TransactionJournal extends TransactionJournalSupport
|
class TransactionJournal extends TransactionJournalSupport
|
||||||
{
|
{
|
||||||
|
@@ -20,23 +20,6 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|||||||
* Class TransactionJournalMeta
|
* Class TransactionJournalMeta
|
||||||
*
|
*
|
||||||
* @package FireflyIII\Models
|
* @package FireflyIII\Models
|
||||||
* @property-read \FireflyIII\Models\TransactionJournal $transactionjournal
|
|
||||||
* @property integer $id
|
|
||||||
* @property \Carbon\Carbon $created_at
|
|
||||||
* @property \Carbon\Carbon $updated_at
|
|
||||||
* @property integer $transaction_journal_id
|
|
||||||
* @property string $name
|
|
||||||
* @property string $data
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionJournalMeta whereId($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionJournalMeta whereCreatedAt($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionJournalMeta whereUpdatedAt($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionJournalMeta whereTransactionJournalId($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionJournalMeta whereName($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionJournalMeta whereData($value)
|
|
||||||
* @mixin \Eloquent
|
|
||||||
* @property string $hash
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionJournalMeta whereHash($value)
|
|
||||||
* @property-read \FireflyIII\Models\TransactionJournal $transactionJournal
|
|
||||||
*/
|
*/
|
||||||
class TransactionJournalMeta extends Model
|
class TransactionJournalMeta extends Model
|
||||||
{
|
{
|
||||||
|
@@ -18,20 +18,9 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
|||||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FireflyIII\Models\TransactionType
|
* Class TransactionType
|
||||||
*
|
*
|
||||||
* @property integer $id
|
* @package FireflyIII\Models
|
||||||
* @property \Carbon\Carbon $created_at
|
|
||||||
* @property \Carbon\Carbon $updated_at
|
|
||||||
* @property \Carbon\Carbon $deleted_at
|
|
||||||
* @property string $type
|
|
||||||
* @property-read \Illuminate\Database\Eloquent\Collection|TransactionJournal[] $transactionJournals
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionType whereId($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionType whereCreatedAt($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionType whereUpdatedAt($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionType whereDeletedAt($value)
|
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionType whereType($value)
|
|
||||||
* @mixin \Eloquent
|
|
||||||
*/
|
*/
|
||||||
class TransactionType extends Model
|
class TransactionType extends Model
|
||||||
{
|
{
|
||||||
|
@@ -14,6 +14,7 @@ declare(strict_types = 1);
|
|||||||
namespace FireflyIII\Repositories\Budget;
|
namespace FireflyIII\Repositories\Budget;
|
||||||
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
|
use DB;
|
||||||
use FireflyIII\Events\StoredBudgetLimit;
|
use FireflyIII\Events\StoredBudgetLimit;
|
||||||
use FireflyIII\Events\UpdatedBudgetLimit;
|
use FireflyIII\Events\UpdatedBudgetLimit;
|
||||||
use FireflyIII\Models\Budget;
|
use FireflyIII\Models\Budget;
|
||||||
@@ -27,6 +28,7 @@ use Illuminate\Database\Eloquent\Builder;
|
|||||||
use Illuminate\Database\Query\JoinClause;
|
use Illuminate\Database\Query\JoinClause;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
use Log;
|
use Log;
|
||||||
|
use stdClass;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class BudgetRepository
|
* Class BudgetRepository
|
||||||
@@ -72,6 +74,39 @@ class BudgetRepository implements BudgetRepositoryInterface
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filters entries from the result set generated by getBudgetPeriodReport
|
||||||
|
*
|
||||||
|
* @param Collection $set
|
||||||
|
* @param int $budgetId
|
||||||
|
* @param array $periods
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function filterAmounts(Collection $set, int $budgetId, array $periods): array
|
||||||
|
{
|
||||||
|
$arr = [];
|
||||||
|
$keys = array_keys($periods);
|
||||||
|
foreach ($keys as $period) {
|
||||||
|
/** @var stdClass $object */
|
||||||
|
$result = $set->filter(
|
||||||
|
function (TransactionJournal $object) use ($budgetId, $period) {
|
||||||
|
$result = strval($object->period_marker) === strval($period) && $budgetId === intval($object->budget_id);
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
$amount = '0';
|
||||||
|
if (!is_null($result->first())) {
|
||||||
|
$amount = $result->first()->sum_of_period;
|
||||||
|
}
|
||||||
|
|
||||||
|
$arr[$period] = $amount;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $arr;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find a budget.
|
* Find a budget.
|
||||||
*
|
*
|
||||||
@@ -175,6 +210,73 @@ class BudgetRepository implements BudgetRepositoryInterface
|
|||||||
return $set;
|
return $set;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method is being used to generate the budget overview in the year/multi-year report. More specifically, this
|
||||||
|
* method runs the query and returns the result that is used for this report.
|
||||||
|
*
|
||||||
|
* The query is used in both the year/multi-year budget overview AND in the accompanying chart.
|
||||||
|
*
|
||||||
|
* @param Collection $budgets
|
||||||
|
* @param Collection $accounts
|
||||||
|
* @param Carbon $start
|
||||||
|
* @param Carbon $end
|
||||||
|
*
|
||||||
|
* @return Collection
|
||||||
|
*/
|
||||||
|
public function getBudgetPeriodReport(Collection $budgets, Collection $accounts, Carbon $start, Carbon $end): Collection
|
||||||
|
{
|
||||||
|
// get account ID's.
|
||||||
|
$accountIds = $accounts->pluck('id')->toArray();
|
||||||
|
|
||||||
|
// get budget ID's.
|
||||||
|
$budgetIds = $budgets->pluck('id')->toArray();
|
||||||
|
|
||||||
|
// define period to group on:
|
||||||
|
$sqlDateFormat = '%Y-%m-%d';
|
||||||
|
// monthly report (for year)
|
||||||
|
if ($start->diffInMonths($end) > 1) {
|
||||||
|
$sqlDateFormat = '%Y-%m';
|
||||||
|
}
|
||||||
|
|
||||||
|
// yearly report (for multi year)
|
||||||
|
if ($start->diffInMonths($end) > 12) {
|
||||||
|
$sqlDateFormat = '%Y';
|
||||||
|
}
|
||||||
|
|
||||||
|
// build query.
|
||||||
|
$query = TransactionJournal
|
||||||
|
::leftJoin('budget_transaction_journal', 'budget_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id')
|
||||||
|
->leftJoin('transaction_types', 'transaction_types.id', '=', 'transaction_journals.transaction_type_id')
|
||||||
|
->leftJoin(
|
||||||
|
'transactions', function (JoinClause $join) {
|
||||||
|
$join->on('transaction_journals.id', '=', 'transactions.transaction_journal_id')->where('transactions.amount', '<', 0);
|
||||||
|
}
|
||||||
|
)
|
||||||
|
->whereNull('transaction_journals.deleted_at')
|
||||||
|
->whereNull('transactions.deleted_at')
|
||||||
|
->where('transaction_types.type', 'Withdrawal')
|
||||||
|
->where('transaction_journals.user_id', auth()->user()->id);
|
||||||
|
|
||||||
|
if (count($accountIds) > 0) {
|
||||||
|
$query->whereIn('transactions.account_id', $accountIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (count($budgetIds) > 0) {
|
||||||
|
$query->whereIn('budget_transaction_journal.budget_id', $budgetIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
$query->groupBy(['budget_transaction_journal.budget_id', 'period_marker']);
|
||||||
|
|
||||||
|
return $query->get(
|
||||||
|
[
|
||||||
|
'budget_transaction_journal.budget_id',
|
||||||
|
DB::raw(sprintf('DATE_FORMAT(transaction_journals.date,"%s") AS period_marker', $sqlDateFormat)),
|
||||||
|
DB::raw('SUM(transactions.amount) as sum_of_period'),
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Collection
|
* @return Collection
|
||||||
*/
|
*/
|
||||||
|
@@ -38,6 +38,17 @@ interface BudgetRepositoryInterface
|
|||||||
*/
|
*/
|
||||||
public function destroy(Budget $budget): bool;
|
public function destroy(Budget $budget): bool;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filters entries from the result set generated by getBudgetPeriodReport
|
||||||
|
*
|
||||||
|
* @param Collection $set
|
||||||
|
* @param int $budgetId
|
||||||
|
* @param array $periods
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function filterAmounts(Collection $set, int $budgetId, array $periods): array;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find a budget.
|
* Find a budget.
|
||||||
*
|
*
|
||||||
@@ -79,6 +90,21 @@ interface BudgetRepositoryInterface
|
|||||||
*/
|
*/
|
||||||
public function getAllBudgetLimitRepetitions(Carbon $start, Carbon $end): Collection;
|
public function getAllBudgetLimitRepetitions(Carbon $start, Carbon $end): Collection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method is being used to generate the budget overview in the year/multi-year report. More specifically, this
|
||||||
|
* method runs the query and returns the result that is used for this report.
|
||||||
|
*
|
||||||
|
* The query is used in both the year/multi-year budget overview AND in the accompanying chart.
|
||||||
|
*
|
||||||
|
* @param Collection $budgets
|
||||||
|
* @param Collection $accounts
|
||||||
|
* @param Carbon $start
|
||||||
|
* @param Carbon $end
|
||||||
|
*
|
||||||
|
* @return Collection
|
||||||
|
*/
|
||||||
|
public function getBudgetPeriodReport(Collection $budgets, Collection $accounts, Carbon $start, Carbon $end): Collection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Collection
|
* @return Collection
|
||||||
*/
|
*/
|
||||||
|
@@ -397,6 +397,7 @@ class JournalRepository implements JournalRepositoryInterface
|
|||||||
if (strlen(trim($name)) > 0) {
|
if (strlen(trim($name)) > 0) {
|
||||||
$tag = Tag::firstOrCreateEncrypted(['tag' => $name, 'user_id' => $journal->user_id]);
|
$tag = Tag::firstOrCreateEncrypted(['tag' => $name, 'user_id' => $journal->user_id]);
|
||||||
if (!is_null($tag)) {
|
if (!is_null($tag)) {
|
||||||
|
Log::debug(sprintf('Will try to connect tag #%d to journal #%d.', $tag->id, $journal->id));
|
||||||
$tagRepository->connect($journal, $tag);
|
$tagRepository->connect($journal, $tag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -509,20 +510,28 @@ class JournalRepository implements JournalRepositoryInterface
|
|||||||
*/
|
*/
|
||||||
private function storeDepositAccounts(array $data): array
|
private function storeDepositAccounts(array $data): array
|
||||||
{
|
{
|
||||||
|
Log::debug('Now in storeDepositAccounts().');
|
||||||
$destinationAccount = Account::where('user_id', $this->user->id)->where('id', $data['destination_account_id'])->first(['accounts.*']);
|
$destinationAccount = Account::where('user_id', $this->user->id)->where('id', $data['destination_account_id'])->first(['accounts.*']);
|
||||||
|
|
||||||
|
Log::debug(sprintf('Destination account is #%d ("%s")', $destinationAccount->id, $destinationAccount->name));
|
||||||
|
|
||||||
if (strlen($data['source_account_name']) > 0) {
|
if (strlen($data['source_account_name']) > 0) {
|
||||||
$sourceType = AccountType::where('type', 'Revenue account')->first();
|
$sourceType = AccountType::where('type', 'Revenue account')->first();
|
||||||
$sourceAccount = Account::firstOrCreateEncrypted(
|
$sourceAccount = Account::firstOrCreateEncrypted(
|
||||||
['user_id' => $this->user->id, 'account_type_id' => $sourceType->id, 'name' => $data['source_account_name'], 'active' => 1]
|
['user_id' => $this->user->id, 'account_type_id' => $sourceType->id, 'name' => $data['source_account_name'], 'active' => 1]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Log::debug(sprintf('source account name is "%s", account is %d', $data['source_account_name'], $sourceAccount->id));
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'source' => $sourceAccount,
|
'source' => $sourceAccount,
|
||||||
'destination' => $destinationAccount,
|
'destination' => $destinationAccount,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
$sourceType = AccountType::where('type', 'Cash account')->first();
|
|
||||||
|
Log::debug('source_account_name is empty, so default to cash account!');
|
||||||
|
|
||||||
|
$sourceType = AccountType::where('type', AccountType::CASH)->first();
|
||||||
$sourceAccount = Account::firstOrCreateEncrypted(
|
$sourceAccount = Account::firstOrCreateEncrypted(
|
||||||
['user_id' => $this->user->id, 'account_type_id' => $sourceType->id, 'name' => 'Cash account', 'active' => 1]
|
['user_id' => $this->user->id, 'account_type_id' => $sourceType->id, 'name' => 'Cash account', 'active' => 1]
|
||||||
);
|
);
|
||||||
@@ -617,8 +626,11 @@ class JournalRepository implements JournalRepositoryInterface
|
|||||||
*/
|
*/
|
||||||
private function storeWithdrawalAccounts(array $data): array
|
private function storeWithdrawalAccounts(array $data): array
|
||||||
{
|
{
|
||||||
|
Log::debug('Now in storeWithdrawalAccounts().');
|
||||||
$sourceAccount = Account::where('user_id', $this->user->id)->where('id', $data['source_account_id'])->first(['accounts.*']);
|
$sourceAccount = Account::where('user_id', $this->user->id)->where('id', $data['source_account_id'])->first(['accounts.*']);
|
||||||
|
|
||||||
|
Log::debug(sprintf('Source account is #%d ("%s")', $sourceAccount->id, $sourceAccount->name));
|
||||||
|
|
||||||
if (strlen($data['destination_account_name']) > 0) {
|
if (strlen($data['destination_account_name']) > 0) {
|
||||||
$destinationType = AccountType::where('type', AccountType::EXPENSE)->first();
|
$destinationType = AccountType::where('type', AccountType::EXPENSE)->first();
|
||||||
$destinationAccount = Account::firstOrCreateEncrypted(
|
$destinationAccount = Account::firstOrCreateEncrypted(
|
||||||
@@ -630,12 +642,15 @@ class JournalRepository implements JournalRepositoryInterface
|
|||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Log::debug(sprintf('destination account name is "%s", account is %d', $data['destination_account_name'], $destinationAccount->id));
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'source' => $sourceAccount,
|
'source' => $sourceAccount,
|
||||||
'destination' => $destinationAccount,
|
'destination' => $destinationAccount,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
$destinationType = AccountType::where('type', 'Cash account')->first();
|
Log::debug('destination_account_name is empty, so default to cash account!');
|
||||||
|
$destinationType = AccountType::where('type', AccountType::CASH)->first();
|
||||||
$destinationAccount = Account::firstOrCreateEncrypted(
|
$destinationAccount = Account::firstOrCreateEncrypted(
|
||||||
['user_id' => $this->user->id, 'account_type_id' => $destinationType->id, 'name' => 'Cash account', 'active' => 1]
|
['user_id' => $this->user->id, 'account_type_id' => $destinationType->id, 'name' => 'Cash account', 'active' => 1]
|
||||||
);
|
);
|
||||||
@@ -733,6 +748,7 @@ class JournalRepository implements JournalRepositoryInterface
|
|||||||
// connect each tag to journal (if not yet connected):
|
// connect each tag to journal (if not yet connected):
|
||||||
/** @var Tag $tag */
|
/** @var Tag $tag */
|
||||||
foreach ($tags as $tag) {
|
foreach ($tags as $tag) {
|
||||||
|
Log::debug(sprintf('Will try to connect tag #%d to journal #%d.', $tag->id, $journal->id));
|
||||||
$tagRepository->connect($journal, $tag);
|
$tagRepository->connect($journal, $tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -13,16 +13,15 @@ declare(strict_types = 1);
|
|||||||
|
|
||||||
namespace FireflyIII\Repositories\Journal;
|
namespace FireflyIII\Repositories\Journal;
|
||||||
|
|
||||||
use Carbon\Carbon;
|
|
||||||
use Crypt;
|
use Crypt;
|
||||||
use DB;
|
use DB;
|
||||||
|
use FireflyIII\Models\AccountType;
|
||||||
use FireflyIII\Models\PiggyBankEvent;
|
use FireflyIII\Models\PiggyBankEvent;
|
||||||
use FireflyIII\Models\Transaction;
|
use FireflyIII\Models\Transaction;
|
||||||
use FireflyIII\Models\TransactionJournal;
|
use FireflyIII\Models\TransactionJournal;
|
||||||
use FireflyIII\User;
|
use FireflyIII\User;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Illuminate\Database\Query\JoinClause;
|
use Illuminate\Database\Query\JoinClause;
|
||||||
use Illuminate\Pagination\LengthAwarePaginator;
|
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -116,7 +115,9 @@ class JournalTasker implements JournalTaskerInterface
|
|||||||
)
|
)
|
||||||
->with(['budgets', 'categories'])
|
->with(['budgets', 'categories'])
|
||||||
->leftJoin('accounts as source_accounts', 'transactions.account_id', '=', 'source_accounts.id')
|
->leftJoin('accounts as source_accounts', 'transactions.account_id', '=', 'source_accounts.id')
|
||||||
|
->leftJoin('account_types as source_account_types', 'source_accounts.account_type_id', '=', 'source_account_types.id')
|
||||||
->leftJoin('accounts as destination_accounts', 'destination.account_id', '=', 'destination_accounts.id')
|
->leftJoin('accounts as destination_accounts', 'destination.account_id', '=', 'destination_accounts.id')
|
||||||
|
->leftJoin('account_types as destination_account_types', 'destination_accounts.account_type_id', '=', 'destination_account_types.id')
|
||||||
->where('transactions.amount', '<', 0)
|
->where('transactions.amount', '<', 0)
|
||||||
->whereNull('transactions.deleted_at')
|
->whereNull('transactions.deleted_at')
|
||||||
->get(
|
->get(
|
||||||
@@ -125,12 +126,14 @@ class JournalTasker implements JournalTaskerInterface
|
|||||||
'transactions.account_id',
|
'transactions.account_id',
|
||||||
'source_accounts.name as account_name',
|
'source_accounts.name as account_name',
|
||||||
'source_accounts.encrypted as account_encrypted',
|
'source_accounts.encrypted as account_encrypted',
|
||||||
|
'source_account_types.type as account_type',
|
||||||
'transactions.amount',
|
'transactions.amount',
|
||||||
'transactions.description',
|
'transactions.description',
|
||||||
'destination.id as destination_id',
|
'destination.id as destination_id',
|
||||||
'destination.account_id as destination_account_id',
|
'destination.account_id as destination_account_id',
|
||||||
'destination_accounts.name as destination_account_name',
|
'destination_accounts.name as destination_account_name',
|
||||||
'destination_accounts.encrypted as destination_account_encrypted',
|
'destination_accounts.encrypted as destination_account_encrypted',
|
||||||
|
'destination_account_types.type as destination_account_type',
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -143,17 +146,18 @@ class JournalTasker implements JournalTaskerInterface
|
|||||||
$budget = $entry->budgets->first();
|
$budget = $entry->budgets->first();
|
||||||
$category = $entry->categories->first();
|
$category = $entry->categories->first();
|
||||||
$transaction = [
|
$transaction = [
|
||||||
'source_id' => $entry->id,
|
'source_id' => $entry->id,
|
||||||
'source_amount' => $entry->amount,
|
'source_amount' => $entry->amount,
|
||||||
|
|
||||||
'description' => $entry->description,
|
'description' => $entry->description,
|
||||||
'source_account_id' => $entry->account_id,
|
'source_account_id' => $entry->account_id,
|
||||||
'source_account_name' => intval($entry->account_encrypted) === 1 ? Crypt::decrypt($entry->account_name) : $entry->account_name,
|
'source_account_name' => intval($entry->account_encrypted) === 1 ? Crypt::decrypt($entry->account_name) : $entry->account_name,
|
||||||
|
'source_account_type' => $entry->account_type,
|
||||||
'source_account_before' => $sourceBalance,
|
'source_account_before' => $sourceBalance,
|
||||||
'source_account_after' => bcadd($sourceBalance, $entry->amount),
|
'source_account_after' => bcadd($sourceBalance, $entry->amount),
|
||||||
'destination_id' => $entry->destination_id,
|
'destination_id' => $entry->destination_id,
|
||||||
'destination_amount' => bcmul($entry->amount, '-1'),
|
'destination_amount' => bcmul($entry->amount, '-1'),
|
||||||
'destination_account_id' => $entry->destination_account_id,
|
'destination_account_id' => $entry->destination_account_id,
|
||||||
|
'destination_account_type' => $entry->destination_account_type,
|
||||||
'destination_account_name' =>
|
'destination_account_name' =>
|
||||||
intval($entry->destination_account_encrypted) === 1 ? Crypt::decrypt($entry->destination_account_name) : $entry->destination_account_name,
|
intval($entry->destination_account_encrypted) === 1 ? Crypt::decrypt($entry->destination_account_name) : $entry->destination_account_name,
|
||||||
'destination_account_before' => $destinationBalance,
|
'destination_account_before' => $destinationBalance,
|
||||||
@@ -161,6 +165,13 @@ class JournalTasker implements JournalTaskerInterface
|
|||||||
'budget_id' => is_null($budget) ? 0 : $budget->id,
|
'budget_id' => is_null($budget) ? 0 : $budget->id,
|
||||||
'category' => is_null($category) ? '' : $category->name,
|
'category' => is_null($category) ? '' : $category->name,
|
||||||
];
|
];
|
||||||
|
if ($entry->destination_account_type === AccountType::CASH) {
|
||||||
|
$transaction['destination_account_name'] = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($entry->account_type === AccountType::CASH) {
|
||||||
|
$transaction['source_account_name'] = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$transactions[] = $transaction;
|
$transactions[] = $transaction;
|
||||||
|
@@ -14,9 +14,7 @@ declare(strict_types = 1);
|
|||||||
namespace FireflyIII\Repositories\Journal;
|
namespace FireflyIII\Repositories\Journal;
|
||||||
|
|
||||||
|
|
||||||
use Carbon\Carbon;
|
|
||||||
use FireflyIII\Models\TransactionJournal;
|
use FireflyIII\Models\TransactionJournal;
|
||||||
use Illuminate\Pagination\LengthAwarePaginator;
|
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -19,6 +19,7 @@ use FireflyIII\Models\TransactionJournal;
|
|||||||
use FireflyIII\Models\TransactionType;
|
use FireflyIII\Models\TransactionType;
|
||||||
use FireflyIII\User;
|
use FireflyIII\User;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
|
use Log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class TagRepository
|
* Class TagRepository
|
||||||
@@ -54,11 +55,14 @@ class TagRepository implements TagRepositoryInterface
|
|||||||
* Already connected:
|
* Already connected:
|
||||||
*/
|
*/
|
||||||
if ($journal->tags()->find($tag->id)) {
|
if ($journal->tags()->find($tag->id)) {
|
||||||
|
Log::error(sprintf('Cannot find tag #%d', $tag->id));
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ($tag->tagMode) {
|
switch ($tag->tagMode) {
|
||||||
case 'nothing':
|
case 'nothing':
|
||||||
|
Log::debug(sprintf('Tag #%d connected', $tag->id));
|
||||||
$journal->tags()->save($tag);
|
$journal->tags()->save($tag);
|
||||||
$journal->save();
|
$journal->save();
|
||||||
|
|
||||||
@@ -184,22 +188,23 @@ class TagRepository implements TagRepositoryInterface
|
|||||||
*/
|
*/
|
||||||
protected function connectAdvancePayment(TransactionJournal $journal, Tag $tag): bool
|
protected function connectAdvancePayment(TransactionJournal $journal, Tag $tag): bool
|
||||||
{
|
{
|
||||||
/** @var TransactionType $transfer */
|
$type = $journal->transactionType->type;
|
||||||
$transfer = TransactionType::whereType(TransactionType::TRANSFER)->first();
|
$withdrawals = $tag->transactionJournals()
|
||||||
/** @var TransactionType $withdrawal */
|
->leftJoin('transaction_types', 'transaction_types.id', 'transaction_journals.transaction_type_id')
|
||||||
$withdrawal = TransactionType::whereType(TransactionType::WITHDRAWAL)->first();
|
->where('transaction_types.type', TransactionType::WITHDRAWAL)->count();
|
||||||
/** @var TransactionType $deposit */
|
$deposits = $tag->transactionJournals()
|
||||||
$deposit = TransactionType::whereType(TransactionType::DEPOSIT)->first();
|
->leftJoin('transaction_types', 'transaction_types.id', 'transaction_journals.transaction_type_id')
|
||||||
|
->where('transaction_types.type', TransactionType::DEPOSIT)->count();
|
||||||
|
|
||||||
$withdrawals = $tag->transactionJournals()->where('transaction_type_id', $withdrawal->id)->count();
|
if ($type === TransactionType::TRANSFER) { // advance payments cannot accept transfers:
|
||||||
$deposits = $tag->transactionJournals()->where('transaction_type_id', $deposit->id)->count();
|
Log::error(sprintf('Journal #%d is a transfer and cannot connect to tag #%d', $journal->id, $tag->id));
|
||||||
|
|
||||||
if ($journal->transaction_type_id == $transfer->id) { // advance payments cannot accept transfers:
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// the first transaction to be attached to this tag is attached just like that:
|
// the first transaction to be attached to this tag is attached just like that:
|
||||||
if ($withdrawals < 1 && $deposits < 1) {
|
if ($withdrawals < 1 && $deposits < 1) {
|
||||||
|
Log::debug(sprintf('Tag #%d has 0 withdrawals and 0 deposits so its fine.', $tag->id));
|
||||||
$journal->tags()->save($tag);
|
$journal->tags()->save($tag);
|
||||||
$journal->save();
|
$journal->save();
|
||||||
|
|
||||||
@@ -207,12 +212,16 @@ class TagRepository implements TagRepositoryInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if withdrawal and already has a withdrawal, return false:
|
// if withdrawal and already has a withdrawal, return false:
|
||||||
if ($journal->transaction_type_id == $withdrawal->id && $withdrawals == 1) {
|
if ($type === TransactionType::WITHDRAWAL && $withdrawals > 0) {
|
||||||
|
Log::error(sprintf('Journal #%d is a withdrawal but tag already has %d withdrawal(s).', $journal->id, $withdrawals));
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if already has transaction journals, must match ALL asset account id's:
|
// if already has transaction journals, must match ALL asset account id's:
|
||||||
if ($deposits > 0 || $withdrawals == 1) {
|
if ($deposits > 0 || $withdrawals == 1) {
|
||||||
|
Log::debug('Need to match all asset accounts.');
|
||||||
|
|
||||||
return $this->matchAll($journal, $tag);
|
return $this->matchAll($journal, $tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -229,28 +238,39 @@ class TagRepository implements TagRepositoryInterface
|
|||||||
*/
|
*/
|
||||||
protected function connectBalancingAct(TransactionJournal $journal, Tag $tag): bool
|
protected function connectBalancingAct(TransactionJournal $journal, Tag $tag): bool
|
||||||
{
|
{
|
||||||
/** @var TransactionType $withdrawal */
|
$type = $journal->transactionType->type;
|
||||||
$withdrawal = TransactionType::whereType(TransactionType::WITHDRAWAL)->first();
|
$withdrawals = $tag->transactionJournals()
|
||||||
$withdrawals = $tag->transactionJournals()->where('transaction_type_id', $withdrawal->id)->count();
|
->leftJoin('transaction_types', 'transaction_types.id', 'transaction_journals.transaction_type_id')
|
||||||
/** @var TransactionType $transfer */
|
->where('transaction_types.type', TransactionType::WITHDRAWAL)->count();
|
||||||
$transfer = TransactionType::whereType(TransactionType::TRANSFER)->first();
|
$transfers = $tag->transactionJournals()
|
||||||
$transfers = $tag->transactionJournals()->where('transaction_type_id', $transfer->id)->count();
|
->leftJoin('transaction_types', 'transaction_types.id', 'transaction_journals.transaction_type_id')
|
||||||
|
->where('transaction_types.type', TransactionType::TRANSFER)->count();
|
||||||
|
|
||||||
|
|
||||||
|
Log::debug(sprintf('Journal #%d is a %s', $journal->id, $type));
|
||||||
|
|
||||||
// only if this is the only withdrawal.
|
// only if this is the only withdrawal.
|
||||||
if ($journal->transaction_type_id == $withdrawal->id && $withdrawals < 1) {
|
if ($type === TransactionType::WITHDRAWAL && $withdrawals < 1) {
|
||||||
|
Log::debug('Will connect this journal because it is the only withdrawal in this tag.');
|
||||||
$journal->tags()->save($tag);
|
$journal->tags()->save($tag);
|
||||||
$journal->save();
|
$journal->save();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// and only if this is the only transfer
|
// and only if this is the only transfer
|
||||||
if ($journal->transaction_type_id == $transfer->id && $transfers < 1) {
|
if ($type === TransactionType::TRANSFER && $transfers < 1) {
|
||||||
|
Log::debug('Will connect this journal because it is the only transfer in this tag.');
|
||||||
$journal->tags()->save($tag);
|
$journal->tags()->save($tag);
|
||||||
$journal->save();
|
$journal->save();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Log::error(
|
||||||
|
sprintf(
|
||||||
|
'Tag #%d has %d withdrawals and %d transfers and cannot contain %s #%d',
|
||||||
|
$tag->id, $withdrawals, $transfers, $type, $journal->id
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
// ignore expense
|
// ignore expense
|
||||||
return false;
|
return false;
|
||||||
@@ -267,28 +287,42 @@ class TagRepository implements TagRepositoryInterface
|
|||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
protected function matchAll(TransactionJournal $journal, Tag $tag): bool
|
private function matchAll(TransactionJournal $journal, Tag $tag): bool
|
||||||
{
|
{
|
||||||
$checkSources = join(',', TransactionJournal::sourceAccountList($journal)->pluck('id')->toArray());
|
$journalSources = join(',', TransactionJournal::sourceAccountList($journal)->pluck('id')->toArray());
|
||||||
$checkDestinations = join(',', TransactionJournal::destinationAccountList($journal)->pluck('id')->toArray());
|
$journalDestinations = join(',', TransactionJournal::destinationAccountList($journal)->pluck('id')->toArray());
|
||||||
|
$match = true;
|
||||||
|
$journals = $tag->transactionJournals()->get(['transaction_journals.*']);
|
||||||
|
|
||||||
$match = true;
|
Log::debug(sprintf('Tag #%d has %d journals to verify:', $tag->id, $journals->count()));
|
||||||
/** @var TransactionJournal $check */
|
|
||||||
foreach ($tag->transactionjournals as $check) {
|
/** @var TransactionJournal $original */
|
||||||
|
foreach ($journals as $original) {
|
||||||
// $checkAccount is the source_account for a withdrawal
|
// $checkAccount is the source_account for a withdrawal
|
||||||
// $checkAccount is the destination_account for a deposit
|
// $checkAccount is the destination_account for a deposit
|
||||||
$thisSources = join(',', TransactionJournal::sourceAccountList($check)->pluck('id')->toArray());
|
$originalSources = join(',', TransactionJournal::sourceAccountList($original)->pluck('id')->toArray());
|
||||||
$thisDestinations = join(',', TransactionJournal::destinationAccountList($check)->pluck('id')->toArray());
|
$originalDestinations = join(',', TransactionJournal::destinationAccountList($original)->pluck('id')->toArray());
|
||||||
|
|
||||||
|
if ($original->isWithdrawal() && $originalSources !== $journalDestinations) {
|
||||||
|
Log::debug(sprintf('Original journal #%d is a withdrawal.', $original->id));
|
||||||
|
Log::debug(sprintf('Journal #%d must have these destination accounts: %s', $journal->id, $originalSources));
|
||||||
|
Log::debug(sprintf('Journal #%d actually these destination accounts: %s', $journal->id, $journalDestinations));
|
||||||
|
Log::debug('So match is FALSE');
|
||||||
|
|
||||||
if ($check->isWithdrawal() && $thisSources !== $checkSources) {
|
|
||||||
$match = false;
|
$match = false;
|
||||||
}
|
}
|
||||||
if ($check->isDeposit() && $thisDestinations !== $checkDestinations) {
|
if ($original->isDeposit() && $originalDestinations !== $journalSources) {
|
||||||
|
Log::debug(sprintf('Original journal #%d is a deposit.', $original->id));
|
||||||
|
Log::debug(sprintf('Journal #%d must have these destination accounts: %s', $journal->id, $originalSources));
|
||||||
|
Log::debug(sprintf('Journal #%d actually these destination accounts: %s', $journal->id, $journalDestinations));
|
||||||
|
Log::debug('So match is FALSE');
|
||||||
|
|
||||||
$match = false;
|
$match = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if ($match) {
|
if ($match) {
|
||||||
|
Log::debug(sprintf('Match is true, connect journal #%d with tag #%d.', $journal->id, $tag->id));
|
||||||
$journal->tags()->save($tag);
|
$journal->tags()->save($tag);
|
||||||
$journal->save();
|
$journal->save();
|
||||||
|
|
||||||
|
@@ -14,6 +14,7 @@ declare(strict_types = 1);
|
|||||||
namespace FireflyIII\Repositories\User;
|
namespace FireflyIII\Repositories\User;
|
||||||
|
|
||||||
|
|
||||||
|
use FireflyConfig;
|
||||||
use FireflyIII\Models\BudgetLimit;
|
use FireflyIII\Models\BudgetLimit;
|
||||||
use FireflyIII\Models\Role;
|
use FireflyIII\Models\Role;
|
||||||
use FireflyIII\User;
|
use FireflyIII\User;
|
||||||
@@ -94,10 +95,10 @@ class UserRepository implements UserRepositoryInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
// is user activated?
|
// is user activated?
|
||||||
$confirmAccount = env('MUST_CONFIRM_ACCOUNT', false);
|
$mustConfirmAccount = FireflyConfig::get('must_confirm_account', config('firefly.configuration.must_confirm_account'))->data;
|
||||||
$isConfirmed = Preferences::getForUser($user, 'user_confirmed', false)->data;
|
$isConfirmed = Preferences::getForUser($user, 'user_confirmed', false)->data;
|
||||||
$return['is_activated'] = true;
|
$return['is_activated'] = true;
|
||||||
if ($isConfirmed === false && $confirmAccount === true) {
|
if ($isConfirmed === false && $mustConfirmAccount === true) {
|
||||||
$return['is_activated'] = false;
|
$return['is_activated'] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -123,7 +123,7 @@ class SetDestinationAccount implements ActionInterface
|
|||||||
*/
|
*/
|
||||||
private function findExpenseAccount()
|
private function findExpenseAccount()
|
||||||
{
|
{
|
||||||
$account = $this->repository->findByName($this->action->action_value, [AccountType::REVENUE]);
|
$account = $this->repository->findByName($this->action->action_value, [AccountType::EXPENSE]);
|
||||||
if (is_null($account->id)) {
|
if (is_null($account->id)) {
|
||||||
// create new revenue account with this name:
|
// create new revenue account with this name:
|
||||||
$data = [
|
$data = [
|
||||||
|
56
app/Support/ChartColour.php
Normal file
56
app/Support/ChartColour.php
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ChartColour.php
|
||||||
|
* Copyright (C) 2016 thegrumpydictator@gmail.com
|
||||||
|
*
|
||||||
|
* This software may be modified and distributed under the terms of the
|
||||||
|
* Creative Commons Attribution-ShareAlike 4.0 International License.
|
||||||
|
*
|
||||||
|
* See the LICENSE file for details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types = 1);
|
||||||
|
|
||||||
|
namespace FireflyIII\Support;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class ChartColour
|
||||||
|
*
|
||||||
|
* @package FireflyIII\Support
|
||||||
|
*/
|
||||||
|
class ChartColour
|
||||||
|
{
|
||||||
|
public static $colours
|
||||||
|
= [
|
||||||
|
[53, 124, 165],
|
||||||
|
[0, 141, 76],
|
||||||
|
[219, 139, 11],
|
||||||
|
[202, 25, 90],
|
||||||
|
[85, 82, 153],
|
||||||
|
[66, 133, 244],
|
||||||
|
[219, 68, 55],
|
||||||
|
[244, 180, 0],
|
||||||
|
[15, 157, 88],
|
||||||
|
[171, 71, 188],
|
||||||
|
[0, 172, 193],
|
||||||
|
[255, 112, 67],
|
||||||
|
[158, 157, 36],
|
||||||
|
[92, 107, 192],
|
||||||
|
[240, 98, 146],
|
||||||
|
[0, 121, 107],
|
||||||
|
[194, 24, 91],
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param int $index
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public static function getColour(int $index): string
|
||||||
|
{
|
||||||
|
$index = $index % count(self::$colours);
|
||||||
|
$row = self::$colours[$index];
|
||||||
|
|
||||||
|
return sprintf('rgba(%d, %d, %d, 0.7)', $row[0], $row[1], $row[2]);
|
||||||
|
}
|
||||||
|
}
|
@@ -24,7 +24,6 @@ use FireflyIII\Exceptions\FireflyException;
|
|||||||
class Navigation
|
class Navigation
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param \Carbon\Carbon $theDate
|
* @param \Carbon\Carbon $theDate
|
||||||
* @param $repeatFreq
|
* @param $repeatFreq
|
||||||
@@ -170,6 +169,46 @@ class Navigation
|
|||||||
return $currentEnd;
|
return $currentEnd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param \Carbon\Carbon $start
|
||||||
|
* @param \Carbon\Carbon $end
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function listOfPeriods(Carbon $start, Carbon $end): array
|
||||||
|
{
|
||||||
|
// define period to increment
|
||||||
|
$increment = 'addDay';
|
||||||
|
$format = 'Y-m-d';
|
||||||
|
$displayFormat = strval(trans('config.month_and_day'));
|
||||||
|
// increment by month (for year)
|
||||||
|
if ($start->diffInMonths($end) > 1) {
|
||||||
|
$increment = 'addMonth';
|
||||||
|
$format = 'Y-m';
|
||||||
|
$displayFormat = strval(trans('config.month'));
|
||||||
|
}
|
||||||
|
|
||||||
|
// increment by year (for multi year)
|
||||||
|
if ($start->diffInMonths($end) > 12) {
|
||||||
|
$increment = 'addYear';
|
||||||
|
$format = 'Y';
|
||||||
|
$displayFormat = strval(trans('config.year'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$begin = clone $start;
|
||||||
|
$entries = [];
|
||||||
|
while ($begin < $end) {
|
||||||
|
$formatted = $begin->format($format);
|
||||||
|
$displayed = $begin->formatLocalized($displayFormat);
|
||||||
|
$entries[$formatted] = $displayed;
|
||||||
|
|
||||||
|
$begin->$increment();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $entries;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param \Carbon\Carbon $date
|
* @param \Carbon\Carbon $date
|
||||||
* @param $repeatFrequency
|
* @param $repeatFrequency
|
||||||
|
@@ -189,9 +189,18 @@ class Transaction extends Twig_Extension
|
|||||||
$name = intval($transaction->account_encrypted) === 1 ? Crypt::decrypt($transaction->account_name) : $transaction->account_name;
|
$name = intval($transaction->account_encrypted) === 1 ? Crypt::decrypt($transaction->account_name) : $transaction->account_name;
|
||||||
$id = intval($transaction->account_id);
|
$id = intval($transaction->account_id);
|
||||||
$type = $transaction->account_type;
|
$type = $transaction->account_type;
|
||||||
// if the amount is positive, assume that the current account (the one in $transaction) is indeed the destination account.
|
|
||||||
|
|
||||||
if (bccomp($transaction->transaction_amount, '0') === -1) {
|
// name is present in object, use that one:
|
||||||
|
if (bccomp($transaction->transaction_amount, '0') === -1 && !is_null($transaction->opposing_account_id)) {
|
||||||
|
|
||||||
|
$name = intval($transaction->opposing_account_encrypted) === 1 ? Crypt::decrypt($transaction->opposing_account_name)
|
||||||
|
: $transaction->opposing_account_name;
|
||||||
|
$id = intval($transaction->opposing_account_id);
|
||||||
|
$type = intval($transaction->opposing_account_type);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Find the opposing account and use that one:
|
||||||
|
if (bccomp($transaction->transaction_amount, '0') === -1 && is_null($transaction->opposing_account_id)) {
|
||||||
// if the amount is negative, find the opposing account and use that one:
|
// if the amount is negative, find the opposing account and use that one:
|
||||||
$journalId = $transaction->journal_id;
|
$journalId = $transaction->journal_id;
|
||||||
/** @var TransactionModel $other */
|
/** @var TransactionModel $other */
|
||||||
@@ -252,13 +261,21 @@ class Transaction extends Twig_Extension
|
|||||||
return new Twig_SimpleFunction(
|
return new Twig_SimpleFunction(
|
||||||
'transactionSourceAccount', function (TransactionModel $transaction): string {
|
'transactionSourceAccount', function (TransactionModel $transaction): string {
|
||||||
|
|
||||||
|
// if the amount is negative, assume that the current account (the one in $transaction) is indeed the source account.
|
||||||
$name = intval($transaction->account_encrypted) === 1 ? Crypt::decrypt($transaction->account_name) : $transaction->account_name;
|
$name = intval($transaction->account_encrypted) === 1 ? Crypt::decrypt($transaction->account_name) : $transaction->account_name;
|
||||||
$id = intval($transaction->account_id);
|
$id = intval($transaction->account_id);
|
||||||
$type = $transaction->account_type;
|
$type = $transaction->account_type;
|
||||||
// if the amount is negative, assume that the current account (the one in $transaction) is indeed the source account.
|
|
||||||
|
|
||||||
if (bccomp($transaction->transaction_amount, '0') === 1) {
|
// name is present in object, use that one:
|
||||||
// if the amount is positive, find the opposing account and use that one:
|
if (bccomp($transaction->transaction_amount, '0') === 1 && !is_null($transaction->opposing_account_id)) {
|
||||||
|
|
||||||
|
$name = intval($transaction->opposing_account_encrypted) === 1 ? Crypt::decrypt($transaction->opposing_account_name)
|
||||||
|
: $transaction->opposing_account_name;
|
||||||
|
$id = intval($transaction->opposing_account_id);
|
||||||
|
$type = intval($transaction->opposing_account_type);
|
||||||
|
}
|
||||||
|
// Find the opposing account and use that one:
|
||||||
|
if (bccomp($transaction->transaction_amount, '0') === 1 && is_null($transaction->opposing_account_id)) {
|
||||||
$journalId = $transaction->journal_id;
|
$journalId = $transaction->journal_id;
|
||||||
/** @var TransactionModel $other */
|
/** @var TransactionModel $other */
|
||||||
$other = TransactionModel
|
$other = TransactionModel
|
||||||
|
@@ -30,24 +30,24 @@
|
|||||||
"ext-intl": "*",
|
"ext-intl": "*",
|
||||||
"laravel/framework": "5.3.18",
|
"laravel/framework": "5.3.18",
|
||||||
"davejamesmiller/laravel-breadcrumbs": "^3.0",
|
"davejamesmiller/laravel-breadcrumbs": "^3.0",
|
||||||
"watson/validating": "^3.0",
|
"watson/validating": "3.*",
|
||||||
"doctrine/dbal": "^2.5",
|
"doctrine/dbal": "^2.5",
|
||||||
"league/commonmark": "^0.15.0",
|
"league/commonmark": "0.15.*",
|
||||||
"rcrowe/twigbridge": "^0.9.3",
|
"rcrowe/twigbridge": "0.9.*",
|
||||||
"league/csv": "^8.1",
|
"league/csv": "8.*",
|
||||||
"laravelcollective/html": "^5.3",
|
"laravelcollective/html": "^5.3",
|
||||||
"rmccue/requests": "^1.6",
|
"rmccue/requests": "1.*",
|
||||||
"pragmarx/google2fa": "^1.0",
|
"pragmarx/google2fa": "1.*",
|
||||||
"barryvdh/laravel-debugbar": "^2.2",
|
"bacon/bacon-qr-code": "1.*"
|
||||||
"barryvdh/laravel-ide-helper": "^2.2",
|
|
||||||
"bacon/bacon-qr-code": "^1.0"
|
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"fzaninotto/faker": "~1.4",
|
"fzaninotto/faker": "~1.4",
|
||||||
"mockery/mockery": "0.9.*",
|
"mockery/mockery": "0.9.*",
|
||||||
"phpunit/phpunit": "~5.0",
|
"phpunit/phpunit": "~5.0",
|
||||||
"symfony/css-selector": "3.1.*",
|
"symfony/css-selector": "3.1.*",
|
||||||
"symfony/dom-crawler": "3.1.*"
|
"symfony/dom-crawler": "3.1.*",
|
||||||
|
"barryvdh/laravel-debugbar": "2.*",
|
||||||
|
"barryvdh/laravel-ide-helper": "2.*"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"classmap": [
|
"classmap": [
|
||||||
|
706
composer.lock
generated
706
composer.lock
generated
@@ -4,8 +4,8 @@
|
|||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"hash": "12c9e9450c824d192b8c049989188b8e",
|
"hash": "3c2ecf3f444f89ec56e069b5452744fa",
|
||||||
"content-hash": "473d3c681e5c41989e9dced651a939df",
|
"content-hash": "19ebf906c75d026c93d83cb8186e5d27",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "bacon/bacon-qr-code",
|
"name": "bacon/bacon-qr-code",
|
||||||
@@ -49,175 +49,6 @@
|
|||||||
"homepage": "https://github.com/Bacon/BaconQrCode",
|
"homepage": "https://github.com/Bacon/BaconQrCode",
|
||||||
"time": "2016-01-09 22:55:35"
|
"time": "2016-01-09 22:55:35"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "barryvdh/laravel-debugbar",
|
|
||||||
"version": "v2.3.0",
|
|
||||||
"source": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://github.com/barryvdh/laravel-debugbar.git",
|
|
||||||
"reference": "0c87981df959c7c1943abe227baf607c92f204f9"
|
|
||||||
},
|
|
||||||
"dist": {
|
|
||||||
"type": "zip",
|
|
||||||
"url": "https://api.github.com/repos/barryvdh/laravel-debugbar/zipball/0c87981df959c7c1943abe227baf607c92f204f9",
|
|
||||||
"reference": "0c87981df959c7c1943abe227baf607c92f204f9",
|
|
||||||
"shasum": ""
|
|
||||||
},
|
|
||||||
"require": {
|
|
||||||
"illuminate/support": "5.1.*|5.2.*|5.3.*",
|
|
||||||
"maximebf/debugbar": "~1.13.0",
|
|
||||||
"php": ">=5.5.9",
|
|
||||||
"symfony/finder": "~2.7|~3.0"
|
|
||||||
},
|
|
||||||
"type": "library",
|
|
||||||
"extra": {
|
|
||||||
"branch-alias": {
|
|
||||||
"dev-master": "2.3-dev"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"autoload": {
|
|
||||||
"psr-4": {
|
|
||||||
"Barryvdh\\Debugbar\\": "src/"
|
|
||||||
},
|
|
||||||
"files": [
|
|
||||||
"src/helpers.php"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"notification-url": "https://packagist.org/downloads/",
|
|
||||||
"license": [
|
|
||||||
"MIT"
|
|
||||||
],
|
|
||||||
"authors": [
|
|
||||||
{
|
|
||||||
"name": "Barry vd. Heuvel",
|
|
||||||
"email": "barryvdh@gmail.com"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"description": "PHP Debugbar integration for Laravel",
|
|
||||||
"keywords": [
|
|
||||||
"debug",
|
|
||||||
"debugbar",
|
|
||||||
"laravel",
|
|
||||||
"profiler",
|
|
||||||
"webprofiler"
|
|
||||||
],
|
|
||||||
"time": "2016-09-15 14:05:56"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "barryvdh/laravel-ide-helper",
|
|
||||||
"version": "v2.2.1",
|
|
||||||
"source": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://github.com/barryvdh/laravel-ide-helper.git",
|
|
||||||
"reference": "28af7cd19ca41cc0c63dd1de2b46c2b84d31c463"
|
|
||||||
},
|
|
||||||
"dist": {
|
|
||||||
"type": "zip",
|
|
||||||
"url": "https://api.github.com/repos/barryvdh/laravel-ide-helper/zipball/28af7cd19ca41cc0c63dd1de2b46c2b84d31c463",
|
|
||||||
"reference": "28af7cd19ca41cc0c63dd1de2b46c2b84d31c463",
|
|
||||||
"shasum": ""
|
|
||||||
},
|
|
||||||
"require": {
|
|
||||||
"barryvdh/reflection-docblock": "^2.0.4",
|
|
||||||
"illuminate/console": "^5.0,<5.4",
|
|
||||||
"illuminate/filesystem": "^5.0,<5.4",
|
|
||||||
"illuminate/support": "^5.0,<5.4",
|
|
||||||
"php": ">=5.4.0",
|
|
||||||
"symfony/class-loader": "^2.3|^3.0"
|
|
||||||
},
|
|
||||||
"require-dev": {
|
|
||||||
"doctrine/dbal": "~2.3",
|
|
||||||
"phpunit/phpunit": "4.*",
|
|
||||||
"scrutinizer/ocular": "~1.1",
|
|
||||||
"squizlabs/php_codesniffer": "~2.3"
|
|
||||||
},
|
|
||||||
"suggest": {
|
|
||||||
"doctrine/dbal": "Load information from the database about models for phpdocs (~2.3)"
|
|
||||||
},
|
|
||||||
"type": "library",
|
|
||||||
"extra": {
|
|
||||||
"branch-alias": {
|
|
||||||
"dev-master": "2.2-dev"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"autoload": {
|
|
||||||
"psr-4": {
|
|
||||||
"Barryvdh\\LaravelIdeHelper\\": "src"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"notification-url": "https://packagist.org/downloads/",
|
|
||||||
"license": [
|
|
||||||
"MIT"
|
|
||||||
],
|
|
||||||
"authors": [
|
|
||||||
{
|
|
||||||
"name": "Barry vd. Heuvel",
|
|
||||||
"email": "barryvdh@gmail.com"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"description": "Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.",
|
|
||||||
"keywords": [
|
|
||||||
"autocomplete",
|
|
||||||
"codeintel",
|
|
||||||
"helper",
|
|
||||||
"ide",
|
|
||||||
"laravel",
|
|
||||||
"netbeans",
|
|
||||||
"phpdoc",
|
|
||||||
"phpstorm",
|
|
||||||
"sublime"
|
|
||||||
],
|
|
||||||
"time": "2016-07-04 11:52:48"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "barryvdh/reflection-docblock",
|
|
||||||
"version": "v2.0.4",
|
|
||||||
"source": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://github.com/barryvdh/ReflectionDocBlock.git",
|
|
||||||
"reference": "3dcbd98b5d9384a5357266efba8fd29884458e5c"
|
|
||||||
},
|
|
||||||
"dist": {
|
|
||||||
"type": "zip",
|
|
||||||
"url": "https://api.github.com/repos/barryvdh/ReflectionDocBlock/zipball/3dcbd98b5d9384a5357266efba8fd29884458e5c",
|
|
||||||
"reference": "3dcbd98b5d9384a5357266efba8fd29884458e5c",
|
|
||||||
"shasum": ""
|
|
||||||
},
|
|
||||||
"require": {
|
|
||||||
"php": ">=5.3.3"
|
|
||||||
},
|
|
||||||
"require-dev": {
|
|
||||||
"phpunit/phpunit": "~4.0,<4.5"
|
|
||||||
},
|
|
||||||
"suggest": {
|
|
||||||
"dflydev/markdown": "~1.0",
|
|
||||||
"erusev/parsedown": "~1.0"
|
|
||||||
},
|
|
||||||
"type": "library",
|
|
||||||
"extra": {
|
|
||||||
"branch-alias": {
|
|
||||||
"dev-master": "2.0.x-dev"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"autoload": {
|
|
||||||
"psr-0": {
|
|
||||||
"Barryvdh": [
|
|
||||||
"src/"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"notification-url": "https://packagist.org/downloads/",
|
|
||||||
"license": [
|
|
||||||
"MIT"
|
|
||||||
],
|
|
||||||
"authors": [
|
|
||||||
{
|
|
||||||
"name": "Mike van Riel",
|
|
||||||
"email": "mike.vanriel@naenius.com"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"time": "2016-06-13 19:28:20"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "christian-riesen/base32",
|
"name": "christian-riesen/base32",
|
||||||
"version": "1.3.1",
|
"version": "1.3.1",
|
||||||
@@ -1206,16 +1037,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "league/commonmark",
|
"name": "league/commonmark",
|
||||||
"version": "0.15.0",
|
"version": "0.15.1",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/thephpleague/commonmark.git",
|
"url": "https://github.com/thephpleague/commonmark.git",
|
||||||
"reference": "19fb96643beba24e681c371dc133e25409742664"
|
"reference": "20bdba6777e6c63f861711501eec8887e65412fc"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/thephpleague/commonmark/zipball/19fb96643beba24e681c371dc133e25409742664",
|
"url": "https://api.github.com/repos/thephpleague/commonmark/zipball/20bdba6777e6c63f861711501eec8887e65412fc",
|
||||||
"reference": "19fb96643beba24e681c371dc133e25409742664",
|
"reference": "20bdba6777e6c63f861711501eec8887e65412fc",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@@ -1271,7 +1102,7 @@
|
|||||||
"markdown",
|
"markdown",
|
||||||
"parser"
|
"parser"
|
||||||
],
|
],
|
||||||
"time": "2016-09-14 15:44:35"
|
"time": "2016-11-08 15:28:32"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "league/csv",
|
"name": "league/csv",
|
||||||
@@ -1413,67 +1244,6 @@
|
|||||||
],
|
],
|
||||||
"time": "2016-10-19 20:38:46"
|
"time": "2016-10-19 20:38:46"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "maximebf/debugbar",
|
|
||||||
"version": "v1.13.0",
|
|
||||||
"source": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://github.com/maximebf/php-debugbar.git",
|
|
||||||
"reference": "5f49a5ed6cfde81d31d89378806670d77462526e"
|
|
||||||
},
|
|
||||||
"dist": {
|
|
||||||
"type": "zip",
|
|
||||||
"url": "https://api.github.com/repos/maximebf/php-debugbar/zipball/5f49a5ed6cfde81d31d89378806670d77462526e",
|
|
||||||
"reference": "5f49a5ed6cfde81d31d89378806670d77462526e",
|
|
||||||
"shasum": ""
|
|
||||||
},
|
|
||||||
"require": {
|
|
||||||
"php": ">=5.3.0",
|
|
||||||
"psr/log": "^1.0",
|
|
||||||
"symfony/var-dumper": "^2.6|^3.0"
|
|
||||||
},
|
|
||||||
"require-dev": {
|
|
||||||
"phpunit/phpunit": "^4.0|^5.0"
|
|
||||||
},
|
|
||||||
"suggest": {
|
|
||||||
"kriswallsmith/assetic": "The best way to manage assets",
|
|
||||||
"monolog/monolog": "Log using Monolog",
|
|
||||||
"predis/predis": "Redis storage"
|
|
||||||
},
|
|
||||||
"type": "library",
|
|
||||||
"extra": {
|
|
||||||
"branch-alias": {
|
|
||||||
"dev-master": "1.13-dev"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"autoload": {
|
|
||||||
"psr-4": {
|
|
||||||
"DebugBar\\": "src/DebugBar/"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"notification-url": "https://packagist.org/downloads/",
|
|
||||||
"license": [
|
|
||||||
"MIT"
|
|
||||||
],
|
|
||||||
"authors": [
|
|
||||||
{
|
|
||||||
"name": "Maxime Bouroumeau-Fuseau",
|
|
||||||
"email": "maxime.bouroumeau@gmail.com",
|
|
||||||
"homepage": "http://maximebf.com"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Barry vd. Heuvel",
|
|
||||||
"email": "barryvdh@gmail.com"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"description": "Debug bar in the browser for php application",
|
|
||||||
"homepage": "https://github.com/maximebf/php-debugbar",
|
|
||||||
"keywords": [
|
|
||||||
"debug",
|
|
||||||
"debugbar"
|
|
||||||
],
|
|
||||||
"time": "2016-09-15 14:01:59"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "monolog/monolog",
|
"name": "monolog/monolog",
|
||||||
"version": "1.21.0",
|
"version": "1.21.0",
|
||||||
@@ -1696,16 +1466,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "paragonie/random_compat",
|
"name": "paragonie/random_compat",
|
||||||
"version": "v2.0.3",
|
"version": "v2.0.4",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/paragonie/random_compat.git",
|
"url": "https://github.com/paragonie/random_compat.git",
|
||||||
"reference": "c0125896dbb151380ab47e96c621741e79623beb"
|
"reference": "a9b97968bcde1c4de2a5ec6cbd06a0f6c919b46e"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/paragonie/random_compat/zipball/c0125896dbb151380ab47e96c621741e79623beb",
|
"url": "https://api.github.com/repos/paragonie/random_compat/zipball/a9b97968bcde1c4de2a5ec6cbd06a0f6c919b46e",
|
||||||
"reference": "c0125896dbb151380ab47e96c621741e79623beb",
|
"reference": "a9b97968bcde1c4de2a5ec6cbd06a0f6c919b46e",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@@ -1740,7 +1510,7 @@
|
|||||||
"pseudorandom",
|
"pseudorandom",
|
||||||
"random"
|
"random"
|
||||||
],
|
],
|
||||||
"time": "2016-10-17 15:23:22"
|
"time": "2016-11-07 23:38:38"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "pragmarx/google2fa",
|
"name": "pragmarx/google2fa",
|
||||||
@@ -2168,62 +1938,6 @@
|
|||||||
],
|
],
|
||||||
"time": "2016-07-08 11:51:25"
|
"time": "2016-07-08 11:51:25"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "symfony/class-loader",
|
|
||||||
"version": "v3.1.6",
|
|
||||||
"source": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://github.com/symfony/class-loader.git",
|
|
||||||
"reference": "bcb072aba46ddf3b1a496438c63be6be647739aa"
|
|
||||||
},
|
|
||||||
"dist": {
|
|
||||||
"type": "zip",
|
|
||||||
"url": "https://api.github.com/repos/symfony/class-loader/zipball/bcb072aba46ddf3b1a496438c63be6be647739aa",
|
|
||||||
"reference": "bcb072aba46ddf3b1a496438c63be6be647739aa",
|
|
||||||
"shasum": ""
|
|
||||||
},
|
|
||||||
"require": {
|
|
||||||
"php": ">=5.5.9"
|
|
||||||
},
|
|
||||||
"require-dev": {
|
|
||||||
"symfony/finder": "~2.8|~3.0",
|
|
||||||
"symfony/polyfill-apcu": "~1.1"
|
|
||||||
},
|
|
||||||
"suggest": {
|
|
||||||
"symfony/polyfill-apcu": "For using ApcClassLoader on HHVM"
|
|
||||||
},
|
|
||||||
"type": "library",
|
|
||||||
"extra": {
|
|
||||||
"branch-alias": {
|
|
||||||
"dev-master": "3.1-dev"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"autoload": {
|
|
||||||
"psr-4": {
|
|
||||||
"Symfony\\Component\\ClassLoader\\": ""
|
|
||||||
},
|
|
||||||
"exclude-from-classmap": [
|
|
||||||
"/Tests/"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"notification-url": "https://packagist.org/downloads/",
|
|
||||||
"license": [
|
|
||||||
"MIT"
|
|
||||||
],
|
|
||||||
"authors": [
|
|
||||||
{
|
|
||||||
"name": "Fabien Potencier",
|
|
||||||
"email": "fabien@symfony.com"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Symfony Community",
|
|
||||||
"homepage": "https://symfony.com/contributors"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"description": "Symfony ClassLoader Component",
|
|
||||||
"homepage": "https://symfony.com",
|
|
||||||
"time": "2016-09-06 23:30:54"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "symfony/console",
|
"name": "symfony/console",
|
||||||
"version": "v3.1.6",
|
"version": "v3.1.6",
|
||||||
@@ -2588,16 +2302,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/polyfill-mbstring",
|
"name": "symfony/polyfill-mbstring",
|
||||||
"version": "v1.2.0",
|
"version": "v1.3.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/symfony/polyfill-mbstring.git",
|
"url": "https://github.com/symfony/polyfill-mbstring.git",
|
||||||
"reference": "dff51f72b0706335131b00a7f49606168c582594"
|
"reference": "e79d363049d1c2128f133a2667e4f4190904f7f4"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/dff51f72b0706335131b00a7f49606168c582594",
|
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/e79d363049d1c2128f133a2667e4f4190904f7f4",
|
||||||
"reference": "dff51f72b0706335131b00a7f49606168c582594",
|
"reference": "e79d363049d1c2128f133a2667e4f4190904f7f4",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@@ -2609,7 +2323,7 @@
|
|||||||
"type": "library",
|
"type": "library",
|
||||||
"extra": {
|
"extra": {
|
||||||
"branch-alias": {
|
"branch-alias": {
|
||||||
"dev-master": "1.2-dev"
|
"dev-master": "1.3-dev"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
@@ -2643,20 +2357,20 @@
|
|||||||
"portable",
|
"portable",
|
||||||
"shim"
|
"shim"
|
||||||
],
|
],
|
||||||
"time": "2016-05-18 14:26:46"
|
"time": "2016-11-14 01:06:16"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/polyfill-php56",
|
"name": "symfony/polyfill-php56",
|
||||||
"version": "v1.2.0",
|
"version": "v1.3.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/symfony/polyfill-php56.git",
|
"url": "https://github.com/symfony/polyfill-php56.git",
|
||||||
"reference": "3edf57a8fbf9a927533344cef65ad7e1cf31030a"
|
"reference": "1dd42b9b89556f18092f3d1ada22cb05ac85383c"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/symfony/polyfill-php56/zipball/3edf57a8fbf9a927533344cef65ad7e1cf31030a",
|
"url": "https://api.github.com/repos/symfony/polyfill-php56/zipball/1dd42b9b89556f18092f3d1ada22cb05ac85383c",
|
||||||
"reference": "3edf57a8fbf9a927533344cef65ad7e1cf31030a",
|
"reference": "1dd42b9b89556f18092f3d1ada22cb05ac85383c",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@@ -2666,7 +2380,7 @@
|
|||||||
"type": "library",
|
"type": "library",
|
||||||
"extra": {
|
"extra": {
|
||||||
"branch-alias": {
|
"branch-alias": {
|
||||||
"dev-master": "1.2-dev"
|
"dev-master": "1.3-dev"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
@@ -2699,20 +2413,20 @@
|
|||||||
"portable",
|
"portable",
|
||||||
"shim"
|
"shim"
|
||||||
],
|
],
|
||||||
"time": "2016-05-18 14:26:46"
|
"time": "2016-11-14 01:06:16"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/polyfill-util",
|
"name": "symfony/polyfill-util",
|
||||||
"version": "v1.2.0",
|
"version": "v1.3.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/symfony/polyfill-util.git",
|
"url": "https://github.com/symfony/polyfill-util.git",
|
||||||
"reference": "ef830ce3d218e622b221d6bfad42c751d974bf99"
|
"reference": "746bce0fca664ac0a575e465f65c6643faddf7fb"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/symfony/polyfill-util/zipball/ef830ce3d218e622b221d6bfad42c751d974bf99",
|
"url": "https://api.github.com/repos/symfony/polyfill-util/zipball/746bce0fca664ac0a575e465f65c6643faddf7fb",
|
||||||
"reference": "ef830ce3d218e622b221d6bfad42c751d974bf99",
|
"reference": "746bce0fca664ac0a575e465f65c6643faddf7fb",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@@ -2721,7 +2435,7 @@
|
|||||||
"type": "library",
|
"type": "library",
|
||||||
"extra": {
|
"extra": {
|
||||||
"branch-alias": {
|
"branch-alias": {
|
||||||
"dev-master": "1.2-dev"
|
"dev-master": "1.3-dev"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
@@ -2751,7 +2465,7 @@
|
|||||||
"polyfill",
|
"polyfill",
|
||||||
"shim"
|
"shim"
|
||||||
],
|
],
|
||||||
"time": "2016-05-18 14:26:46"
|
"time": "2016-11-14 01:06:16"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/process",
|
"name": "symfony/process",
|
||||||
@@ -3006,16 +2720,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "twig/twig",
|
"name": "twig/twig",
|
||||||
"version": "v1.27.0",
|
"version": "v1.28.1",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/twigphp/Twig.git",
|
"url": "https://github.com/twigphp/Twig.git",
|
||||||
"reference": "3c6c0033fd3b5679c6e1cb60f4f9766c2b424d97"
|
"reference": "fff80c4a7ae1d47a81dfec10c76cbcb939170b45"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/twigphp/Twig/zipball/3c6c0033fd3b5679c6e1cb60f4f9766c2b424d97",
|
"url": "https://api.github.com/repos/twigphp/Twig/zipball/fff80c4a7ae1d47a81dfec10c76cbcb939170b45",
|
||||||
"reference": "3c6c0033fd3b5679c6e1cb60f4f9766c2b424d97",
|
"reference": "fff80c4a7ae1d47a81dfec10c76cbcb939170b45",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@@ -3028,7 +2742,7 @@
|
|||||||
"type": "library",
|
"type": "library",
|
||||||
"extra": {
|
"extra": {
|
||||||
"branch-alias": {
|
"branch-alias": {
|
||||||
"dev-master": "1.27-dev"
|
"dev-master": "1.28-dev"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
@@ -3063,7 +2777,7 @@
|
|||||||
"keywords": [
|
"keywords": [
|
||||||
"templating"
|
"templating"
|
||||||
],
|
],
|
||||||
"time": "2016-10-25 19:17:17"
|
"time": "2016-11-19 05:52:49"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "vlucas/phpdotenv",
|
"name": "vlucas/phpdotenv",
|
||||||
@@ -3167,6 +2881,175 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"packages-dev": [
|
"packages-dev": [
|
||||||
|
{
|
||||||
|
"name": "barryvdh/laravel-debugbar",
|
||||||
|
"version": "v2.3.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/barryvdh/laravel-debugbar.git",
|
||||||
|
"reference": "0c87981df959c7c1943abe227baf607c92f204f9"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/barryvdh/laravel-debugbar/zipball/0c87981df959c7c1943abe227baf607c92f204f9",
|
||||||
|
"reference": "0c87981df959c7c1943abe227baf607c92f204f9",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"illuminate/support": "5.1.*|5.2.*|5.3.*",
|
||||||
|
"maximebf/debugbar": "~1.13.0",
|
||||||
|
"php": ">=5.5.9",
|
||||||
|
"symfony/finder": "~2.7|~3.0"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "2.3-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Barryvdh\\Debugbar\\": "src/"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"src/helpers.php"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Barry vd. Heuvel",
|
||||||
|
"email": "barryvdh@gmail.com"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "PHP Debugbar integration for Laravel",
|
||||||
|
"keywords": [
|
||||||
|
"debug",
|
||||||
|
"debugbar",
|
||||||
|
"laravel",
|
||||||
|
"profiler",
|
||||||
|
"webprofiler"
|
||||||
|
],
|
||||||
|
"time": "2016-09-15 14:05:56"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "barryvdh/laravel-ide-helper",
|
||||||
|
"version": "v2.2.1",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/barryvdh/laravel-ide-helper.git",
|
||||||
|
"reference": "28af7cd19ca41cc0c63dd1de2b46c2b84d31c463"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/barryvdh/laravel-ide-helper/zipball/28af7cd19ca41cc0c63dd1de2b46c2b84d31c463",
|
||||||
|
"reference": "28af7cd19ca41cc0c63dd1de2b46c2b84d31c463",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"barryvdh/reflection-docblock": "^2.0.4",
|
||||||
|
"illuminate/console": "^5.0,<5.4",
|
||||||
|
"illuminate/filesystem": "^5.0,<5.4",
|
||||||
|
"illuminate/support": "^5.0,<5.4",
|
||||||
|
"php": ">=5.4.0",
|
||||||
|
"symfony/class-loader": "^2.3|^3.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"doctrine/dbal": "~2.3",
|
||||||
|
"phpunit/phpunit": "4.*",
|
||||||
|
"scrutinizer/ocular": "~1.1",
|
||||||
|
"squizlabs/php_codesniffer": "~2.3"
|
||||||
|
},
|
||||||
|
"suggest": {
|
||||||
|
"doctrine/dbal": "Load information from the database about models for phpdocs (~2.3)"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "2.2-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Barryvdh\\LaravelIdeHelper\\": "src"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Barry vd. Heuvel",
|
||||||
|
"email": "barryvdh@gmail.com"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.",
|
||||||
|
"keywords": [
|
||||||
|
"autocomplete",
|
||||||
|
"codeintel",
|
||||||
|
"helper",
|
||||||
|
"ide",
|
||||||
|
"laravel",
|
||||||
|
"netbeans",
|
||||||
|
"phpdoc",
|
||||||
|
"phpstorm",
|
||||||
|
"sublime"
|
||||||
|
],
|
||||||
|
"time": "2016-07-04 11:52:48"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "barryvdh/reflection-docblock",
|
||||||
|
"version": "v2.0.4",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/barryvdh/ReflectionDocBlock.git",
|
||||||
|
"reference": "3dcbd98b5d9384a5357266efba8fd29884458e5c"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/barryvdh/ReflectionDocBlock/zipball/3dcbd98b5d9384a5357266efba8fd29884458e5c",
|
||||||
|
"reference": "3dcbd98b5d9384a5357266efba8fd29884458e5c",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=5.3.3"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"phpunit/phpunit": "~4.0,<4.5"
|
||||||
|
},
|
||||||
|
"suggest": {
|
||||||
|
"dflydev/markdown": "~1.0",
|
||||||
|
"erusev/parsedown": "~1.0"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "2.0.x-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-0": {
|
||||||
|
"Barryvdh": [
|
||||||
|
"src/"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Mike van Riel",
|
||||||
|
"email": "mike.vanriel@naenius.com"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"time": "2016-06-13 19:28:20"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "doctrine/instantiator",
|
"name": "doctrine/instantiator",
|
||||||
"version": "1.0.5",
|
"version": "1.0.5",
|
||||||
@@ -3315,17 +3198,78 @@
|
|||||||
"time": "2015-05-11 14:41:42"
|
"time": "2015-05-11 14:41:42"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "mockery/mockery",
|
"name": "maximebf/debugbar",
|
||||||
"version": "0.9.5",
|
"version": "v1.13.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/padraic/mockery.git",
|
"url": "https://github.com/maximebf/php-debugbar.git",
|
||||||
"reference": "4db079511a283e5aba1b3c2fb19037c645e70fc2"
|
"reference": "5f49a5ed6cfde81d31d89378806670d77462526e"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/padraic/mockery/zipball/4db079511a283e5aba1b3c2fb19037c645e70fc2",
|
"url": "https://api.github.com/repos/maximebf/php-debugbar/zipball/5f49a5ed6cfde81d31d89378806670d77462526e",
|
||||||
"reference": "4db079511a283e5aba1b3c2fb19037c645e70fc2",
|
"reference": "5f49a5ed6cfde81d31d89378806670d77462526e",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=5.3.0",
|
||||||
|
"psr/log": "^1.0",
|
||||||
|
"symfony/var-dumper": "^2.6|^3.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"phpunit/phpunit": "^4.0|^5.0"
|
||||||
|
},
|
||||||
|
"suggest": {
|
||||||
|
"kriswallsmith/assetic": "The best way to manage assets",
|
||||||
|
"monolog/monolog": "Log using Monolog",
|
||||||
|
"predis/predis": "Redis storage"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "1.13-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"DebugBar\\": "src/DebugBar/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Maxime Bouroumeau-Fuseau",
|
||||||
|
"email": "maxime.bouroumeau@gmail.com",
|
||||||
|
"homepage": "http://maximebf.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Barry vd. Heuvel",
|
||||||
|
"email": "barryvdh@gmail.com"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Debug bar in the browser for php application",
|
||||||
|
"homepage": "https://github.com/maximebf/php-debugbar",
|
||||||
|
"keywords": [
|
||||||
|
"debug",
|
||||||
|
"debugbar"
|
||||||
|
],
|
||||||
|
"time": "2016-09-15 14:01:59"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "mockery/mockery",
|
||||||
|
"version": "0.9.6",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/padraic/mockery.git",
|
||||||
|
"reference": "65d4ca18e15cb02eeb1e5336f884e46b9b905be0"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/padraic/mockery/zipball/65d4ca18e15cb02eeb1e5336f884e46b9b905be0",
|
||||||
|
"reference": "65d4ca18e15cb02eeb1e5336f884e46b9b905be0",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@@ -3377,7 +3321,7 @@
|
|||||||
"test double",
|
"test double",
|
||||||
"testing"
|
"testing"
|
||||||
],
|
],
|
||||||
"time": "2016-05-22 21:52:33"
|
"time": "2016-09-30 12:09:40"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "myclabs/deep-copy",
|
"name": "myclabs/deep-copy",
|
||||||
@@ -3826,16 +3770,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "phpunit/php-token-stream",
|
"name": "phpunit/php-token-stream",
|
||||||
"version": "1.4.8",
|
"version": "1.4.9",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/sebastianbergmann/php-token-stream.git",
|
"url": "https://github.com/sebastianbergmann/php-token-stream.git",
|
||||||
"reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da"
|
"reference": "3b402f65a4cc90abf6e1104e388b896ce209631b"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da",
|
"url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/3b402f65a4cc90abf6e1104e388b896ce209631b",
|
||||||
"reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da",
|
"reference": "3b402f65a4cc90abf6e1104e388b896ce209631b",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@@ -3871,20 +3815,20 @@
|
|||||||
"keywords": [
|
"keywords": [
|
||||||
"tokenizer"
|
"tokenizer"
|
||||||
],
|
],
|
||||||
"time": "2015-09-15 10:49:45"
|
"time": "2016-11-15 14:06:22"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "phpunit/phpunit",
|
"name": "phpunit/phpunit",
|
||||||
"version": "5.6.2",
|
"version": "5.6.4",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/sebastianbergmann/phpunit.git",
|
"url": "https://github.com/sebastianbergmann/phpunit.git",
|
||||||
"reference": "cd13b23ac5a519a4708e00736c26ee0bb28b2e01"
|
"reference": "4ddb822f1de421b4cadb47570a525fd7d9359493"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/cd13b23ac5a519a4708e00736c26ee0bb28b2e01",
|
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/4ddb822f1de421b4cadb47570a525fd7d9359493",
|
||||||
"reference": "cd13b23ac5a519a4708e00736c26ee0bb28b2e01",
|
"reference": "4ddb822f1de421b4cadb47570a525fd7d9359493",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@@ -3912,7 +3856,9 @@
|
|||||||
"symfony/yaml": "~2.1|~3.0"
|
"symfony/yaml": "~2.1|~3.0"
|
||||||
},
|
},
|
||||||
"conflict": {
|
"conflict": {
|
||||||
"phpdocumentor/reflection-docblock": "3.0.2"
|
"phpdocumentor/reflection-docblock": "3.0.2",
|
||||||
|
"sebastian/object-enumerator": "1.0.1",
|
||||||
|
"sebastian/recursion-context": "1.0.3 || 1.0.4"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"ext-pdo": "*"
|
"ext-pdo": "*"
|
||||||
@@ -3953,27 +3899,27 @@
|
|||||||
"testing",
|
"testing",
|
||||||
"xunit"
|
"xunit"
|
||||||
],
|
],
|
||||||
"time": "2016-10-25 07:40:25"
|
"time": "2016-11-18 09:50:51"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "phpunit/phpunit-mock-objects",
|
"name": "phpunit/phpunit-mock-objects",
|
||||||
"version": "3.4.0",
|
"version": "3.4.1",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git",
|
"url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git",
|
||||||
"reference": "238d7a2723bce689c79eeac9c7d5e1d623bb9dc2"
|
"reference": "45026c8383187ad1dcb14fbfec77dced265b9cfc"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/238d7a2723bce689c79eeac9c7d5e1d623bb9dc2",
|
"url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/45026c8383187ad1dcb14fbfec77dced265b9cfc",
|
||||||
"reference": "238d7a2723bce689c79eeac9c7d5e1d623bb9dc2",
|
"reference": "45026c8383187ad1dcb14fbfec77dced265b9cfc",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"doctrine/instantiator": "^1.0.2",
|
"doctrine/instantiator": "^1.0.2",
|
||||||
"php": "^5.6 || ^7.0",
|
"php": "^5.6 || ^7.0",
|
||||||
"phpunit/php-text-template": "^1.2",
|
"phpunit/php-text-template": "^1.2",
|
||||||
"sebastian/exporter": "^1.2"
|
"sebastian/exporter": "^1.2 || ^2.0"
|
||||||
},
|
},
|
||||||
"conflict": {
|
"conflict": {
|
||||||
"phpunit/phpunit": "<5.4.0"
|
"phpunit/phpunit": "<5.4.0"
|
||||||
@@ -4012,7 +3958,7 @@
|
|||||||
"mock",
|
"mock",
|
||||||
"xunit"
|
"xunit"
|
||||||
],
|
],
|
||||||
"time": "2016-10-09 07:01:45"
|
"time": "2016-11-19 09:07:46"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "sebastian/code-unit-reverse-lookup",
|
"name": "sebastian/code-unit-reverse-lookup",
|
||||||
@@ -4061,22 +4007,22 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "sebastian/comparator",
|
"name": "sebastian/comparator",
|
||||||
"version": "1.2.0",
|
"version": "1.2.2",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/sebastianbergmann/comparator.git",
|
"url": "https://github.com/sebastianbergmann/comparator.git",
|
||||||
"reference": "937efb279bd37a375bcadf584dec0726f84dbf22"
|
"reference": "6a1ed12e8b2409076ab22e3897126211ff8b1f7f"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/937efb279bd37a375bcadf584dec0726f84dbf22",
|
"url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/6a1ed12e8b2409076ab22e3897126211ff8b1f7f",
|
||||||
"reference": "937efb279bd37a375bcadf584dec0726f84dbf22",
|
"reference": "6a1ed12e8b2409076ab22e3897126211ff8b1f7f",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"php": ">=5.3.3",
|
"php": ">=5.3.3",
|
||||||
"sebastian/diff": "~1.2",
|
"sebastian/diff": "~1.2",
|
||||||
"sebastian/exporter": "~1.2"
|
"sebastian/exporter": "~1.2 || ~2.0"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"phpunit/phpunit": "~4.4"
|
"phpunit/phpunit": "~4.4"
|
||||||
@@ -4121,7 +4067,7 @@
|
|||||||
"compare",
|
"compare",
|
||||||
"equality"
|
"equality"
|
||||||
],
|
],
|
||||||
"time": "2015-07-26 15:48:44"
|
"time": "2016-11-19 09:18:40"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "sebastian/diff",
|
"name": "sebastian/diff",
|
||||||
@@ -4527,6 +4473,62 @@
|
|||||||
"homepage": "https://github.com/sebastianbergmann/version",
|
"homepage": "https://github.com/sebastianbergmann/version",
|
||||||
"time": "2016-02-04 12:56:52"
|
"time": "2016-02-04 12:56:52"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "symfony/class-loader",
|
||||||
|
"version": "v3.1.6",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/symfony/class-loader.git",
|
||||||
|
"reference": "bcb072aba46ddf3b1a496438c63be6be647739aa"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/symfony/class-loader/zipball/bcb072aba46ddf3b1a496438c63be6be647739aa",
|
||||||
|
"reference": "bcb072aba46ddf3b1a496438c63be6be647739aa",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=5.5.9"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"symfony/finder": "~2.8|~3.0",
|
||||||
|
"symfony/polyfill-apcu": "~1.1"
|
||||||
|
},
|
||||||
|
"suggest": {
|
||||||
|
"symfony/polyfill-apcu": "For using ApcClassLoader on HHVM"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "3.1-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Symfony\\Component\\ClassLoader\\": ""
|
||||||
|
},
|
||||||
|
"exclude-from-classmap": [
|
||||||
|
"/Tests/"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Fabien Potencier",
|
||||||
|
"email": "fabien@symfony.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Symfony Community",
|
||||||
|
"homepage": "https://symfony.com/contributors"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Symfony ClassLoader Component",
|
||||||
|
"homepage": "https://symfony.com",
|
||||||
|
"time": "2016-09-06 23:30:54"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/css-selector",
|
"name": "symfony/css-selector",
|
||||||
"version": "v3.1.6",
|
"version": "v3.1.6",
|
||||||
|
258
config/app.php
258
config/app.php
@@ -12,141 +12,18 @@
|
|||||||
declare(strict_types = 1);
|
declare(strict_types = 1);
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
'name' => 'Firefly III',
|
||||||
/*
|
'env' => env('APP_ENV', 'production'),
|
||||||
|--------------------------------------------------------------------------
|
'debug' => env('APP_DEBUG', false),
|
||||||
| Application Name
|
'url' => env('APP_URL', 'http://localhost'),
|
||||||
|--------------------------------------------------------------------------
|
'timezone' => 'UTC',
|
||||||
|
|
'locale' => 'en_US',
|
||||||
| This value is the name of your application. This value is used when the
|
|
||||||
| framework needs to place the application's name in a notification or
|
|
||||||
| any other location as required by the application or its packages.
|
|
||||||
*/
|
|
||||||
|
|
||||||
'name' => 'Firefly III',
|
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| Application Environment
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| This value determines the "environment" your application is currently
|
|
||||||
| running in. This may determine how you prefer to configure various
|
|
||||||
| services your application utilizes. Set this in your ".env" file.
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
'env' => env('APP_ENV', 'production'),
|
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| Application Debug Mode
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| When your application is in debug mode, detailed error messages with
|
|
||||||
| stack traces will be shown on every error that occurs within your
|
|
||||||
| application. If disabled, a simple generic error page is shown.
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
'debug' => env('APP_DEBUG', false),
|
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| Application URL
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| This URL is used by the console to properly generate URLs when using
|
|
||||||
| the Artisan command line tool. You should set this to the root of
|
|
||||||
| your application so that it is used when running Artisan tasks.
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
'url' => env('APP_URL', 'http://localhost'),
|
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| Application Timezone
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| Here you may specify the default timezone for your application, which
|
|
||||||
| will be used by the PHP date and date-time functions. We have gone
|
|
||||||
| ahead and set this to a sensible default for you out of the box.
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
'timezone' => 'UTC',
|
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| Application Locale Configuration
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| The application locale determines the default locale that will be used
|
|
||||||
| by the translation service provider. You are free to set this value
|
|
||||||
| to any of the locales which will be supported by the application.
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
'locale' => 'en_US',
|
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| Application Fallback Locale
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| The fallback locale determines the locale to use when the current one
|
|
||||||
| is not available. You may change the value to correspond to any of
|
|
||||||
| the language folders that are provided through your application.
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
'fallback_locale' => 'en_US',
|
'fallback_locale' => 'en_US',
|
||||||
|
'key' => env('APP_KEY'),
|
||||||
/*
|
'cipher' => 'AES-256-CBC',
|
||||||
|--------------------------------------------------------------------------
|
'log' => env('APP_LOG', 'daily'),
|
||||||
| Encryption Key
|
'log_level' => env('APP_LOG_LEVEL', 'info'),
|
||||||
|--------------------------------------------------------------------------
|
'providers' => [
|
||||||
|
|
|
||||||
| This key is used by the Illuminate encrypter service and should be set
|
|
||||||
| to a random, 32 character string, otherwise these encrypted strings
|
|
||||||
| will not be safe. Please do this before deploying an application!
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
'key' => env('APP_KEY'),
|
|
||||||
|
|
||||||
'cipher' => 'AES-256-CBC',
|
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| Logging Configuration
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| Here you may configure the log settings for your application. Out of
|
|
||||||
| the box, Laravel uses the Monolog PHP logging library. This gives
|
|
||||||
| you a variety of powerful log handlers / formatters to utilize.
|
|
||||||
|
|
|
||||||
| Available Settings: "single", "daily", "syslog", "errorlog"
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
'log' => env('APP_LOG', 'daily'),
|
|
||||||
|
|
||||||
'log_level' => env('APP_LOG_LEVEL', 'info'),
|
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| Autoloaded Service Providers
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| The service providers listed here will be automatically loaded on the
|
|
||||||
| request to your application. Feel free to add your own services to
|
|
||||||
| this array to grant expanded functionality to your applications.
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
'providers' => [
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Laravel Framework Service Providers...
|
* Laravel Framework Service Providers...
|
||||||
@@ -188,15 +65,16 @@ return [
|
|||||||
|
|
||||||
|
|
||||||
// own stuff:
|
// own stuff:
|
||||||
// Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class,
|
|
||||||
// Barryvdh\Debugbar\ServiceProvider::class,
|
//Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class,
|
||||||
|
//Barryvdh\Debugbar\ServiceProvider::class,
|
||||||
DaveJamesMiller\Breadcrumbs\ServiceProvider::class,
|
DaveJamesMiller\Breadcrumbs\ServiceProvider::class,
|
||||||
TwigBridge\ServiceProvider::class,
|
TwigBridge\ServiceProvider::class,
|
||||||
'PragmaRX\Google2FA\Vendor\Laravel\ServiceProvider',
|
'PragmaRX\Google2FA\Vendor\Laravel\ServiceProvider',
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* More service providers.
|
* More service providers.
|
||||||
*/
|
*/
|
||||||
FireflyIII\Providers\CrudServiceProvider::class,
|
FireflyIII\Providers\CrudServiceProvider::class,
|
||||||
FireflyIII\Providers\AccountServiceProvider::class,
|
FireflyIII\Providers\AccountServiceProvider::class,
|
||||||
FireflyIII\Providers\AttachmentServiceProvider::class,
|
FireflyIII\Providers\AttachmentServiceProvider::class,
|
||||||
@@ -213,66 +91,52 @@ return [
|
|||||||
|
|
||||||
|
|
||||||
],
|
],
|
||||||
|
'aliases' => [
|
||||||
|
|
||||||
/*
|
'App' => Illuminate\Support\Facades\App::class,
|
||||||
|--------------------------------------------------------------------------
|
'Artisan' => Illuminate\Support\Facades\Artisan::class,
|
||||||
| Class Aliases
|
'Auth' => Illuminate\Support\Facades\Auth::class,
|
||||||
|--------------------------------------------------------------------------
|
'Blade' => Illuminate\Support\Facades\Blade::class,
|
||||||
|
|
'Cache' => Illuminate\Support\Facades\Cache::class,
|
||||||
| This array of class aliases will be registered when this application
|
'Config' => Illuminate\Support\Facades\Config::class,
|
||||||
| is started. However, feel free to register as many as you wish as
|
'Cookie' => Illuminate\Support\Facades\Cookie::class,
|
||||||
| the aliases are "lazy" loaded so they don't hinder performance.
|
'Crypt' => Illuminate\Support\Facades\Crypt::class,
|
||||||
|
|
'DB' => Illuminate\Support\Facades\DB::class,
|
||||||
*/
|
'Eloquent' => Illuminate\Database\Eloquent\Model::class,
|
||||||
|
'Event' => Illuminate\Support\Facades\Event::class,
|
||||||
'aliases' => [
|
'File' => Illuminate\Support\Facades\File::class,
|
||||||
|
'Gate' => Illuminate\Support\Facades\Gate::class,
|
||||||
'App' => Illuminate\Support\Facades\App::class,
|
'Hash' => Illuminate\Support\Facades\Hash::class,
|
||||||
'Artisan' => Illuminate\Support\Facades\Artisan::class,
|
'Lang' => Illuminate\Support\Facades\Lang::class,
|
||||||
'Auth' => Illuminate\Support\Facades\Auth::class,
|
'Log' => Illuminate\Support\Facades\Log::class,
|
||||||
'Blade' => Illuminate\Support\Facades\Blade::class,
|
'Mail' => Illuminate\Support\Facades\Mail::class,
|
||||||
'Cache' => Illuminate\Support\Facades\Cache::class,
|
'Notification' => Illuminate\Support\Facades\Notification::class,
|
||||||
'Config' => Illuminate\Support\Facades\Config::class,
|
'Password' => Illuminate\Support\Facades\Password::class,
|
||||||
'Cookie' => Illuminate\Support\Facades\Cookie::class,
|
'Queue' => Illuminate\Support\Facades\Queue::class,
|
||||||
'Crypt' => Illuminate\Support\Facades\Crypt::class,
|
'Redirect' => Illuminate\Support\Facades\Redirect::class,
|
||||||
'DB' => Illuminate\Support\Facades\DB::class,
|
'Redis' => Illuminate\Support\Facades\Redis::class,
|
||||||
'Eloquent' => Illuminate\Database\Eloquent\Model::class,
|
'Request' => Illuminate\Support\Facades\Request::class,
|
||||||
'Event' => Illuminate\Support\Facades\Event::class,
|
'Response' => Illuminate\Support\Facades\Response::class,
|
||||||
'File' => Illuminate\Support\Facades\File::class,
|
'Route' => Illuminate\Support\Facades\Route::class,
|
||||||
'Gate' => Illuminate\Support\Facades\Gate::class,
|
'Schema' => Illuminate\Support\Facades\Schema::class,
|
||||||
'Hash' => Illuminate\Support\Facades\Hash::class,
|
'Session' => Illuminate\Support\Facades\Session::class,
|
||||||
'Lang' => Illuminate\Support\Facades\Lang::class,
|
'Storage' => Illuminate\Support\Facades\Storage::class,
|
||||||
'Log' => Illuminate\Support\Facades\Log::class,
|
'URL' => Illuminate\Support\Facades\URL::class,
|
||||||
'Mail' => Illuminate\Support\Facades\Mail::class,
|
'Validator' => Illuminate\Support\Facades\Validator::class,
|
||||||
'Notification' => Illuminate\Support\Facades\Notification::class,
|
'View' => Illuminate\Support\Facades\View::class,
|
||||||
'Password' => Illuminate\Support\Facades\Password::class,
|
'Twig' => 'TwigBridge\Facade\Twig',
|
||||||
'Queue' => Illuminate\Support\Facades\Queue::class,
|
'Form' => Collective\Html\FormFacade::class,
|
||||||
'Redirect' => Illuminate\Support\Facades\Redirect::class,
|
'Html' => Collective\Html\HtmlFacade::class,
|
||||||
'Redis' => Illuminate\Support\Facades\Redis::class,
|
'Breadcrumbs' => 'DaveJamesMiller\Breadcrumbs\Facade',
|
||||||
'Request' => Illuminate\Support\Facades\Request::class,
|
'Preferences' => 'FireflyIII\Support\Facades\Preferences',
|
||||||
'Response' => Illuminate\Support\Facades\Response::class,
|
'FireflyConfig' => 'FireflyIII\Support\Facades\FireflyConfig',
|
||||||
'Route' => Illuminate\Support\Facades\Route::class,
|
'Navigation' => 'FireflyIII\Support\Facades\Navigation',
|
||||||
'Schema' => Illuminate\Support\Facades\Schema::class,
|
'Amount' => 'FireflyIII\Support\Facades\Amount',
|
||||||
'Session' => Illuminate\Support\Facades\Session::class,
|
'Steam' => 'FireflyIII\Support\Facades\Steam',
|
||||||
'Storage' => Illuminate\Support\Facades\Storage::class,
|
'ExpandedForm' => 'FireflyIII\Support\Facades\ExpandedForm',
|
||||||
'URL' => Illuminate\Support\Facades\URL::class,
|
'Entrust' => 'Zizaco\Entrust\EntrustFacade',
|
||||||
'Validator' => Illuminate\Support\Facades\Validator::class,
|
'Input' => 'Illuminate\Support\Facades\Input',
|
||||||
'View' => Illuminate\Support\Facades\View::class,
|
'Google2FA' => 'PragmaRX\Google2FA\Vendor\Laravel\Facade',
|
||||||
'Twig' => 'TwigBridge\Facade\Twig',
|
|
||||||
'Form' => Collective\Html\FormFacade::class,
|
|
||||||
'Html' => Collective\Html\HtmlFacade::class,
|
|
||||||
'Breadcrumbs' => 'DaveJamesMiller\Breadcrumbs\Facade',
|
|
||||||
'Preferences' => 'FireflyIII\Support\Facades\Preferences',
|
|
||||||
'FireflyConfig' => 'FireflyIII\Support\Facades\FireflyConfig',
|
|
||||||
'Navigation' => 'FireflyIII\Support\Facades\Navigation',
|
|
||||||
'Amount' => 'FireflyIII\Support\Facades\Amount',
|
|
||||||
'Steam' => 'FireflyIII\Support\Facades\Steam',
|
|
||||||
'ExpandedForm' => 'FireflyIII\Support\Facades\ExpandedForm',
|
|
||||||
'Entrust' => 'Zizaco\Entrust\EntrustFacade',
|
|
||||||
'Input' => 'Illuminate\Support\Facades\Input',
|
|
||||||
'Google2FA' => 'PragmaRX\Google2FA\Vendor\Laravel\Facade',
|
|
||||||
|
|
||||||
|
|
||||||
],
|
],
|
||||||
|
|
||||||
];
|
];
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user