mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-22 20:16:22 +00:00
Various code cleanup and fixed alignments.
This commit is contained in:
@@ -82,8 +82,8 @@ class ExportDataGenerator
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->accounts = new Collection();
|
||||
$this->start = today(config('app.timezone'));
|
||||
$this->accounts = new Collection();
|
||||
$this->start = today(config('app.timezone'));
|
||||
$this->start->subYear();
|
||||
$this->end = today(config('app.timezone'));
|
||||
$this->exportTransactions = false;
|
||||
@@ -222,7 +222,7 @@ class ExportDataGenerator
|
||||
*/
|
||||
private function exportAccounts(): string
|
||||
{
|
||||
$header = [
|
||||
$header = [
|
||||
'user_id',
|
||||
'account_id',
|
||||
'created_at',
|
||||
@@ -243,7 +243,7 @@ class ExportDataGenerator
|
||||
];
|
||||
|
||||
/** @var AccountRepositoryInterface $repository */
|
||||
$repository = app(AccountRepositoryInterface::class);
|
||||
$repository = app(AccountRepositoryInterface::class);
|
||||
$repository->setUser($this->user);
|
||||
$allAccounts = $repository->getAccountsByType([]);
|
||||
$records = [];
|
||||
@@ -273,7 +273,7 @@ class ExportDataGenerator
|
||||
}
|
||||
|
||||
// load the CSV document from a string
|
||||
$csv = Writer::createFromString();
|
||||
$csv = Writer::createFromString();
|
||||
|
||||
// insert the header
|
||||
try {
|
||||
@@ -306,8 +306,8 @@ class ExportDataGenerator
|
||||
/** @var BillRepositoryInterface $repository */
|
||||
$repository = app(BillRepositoryInterface::class);
|
||||
$repository->setUser($this->user);
|
||||
$bills = $repository->getBills();
|
||||
$header = [
|
||||
$bills = $repository->getBills();
|
||||
$header = [
|
||||
'user_id',
|
||||
'bill_id',
|
||||
'created_at',
|
||||
@@ -321,7 +321,7 @@ class ExportDataGenerator
|
||||
'skip',
|
||||
'active',
|
||||
];
|
||||
$records = [];
|
||||
$records = [];
|
||||
|
||||
/** @var Bill $bill */
|
||||
foreach ($bills as $bill) {
|
||||
@@ -342,7 +342,7 @@ class ExportDataGenerator
|
||||
}
|
||||
|
||||
// load the CSV document from a string
|
||||
$csv = Writer::createFromString();
|
||||
$csv = Writer::createFromString();
|
||||
|
||||
// insert the header
|
||||
try {
|
||||
@@ -372,7 +372,7 @@ class ExportDataGenerator
|
||||
*/
|
||||
private function exportBudgets(): string
|
||||
{
|
||||
$header = [
|
||||
$header = [
|
||||
'user_id',
|
||||
'budget_id',
|
||||
'name',
|
||||
@@ -386,9 +386,9 @@ class ExportDataGenerator
|
||||
|
||||
$budgetRepos = app(BudgetRepositoryInterface::class);
|
||||
$budgetRepos->setUser($this->user);
|
||||
$limitRepos = app(BudgetLimitRepositoryInterface::class);
|
||||
$budgets = $budgetRepos->getBudgets();
|
||||
$records = [];
|
||||
$limitRepos = app(BudgetLimitRepositoryInterface::class);
|
||||
$budgets = $budgetRepos->getBudgets();
|
||||
$records = [];
|
||||
|
||||
/** @var Budget $budget */
|
||||
foreach ($budgets as $budget) {
|
||||
@@ -411,7 +411,7 @@ class ExportDataGenerator
|
||||
}
|
||||
|
||||
// load the CSV document from a string
|
||||
$csv = Writer::createFromString();
|
||||
$csv = Writer::createFromString();
|
||||
|
||||
// insert the header
|
||||
try {
|
||||
@@ -441,10 +441,10 @@ class ExportDataGenerator
|
||||
*/
|
||||
private function exportCategories(): string
|
||||
{
|
||||
$header = ['user_id', 'category_id', 'created_at', 'updated_at', 'name'];
|
||||
$header = ['user_id', 'category_id', 'created_at', 'updated_at', 'name'];
|
||||
|
||||
/** @var CategoryRepositoryInterface $catRepos */
|
||||
$catRepos = app(CategoryRepositoryInterface::class);
|
||||
$catRepos = app(CategoryRepositoryInterface::class);
|
||||
$catRepos->setUser($this->user);
|
||||
|
||||
$records = [];
|
||||
@@ -462,7 +462,7 @@ class ExportDataGenerator
|
||||
}
|
||||
|
||||
// load the CSV document from a string
|
||||
$csv = Writer::createFromString();
|
||||
$csv = Writer::createFromString();
|
||||
|
||||
// insert the header
|
||||
try {
|
||||
@@ -493,14 +493,14 @@ class ExportDataGenerator
|
||||
private function exportPiggies(): string
|
||||
{
|
||||
/** @var PiggyBankRepositoryInterface $piggyRepos */
|
||||
$piggyRepos = app(PiggyBankRepositoryInterface::class);
|
||||
$piggyRepos = app(PiggyBankRepositoryInterface::class);
|
||||
$piggyRepos->setUser($this->user);
|
||||
|
||||
/** @var AccountRepositoryInterface $accountRepos */
|
||||
$accountRepos = app(AccountRepositoryInterface::class);
|
||||
$accountRepos->setUser($this->user);
|
||||
|
||||
$header = [
|
||||
$header = [
|
||||
'user_id',
|
||||
'piggy_bank_id',
|
||||
'created_at',
|
||||
@@ -516,8 +516,8 @@ class ExportDataGenerator
|
||||
'order',
|
||||
'active',
|
||||
];
|
||||
$records = [];
|
||||
$piggies = $piggyRepos->getPiggyBanks();
|
||||
$records = [];
|
||||
$piggies = $piggyRepos->getPiggyBanks();
|
||||
|
||||
/** @var PiggyBank $piggy */
|
||||
foreach ($piggies as $piggy) {
|
||||
@@ -542,7 +542,7 @@ class ExportDataGenerator
|
||||
}
|
||||
|
||||
// load the CSV document from a string
|
||||
$csv = Writer::createFromString();
|
||||
$csv = Writer::createFromString();
|
||||
|
||||
// insert the header
|
||||
try {
|
||||
@@ -575,7 +575,7 @@ class ExportDataGenerator
|
||||
/** @var RecurringRepositoryInterface $recurringRepos */
|
||||
$recurringRepos = app(RecurringRepositoryInterface::class);
|
||||
$recurringRepos->setUser($this->user);
|
||||
$header = [
|
||||
$header = [
|
||||
// recurrence:
|
||||
'user_id', 'recurrence_id', 'row_contains', 'created_at', 'updated_at', 'type', 'title', 'description', 'first_date', 'repeat_until', 'latest_date', 'repetitions', 'apply_rules', 'active',
|
||||
|
||||
@@ -584,8 +584,8 @@ class ExportDataGenerator
|
||||
// transactions + meta:
|
||||
'currency_code', 'foreign_currency_code', 'source_name', 'source_type', 'destination_name', 'destination_type', 'amount', 'foreign_amount', 'category', 'budget', 'piggy_bank', 'tags',
|
||||
];
|
||||
$records = [];
|
||||
$recurrences = $recurringRepos->getAll();
|
||||
$records = [];
|
||||
$recurrences = $recurringRepos->getAll();
|
||||
|
||||
/** @var Recurrence $recurrence */
|
||||
foreach ($recurrences as $recurrence) {
|
||||
@@ -618,7 +618,7 @@ class ExportDataGenerator
|
||||
$piggyBankId = $recurringRepos->getPiggyBank($transaction);
|
||||
$tags = $recurringRepos->getTags($transaction);
|
||||
|
||||
$records[] = [
|
||||
$records[] = [
|
||||
// recurrence
|
||||
$this->user->id,
|
||||
$recurrence->id,
|
||||
@@ -634,7 +634,7 @@ class ExportDataGenerator
|
||||
}
|
||||
}
|
||||
// load the CSV document from a string
|
||||
$csv = Writer::createFromString();
|
||||
$csv = Writer::createFromString();
|
||||
|
||||
// insert the header
|
||||
try {
|
||||
@@ -667,8 +667,8 @@ class ExportDataGenerator
|
||||
$header = ['user_id', 'rule_id', 'row_contains', 'created_at', 'updated_at', 'group_id', 'title', 'description', 'order', 'active', 'stop_processing', 'strict', 'trigger_type', 'trigger_value', 'trigger_order', 'trigger_active', 'trigger_stop_processing', 'action_type', 'action_value', 'action_order', 'action_active', 'action_stop_processing'];
|
||||
$ruleRepos = app(RuleRepositoryInterface::class);
|
||||
$ruleRepos->setUser($this->user);
|
||||
$rules = $ruleRepos->getAll();
|
||||
$records = [];
|
||||
$rules = $ruleRepos->getAll();
|
||||
$records = [];
|
||||
|
||||
/** @var Rule $rule */
|
||||
foreach ($rules as $rule) {
|
||||
@@ -702,7 +702,7 @@ class ExportDataGenerator
|
||||
}
|
||||
|
||||
// load the CSV document from a string
|
||||
$csv = Writer::createFromString();
|
||||
$csv = Writer::createFromString();
|
||||
|
||||
// insert the header
|
||||
try {
|
||||
@@ -732,12 +732,12 @@ class ExportDataGenerator
|
||||
*/
|
||||
private function exportTags(): string
|
||||
{
|
||||
$header = ['user_id', 'tag_id', 'created_at', 'updated_at', 'tag', 'date', 'description', 'latitude', 'longitude', 'zoom_level'];
|
||||
$header = ['user_id', 'tag_id', 'created_at', 'updated_at', 'tag', 'date', 'description', 'latitude', 'longitude', 'zoom_level'];
|
||||
|
||||
$tagRepos = app(TagRepositoryInterface::class);
|
||||
$tagRepos->setUser($this->user);
|
||||
$tags = $tagRepos->get();
|
||||
$records = [];
|
||||
$tags = $tagRepos->get();
|
||||
$records = [];
|
||||
|
||||
/** @var Tag $tag */
|
||||
foreach ($tags as $tag) {
|
||||
@@ -756,7 +756,7 @@ class ExportDataGenerator
|
||||
}
|
||||
|
||||
// load the CSV document from a string
|
||||
$csv = Writer::createFromString();
|
||||
$csv = Writer::createFromString();
|
||||
|
||||
// insert the header
|
||||
try {
|
||||
@@ -787,12 +787,12 @@ class ExportDataGenerator
|
||||
private function exportTransactions(): string
|
||||
{
|
||||
// TODO better place for keys?
|
||||
$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', 'destination_type', 'reconciled', 'category', 'budget', 'bill', 'tags', 'notes'];
|
||||
$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', 'destination_type', 'reconciled', 'category', 'budget', 'bill', 'tags', 'notes'];
|
||||
|
||||
$metaFields = config('firefly.journal_meta_fields');
|
||||
$header = array_merge($header, $metaFields);
|
||||
|
||||
$collector = app(GroupCollectorInterface::class);
|
||||
$collector = app(GroupCollectorInterface::class);
|
||||
$collector->setUser($this->user);
|
||||
$collector->setRange($this->start, $this->end)->withAccountInformation()->withCategoryInformation()->withBillInformation()
|
||||
->withBudgetInformation()->withTagInformation()->withNotes()
|
||||
@@ -801,13 +801,13 @@ class ExportDataGenerator
|
||||
$collector->setAccounts($this->accounts);
|
||||
}
|
||||
|
||||
$journals = $collector->getExtractedJournals();
|
||||
$journals = $collector->getExtractedJournals();
|
||||
|
||||
// get repository for meta data:
|
||||
$repository = app(TransactionGroupRepositoryInterface::class);
|
||||
$repository->setUser($this->user);
|
||||
|
||||
$records = [];
|
||||
$records = [];
|
||||
|
||||
/** @var array $journal */
|
||||
foreach ($journals as $journal) {
|
||||
@@ -832,7 +832,7 @@ class ExportDataGenerator
|
||||
}
|
||||
|
||||
// load the CSV document from a string
|
||||
$csv = Writer::createFromString();
|
||||
$csv = Writer::createFromString();
|
||||
|
||||
// insert the header
|
||||
try {
|
||||
|
Reference in New Issue
Block a user