Skip to content

Firefly III: a personal finances manager

Various fixes and extensions.

James Cole6d971e86b118
diff --git a/app/Http/Controllers/Bill/IndexController.php b/app/Http/Controllers/Bill/IndexController.php
index 7f7d472c3e..ba627833e1 100644
--- a/app/Http/Controllers/Bill/IndexController.php
+++ b/app/Http/Controllers/Bill/IndexController.php
@@ -107,18 +107,18 @@ class IndexController extends Controller
'object_group_title' => $array['object_group_title'],
'bills' => [],
];
-
- // expected today? default:
- $array['next_expected_match_diff'] = trans('firefly.not_expected_period');
- $nextExpectedMatch = new Carbon($array['next_expected_match']);
- if ($nextExpectedMatch->isToday()) {
- $array['next_expected_match_diff'] = trans('firefly.today');
- }
- $current = $array['pay_dates'][0] ?? null;
- if (null !== $current && !$nextExpectedMatch->isToday()) {
- $currentExpectedMatch = Carbon::createFromFormat('Y-m-d\TH:i:sP', $current);
- $array['next_expected_match_diff'] = $currentExpectedMatch->diffForHumans(today(), Carbon::DIFF_RELATIVE_TO_NOW);
- }
+// var_dump($array);exit;
+// // expected today? default:
+// $array['next_expected_match_diff'] = trans('firefly.not_expected_period');
+// $nextExpectedMatch = new Carbon($array['next_expected_match']);
+// if ($nextExpectedMatch->isToday()) {
+// $array['next_expected_match_diff'] = trans('firefly.today');
+// }
+// $current = $array['pay_dates'][0] ?? null;
+// if (null !== $current && !$nextExpectedMatch->isToday()) {
+// $currentExpectedMatch = Carbon::createFromFormat('Y-m-d\TH:i:sP', $current);
+// $array['next_expected_match_diff'] = $currentExpectedMatch->diffForHumans(today(), Carbon::DIFF_RELATIVE_TO_NOW);
+// }
$currency = $bill->transactionCurrency ?? $defaultCurrency;
$array['currency_id'] = $currency->id;
diff --git a/app/Http/Controllers/Recurring/CreateController.php b/app/Http/Controllers/Recurring/CreateController.php
index d0455c2d48..08a995118b 100644
--- a/app/Http/Controllers/Recurring/CreateController.php
+++ b/app/Http/Controllers/Recurring/CreateController.php
@@ -30,6 +30,7 @@ use FireflyIII\Http\Requests\RecurrenceFormRequest;
use FireflyIII\Models\RecurrenceRepetition;
use FireflyIII\Models\Transaction;
use FireflyIII\Models\TransactionJournal;
+use FireflyIII\Repositories\Bill\BillRepositoryInterface;
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
use FireflyIII\Repositories\Recurring\RecurringRepositoryInterface;
use Illuminate\Contracts\View\Factory;
@@ -47,6 +48,7 @@ class CreateController extends Controller
private AttachmentHelperInterface $attachments;
private BudgetRepositoryInterface $budgetRepos;
private RecurringRepositoryInterface $recurring;
+ private BillRepositoryInterface $billRepository;
/**
* CreateController constructor.
@@ -64,9 +66,10 @@ class CreateController extends Controller
app('view')->share('title', (string)trans('firefly.recurrences'));
app('view')->share('subTitle', (string)trans('firefly.create_new_recurrence'));
- $this->recurring = app(RecurringRepositoryInterface::class);
- $this->budgetRepos = app(BudgetRepositoryInterface::class);
- $this->attachments = app(AttachmentHelperInterface::class);
+ $this->recurring = app(RecurringRepositoryInterface::class);
+ $this->budgetRepos = app(BudgetRepositoryInterface::class);
+ $this->attachments = app(AttachmentHelperInterface::class);
+ $this->billRepository = app(BillRepositoryInterface::class);
return $next($request);
}
@@ -83,6 +86,7 @@ class CreateController extends Controller
public function create(Request $request)
{
$budgets = app('expandedform')->makeSelectListWithEmpty($this->budgetRepos->getActiveBudgets());
+ $bills = app('expandedform')->makeSelectListWithEmpty($this->billRepository->getActiveBills());
$defaultCurrency = app('amount')->getDefaultCurrency();
$tomorrow = today(config('app.timezone'));
$oldRepetitionType = $request->old('repetition_type');
@@ -115,7 +119,7 @@ class CreateController extends Controller
return prefixView(
'recurring.create',
- compact('tomorrow', 'oldRepetitionType', 'weekendResponses', 'preFilled', 'repetitionEnds', 'defaultCurrency', 'budgets')
+ compact('tomorrow', 'oldRepetitionType', 'bills', 'weekendResponses', 'preFilled', 'repetitionEnds', 'defaultCurrency', 'budgets')
);
}
@@ -155,11 +159,12 @@ class CreateController extends Controller
$type = strtolower($journal->transactionType->type);
/** @var Transaction $source */
- $source = $journal->transactions()->where('amount', '<', 0)->first();
+ $source = $journal->transactions()->where('amount', '<', 0)->first();
/** @var Transaction $dest */
$dest = $journal->transactions()->where('amount', '>', 0)->first();
$category = $journal->categories()->first() ? $journal->categories()->first()->name : '';
$budget = $journal->budgets()->first() ? $journal->budgets()->first()->id : 0;
+ $bill = $journal->bill ? $journal->bill->id : 0;
$hasOldInput = null !== $request->old('_token'); // flash some data
$preFilled = [];
if (true === $hasOldInput) {
@@ -178,6 +183,7 @@ class CreateController extends Controller
'transaction_type' => $request->old('transaction_type'),
'category' => $request->old('category'),
'budget_id' => $request->old('budget_id'),
+ 'bill_id' => $request->old('bill_id'),
'active' => (bool)$request->old('active'),
'apply_rules' => (bool)$request->old('apply_rules'),
];
@@ -198,6 +204,7 @@ class CreateController extends Controller
'transaction_type' => $type,
'category' => $category,
'budget_id' => $budget,
+ 'bill_id' => $bill,
'active' => true,
'apply_rules' => true,
];
@@ -243,7 +250,7 @@ class CreateController extends Controller
}
if (count($this->attachments->getMessages()->get('attachments')) > 0) {
- $request->session()->flash('info', $this->attachments->getMessages()->get('attachments'));
+ $request->session()->flash('info', $this->attachments->getMessages()->get('attachments'));
}
$redirect = redirect($this->getPreviousUri('recurring.create.uri'));
diff --git a/app/Http/Controllers/Recurring/EditController.php b/app/Http/Controllers/Recurring/EditController.php
index 910b0046c7..432d4b5eb2 100644
--- a/app/Http/Controllers/Recurring/EditController.php
+++ b/app/Http/Controllers/Recurring/EditController.php
@@ -29,6 +29,7 @@ use FireflyIII\Http\Controllers\Controller;
use FireflyIII\Http\Requests\RecurrenceFormRequest;
use FireflyIII\Models\Recurrence;
use FireflyIII\Models\RecurrenceRepetition;
+use FireflyIII\Repositories\Bill\BillRepositoryInterface;
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
use FireflyIII\Repositories\Recurring\RecurringRepositoryInterface;
use FireflyIII\Transformers\RecurrenceTransformer;
@@ -48,6 +49,7 @@ class EditController extends Controller
private AttachmentHelperInterface $attachments;
private BudgetRepositoryInterface $budgetRepos;
private RecurringRepositoryInterface $recurring;
+ private BillRepositoryInterface $billRepository;
/**
* EditController constructor.
@@ -65,9 +67,10 @@ class EditController extends Controller
app('view')->share('title', (string)trans('firefly.recurrences'));
app('view')->share('subTitle', (string)trans('firefly.recurrences'));
- $this->recurring = app(RecurringRepositoryInterface::class);
- $this->budgetRepos = app(BudgetRepositoryInterface::class);
- $this->attachments = app(AttachmentHelperInterface::class);
+ $this->recurring = app(RecurringRepositoryInterface::class);
+ $this->budgetRepos = app(BudgetRepositoryInterface::class);
+ $this->attachments = app(AttachmentHelperInterface::class);
+ $this->billRepository = app(BillRepositoryInterface::class);
return $next($request);
}
@@ -86,7 +89,7 @@ class EditController extends Controller
*/
public function edit(Request $request, Recurrence $recurrence)
{
-// See reference nr. 69
+ // See reference nr. 69
$count = $recurrence->recurrenceTransactions()->count();
if (0 === $count) {
throw new FireflyException('This recurring transaction has no meta-data. You will have to delete it and recreate it. Sorry!');
@@ -98,6 +101,7 @@ class EditController extends Controller
$array = $transformer->transform($recurrence);
$budgets = app('expandedform')->makeSelectListWithEmpty($this->budgetRepos->getActiveBudgets());
+ $bills = app('expandedform')->makeSelectListWithEmpty($this->billRepository->getActiveBills());
/** @var RecurrenceRepetition $repetition */
$repetition = $recurrence->recurrenceRepetitions()->first();
@@ -146,7 +150,10 @@ class EditController extends Controller
return prefixView(
'recurring.edit',
- compact('recurrence', 'array', 'weekendResponses', 'budgets', 'preFilled', 'currentRepType', 'repetitionEnd', 'repetitionEnds')
+ compact(
+ 'recurrence', 'array', 'bills',
+ 'weekendResponses', 'budgets', 'preFilled', 'currentRepType', 'repetitionEnd', 'repetitionEnds'
+ )
);
}
diff --git a/app/Http/Requests/RecurrenceFormRequest.php b/app/Http/Requests/RecurrenceFormRequest.php
index 1fd8aad43c..e43c1b3c44 100644
--- a/app/Http/Requests/RecurrenceFormRequest.php
+++ b/app/Http/Requests/RecurrenceFormRequest.php
@@ -78,6 +78,8 @@ class RecurrenceFormRequest extends FormRequest
'foreign_currency_code' => null,
'budget_id' => $this->integer('budget_id'),
'budget_name' => null,
+ 'bill_id' => $this->integer('bill_id'),
+ 'bill_name' => null,
'category_id' => null,
'category_name' => $this->string('category'),
'tags' => '' !== $this->string('tags') ? explode(',', $this->string('tags')) : [],
@@ -109,7 +111,7 @@ class RecurrenceFormRequest extends FormRequest
// fill in source and destination account data
switch ($this->string('transaction_type')) {
default:
- throw new FireflyException(sprintf('Cannot handle transaction type "%s"', $this->string('transaction_type')));
+ throw new FireflyException(sprintf('Cannot handle transaction type "%s"', $this->string('transaction_type')));
case 'withdrawal':
$return['transactions'][0]['source_id'] = $this->integer('source_id');
$return['transactions'][0]['destination_id'] = $this->integer('withdrawal_destination_id');
@@ -162,11 +164,11 @@ class RecurrenceFormRequest extends FormRequest
$return['type'] = substr($value, 0, 6);
$return['moment'] = substr($value, 7);
}
- if (0 === strpos($value, 'monthly')) {
+ if (str_starts_with($value, 'monthly')) {
$return['type'] = substr($value, 0, 7);
$return['moment'] = substr($value, 8);
}
- if (0 === strpos($value, 'ndom')) {
+ if (str_starts_with($value, 'ndom')) {
$return['type'] = substr($value, 0, 4);
$return['moment'] = substr($value, 5);
}
@@ -213,6 +215,7 @@ class RecurrenceFormRequest extends FormRequest
// optional fields:
'budget_id' => 'mustExist:budgets,id|belongsToUser:budgets,id|nullable',
+ 'bill_id' => 'mustExist:bills,id|belongsToUser:bills,id|nullable',
'category' => 'between:1,255|nullable',
'tags' => 'between:1,255|nullable',
];
@@ -251,7 +254,7 @@ class RecurrenceFormRequest extends FormRequest
break;
default:
- throw new FireflyException(sprintf('Cannot handle transaction type of type "%s"', $this->string('transaction_type')));
+ throw new FireflyException(sprintf('Cannot handle transaction type of type "%s"', $this->string('transaction_type')));
}
// update some rules in case the user is editing a post:
@@ -304,11 +307,11 @@ class RecurrenceFormRequest extends FormRequest
$sourceId = null;
$destinationId = null;
-// See reference nr. 45
+ // See reference nr. 45
switch ($this->string('transaction_type')) {
default:
- throw new FireflyException(sprintf('Cannot handle transaction type "%s"', $this->string('transaction_type')));
+ throw new FireflyException(sprintf('Cannot handle transaction type "%s"', $this->string('transaction_type')));
case 'withdrawal':
$sourceId = (int)$data['source_id'];
$destinationId = (int)$data['withdrawal_destination_id'];
diff --git a/app/Models/Bill.php b/app/Models/Bill.php
index e1e924cd83..7f05a8f9ef 100644
--- a/app/Models/Bill.php
+++ b/app/Models/Bill.php
@@ -110,6 +110,8 @@ class Bill extends Model
'updated_at' => 'datetime',
'deleted_at' => 'datetime',
'date' => 'date',
+ 'end_date' => 'date',
+ 'extension_date' => 'date',
'skip' => 'int',
'automatch' => 'boolean',
'active' => 'boolean',
diff --git a/app/Repositories/Tag/TagRepository.php b/app/Repositories/Tag/TagRepository.php
index be1ae9e6fc..bd05564f1b 100644
--- a/app/Repositories/Tag/TagRepository.php
+++ b/app/Repositories/Tag/TagRepository.php
@@ -61,6 +61,7 @@ class TagRepository implements TagRepositoryInterface
*/
public function destroy(Tag $tag): bool
{
+ DB::table('tag_transaction_journal')->where('tag_id', $tag->id)->delete();
$tag->transactionJournals()->sync([]);
$tag->delete();
diff --git a/app/Services/Internal/Support/RecurringTransactionTrait.php b/app/Services/Internal/Support/RecurringTransactionTrait.php
index 57c4fa56ab..433111735f 100644
--- a/app/Services/Internal/Support/RecurringTransactionTrait.php
+++ b/app/Services/Internal/Support/RecurringTransactionTrait.php
@@ -26,6 +26,7 @@ namespace FireflyIII\Services\Internal\Support;
use Exception;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Factory\AccountFactory;
+use FireflyIII\Factory\BillFactory;
use FireflyIII\Factory\BudgetFactory;
use FireflyIII\Factory\CategoryFactory;
use FireflyIII\Factory\PiggyBankFactory;
@@ -136,16 +137,16 @@ trait RecurringTransactionTrait
$validator->setUser($recurrence->user);
$validator->setTransactionType($recurrence->transactionType->type);
if (!$validator->validateSource($source->id, null, null)) {
- throw new FireflyException(sprintf('Source invalid: %s', $validator->sourceError));
+ throw new FireflyException(sprintf('Source invalid: %s', $validator->sourceError));
}
if (!$validator->validateDestination($destination->id, null, null)) {
- throw new FireflyException(sprintf('Destination invalid: %s', $validator->destError));
+ throw new FireflyException(sprintf('Destination invalid: %s', $validator->destError));
}
if (array_key_exists('foreign_amount', $array) && '' === (string)$array['foreign_amount']) {
unset($array['foreign_amount']);
}
-// See reference nr. 100
+ // See reference nr. 100
$transaction = new RecurrenceTransaction(
[
'recurrence_id' => $recurrence->id,
@@ -163,6 +164,9 @@ trait RecurringTransactionTrait
if (array_key_exists('budget_id', $array)) {
$this->setBudget($transaction, (int)$array['budget_id']);
}
+ if (array_key_exists('bill_id', $array)) {
+ $this->setBill($transaction, (int)$array['bill_id']);
+ }
if (array_key_exists('category_id', $array)) {
$this->setCategory($transaction, (int)$array['category_id']);
}
@@ -254,6 +258,29 @@ trait RecurringTransactionTrait
$meta->save();
}
+ /**
+ * @param RecurrenceTransaction $transaction
+ * @param int $billId
+ */
+ private function setBill(RecurrenceTransaction $transaction, int $billId): void
+ {
+ $billFactory = app(BillFactory::class);
+ $billFactory->setUser($transaction->recurrence->user);
+ $bill = $billFactory->find($billId, null);
+ if (null === $bill) {
+ return;
+ }
+
+ $meta = $transaction->recurrenceTransactionMeta()->where('name', 'bill_id')->first();
+ if (null === $meta) {
+ $meta = new RecurrenceTransactionMeta;
+ $meta->rt_id = $transaction->id;
+ $meta->name = 'bill_id';
+ }
+ $meta->value = $bill->id;
+ $meta->save();
+ }
+
/**
* @param RecurrenceTransaction $transaction
* @param int $categoryId
@@ -269,6 +296,7 @@ trait RecurringTransactionTrait
// remove category:
$transaction->recurrenceTransactionMeta()->where('name', 'category_id')->delete();
$transaction->recurrenceTransactionMeta()->where('name', 'category_name')->delete();
+
return;
}
diff --git a/app/Services/Internal/Update/RecurrenceUpdateService.php b/app/Services/Internal/Update/RecurrenceUpdateService.php
index 051f8bd4cd..c1d597d77b 100644
--- a/app/Services/Internal/Update/RecurrenceUpdateService.php
+++ b/app/Services/Internal/Update/RecurrenceUpdateService.php
@@ -289,6 +289,9 @@ class RecurrenceUpdateService
if (array_key_exists('budget_id', $current)) {
$this->setBudget($match, (int)$current['budget_id']);
}
+ if (array_key_exists('bill_id', $current)) {
+ $this->setBill($match, (int)$current['bill_id']);
+ }
// reset category if name is set but empty:
// can be removed when v1 is retired.
if (array_key_exists('category_name', $current) && '' === (string)$current['category_name']) {
diff --git a/app/Transformers/BillTransformer.php b/app/Transformers/BillTransformer.php
index f1804ddf62..995dd48de9 100644
--- a/app/Transformers/BillTransformer.php
+++ b/app/Transformers/BillTransformer.php
@@ -78,43 +78,62 @@ class BillTransformer extends AbstractTransformer
$paidDataFormatted = [];
$payDatesFormatted = [];
- foreach($paidData['paid_dates'] as $object) {
- $object['date'] = Carbon::createFromFormat('!Y-m-d', $object['date'], config('app.timezone'))->toAtomString();
- $paidDataFormatted[] = $object;
+ foreach ($paidData['paid_dates'] as $object) {
+ $object['date'] = Carbon::createFromFormat('!Y-m-d', $object['date'], config('app.timezone'))->toAtomString();
+ $paidDataFormatted[] = $object;
}
foreach ($payDates as $string) {
$payDatesFormatted[] = Carbon::createFromFormat('!Y-m-d', $string, config('app.timezone'))->toAtomString();
}
$nextExpectedMatch = null;
- if(null !== $paidData['next_expected_match'] ) {
+ if (null !== $paidData['next_expected_match']) {
$nextExpectedMatch = Carbon::createFromFormat('!Y-m-d', $paidData['next_expected_match'], config('app.timezone'))->toAtomString();
}
+ $nextExpectedMatchDiff = trans('firefly.not_expected_period');
+ // converting back and forth is bad code but OK.
+ $temp = new Carbon($nextExpectedMatch);
+ if ($temp->isToday()) {
+ $nextExpectedMatchDiff = trans('firefly.today');
+ }
+
+ $current = $payDatesFormatted[0] ?? null;
+ if (null !== $current && !$temp->isToday()) {
+ $temp2 = Carbon::createFromFormat('Y-m-d\TH:i:sP', $current);
+ $nextExpectedMatchDiff = $temp2->diffForHumans(today(), Carbon::DIFF_RELATIVE_TO_NOW);
+ }
+ unset($temp, $temp2);
+
return [
- 'id' => (int)$bill->id,
- 'created_at' => $bill->created_at->toAtomString(),
- 'updated_at' => $bill->updated_at->toAtomString(),
- 'currency_id' => (string)$bill->transaction_currency_id,
- 'currency_code' => $currency->code,
- 'currency_symbol' => $currency->symbol,
- 'currency_decimal_places' => (int)$currency->decimal_places,
- 'name' => $bill->name,
- 'amount_min' => number_format((float)$bill->amount_min, $currency->decimal_places, '.', ''),
- 'amount_max' => number_format((float)$bill->amount_max, $currency->decimal_places, '.', ''),
- 'date' => $bill->date->toAtomString(),
- 'repeat_freq' => $bill->repeat_freq,
- 'skip' => (int)$bill->skip,
- 'active' => $bill->active,
- 'order' => (int)$bill->order,
- 'notes' => $notes,
- 'next_expected_match' => $nextExpectedMatch,
- 'pay_dates' => $payDatesFormatted,
- 'paid_dates' => $paidDataFormatted,
- 'object_group_id' => $objectGroupId ? (string)$objectGroupId : null,
- 'object_group_order' => $objectGroupOrder,
- 'object_group_title' => $objectGroupTitle,
- 'links' => [
+ 'id' => (int)$bill->id,
+ 'created_at' => $bill->created_at->toAtomString(),
+ 'updated_at' => $bill->updated_at->toAtomString(),
+ 'currency_id' => (string)$bill->transaction_currency_id,
+ 'currency_code' => $currency->code,
+ 'currency_symbol' => $currency->symbol,
+ 'currency_decimal_places' => (int)$currency->decimal_places,
+ 'name' => $bill->name,
+ 'amount_min' => number_format((float)$bill->amount_min, $currency->decimal_places, '.', ''),
+ 'amount_max' => number_format((float)$bill->amount_max, $currency->decimal_places, '.', ''),
+ 'date' => $bill->date->toAtomString(),
+ 'end_date' => $bill->end_date?->toAtomString(),
+ 'extension_date' => $bill->extension_date?->toAtomString(),
+ 'repeat_freq' => $bill->repeat_freq,
+ 'skip' => (int)$bill->skip,
+ 'active' => $bill->active,
+ 'order' => (int)$bill->order,
+ 'notes' => $notes,
+ 'object_group_id' => $objectGroupId ? (string)$objectGroupId : null,
+ 'object_group_order' => $objectGroupOrder,
+ 'object_group_title' => $objectGroupTitle,
+
+ // these fields need work:
+ 'next_expected_match' => $nextExpectedMatch,
+ 'next_expected_match_diff' => $nextExpectedMatchDiff,
+ 'pay_dates' => $payDatesFormatted,
+ 'paid_dates' => $paidDataFormatted,
+ 'links' => [
[
'rel' => 'self',
'uri' => '/bills/' . $bill->id,
@@ -208,7 +227,7 @@ class BillTransformer extends AbstractTransformer
protected function lastPaidDate(Collection $dates, Carbon $default): Carbon
{
if (0 === $dates->count()) {
- return $default;
+ return $default;
}
$latest = $dates->first()->date;
/** @var TransactionJournal $journal */
@@ -254,6 +273,7 @@ class BillTransformer extends AbstractTransformer
return $date->format('Y-m-d');
}
);
+
return $simple->toArray();
}
diff --git a/app/Transformers/RecurrenceTransformer.php b/app/Transformers/RecurrenceTransformer.php
index 949d39fa67..19a14d4a98 100644
--- a/app/Transformers/RecurrenceTransformer.php
+++ b/app/Transformers/RecurrenceTransformer.php
@@ -22,6 +22,7 @@
declare(strict_types=1);
namespace FireflyIII\Transformers;
+
use Carbon\Carbon;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Factory\CategoryFactory;
@@ -29,6 +30,7 @@ use FireflyIII\Models\Recurrence;
use FireflyIII\Models\RecurrenceRepetition;
use FireflyIII\Models\RecurrenceTransaction;
use FireflyIII\Models\RecurrenceTransactionMeta;
+use FireflyIII\Repositories\Bill\BillRepositoryInterface;
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
use FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface;
use FireflyIII\Repositories\Recurring\RecurringRepositoryInterface;
@@ -44,6 +46,7 @@ class RecurrenceTransformer extends AbstractTransformer
private CategoryFactory $factory;
private PiggyBankRepositoryInterface $piggyRepos;
private RecurringRepositoryInterface $repository;
+ private BillRepositoryInterface $billRepos;
/**
* RecurrenceTransformer constructor.
@@ -56,6 +59,7 @@ class RecurrenceTransformer extends AbstractTransformer
$this->piggyRepos = app(PiggyBankRepositoryInterface::class);
$this->factory = app(CategoryFactory::class);
$this->budgetRepos = app(BudgetRepositoryInterface::class);
+ $this->billRepos = app(BillRepositoryInterface::class);
}
@@ -251,6 +255,8 @@ class RecurrenceTransformer extends AbstractTransformer
$array['budget_name'] = null;
$array['piggy_bank_id'] = null;
$array['piggy_bank_name'] = null;
+ $array['bill_id'] = null;
+ $array['bill_name'] = null;
/** @var RecurrenceTransactionMeta $transactionMeta */
foreach ($transaction->recurrenceTransactionMeta as $transactionMeta) {
@@ -258,6 +264,11 @@ class RecurrenceTransformer extends AbstractTransformer
default:
throw new FireflyException(sprintf('Recurrence transformer cant handle field "%s"', $transactionMeta->name));
case 'bill_id':
+ $bill = $this->billRepos->find((int)$transactionMeta->value);
+ if (null !== $bill) {
+ $array['bill_id'] = (string)$bill->id;
+ $array['bill_name'] = $bill->name;
+ }
break;
case 'tags':
$array['tags'] = json_decode($transactionMeta->value);
diff --git a/database/migrations/2021_05_09_064644_add_ldap_columns_to_users_table.php b/database/migrations/2021_05_09_064644_add_ldap_columns_to_users_table.php
index 7ae7fda50e..17d54fa8bd 100644
--- a/database/migrations/2021_05_09_064644_add_ldap_columns_to_users_table.php
+++ b/database/migrations/2021_05_09_064644_add_ldap_columns_to_users_table.php
@@ -1,29 +1,54 @@
<?php
+
+/*
+ * 2021_05_09_064644_add_ldap_columns_to_users_table.php
+ * Copyright (c) 2021 [email protected]
+ *
+ * This file is part of Firefly III (https://github.com/firefly-iii).
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
declare(strict_types=1);
-use Illuminate\Support\Facades\Schema;
-use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
class AddLdapColumnsToUsersTable extends Migration
{
/**
- * Run the migrations.
+ * Reverse the migrations.
*/
- public function up()
+ public function down()
{
- Schema::table('users', function (Blueprint $table) {
- $table->string('domain')->nullable();
- });
+ Schema::table(
+ 'users', function (Blueprint $table) {
+ $table->dropColumn(['domain']);
+ }
+ );
}
/**
- * Reverse the migrations.
+ * Run the migrations.
*/
- public function down()
+ public function up()
{
- Schema::table('users', function (Blueprint $table) {
- $table->dropColumn(['domain']);
- });
+ Schema::table(
+ 'users', function (Blueprint $table) {
+ $table->string('domain')->nullable();
+ }
+ );
}
}
diff --git a/database/migrations/2021_05_13_053836_extend_currency_info.php b/database/migrations/2021_05_13_053836_extend_currency_info.php
index f5fdacddc2..1eeea51fa5 100644
--- a/database/migrations/2021_05_13_053836_extend_currency_info.php
+++ b/database/migrations/2021_05_13_053836_extend_currency_info.php
@@ -1,4 +1,25 @@
<?php
+
+/*
+ * 2021_05_13_053836_extend_currency_info.php
+ * Copyright (c) 2021 [email protected]
+ *
+ * This file is part of Firefly III (https://github.com/firefly-iii).
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
declare(strict_types=1);
use Illuminate\Database\Migrations\Migration;
diff --git a/database/migrations/2021_07_05_193044_drop_tele_table.php b/database/migrations/2021_07_05_193044_drop_tele_table.php
index 7d6b5f82de..2d5f7e8823 100644
--- a/database/migrations/2021_07_05_193044_drop_tele_table.php
+++ b/database/migrations/2021_07_05_193044_drop_tele_table.php
@@ -1,4 +1,25 @@
<?php
+
+/*
+ * 2021_07_05_193044_drop_tele_table.php
+ * Copyright (c) 2021 [email protected]
+ *
+ * This file is part of Firefly III (https://github.com/firefly-iii).
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
declare(strict_types=1);
use Illuminate\Database\Migrations\Migration;
@@ -10,21 +31,21 @@ use Illuminate\Support\Facades\Schema;
class DropTeleTable extends Migration
{
/**
- * Run the migrations.
+ * Reverse the migrations.
*
* @return void
*/
- public function up()
+ public function down()
{
Schema::dropIfExists('telemetry');
}
/**
- * Reverse the migrations.
+ * Run the migrations.
*
* @return void
*/
- public function down()
+ public function up()
{
Schema::dropIfExists('telemetry');
}