mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2024-11-22 08:56:39 -06:00
Include notes in export.
This commit is contained in:
parent
1bac3258da
commit
5b829b514f
@ -36,6 +36,8 @@ trait CollectorProperties
|
|||||||
private $hasAccountInfo;
|
private $hasAccountInfo;
|
||||||
/** @var bool Will be true if query result includes bill information. */
|
/** @var bool Will be true if query result includes bill information. */
|
||||||
private $hasBillInformation;
|
private $hasBillInformation;
|
||||||
|
/** @var bool */
|
||||||
|
private $hasNotesInformation;
|
||||||
/** @var bool Will be true if query result contains budget info. */
|
/** @var bool Will be true if query result contains budget info. */
|
||||||
private $hasBudgetInformation;
|
private $hasBudgetInformation;
|
||||||
/** @var bool Will be true if query result contains category info. */
|
/** @var bool Will be true if query result contains category info. */
|
||||||
|
@ -28,6 +28,7 @@ use FireflyIII\Models\Budget;
|
|||||||
use FireflyIII\Models\Category;
|
use FireflyIII\Models\Category;
|
||||||
use FireflyIII\Models\Tag;
|
use FireflyIII\Models\Tag;
|
||||||
use Illuminate\Database\Eloquent\Builder as EloquentBuilder;
|
use Illuminate\Database\Eloquent\Builder as EloquentBuilder;
|
||||||
|
use Illuminate\Database\Query\JoinClause;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -36,6 +37,27 @@ use Illuminate\Support\Collection;
|
|||||||
trait MetaCollection
|
trait MetaCollection
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function withNotes(): GroupCollectorInterface
|
||||||
|
{
|
||||||
|
if (false === $this->hasNotesInformation) {
|
||||||
|
// join bill table
|
||||||
|
$this->query->leftJoin(
|
||||||
|
'notes',
|
||||||
|
static function (JoinClause $join) {
|
||||||
|
$join->on('notes.noteable_id', '=', 'transaction_journals.id');
|
||||||
|
$join->where('notes.noteable_type', '=', 'FireflyIII\Models\TransactionJournal');
|
||||||
|
}
|
||||||
|
);
|
||||||
|
// add fields
|
||||||
|
$this->fields[] = 'notes.text as notes';
|
||||||
|
$this->hasNotesInformation = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Limit the search to a specific bill.
|
* Limit the search to a specific bill.
|
||||||
|
@ -62,6 +62,7 @@ class GroupCollector implements GroupCollectorInterface
|
|||||||
$this->hasCatInformation = false;
|
$this->hasCatInformation = false;
|
||||||
$this->hasBudgetInformation = false;
|
$this->hasBudgetInformation = false;
|
||||||
$this->hasBillInformation = false;
|
$this->hasBillInformation = false;
|
||||||
|
$this->hasNotesInformation = false;
|
||||||
$this->hasJoinedTagTables = false;
|
$this->hasJoinedTagTables = false;
|
||||||
$this->hasJoinedAttTables = false;
|
$this->hasJoinedAttTables = false;
|
||||||
$this->integerFields = [
|
$this->integerFields = [
|
||||||
@ -681,4 +682,5 @@ class GroupCollector implements GroupCollectorInterface
|
|||||||
->orderBy('transaction_journals.description', 'DESC')
|
->orderBy('transaction_journals.description', 'DESC')
|
||||||
->orderBy('source.amount', 'DESC');
|
->orderBy('source.amount', 'DESC');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -398,6 +398,13 @@ interface GroupCollectorInterface
|
|||||||
*/
|
*/
|
||||||
public function withCategoryInformation(): GroupCollectorInterface;
|
public function withCategoryInformation(): GroupCollectorInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Will include notes.
|
||||||
|
*
|
||||||
|
* @return GroupCollectorInterface
|
||||||
|
*/
|
||||||
|
public function withNotes(): GroupCollectorInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add tag info.
|
* Add tag info.
|
||||||
*
|
*
|
||||||
|
@ -656,11 +656,11 @@ class ExportDataGenerator
|
|||||||
// TODO better place for keys?
|
// TODO better place for keys?
|
||||||
$header = ['user_id', 'group_id', 'journal_id', 'created_at', 'updated_at', 'group_title', 'type', 'amount', 'foreign_amount', 'currency_code',
|
$header = ['user_id', 'group_id', 'journal_id', 'created_at', 'updated_at', 'group_title', 'type', 'amount', 'foreign_amount', 'currency_code',
|
||||||
'foreign_currency_code', 'description', 'date', 'source_name', 'source_iban', 'source_type', 'destination_name', 'destination_iban',
|
'foreign_currency_code', 'description', 'date', 'source_name', 'source_iban', 'source_type', 'destination_name', 'destination_iban',
|
||||||
'destination_type', 'reconciled', 'category', 'budget', 'bill', 'tags',];
|
'destination_type', 'reconciled', 'category', 'budget', 'bill', 'tags', 'notes'];
|
||||||
$collector = app(GroupCollectorInterface::class);
|
$collector = app(GroupCollectorInterface::class);
|
||||||
$collector->setUser($this->user);
|
$collector->setUser($this->user);
|
||||||
$collector->setRange($this->start, $this->end)->withAccountInformation()->withCategoryInformation()->withBillInformation()
|
$collector->setRange($this->start, $this->end)->withAccountInformation()->withCategoryInformation()->withBillInformation()
|
||||||
->withBudgetInformation()->withTagInformation();
|
->withBudgetInformation()->withTagInformation()->withNotes();
|
||||||
$journals = $collector->getExtractedJournals();
|
$journals = $collector->getExtractedJournals();
|
||||||
|
|
||||||
$records = [];
|
$records = [];
|
||||||
@ -691,6 +691,7 @@ class ExportDataGenerator
|
|||||||
$journal['budget_name'],
|
$journal['budget_name'],
|
||||||
$journal['bill_name'],
|
$journal['bill_name'],
|
||||||
$this->mergeTags($journal['tags']),
|
$this->mergeTags($journal['tags']),
|
||||||
|
$journal['notes'],
|
||||||
];
|
];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -93,6 +93,7 @@
|
|||||||
"laravel/ui": "^2.0",
|
"laravel/ui": "^2.0",
|
||||||
"laravelcollective/html": "6.*",
|
"laravelcollective/html": "6.*",
|
||||||
"league/commonmark": "1.*",
|
"league/commonmark": "1.*",
|
||||||
|
"league/csv": "^9.6",
|
||||||
"league/fractal": "0.*",
|
"league/fractal": "0.*",
|
||||||
"pragmarx/google2fa": "^7.0",
|
"pragmarx/google2fa": "^7.0",
|
||||||
"pragmarx/recovery": "^0.1.0",
|
"pragmarx/recovery": "^0.1.0",
|
||||||
|
79
composer.lock
generated
79
composer.lock
generated
@ -4,7 +4,7 @@
|
|||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "c87d6fc7dfa25bdd667573fd4f924d0b",
|
"content-hash": "ff245cbb0236e439d420e96a58327852",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "adldap2/adldap2",
|
"name": "adldap2/adldap2",
|
||||||
@ -1929,6 +1929,83 @@
|
|||||||
],
|
],
|
||||||
"time": "2020-05-04T22:15:21+00:00"
|
"time": "2020-05-04T22:15:21+00:00"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "league/csv",
|
||||||
|
"version": "9.6.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/thephpleague/csv.git",
|
||||||
|
"reference": "7351a74625601914409b42b32cabb91a93773b7b"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/thephpleague/csv/zipball/7351a74625601914409b42b32cabb91a93773b7b",
|
||||||
|
"reference": "7351a74625601914409b42b32cabb91a93773b7b",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"ext-json": "*",
|
||||||
|
"ext-mbstring": "*",
|
||||||
|
"php": "^7.2.5"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"ext-curl": "*",
|
||||||
|
"friendsofphp/php-cs-fixer": "^2.16",
|
||||||
|
"phpstan/phpstan": "^0.12.0",
|
||||||
|
"phpstan/phpstan-phpunit": "^0.12.0",
|
||||||
|
"phpstan/phpstan-strict-rules": "^0.12.0",
|
||||||
|
"phpunit/phpunit": "^8.0"
|
||||||
|
},
|
||||||
|
"suggest": {
|
||||||
|
"ext-dom": "Required to use the XMLConverter and or the HTMLConverter classes",
|
||||||
|
"ext-iconv": "Needed to ease transcoding CSV using iconv stream filters"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "9.x-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"League\\Csv\\": "src"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"src/functions_include.php"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Ignace Nyamagana Butera",
|
||||||
|
"email": "nyamsprod@gmail.com",
|
||||||
|
"homepage": "https://github.com/nyamsprod/",
|
||||||
|
"role": "Developer"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "CSV data manipulation made easy in PHP",
|
||||||
|
"homepage": "http://csv.thephpleague.com",
|
||||||
|
"keywords": [
|
||||||
|
"convert",
|
||||||
|
"csv",
|
||||||
|
"export",
|
||||||
|
"filter",
|
||||||
|
"import",
|
||||||
|
"read",
|
||||||
|
"transform",
|
||||||
|
"write"
|
||||||
|
],
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"url": "https://github.com/sponsors/nyamsprod",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"time": "2020-03-17T15:15:35+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "league/event",
|
"name": "league/event",
|
||||||
"version": "2.2.0",
|
"version": "2.2.0",
|
||||||
|
Loading…
Reference in New Issue
Block a user