diff --git a/app/Handlers/Events/UpdatedJournalEventHandler.php b/app/Handlers/Events/UpdatedJournalEventHandler.php index b6b7a8c8fd..60871ebf08 100644 --- a/app/Handlers/Events/UpdatedJournalEventHandler.php +++ b/app/Handlers/Events/UpdatedJournalEventHandler.php @@ -15,11 +15,8 @@ namespace FireflyIII\Handlers\Events; use FireflyIII\Events\UpdatedTransactionJournal; -use FireflyIII\Models\PiggyBankEvent; -use FireflyIII\Models\PiggyBankRepetition; use FireflyIII\Models\Rule; use FireflyIII\Models\RuleGroup; -use FireflyIII\Models\TransactionJournal; use FireflyIII\Rules\Processor; use FireflyIII\Support\Events\BillScanner; diff --git a/app/Helpers/Help/HelpInterface.php b/app/Helpers/Help/HelpInterface.php index 7356ba0ba2..4187ddf1ce 100644 --- a/app/Helpers/Help/HelpInterface.php +++ b/app/Helpers/Help/HelpInterface.php @@ -49,7 +49,7 @@ interface HelpInterface * * @return bool */ - public function inCache(string $route, string $language ): bool; + public function inCache(string $route, string $language): bool; /** * @param string $route diff --git a/app/Helpers/Report/ReportHelper.php b/app/Helpers/Report/ReportHelper.php index 27c76bb3c5..5110e3d6c5 100644 --- a/app/Helpers/Report/ReportHelper.php +++ b/app/Helpers/Report/ReportHelper.php @@ -25,7 +25,6 @@ use FireflyIII\Models\Bill; use FireflyIII\Models\Category; use FireflyIII\Models\Tag; use FireflyIII\Models\Transaction; -use FireflyIII\Models\TransactionJournal; use FireflyIII\Repositories\Account\AccountTaskerInterface; use FireflyIII\Repositories\Bill\BillRepositoryInterface; use FireflyIII\Repositories\Budget\BudgetRepositoryInterface; diff --git a/app/Http/Controllers/AccountController.php b/app/Http/Controllers/AccountController.php index 5258baa91b..57f532f28f 100644 --- a/app/Http/Controllers/AccountController.php +++ b/app/Http/Controllers/AccountController.php @@ -24,7 +24,6 @@ use FireflyIII\Models\Transaction; use FireflyIII\Repositories\Account\AccountRepositoryInterface as ARI; use FireflyIII\Repositories\Account\AccountTaskerInterface; use FireflyIII\Support\CacheProperties; -use Illuminate\Pagination\LengthAwarePaginator; use Illuminate\Support\Collection; use Input; use Navigation; diff --git a/app/Http/Controllers/BillController.php b/app/Http/Controllers/BillController.php index e0efc0f812..4cccbdeba3 100644 --- a/app/Http/Controllers/BillController.php +++ b/app/Http/Controllers/BillController.php @@ -206,9 +206,9 @@ class BillController extends Controller $overallAverage = $repository->getOverallAverage($bill); // use collector: - $collector = new JournalCollector(auth()->user()); + $collector = new JournalCollector(auth()->user()); $collector->setAllAssetAccounts()->setBills(new Collection([$bill]))->setPage($page)->setLimit($pageSize); - $journals = $collector->getPaginatedJournals(); + $journals = $collector->getPaginatedJournals(); $journals->setPath('/bills/show/' . $bill->id); $bill->nextExpectedMatch = $repository->nextExpectedMatch($bill, new Carbon); diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.php index 727ef34f7a..6109a79967 100755 --- a/app/Http/Controllers/Controller.php +++ b/app/Http/Controllers/Controller.php @@ -13,7 +13,6 @@ declare(strict_types = 1); namespace FireflyIII\Http\Controllers; -use Carbon\Carbon; use Illuminate\Foundation\Auth\Access\AuthorizesRequests; use Illuminate\Foundation\Bus\DispatchesJobs; use Illuminate\Foundation\Validation\ValidatesRequests; diff --git a/app/Http/Controllers/HelpController.php b/app/Http/Controllers/HelpController.php index 2d4299818e..24d2d75254 100644 --- a/app/Http/Controllers/HelpController.php +++ b/app/Http/Controllers/HelpController.php @@ -42,8 +42,8 @@ class HelpController extends Controller public function show(HelpInterface $help, string $route) { - $language = Preferences::get('language', config('firefly.default_language', 'en_US'))->data; - $content = '

' . strval(trans('firefly.route_has_no_help')) . '

'; + $language = Preferences::get('language', config('firefly.default_language', 'en_US'))->data; + $content = '

' . strval(trans('firefly.route_has_no_help')) . '

'; if (!$help->hasRoute($route)) { Log::error('No such route: ' . $route); diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index 8137923969..40872742b5 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -19,7 +19,6 @@ use FireflyIII\Helpers\Collector\JournalCollector; use FireflyIII\Models\AccountType; use FireflyIII\Models\Tag; use FireflyIII\Repositories\Account\AccountRepositoryInterface as ARI; -use FireflyIII\Repositories\Account\AccountTaskerInterface; use FireflyIII\Repositories\Tag\TagRepositoryInterface; use Illuminate\Http\Request; use Illuminate\Support\Collection; @@ -116,7 +115,7 @@ class HomeController extends Controller } /** - * @param ARI $repository + * @param ARI $repository * * @return \Illuminate\Contracts\View\Factory|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|\Illuminate\View\View */ diff --git a/app/Http/Controllers/JsonController.php b/app/Http/Controllers/JsonController.php index 197fd7a326..33beceec79 100644 --- a/app/Http/Controllers/JsonController.php +++ b/app/Http/Controllers/JsonController.php @@ -21,7 +21,6 @@ use FireflyIII\Repositories\Account\AccountRepositoryInterface; use FireflyIII\Repositories\Account\AccountTaskerInterface; use FireflyIII\Repositories\Bill\BillRepositoryInterface; use FireflyIII\Repositories\Category\CategoryRepositoryInterface as CRI; -use FireflyIII\Repositories\Journal\JournalTaskerInterface; use FireflyIII\Repositories\Tag\TagRepositoryInterface; use FireflyIII\Support\CacheProperties; use Input; @@ -282,7 +281,7 @@ class JsonController extends Controller $types = [$type]; // use journal collector instead: - $collector = new JournalCollector(auth()->user()); + $collector = new JournalCollector(auth()->user()); $collector->setTypes($types)->setLimit(100)->setPage(1); $journals = $collector->getJournals(); foreach ($journals as $j) { diff --git a/app/Http/Controllers/Popup/ReportController.php b/app/Http/Controllers/Popup/ReportController.php index 7f0c7d01fa..b31e514853 100644 --- a/app/Http/Controllers/Popup/ReportController.php +++ b/app/Http/Controllers/Popup/ReportController.php @@ -23,7 +23,6 @@ use FireflyIII\Models\Transaction; use FireflyIII\Models\TransactionJournal; use FireflyIII\Models\TransactionType; use FireflyIII\Repositories\Account\AccountRepositoryInterface; -use FireflyIII\Repositories\Account\AccountTaskerInterface; use FireflyIII\Repositories\Budget\BudgetRepositoryInterface; use FireflyIII\Repositories\Category\CategoryRepositoryInterface; use FireflyIII\Support\Binder\AccountList; @@ -237,10 +236,10 @@ class ReportController extends Controller $repository = app(AccountRepositoryInterface::class); $account = $repository->find(intval($attributes['accountId'])); $types = [TransactionType::DEPOSIT, TransactionType::TRANSFER]; - $collector = new JournalCollector(auth()->user()); + $collector = new JournalCollector(auth()->user()); $collector->setAccounts(new Collection([$account]))->setRange($attributes['startDate'], $attributes['endDate'])->setTypes($types); $journals = $collector->getJournals(); - $report = $attributes['accounts']->pluck('id')->toArray(); // accounts used in this report + $report = $attributes['accounts']->pluck('id')->toArray(); // accounts used in this report // filter the set so the destinations outside of $attributes['accounts'] are not included. $journals = $journals->filter( diff --git a/app/Http/Controllers/ReportController.php b/app/Http/Controllers/ReportController.php index 2f024c88bd..a92648b398 100644 --- a/app/Http/Controllers/ReportController.php +++ b/app/Http/Controllers/ReportController.php @@ -21,7 +21,6 @@ use FireflyIII\Models\Account; use FireflyIII\Models\AccountType; use FireflyIII\Models\Transaction; use FireflyIII\Repositories\Account\AccountRepositoryInterface; -use FireflyIII\Repositories\Account\AccountTaskerInterface; use Illuminate\Support\Collection; use Preferences; use Session; diff --git a/app/Http/Controllers/TransactionController.php b/app/Http/Controllers/TransactionController.php index 8f443f5950..517ceedd7b 100644 --- a/app/Http/Controllers/TransactionController.php +++ b/app/Http/Controllers/TransactionController.php @@ -15,9 +15,7 @@ namespace FireflyIII\Http\Controllers; use Carbon\Carbon; use FireflyIII\Helpers\Collector\JournalCollector; -use FireflyIII\Models\AccountType; use FireflyIII\Models\TransactionJournal; -use FireflyIII\Repositories\Account\AccountRepositoryInterface; use FireflyIII\Repositories\Journal\JournalRepositoryInterface; use FireflyIII\Repositories\Journal\JournalTaskerInterface; use Illuminate\Http\Request; @@ -52,19 +50,19 @@ class TransactionController extends Controller } /** - * @param Request $request - * @param string $what + * @param Request $request + * @param string $what * * @return View */ public function index(Request $request, string $what) { - $pageSize = intval(Preferences::get('transactionPageSize', 50)->data); - $subTitleIcon = config('firefly.transactionIconsByWhat.' . $what); - $types = config('firefly.transactionTypesByWhat.' . $what); - $subTitle = trans('firefly.title_' . $what); - $page = intval($request->get('page')); - $collector = new JournalCollector(auth()->user()); + $pageSize = intval(Preferences::get('transactionPageSize', 50)->data); + $subTitleIcon = config('firefly.transactionIconsByWhat.' . $what); + $types = config('firefly.transactionTypesByWhat.' . $what); + $subTitle = trans('firefly.title_' . $what); + $page = intval($request->get('page')); + $collector = new JournalCollector(auth()->user()); $collector->setTypes($types)->setLimit($pageSize)->setPage($page)->setAllAssetAccounts(); $journals = $collector->getPaginatedJournals(); diff --git a/app/Models/Note.php b/app/Models/Note.php index c811fcc7cd..17444ba3e7 100644 --- a/app/Models/Note.php +++ b/app/Models/Note.php @@ -52,7 +52,8 @@ class Note extends Model */ public function getMarkdownAttribute(): string { - $converter = new CommonMarkConverter; + $converter = new CommonMarkConverter; + return $converter->convertToHtml($this->text); } diff --git a/app/Models/PiggyBank.php b/app/Models/PiggyBank.php index 3d5e5da150..9a57917b26 100644 --- a/app/Models/PiggyBank.php +++ b/app/Models/PiggyBank.php @@ -23,22 +23,22 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; /** * FireflyIII\Models\PiggyBank * - * @property integer $id - * @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 + * @property integer $id + * @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) @@ -54,7 +54,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; * @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 + * @property boolean $active * @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBank whereActive($value) * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Note[] $notes */ diff --git a/app/Repositories/Account/AccountTasker.php b/app/Repositories/Account/AccountTasker.php index 8bba27f601..1711fed6bb 100644 --- a/app/Repositories/Account/AccountTasker.php +++ b/app/Repositories/Account/AccountTasker.php @@ -257,7 +257,6 @@ class AccountTasker implements AccountTaskerInterface $join->on('transaction_journals.id', '=', 'other_side.transaction_journal_id')->where('other_side.amount', $joinModifier, 0); } ) - ->where('transaction_journals.date', '>=', $start->format('Y-m-d')) ->where('transaction_journals.date', '<=', $end->format('Y-m-d')) ->where('transaction_journals.user_id', $this->user->id) @@ -313,7 +312,7 @@ class AccountTasker implements AccountTaskerInterface } ) ->leftJoin('accounts as other_account', 'other_account.id', '=', 'other_side.account_id') - ->where('transaction_types.type','!=', TransactionType::OPENING_BALANCE) + ->where('transaction_types.type', '!=', TransactionType::OPENING_BALANCE) ->where('transaction_journals.date', '>=', $start->format('Y-m-d')) ->where('transaction_journals.date', '<=', $end->format('Y-m-d')) ->where('transaction_journals.user_id', $this->user->id) diff --git a/app/Repositories/Bill/BillRepository.php b/app/Repositories/Bill/BillRepository.php index 4a35819c56..e41196b81d 100644 --- a/app/Repositories/Bill/BillRepository.php +++ b/app/Repositories/Bill/BillRepository.php @@ -22,7 +22,6 @@ use FireflyIII\Models\TransactionType; use FireflyIII\Support\CacheProperties; use FireflyIII\User; use Illuminate\Database\Query\JoinClause; -use Illuminate\Pagination\LengthAwarePaginator; use Illuminate\Support\Collection; use Log; use Navigation; diff --git a/app/Repositories/Bill/BillRepositoryInterface.php b/app/Repositories/Bill/BillRepositoryInterface.php index 16368e53d1..cf71d133bc 100644 --- a/app/Repositories/Bill/BillRepositoryInterface.php +++ b/app/Repositories/Bill/BillRepositoryInterface.php @@ -16,7 +16,6 @@ namespace FireflyIII\Repositories\Bill; use Carbon\Carbon; use FireflyIII\Models\Bill; use FireflyIII\Models\TransactionJournal; -use Illuminate\Pagination\LengthAwarePaginator; use Illuminate\Support\Collection; /** diff --git a/app/Repositories/Budget/BudgetRepository.php b/app/Repositories/Budget/BudgetRepository.php index 5210d63ec8..b814a8eaf8 100644 --- a/app/Repositories/Budget/BudgetRepository.php +++ b/app/Repositories/Budget/BudgetRepository.php @@ -350,8 +350,8 @@ class BudgetRepository implements BudgetRepositoryInterface public function spentInPeriod(Collection $budgets, Collection $accounts, Carbon $start, Carbon $end) : string { // collect amount of transaction journals, which is easy: - $budgetIds = $budgets->pluck('id')->toArray(); - $accountIds = $accounts->pluck('id')->toArray(); + $budgetIds = $budgets->pluck('id')->toArray(); + $accountIds = $accounts->pluck('id')->toArray(); Log::debug('spentInPeriod: Now in spentInPeriod for these budgets: ', $budgetIds); Log::debug('spentInPeriod: and these accounts: ', $accountIds); diff --git a/app/Repositories/Category/CategoryRepository.php b/app/Repositories/Category/CategoryRepository.php index 9004fd682a..cbb2927814 100644 --- a/app/Repositories/Category/CategoryRepository.php +++ b/app/Repositories/Category/CategoryRepository.php @@ -20,7 +20,6 @@ use FireflyIII\Models\TransactionType; use FireflyIII\User; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Query\JoinClause; -use Illuminate\Pagination\LengthAwarePaginator; use Illuminate\Support\Collection; /** diff --git a/app/Repositories/Category/CategoryRepositoryInterface.php b/app/Repositories/Category/CategoryRepositoryInterface.php index b7e2f68e08..d088eebe5d 100644 --- a/app/Repositories/Category/CategoryRepositoryInterface.php +++ b/app/Repositories/Category/CategoryRepositoryInterface.php @@ -15,7 +15,6 @@ namespace FireflyIII\Repositories\Category; use Carbon\Carbon; use FireflyIII\Models\Category; -use Illuminate\Pagination\LengthAwarePaginator; use Illuminate\Support\Collection; /** diff --git a/app/Repositories/Journal/JournalRepositoryInterface.php b/app/Repositories/Journal/JournalRepositoryInterface.php index d1c2825bb5..06e80fb25b 100644 --- a/app/Repositories/Journal/JournalRepositoryInterface.php +++ b/app/Repositories/Journal/JournalRepositoryInterface.php @@ -26,15 +26,6 @@ use Illuminate\Support\MessageBag; interface JournalRepositoryInterface { - /** - * Deletes a journal. - * - * @param TransactionJournal $journal - * - * @return bool - */ - public function delete(TransactionJournal $journal): bool; - /** * @param TransactionJournal $journal * @param TransactionType $type @@ -44,6 +35,15 @@ interface JournalRepositoryInterface */ public function convert(TransactionJournal $journal, TransactionType $type, Account $source, Account $destination): MessageBag; + /** + * Deletes a journal. + * + * @param TransactionJournal $journal + * + * @return bool + */ + public function delete(TransactionJournal $journal): bool; + /** * Find a specific journal *