mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Code cleanup and realign.
This commit is contained in:
parent
f7eef25fed
commit
5908c0ce8c
@ -34,7 +34,6 @@ use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Pagination\LengthAwarePaginator;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
use League\Fractal\Manager;
|
||||
use League\Fractal\Pagination\IlluminatePaginatorAdapter;
|
||||
use League\Fractal\Resource\Collection as FractalCollection;
|
||||
|
@ -54,6 +54,7 @@ class ConfigurationController extends Controller
|
||||
$admin = auth()->user();
|
||||
|
||||
if (!$this->repository->hasRole($admin, 'owner')) {
|
||||
/** @noinspection ExceptionsAnnotatingAndHandlingInspection */
|
||||
throw new FireflyException('No access to method.'); // @codeCoverageIgnore
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ class Import extends Command
|
||||
Log::debug('Start start-import command');
|
||||
$jobKey = (string)$this->argument('key');
|
||||
/** @var ImportJob $job */
|
||||
$job = ImportJob::where('key', $jobKey)->first();
|
||||
$job = ImportJob::where('key', $jobKey)->first();
|
||||
if (null === $job) {
|
||||
$this->errorLine(sprintf('No job found with key "%s"', $jobKey));
|
||||
|
||||
|
@ -82,6 +82,7 @@ class ScanAttachments extends Command
|
||||
$attachment->save();
|
||||
$this->line(sprintf('Fixed attachment #%d', $attachment->id));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -54,6 +54,7 @@ class UpgradeFireflyInstructions extends Command
|
||||
if ('install' === (string)$this->argument('task')) {
|
||||
$this->installInstructions();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -62,6 +62,7 @@ class UseEncryption extends Command
|
||||
$this->handleObjects('Category', 'name', 'encrypted');
|
||||
$this->handleObjects('PiggyBank', 'name', 'encrypted');
|
||||
$this->handleObjects('TransactionJournal', 'description', 'encrypted');
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -36,10 +36,10 @@ class RequestedNewPassword extends Event
|
||||
|
||||
/** @var string The users IP address */
|
||||
public $ipAddress;
|
||||
/** @var User The user */
|
||||
public $user;
|
||||
/** @var string The token */
|
||||
public $token;
|
||||
/** @var User The user */
|
||||
public $user;
|
||||
|
||||
/**
|
||||
* Create a new event instance. This event is triggered when a users tries to reset his or her password.
|
||||
|
@ -28,7 +28,6 @@ use Crypt;
|
||||
use FireflyIII\Models\Attachment;
|
||||
use FireflyIII\Repositories\Attachment\AttachmentRepositoryInterface;
|
||||
use Illuminate\Contracts\Encryption\DecryptException;
|
||||
use Illuminate\Contracts\Filesystem\FileNotFoundException;
|
||||
use Illuminate\Support\Collection;
|
||||
use Log;
|
||||
use Storage;
|
||||
@ -108,7 +107,7 @@ class AttachmentCollector extends BasicCollector implements CollectorInterface
|
||||
if ($this->uploadDisk->exists($file)) {
|
||||
try {
|
||||
$decrypted = Crypt::decrypt($this->uploadDisk->get($file));
|
||||
} catch (FileNotFoundException|DecryptException $e) {
|
||||
} catch (DecryptException $e) {
|
||||
Log::error('Catchable error: could not decrypt attachment #' . $attachment->id . ' because: ' . $e->getMessage());
|
||||
|
||||
return false;
|
||||
|
@ -54,7 +54,7 @@ class ExpandedProcessor implements ProcessorInterface
|
||||
{
|
||||
/** @var Collection All accounts */
|
||||
public $accounts;
|
||||
/** @var string The export format*/
|
||||
/** @var string The export format */
|
||||
public $exportFormat;
|
||||
/** @var bool Should include attachments */
|
||||
public $includeAttachments;
|
||||
@ -62,7 +62,7 @@ class ExpandedProcessor implements ProcessorInterface
|
||||
public $includeOldUploads;
|
||||
/** @var ExportJob The export job itself */
|
||||
public $job;
|
||||
/** @var array The settings*/
|
||||
/** @var array The settings */
|
||||
public $settings;
|
||||
/** @var Collection The entries to export. */
|
||||
private $exportEntries;
|
||||
@ -222,7 +222,7 @@ class ExpandedProcessor implements ProcessorInterface
|
||||
{
|
||||
$exporterClass = config('firefly.export_formats.' . $this->exportFormat);
|
||||
/** @var ExporterInterface $exporter */
|
||||
$exporter = app($exporterClass);
|
||||
$exporter = app($exporterClass);
|
||||
$exporter->setJob($this->job);
|
||||
$exporter->setEntries($this->exportEntries);
|
||||
$exporter->run();
|
||||
@ -260,7 +260,7 @@ class ExpandedProcessor implements ProcessorInterface
|
||||
/**
|
||||
* Delete files.
|
||||
*/
|
||||
private function deleteFiles():void
|
||||
private function deleteFiles(): void
|
||||
{
|
||||
$disk = Storage::disk('export');
|
||||
foreach ($this->getFiles() as $file) {
|
||||
|
@ -104,7 +104,7 @@ class TransactionJournalFactory
|
||||
// store date meta fields (if present):
|
||||
$fields = ['sepa-cc', 'sepa-ct-op', 'sepa-ct-id', 'sepa-db', 'sepa-country', 'sepa-ep', 'sepa-ci', 'interest_date', 'book_date', 'process_date',
|
||||
'due_date', 'recurrence_id', 'payment_date', 'invoice_date', 'internal_reference', 'bunq_payment_id', 'importHash', 'importHashV2',
|
||||
'external_id','sepa-batch-id'];
|
||||
'external_id', 'sepa-batch-id'];
|
||||
|
||||
foreach ($fields as $field) {
|
||||
$this->storeMeta($journal, $data, $field);
|
||||
|
@ -78,15 +78,16 @@ class MonthReportGenerator extends Support implements ReportGeneratorInterface
|
||||
|
||||
// render!
|
||||
try {
|
||||
$result= view('reports.budget.month', compact('accountIds', 'budgetIds', 'accountSummary', 'budgetSummary', 'averageExpenses', 'topExpenses'))
|
||||
->with('start', $this->start)->with('end', $this->end)
|
||||
->with('budgets', $this->budgets)
|
||||
->with('accounts', $this->accounts)
|
||||
->render();
|
||||
$result = view('reports.budget.month', compact('accountIds', 'budgetIds', 'accountSummary', 'budgetSummary', 'averageExpenses', 'topExpenses'))
|
||||
->with('start', $this->start)->with('end', $this->end)
|
||||
->with('budgets', $this->budgets)
|
||||
->with('accounts', $this->accounts)
|
||||
->render();
|
||||
} catch (Throwable $e) {
|
||||
Log::error(sprintf('Cannot render reports.account.report: %s', $e->getMessage()));
|
||||
$result = 'Could not render report view.';
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
@ -90,8 +90,9 @@ class MonthReportGenerator extends Support implements ReportGeneratorInterface
|
||||
try {
|
||||
$result = view(
|
||||
'reports.tag.month', compact(
|
||||
'accountIds', 'tagTags', 'reportType', 'accountSummary', 'tagSummary', 'averageExpenses', 'averageIncome', 'topIncome', 'topExpenses'
|
||||
)
|
||||
'accountIds', 'tagTags', 'reportType', 'accountSummary', 'tagSummary', 'averageExpenses', 'averageIncome', 'topIncome',
|
||||
'topExpenses'
|
||||
)
|
||||
)->with('start', $this->start)->with('end', $this->end)->with('tags', $this->tags)->with('accounts', $this->accounts)->render();
|
||||
} catch (Throwable $e) {
|
||||
Log::error(sprintf('Cannot render reports.tag.month: %s', $e->getMessage()));
|
||||
|
@ -27,14 +27,12 @@ namespace FireflyIII\Handlers\Events;
|
||||
|
||||
use FireflyConfig;
|
||||
use FireflyIII\Events\RequestedVersionCheckStatus;
|
||||
|
||||
use FireflyIII\Helpers\Update\UpdateTrait;
|
||||
use FireflyIII\Repositories\User\UserRepositoryInterface;
|
||||
|
||||
|
||||
use FireflyIII\User;
|
||||
use Log;
|
||||
|
||||
|
||||
/**
|
||||
* Class VersionCheckEventHandler
|
||||
*/
|
||||
@ -81,7 +79,7 @@ class VersionCheckEventHandler
|
||||
|
||||
$latestRelease = $this->getLatestRelease();
|
||||
$versionCheck = $this->versionCheck($latestRelease);
|
||||
$resultString = $this->parseResult($versionCheck, $latestRelease);
|
||||
$resultString = $this->parseResult($versionCheck, $latestRelease);
|
||||
if (0 !== $versionCheck && '' !== $resultString) {
|
||||
// flash info
|
||||
session()->flash('info', $resultString);
|
||||
|
@ -25,7 +25,6 @@ namespace FireflyIII\Helpers\Attachments;
|
||||
use Crypt;
|
||||
use FireflyIII\Models\Attachment;
|
||||
use Illuminate\Contracts\Encryption\DecryptException;
|
||||
use Illuminate\Contracts\Filesystem\FileNotFoundException;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\MessageBag;
|
||||
@ -80,7 +79,7 @@ class AttachmentHelper implements AttachmentHelperInterface
|
||||
|
||||
try {
|
||||
$content = Crypt::decrypt($this->uploadDisk->get(sprintf('at-%d.data', $attachment->id)));
|
||||
} catch (DecryptException|FileNotFoundException $e) {
|
||||
} catch (DecryptException $e) {
|
||||
Log::error(sprintf('Could not decrypt data of attachment #%d: %s', $attachment->id, $e->getMessage()));
|
||||
$content = '';
|
||||
}
|
||||
|
@ -160,6 +160,7 @@ class BalanceReportHelper implements BalanceReportHelperInterface
|
||||
{
|
||||
$set = $balance->getBalanceLines();
|
||||
$newSet = new Collection;
|
||||
/** @var BalanceLine $entry */
|
||||
foreach ($set as $entry) {
|
||||
if (null !== $entry->getBudget()->id) {
|
||||
$sum = '0';
|
||||
|
@ -107,7 +107,7 @@ class CreateController extends Controller
|
||||
}
|
||||
$request->session()->forget('accounts.create.fromStore');
|
||||
|
||||
return view('accounts.create', compact('subTitleIcon', 'what','interestPeriods', 'subTitle', 'roles', 'liabilityTypes'));
|
||||
return view('accounts.create', compact('subTitleIcon', 'what', 'interestPeriods', 'subTitle', 'roles', 'liabilityTypes'));
|
||||
}
|
||||
|
||||
|
||||
|
@ -147,7 +147,7 @@ class ReconcileController extends Controller
|
||||
/** @var Carbon $start */
|
||||
$start = clone session('start', app('navigation')->startOfPeriod(new Carbon, $range));
|
||||
/** @var Carbon $end */
|
||||
$end = clone session('end', app('navigation')->endOfPeriod(new Carbon, $range));
|
||||
$end = clone session('end', app('navigation')->endOfPeriod(new Carbon, $range));
|
||||
}
|
||||
if (null === $end) {
|
||||
/** @var Carbon $end */
|
||||
|
@ -93,7 +93,7 @@ class ShowController extends Controller
|
||||
/** @var Carbon $start */
|
||||
$start = $start ?? session('start');
|
||||
/** @var Carbon $end */
|
||||
$end = $end ?? session('end');
|
||||
$end = $end ?? session('end');
|
||||
if ($end < $start) {
|
||||
throw new FireflyException('End is after start!'); // @codeCoverageIgnore
|
||||
}
|
||||
|
@ -55,6 +55,7 @@ class LinkController extends Controller
|
||||
|
||||
/**
|
||||
* Make a new link form.
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
*/
|
||||
public function create()
|
||||
|
@ -28,7 +28,6 @@ use FireflyIII\Helpers\Collector\JournalCollectorInterface;
|
||||
use FireflyIII\Http\Requests\BillFormRequest;
|
||||
use FireflyIII\Models\Bill;
|
||||
use FireflyIII\Repositories\Bill\BillRepositoryInterface;
|
||||
use FireflyIII\Repositories\RuleGroup\RuleGroupRepositoryInterface;
|
||||
use FireflyIII\TransactionRules\TransactionMatcher;
|
||||
use FireflyIII\Transformers\BillTransformer;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
@ -51,8 +50,6 @@ class BillController extends Controller
|
||||
private $attachments;
|
||||
/** @var BillRepositoryInterface Bill repository */
|
||||
private $billRepository;
|
||||
/** @var RuleGroupRepositoryInterface Rule group repository */
|
||||
private $ruleGroupRepos;
|
||||
|
||||
/**
|
||||
* BillController constructor.
|
||||
@ -72,7 +69,6 @@ class BillController extends Controller
|
||||
app('view')->share('mainTitleIcon', 'fa-calendar-o');
|
||||
$this->attachments = app(AttachmentHelperInterface::class);
|
||||
$this->billRepository = app(BillRepositoryInterface::class);
|
||||
$this->ruleGroupRepos = app(RuleGroupRepositoryInterface::class);
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
|
@ -78,9 +78,9 @@ class IndexController extends Controller
|
||||
public function index(Request $request, string $moment = null)
|
||||
{
|
||||
/** @var string $range */
|
||||
$range = app('preferences')->get('viewRange', '1M')->data;
|
||||
$range = app('preferences')->get('viewRange', '1M')->data;
|
||||
/** @var Carbon $start */
|
||||
$start = session('start', new Carbon);
|
||||
$start = session('start', new Carbon);
|
||||
/** @var Carbon $end */
|
||||
$end = session('end', new Carbon);
|
||||
$page = 0 === (int)$request->get('page') ? 1 : (int)$request->get('page');
|
||||
@ -92,7 +92,7 @@ class IndexController extends Controller
|
||||
try {
|
||||
$start = new Carbon($moment);
|
||||
/** @var Carbon $end */
|
||||
$end = app('navigation')->endOfPeriod($start, $range);
|
||||
$end = app('navigation')->endOfPeriod($start, $range);
|
||||
} catch (Exception $e) {
|
||||
// start and end are already defined.
|
||||
Log::debug(sprintf('start and end are already defined: %s', $e->getMessage()));
|
||||
|
@ -127,7 +127,7 @@ class ShowController extends Controller
|
||||
$transactions = $collector->getPaginatedJournals();
|
||||
$transactions->setPath(route('budgets.no-budget'));
|
||||
|
||||
return view('budgets.no-budget', compact('transactions', 'subTitle', 'moment', 'start', 'end'));
|
||||
return view('budgets.no-budget', compact('transactions', 'subTitle', 'moment', 'start', 'end'));
|
||||
}
|
||||
|
||||
|
||||
|
@ -29,7 +29,6 @@ use FireflyIII\Helpers\Collector\JournalCollectorInterface;
|
||||
use FireflyIII\Helpers\Filter\InternalTransferFilter;
|
||||
use FireflyIII\Http\Controllers\Controller;
|
||||
use FireflyIII\Models\TransactionType;
|
||||
|
||||
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
|
||||
use FireflyIII\Support\CacheProperties;
|
||||
use Illuminate\Http\Request;
|
||||
|
@ -129,6 +129,7 @@ class AccountController extends Controller
|
||||
if ($cache->has()) {
|
||||
return response()->json($cache->get()); // @codeCoverageIgnore
|
||||
}
|
||||
/** @var JournalCollectorInterface $collector */
|
||||
$collector = app(JournalCollectorInterface::class);
|
||||
$collector->setAccounts(new Collection([$account]))->setRange($start, $end)->withBudgetInformation()->setTypes([TransactionType::WITHDRAWAL]);
|
||||
$transactions = $collector->getJournals();
|
||||
@ -192,6 +193,7 @@ class AccountController extends Controller
|
||||
return response()->json($cache->get()); // @codeCoverageIgnore
|
||||
}
|
||||
|
||||
/** @var JournalCollectorInterface $collector */
|
||||
$collector = app(JournalCollectorInterface::class);
|
||||
$collector->setAccounts(new Collection([$account]))->setRange($start, $end)->withCategoryInformation()->setTypes([TransactionType::WITHDRAWAL]);
|
||||
$transactions = $collector->getJournals();
|
||||
@ -283,6 +285,7 @@ class AccountController extends Controller
|
||||
}
|
||||
|
||||
// grab all journals:
|
||||
/** @var JournalCollectorInterface $collector */
|
||||
$collector = app(JournalCollectorInterface::class);
|
||||
$collector->setAccounts(new Collection([$account]))->setRange($start, $end)->withCategoryInformation()->setTypes([TransactionType::DEPOSIT]);
|
||||
$transactions = $collector->getJournals();
|
||||
|
@ -102,7 +102,8 @@ class BillController extends Controller
|
||||
}
|
||||
|
||||
$results = $collector->setAllAssetAccounts()->setBills(new Collection([$bill]))->getJournals();
|
||||
$results = $results->sortBy(
|
||||
/** @var Collection $results */
|
||||
$results = $results->sortBy(
|
||||
function (Transaction $transaction) {
|
||||
return $transaction->date->format('U');
|
||||
}
|
||||
|
@ -325,12 +325,12 @@ class BudgetController extends Controller
|
||||
/**
|
||||
* Shows a budget list with spent/left/overspent.
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
* @return JsonResponse
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
|
||||
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
|
||||
*/
|
||||
public function frontpage(): \Symfony\Component\HttpFoundation\Response
|
||||
public function frontpage(): JsonResponse
|
||||
{
|
||||
$start = session('start', Carbon::now()->startOfMonth());
|
||||
$end = session('end', Carbon::now()->endOfMonth());
|
||||
|
@ -168,6 +168,7 @@ class Controller extends BaseController
|
||||
|
||||
/**
|
||||
* Get user's language.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function getLanguage(): string
|
||||
|
@ -78,7 +78,7 @@ class ExportController extends Controller
|
||||
}
|
||||
$content = $repository->getContent($job);
|
||||
|
||||
$job->change('export_downloaded');
|
||||
$repository->changeStatus($job, 'export_downloaded');
|
||||
/** @var LaravelResponse $response */
|
||||
$response = response($content, 200);
|
||||
$response
|
||||
|
@ -108,7 +108,9 @@ class HomeController extends Controller
|
||||
}
|
||||
$subTitle = (string)trans('firefly.welcomeBack');
|
||||
$transactions = [];
|
||||
$frontPage = app('preferences')->get('frontPageAccounts', $repository->getAccountsByType([AccountType::DEFAULT, AccountType::ASSET])->pluck('id')->toArray());
|
||||
$frontPage = app('preferences')->get(
|
||||
'frontPageAccounts', $repository->getAccountsByType([AccountType::DEFAULT, AccountType::ASSET])->pluck('id')->toArray()
|
||||
);
|
||||
/** @var Carbon $start */
|
||||
$start = session('start', Carbon::now()->startOfMonth());
|
||||
/** @var Carbon $end */
|
||||
|
@ -150,15 +150,15 @@ class JavascriptController extends Controller
|
||||
{
|
||||
$viewRange = app('preferences')->get('viewRange', '1M')->data;
|
||||
/** @var Carbon $start */
|
||||
$start = session('start');
|
||||
$start = session('start');
|
||||
/** @var Carbon $end */
|
||||
$end = session('end');
|
||||
$end = session('end');
|
||||
/** @var Carbon $first */
|
||||
$first = session('first');
|
||||
$title = sprintf('%s - %s', $start->formatLocalized($this->monthAndDayFormat), $end->formatLocalized($this->monthAndDayFormat));
|
||||
$isCustom = true === session('is_custom_range', false);
|
||||
$today = new Carbon;
|
||||
$ranges = [
|
||||
$first = session('first');
|
||||
$title = sprintf('%s - %s', $start->formatLocalized($this->monthAndDayFormat), $end->formatLocalized($this->monthAndDayFormat));
|
||||
$isCustom = true === session('is_custom_range', false);
|
||||
$today = new Carbon;
|
||||
$ranges = [
|
||||
// first range is the current range:
|
||||
$title => [$start, $end],
|
||||
];
|
||||
|
@ -202,7 +202,7 @@ class BoxController extends Controller
|
||||
/** @var Carbon $start */
|
||||
$start = session('start', Carbon::now()->startOfMonth());
|
||||
/** @var Carbon $end */
|
||||
$end = session('end', Carbon::now()->endOfMonth());
|
||||
$end = session('end', Carbon::now()->endOfMonth());
|
||||
|
||||
$cache = new CacheProperties;
|
||||
$cache->addProperty($start);
|
||||
|
@ -80,6 +80,7 @@ class ReportController extends Controller
|
||||
|
||||
/**
|
||||
* Generate popup view.
|
||||
*
|
||||
* @param Request $request
|
||||
*
|
||||
* @return JsonResponse
|
||||
@ -274,7 +275,7 @@ class ReportController extends Controller
|
||||
$attributes['startDate'] = Carbon::createFromFormat('Ymd', $attributes['startDate']);
|
||||
} catch (InvalidArgumentException $e) {
|
||||
Log::debug(sprintf('Not important error message: %s', $e->getMessage()));
|
||||
$date = Carbon::now()->startOfMonth();
|
||||
$date = Carbon::now()->startOfMonth();
|
||||
$attributes['startDate'] = $date;
|
||||
}
|
||||
|
||||
@ -282,7 +283,7 @@ class ReportController extends Controller
|
||||
$attributes['endDate'] = Carbon::createFromFormat('Ymd', $attributes['endDate']);
|
||||
} catch (InvalidArgumentException $e) {
|
||||
Log::debug(sprintf('Not important error message: %s', $e->getMessage()));
|
||||
$date = Carbon::now()->startOfMonth();
|
||||
$date = Carbon::now()->startOfMonth();
|
||||
$attributes['endDate'] = $date;
|
||||
}
|
||||
|
||||
|
@ -340,6 +340,7 @@ class ProfileController extends Controller
|
||||
|
||||
session()->flash('success', (string)trans('firefly.saved_preferences'));
|
||||
app('preferences')->mark();
|
||||
|
||||
return redirect(route('profile.index'));
|
||||
}
|
||||
|
||||
@ -371,6 +372,7 @@ class ProfileController extends Controller
|
||||
|
||||
/**
|
||||
* Regenerate access token.
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
||||
*/
|
||||
public function regenerate()
|
||||
|
@ -86,7 +86,7 @@ class CreateController extends Controller
|
||||
$this->rememberPreviousUri('recurring.create.uri');
|
||||
}
|
||||
$request->session()->forget('recurring.create.fromStore');
|
||||
$repetitionEnds = [
|
||||
$repetitionEnds = [
|
||||
'forever' => (string)trans('firefly.repeat_forever'),
|
||||
'until_date' => (string)trans('firefly.repeat_until_date'),
|
||||
'times' => (string)trans('firefly.repeat_times'),
|
||||
|
@ -86,7 +86,7 @@ class EditController extends Controller
|
||||
$budgets = app('expandedform')->makeSelectListWithEmpty($this->budgets->getActiveBudgets());
|
||||
|
||||
/** @var RecurrenceRepetition $repetition */
|
||||
$repetition = $recurrence->recurrenceRepetitions()->first();
|
||||
$repetition = $recurrence->recurrenceRepetitions()->first();
|
||||
$currentRepType = $repetition->repetition_type;
|
||||
if ('' !== $repetition->repetition_moment) {
|
||||
$currentRepType .= ',' . $repetition->repetition_moment;
|
||||
|
@ -28,7 +28,6 @@ use FireflyIII\Http\Controllers\Controller;
|
||||
use FireflyIII\Http\Requests\RuleFormRequest;
|
||||
use FireflyIII\Models\Bill;
|
||||
use FireflyIII\Models\RuleGroup;
|
||||
use FireflyIII\Repositories\Bill\BillRepositoryInterface;
|
||||
use FireflyIII\Repositories\Rule\RuleRepositoryInterface;
|
||||
use FireflyIII\Support\Http\Controllers\RuleManagement;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
@ -42,8 +41,6 @@ use Throwable;
|
||||
class CreateController extends Controller
|
||||
{
|
||||
use RuleManagement;
|
||||
/** @var BillRepositoryInterface Bill repository */
|
||||
private $billRepos;
|
||||
/** @var RuleRepositoryInterface Rule repository */
|
||||
private $ruleRepos;
|
||||
|
||||
@ -59,7 +56,6 @@ class CreateController extends Controller
|
||||
app('view')->share('title', (string)trans('firefly.rules'));
|
||||
app('view')->share('mainTitleIcon', 'fa-random');
|
||||
|
||||
$this->billRepos = app(BillRepositoryInterface::class);
|
||||
$this->ruleRepos = app(RuleRepositoryInterface::class);
|
||||
|
||||
return $next($request);
|
||||
|
@ -130,7 +130,7 @@ class IndexController extends Controller
|
||||
|
||||
/**
|
||||
* Move rule ip.
|
||||
*
|
||||
*
|
||||
* @param Rule $rule
|
||||
*
|
||||
* @return RedirectResponse|\Illuminate\Routing\Redirector
|
||||
|
@ -34,6 +34,7 @@ use phpseclib\Crypt\RSA;
|
||||
|
||||
/**
|
||||
* Class InstallController
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
class InstallController extends Controller
|
||||
|
@ -136,6 +136,7 @@ class LinkController extends Controller
|
||||
|
||||
/**
|
||||
* Switch link from A <> B to B <> A.
|
||||
*
|
||||
* @param TransactionJournalLink $link
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
||||
|
@ -260,9 +260,9 @@ class TransactionController extends Controller
|
||||
*/
|
||||
private function getPeriodOverview(string $what, Carbon $date): Collection
|
||||
{
|
||||
$range = app('preferences')->get('viewRange', '1M')->data;
|
||||
$first = $this->repository->firstNull();
|
||||
$start = Carbon::now()->subYear();
|
||||
$range = app('preferences')->get('viewRange', '1M')->data;
|
||||
$first = $this->repository->firstNull();
|
||||
$start = Carbon::now()->subYear();
|
||||
$types = config('firefly.transactionTypesByWhat.' . $what);
|
||||
$entries = new Collection;
|
||||
if (null !== $first) {
|
||||
@ -289,9 +289,9 @@ class TransactionController extends Controller
|
||||
/** @noinspection PhpUndefinedMethodInspection */
|
||||
$entries->push(
|
||||
[
|
||||
'name' => $dateName,
|
||||
'sums' => $sums,
|
||||
'sum' => $sum,
|
||||
'name' => $dateName,
|
||||
'sums' => $sums,
|
||||
'sum' => $sum,
|
||||
'start' => $currentDate['start']->format('Y-m-d'),
|
||||
'end' => $currentDate['end']->format('Y-m-d'),
|
||||
]
|
||||
|
@ -45,7 +45,7 @@ class TrustProxies extends Middleware
|
||||
{
|
||||
$trustedProxies = (string)env('TRUSTED_PROXIES', null);
|
||||
$this->proxies = explode(',', $trustedProxies);
|
||||
if ($trustedProxies === '**') {
|
||||
if ('**' === $trustedProxies) {
|
||||
$this->proxies = '**';
|
||||
}
|
||||
parent::__construct($config);
|
||||
|
@ -70,7 +70,7 @@ class AccountFormRequest extends Request
|
||||
|
||||
// if the account type is "liabilities" there are actually four types of liability
|
||||
// that could have been selected.
|
||||
if ($data['accountType'] === 'liabilities') {
|
||||
if ('liabilities' === $data['accountType']) {
|
||||
$data['accountType'] = null;
|
||||
$data['account_type_id'] = $this->integer('liability_type_id');
|
||||
// also reverse the opening balance:
|
||||
|
@ -270,7 +270,7 @@ class JournalFormRequest extends Request
|
||||
*/
|
||||
private function validateDeposit(Validator $validator): void
|
||||
{
|
||||
$data = $validator->getData();
|
||||
$data = $validator->getData();
|
||||
$selectedCurrency = (int)($data['amount_currency_id_amount'] ?? 0);
|
||||
$accountCurrency = (int)($data['destination_account_currency'] ?? 0);
|
||||
$nativeAmount = (string)($data['native_amount'] ?? '');
|
||||
@ -290,7 +290,7 @@ class JournalFormRequest extends Request
|
||||
*/
|
||||
private function validateTransfer(Validator $validator): void
|
||||
{
|
||||
$data = $validator->getData();
|
||||
$data = $validator->getData();
|
||||
$sourceCurrency = (int)($data['source_account_currency'] ?? 0);
|
||||
$destinationCurrency = (int)($data['destination_account_currency'] ?? 0);
|
||||
$sourceAmount = (string)($data['source_amount'] ?? '');
|
||||
|
@ -150,7 +150,7 @@ class RecurrenceFormRequest extends Request
|
||||
{
|
||||
$today = new Carbon;
|
||||
$tomorrow = Carbon::now()->addDay();
|
||||
$rules = [
|
||||
$rules = [
|
||||
// mandatory info for recurrence.
|
||||
'title' => 'required|between:1,255|uniqueObjectForUser:recurrences,title',
|
||||
'first_date' => 'required|date|after:' . $today->format('Y-m-d'),
|
||||
|
@ -61,9 +61,10 @@ class Request extends FormRequest
|
||||
public function float(string $field): ?float
|
||||
{
|
||||
$res = $this->get($field);
|
||||
if(null === $res) {
|
||||
if (null === $res) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (float)$res;
|
||||
}
|
||||
|
||||
|
@ -61,6 +61,7 @@ class RuleFormRequest extends Request
|
||||
'rule_triggers' => $this->getRuleTriggerData(),
|
||||
'rule_actions' => $this->getRuleActionData(),
|
||||
];
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
@ -109,8 +110,8 @@ class RuleFormRequest extends Request
|
||||
*/
|
||||
private function getRuleActionData(): array
|
||||
{
|
||||
$return = [];
|
||||
$actionData= $this->get('rule_actions');
|
||||
$return = [];
|
||||
$actionData = $this->get('rule_actions');
|
||||
if (\is_array($actionData)) {
|
||||
foreach ($actionData as $action) {
|
||||
$stopProcessing = $action['stop_processing'] ?? '0';
|
||||
|
@ -33,6 +33,7 @@ class OpposingAccountIbans implements MapperInterface
|
||||
{
|
||||
/**
|
||||
* Get map of opposing accounts.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getMap(): array
|
||||
|
@ -22,8 +22,8 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Import\Prerequisites;
|
||||
|
||||
use bunq\Exception\BunqException;
|
||||
use bunq\Util\BunqEnumApiEnvironmentType;
|
||||
use Exception;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Services\Bunq\ApiContext;
|
||||
use FireflyIII\Services\IP\IPRetrievalInterface;
|
||||
@ -134,7 +134,7 @@ class BunqPrerequisites implements PrerequisitesInterface
|
||||
try {
|
||||
$json = $apiContext->toJson();
|
||||
// @codeCoverageIgnoreStart
|
||||
} catch (BunqException $e) {
|
||||
} catch (Exception $e) {
|
||||
$messages = new MessageBag();
|
||||
$messages->add('bunq_error', $e->getMessage());
|
||||
|
||||
|
@ -86,17 +86,18 @@ class YnabRoutine implements RoutineInterface
|
||||
if (\count($budgets) > 1) {
|
||||
$this->repository->setStage($this->importJob, 'select_budgets');
|
||||
$this->repository->setStatus($this->importJob, 'need_job_config');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (\count($budgets) === 1) {
|
||||
if (1 === \count($budgets)) {
|
||||
$this->repository->setStatus($this->importJob, 'ready_to_run');
|
||||
$this->repository->setStage($this->importJob, 'get_accounts');
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
if('get_accounts' === $this->importJob->stage) {
|
||||
if ('get_accounts' === $this->importJob->stage) {
|
||||
$this->repository->setStatus($this->importJob, 'running');
|
||||
|
||||
/** @var GetAccountsHandler $handler */
|
||||
@ -106,9 +107,10 @@ class YnabRoutine implements RoutineInterface
|
||||
|
||||
$this->repository->setStage($this->importJob, 'select_accounts');
|
||||
$this->repository->setStatus($this->importJob, 'need_job_config');
|
||||
|
||||
return;
|
||||
}
|
||||
if('go-for-import' === $this->importJob->stage) {
|
||||
if ('go-for-import' === $this->importJob->stage) {
|
||||
$this->repository->setStatus($this->importJob, 'running');
|
||||
$this->repository->setStage($this->importJob, 'do_import');
|
||||
/** @var ImportDataHandler $handler */
|
||||
@ -117,26 +119,27 @@ class YnabRoutine implements RoutineInterface
|
||||
$handler->run();
|
||||
$this->repository->setStatus($this->importJob, 'provider_finished');
|
||||
$this->repository->setStage($this->importJob, 'final');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// if ('match_accounts' === $this->importJob->stage) {
|
||||
// // $this->repository->setStatus($this->importJob, 'running');
|
||||
// /** @var StageGetBudgetsHandler $handler */
|
||||
// $handler = app(StageGetBudgetsHandler::class);
|
||||
// $handler->setImportJob($this->importJob);
|
||||
// $handler->run();
|
||||
// $this->repository->setStage($this->importJob, 'get_transactions');
|
||||
// }
|
||||
//
|
||||
// if ('get_transactions' === $this->importJob->stage) {
|
||||
// // $this->repository->setStatus($this->importJob, 'running');
|
||||
// /** @var StageGetBudgetsHandler $handler */
|
||||
// $handler = app(StageGetBudgetsHandler::class);
|
||||
// $handler->setImportJob($this->importJob);
|
||||
// $handler->run();
|
||||
// $this->repository->setStage($this->importJob, 'get_transactions');
|
||||
// }
|
||||
// if ('match_accounts' === $this->importJob->stage) {
|
||||
// // $this->repository->setStatus($this->importJob, 'running');
|
||||
// /** @var StageGetBudgetsHandler $handler */
|
||||
// $handler = app(StageGetBudgetsHandler::class);
|
||||
// $handler->setImportJob($this->importJob);
|
||||
// $handler->run();
|
||||
// $this->repository->setStage($this->importJob, 'get_transactions');
|
||||
// }
|
||||
//
|
||||
// if ('get_transactions' === $this->importJob->stage) {
|
||||
// // $this->repository->setStatus($this->importJob, 'running');
|
||||
// /** @var StageGetBudgetsHandler $handler */
|
||||
// $handler = app(StageGetBudgetsHandler::class);
|
||||
// $handler->setImportJob($this->importJob);
|
||||
// $handler->run();
|
||||
// $this->repository->setStage($this->importJob, 'get_transactions');
|
||||
// }
|
||||
throw new FireflyException(sprintf('YNAB import routine cannot handle stage "%s"', $this->importJob->stage));
|
||||
}
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ class CreateRecurringTransactions implements ShouldQueue
|
||||
|
||||
/** @var Carbon The current date */
|
||||
private $date;
|
||||
/** @var JournalRepositoryInterface Journal repository */
|
||||
/** @var JournalRepositoryInterface Journal repository */
|
||||
private $journalRepository;
|
||||
/** @var RecurringRepositoryInterface Recurring transactions repository. */
|
||||
private $repository;
|
||||
@ -155,6 +155,7 @@ class CreateRecurringTransactions implements ShouldQueue
|
||||
function (Rule $rule) use ($journal) {
|
||||
Log::debug(sprintf('Going to apply rule #%d to journal %d.', $rule->id, $journal->id));
|
||||
$processor = Processor::make($rule);
|
||||
/** @noinspection ExceptionsAnnotatingAndHandlingInspection */
|
||||
$processor->handleTransactionJournal($journal);
|
||||
if ($rule->stop_processing) {
|
||||
return;
|
||||
|
@ -35,32 +35,32 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
*/
|
||||
class AccountType extends Model
|
||||
{
|
||||
/** @var string */
|
||||
public const DEFAULT = 'Default account';
|
||||
/** @var string */
|
||||
public const CASH = 'Cash account';
|
||||
/** @var string */
|
||||
public const ASSET = 'Asset account';
|
||||
/** @var string */
|
||||
public const EXPENSE = 'Expense account';
|
||||
/** @var string */
|
||||
public const REVENUE = 'Revenue account';
|
||||
/** @var string */
|
||||
/** @var string */
|
||||
public const DEFAULT = 'Default account';
|
||||
/** @var string */
|
||||
public const CASH = 'Cash account';
|
||||
/** @var string */
|
||||
public const ASSET = 'Asset account';
|
||||
/** @var string */
|
||||
public const EXPENSE = 'Expense account';
|
||||
/** @var string */
|
||||
public const REVENUE = 'Revenue account';
|
||||
/** @var string */
|
||||
public const INITIAL_BALANCE = 'Initial balance account';
|
||||
/** @var string */
|
||||
public const BENEFICIARY = 'Beneficiary account';
|
||||
/** @var string */
|
||||
public const IMPORT = 'Import account';
|
||||
/** @var string */
|
||||
public const RECONCILIATION = 'Reconciliation account';
|
||||
/** @var string */
|
||||
public const LOAN = 'Loan';
|
||||
/** @var string */
|
||||
public const DEBT = 'Debt';
|
||||
/** @var string */
|
||||
public const MORTGAGE = 'Mortgage';
|
||||
/** @var string */
|
||||
public const CREDITCARD = 'Credit card';
|
||||
/** @var string */
|
||||
public const BENEFICIARY = 'Beneficiary account';
|
||||
/** @var string */
|
||||
public const IMPORT = 'Import account';
|
||||
/** @var string */
|
||||
public const RECONCILIATION = 'Reconciliation account';
|
||||
/** @var string */
|
||||
public const LOAN = 'Loan';
|
||||
/** @var string */
|
||||
public const DEBT = 'Debt';
|
||||
/** @var string */
|
||||
public const MORTGAGE = 'Mortgage';
|
||||
/** @var string */
|
||||
public const CREDITCARD = 'Credit card';
|
||||
/**
|
||||
* The attributes that should be casted to native types.
|
||||
*
|
||||
|
@ -84,7 +84,7 @@ class Attachment extends Model
|
||||
/** @var User $user */
|
||||
$user = auth()->user();
|
||||
/** @var Attachment $attachment */
|
||||
$attachment = $user->attachments()->find($attachmentId);
|
||||
$attachment = $user->attachments()->find($attachmentId);
|
||||
if (null !== $attachment) {
|
||||
return $attachment;
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ class AvailableBudget extends Model
|
||||
/** @var User $user */
|
||||
$user = auth()->user();
|
||||
/** @var AvailableBudget $availableBudget */
|
||||
$availableBudget = $user->availableBudgets()->find($availableBudgetId);
|
||||
$availableBudget = $user->availableBudgets()->find($availableBudgetId);
|
||||
if (null !== $availableBudget) {
|
||||
return $availableBudget;
|
||||
}
|
||||
|
@ -110,9 +110,9 @@ class Bill extends Model
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
* @return \Illuminate\Database\Eloquent\Relations\MorphMany
|
||||
* @return MorphMany
|
||||
*/
|
||||
public function attachments(): \Illuminate\Database\Eloquent\Relations\MorphMany
|
||||
public function attachments(): MorphMany
|
||||
{
|
||||
return $this->morphMany(Attachment::class, 'attachable');
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
* @property int $user_id
|
||||
* @property-read string $email
|
||||
* @property bool encrypted
|
||||
* @property Collection budgetlimits
|
||||
* @property Collection budgetlimits
|
||||
*/
|
||||
class Budget extends Model
|
||||
{
|
||||
@ -80,7 +80,7 @@ class Budget extends Model
|
||||
/** @var User $user */
|
||||
$user = auth()->user();
|
||||
/** @var Budget $budget */
|
||||
$budget = $user->budgets()->find($budgetId);
|
||||
$budget = $user->budgets()->find($budgetId);
|
||||
if (null !== $budget) {
|
||||
return $budget;
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ class BudgetLimit extends Model
|
||||
* @var array
|
||||
*/
|
||||
protected $casts
|
||||
= [
|
||||
= [
|
||||
'created_at' => 'datetime',
|
||||
'updated_at' => 'datetime',
|
||||
'start_date' => 'date',
|
||||
|
@ -39,7 +39,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
* @property int $id
|
||||
* @property float $spent // used in category reports
|
||||
* @property Carbon|null lastActivity
|
||||
* @property bool encrypted
|
||||
* @property bool encrypted
|
||||
*/
|
||||
class Category extends Model
|
||||
{
|
||||
@ -77,7 +77,7 @@ class Category extends Model
|
||||
/** @var User $user */
|
||||
$user = auth()->user();
|
||||
/** @var Category $category */
|
||||
$category = $user->categories()->find($categoryId);
|
||||
$category = $user->categories()->find($categoryId);
|
||||
if (null !== $category) {
|
||||
return $category;
|
||||
}
|
||||
|
@ -46,8 +46,8 @@ class CurrencyExchangeRate extends Model
|
||||
/** @var array Convert these fields to other data types */
|
||||
protected $casts
|
||||
= [
|
||||
'created_at' => 'datetime',
|
||||
'updated_at' => 'datetime',
|
||||
'created_at' => 'datetime',
|
||||
'updated_at' => 'datetime',
|
||||
'user_id' => 'int',
|
||||
'from_currency_id' => 'int',
|
||||
'to_currency_id' => 'int',
|
||||
|
@ -25,6 +25,7 @@ namespace FireflyIII\Models;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphMany;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
|
||||
/**
|
||||
@ -43,7 +44,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
* @property Tag $tag
|
||||
* @property array $errors
|
||||
* @property array extended_status
|
||||
* @property int id
|
||||
* @property int id
|
||||
*/
|
||||
class ImportJob extends Model
|
||||
{
|
||||
@ -77,7 +78,7 @@ class ImportJob extends Model
|
||||
public static function routeBinder(string $value): ImportJob
|
||||
{
|
||||
if (auth()->check()) {
|
||||
$key = trim($value);
|
||||
$key = trim($value);
|
||||
/** @var User $user */
|
||||
$user = auth()->user();
|
||||
/** @var ImportJob $importJob */
|
||||
@ -91,9 +92,9 @@ class ImportJob extends Model
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
* @return \Illuminate\Database\Eloquent\Relations\MorphMany
|
||||
* @return MorphMany
|
||||
*/
|
||||
public function attachments(): \Illuminate\Database\Eloquent\Relations\MorphMany
|
||||
public function attachments(): MorphMany
|
||||
{
|
||||
return $this->morphMany(Attachment::class, 'attachable');
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
* @property int $order
|
||||
* @property bool $active
|
||||
* @property int $account_id
|
||||
* @property bool encrypted
|
||||
* @property bool encrypted
|
||||
*
|
||||
*/
|
||||
class PiggyBank extends Model
|
||||
|
@ -33,7 +33,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
* @property int $transaction_journal_id
|
||||
* @property int $piggy_bank_id
|
||||
* @property int $id
|
||||
* @property Carbon date
|
||||
* @property Carbon date
|
||||
*/
|
||||
class PiggyBankEvent extends Model
|
||||
{
|
||||
|
@ -41,7 +41,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
* @property Carbon $updated_at
|
||||
* @property Carbon $created_at
|
||||
* @property int $id
|
||||
* @property User user
|
||||
* @property User user
|
||||
*/
|
||||
class Preference extends Model
|
||||
{
|
||||
@ -74,7 +74,7 @@ class Preference extends Model
|
||||
/** @var User $user */
|
||||
$user = auth()->user();
|
||||
/** @var Preference $preference */
|
||||
$preference = $user->preferences()->find($preferenceId);
|
||||
$preference = $user->preferences()->find($preferenceId);
|
||||
if (null !== $preference) {
|
||||
return $preference;
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ class Recurrence extends Model
|
||||
/** @var User $user */
|
||||
$user = auth()->user();
|
||||
/** @var Recurrence $recurrence */
|
||||
$recurrence = $user->recurrences()->find($recurrenceId);
|
||||
$recurrence = $user->recurrences()->find($recurrenceId);
|
||||
if (null !== $recurrence) {
|
||||
return $recurrence;
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ class RecurrenceRepetition extends Model
|
||||
* @var array
|
||||
*/
|
||||
protected $casts
|
||||
= [
|
||||
= [
|
||||
'created_at' => 'datetime',
|
||||
'updated_at' => 'datetime',
|
||||
'deleted_at' => 'datetime',
|
||||
|
@ -43,7 +43,7 @@ class RecurrenceTransactionMeta extends Model
|
||||
* @var array
|
||||
*/
|
||||
protected $casts
|
||||
= [
|
||||
= [
|
||||
'created_at' => 'datetime',
|
||||
'updated_at' => 'datetime',
|
||||
'deleted_at' => 'datetime',
|
||||
|
@ -88,7 +88,7 @@ class Rule extends Model
|
||||
/** @var User $user */
|
||||
$user = auth()->user();
|
||||
/** @var Rule $rule */
|
||||
$rule = $user->rules()->find($ruleId);
|
||||
$rule = $user->rules()->find($ruleId);
|
||||
if (null !== $rule) {
|
||||
return $rule;
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
* @property int $id
|
||||
* @property int $order
|
||||
* @property Collection $rules
|
||||
* @property string description
|
||||
* @property string description
|
||||
*/
|
||||
class RuleGroup extends Model
|
||||
{
|
||||
@ -80,7 +80,7 @@ class RuleGroup extends Model
|
||||
/** @var User $user */
|
||||
$user = auth()->user();
|
||||
/** @var RuleGroup $ruleGroup */
|
||||
$ruleGroup = $user->ruleGroups()->find($ruleGroupId);
|
||||
$ruleGroup = $user->ruleGroups()->find($ruleGroupId);
|
||||
if (null !== $ruleGroup) {
|
||||
return $ruleGroup;
|
||||
}
|
||||
|
@ -237,6 +237,7 @@ class Transaction extends Model
|
||||
|
||||
/**
|
||||
* Check for transactions BEFORE the specified date.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @param Builder $query
|
||||
|
@ -34,7 +34,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
* @property string $symbol
|
||||
* @property int $decimal_places
|
||||
* @property int $id
|
||||
* @property string name
|
||||
* @property string name
|
||||
*
|
||||
*/
|
||||
class TransactionCurrency extends Model
|
||||
|
@ -150,9 +150,9 @@ class TransactionJournal extends Model
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
* @return \Illuminate\Database\Eloquent\Relations\MorphMany
|
||||
* @return MorphMany
|
||||
*/
|
||||
public function attachments(): \Illuminate\Database\Eloquent\Relations\MorphMany
|
||||
public function attachments(): MorphMany
|
||||
{
|
||||
return $this->morphMany(Attachment::class, 'attachable');
|
||||
}
|
||||
|
@ -45,9 +45,6 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
*/
|
||||
class TransactionJournalLink extends Model
|
||||
{
|
||||
/** @var string The table to store the data in */
|
||||
protected $table = 'journal_links';
|
||||
|
||||
/**
|
||||
* The attributes that should be casted to native types.
|
||||
*
|
||||
@ -55,9 +52,11 @@ class TransactionJournalLink extends Model
|
||||
*/
|
||||
protected $casts
|
||||
= [
|
||||
'created_at' => 'datetime',
|
||||
'updated_at' => 'datetime',
|
||||
'created_at' => 'datetime',
|
||||
'updated_at' => 'datetime',
|
||||
];
|
||||
/** @var string The table to store the data in */
|
||||
protected $table = 'journal_links';
|
||||
|
||||
/**
|
||||
* Route binder. Converts the key in the URL to the specified object (or throw 404).
|
||||
|
@ -26,6 +26,7 @@ use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Laravel\Passport\Passport;
|
||||
use URL;
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
* Class AppServiceProvider.
|
||||
@ -38,7 +39,7 @@ class AppServiceProvider extends ServiceProvider
|
||||
public function boot(): void
|
||||
{
|
||||
Schema::defaultStringLength(191);
|
||||
if('heroku' === env('APP_ENV')) {
|
||||
if ('heroku' === env('APP_ENV')) {
|
||||
URL::forceScheme('https');
|
||||
}
|
||||
}
|
||||
|
@ -303,6 +303,7 @@ class AccountRepository implements AccountRepositoryInterface
|
||||
if (null === $note) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $note->text;
|
||||
}
|
||||
|
||||
@ -450,6 +451,9 @@ class AccountRepository implements AccountRepositoryInterface
|
||||
* @param array $data
|
||||
*
|
||||
* @return Account
|
||||
* @throws \FireflyIII\Exceptions\FireflyException
|
||||
* @throws FireflyException
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function update(Account $account, array $data): Account
|
||||
{
|
||||
|
@ -50,6 +50,7 @@ interface AttachmentRepositoryInterface
|
||||
|
||||
/**
|
||||
* @param int $attachmentId
|
||||
*
|
||||
* @return Attachment|null
|
||||
*/
|
||||
public function findWithoutUser(int $attachmentId): ?Attachment;
|
||||
|
@ -323,7 +323,7 @@ class BillRepository implements BillRepositoryInterface
|
||||
*/
|
||||
public function getPayDatesInRange(Bill $bill, Carbon $start, Carbon $end): Collection
|
||||
{
|
||||
$set = new Collection;
|
||||
$set = new Collection;
|
||||
$currentStart = clone $start;
|
||||
Log::debug(sprintf('Now at bill "%s" (%s)', $bill->name, $bill->repeat_freq));
|
||||
Log::debug(sprintf('First currentstart is %s', $currentStart->format('Y-m-d')));
|
||||
|
@ -48,7 +48,8 @@ class ExportJobRepository implements ExportJobRepositoryInterface
|
||||
public function changeStatus(ExportJob $job, string $status): bool
|
||||
{
|
||||
Log::debug(sprintf('Change status of job #%d to "%s"', $job->id, $status));
|
||||
$job->change($status);
|
||||
$job->status = $status;
|
||||
$job->save();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -57,6 +57,7 @@ interface ExportJobRepositoryInterface
|
||||
|
||||
/**
|
||||
* @param string $key
|
||||
*
|
||||
* @return ExportJob|null
|
||||
*/
|
||||
public function findByKey(string $key): ?ExportJob;
|
||||
|
@ -184,6 +184,7 @@ class ImportJobRepository implements ImportJobRepositoryInterface
|
||||
$newConfig = array_merge($currentConfig, $configuration);
|
||||
$job->configuration = $newConfig;
|
||||
$job->save();
|
||||
|
||||
//Log::debug(sprintf('Set config of job "%s" to: ', $job->key), $newConfig);
|
||||
|
||||
return $job;
|
||||
|
@ -54,6 +54,7 @@ interface ImportJobRepositoryInterface
|
||||
|
||||
/**
|
||||
* @param string $key
|
||||
*
|
||||
* @return ImportJob|null
|
||||
*/
|
||||
public function findByKey(string $key): ?ImportJob;
|
||||
|
@ -707,6 +707,8 @@ class JournalRepository implements JournalRepositoryInterface
|
||||
*
|
||||
* @return TransactionJournal
|
||||
*
|
||||
* @throws FireflyException
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function update(TransactionJournal $journal, array $data): TransactionJournal
|
||||
{
|
||||
|
@ -25,7 +25,6 @@ namespace FireflyIII\Repositories\Journal;
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Models\Account;
|
||||
|
||||
use FireflyIII\Models\Transaction;
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
use FireflyIII\Models\TransactionJournalMeta;
|
||||
|
@ -60,7 +60,7 @@ interface TagRepositoryInterface
|
||||
*
|
||||
* @return Tag|null
|
||||
*/
|
||||
public function findByTag(string $tag):?Tag;
|
||||
public function findByTag(string $tag): ?Tag;
|
||||
|
||||
/**
|
||||
* @param int $tagId
|
||||
|
@ -68,7 +68,7 @@ class FixerIOv2 implements ExchangeRateInterface
|
||||
}
|
||||
|
||||
// build URI
|
||||
$uri = sprintf(
|
||||
$uri = sprintf(
|
||||
'http://data.fixer.io/api/%s?access_key=%s&base=%s&symbols=%s',
|
||||
$date->format('Y-m-d'), $apiKey, $fromCurrency->code, $toCurrency->code
|
||||
);
|
||||
|
@ -60,7 +60,7 @@ class UpdateRequest implements GithubRequest
|
||||
}
|
||||
try {
|
||||
$releaseXml = new SimpleXMLElement($res->getBody()->getContents(), LIBXML_NOCDATA);
|
||||
} catch (RunTimeException $e) {
|
||||
} catch (RuntimeException $e) {
|
||||
Log::error(sprintf('Could not get body from github updat result: %s', $e->getMessage()));
|
||||
$releaseXml = new SimpleXMLElement('');
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ use Exception;
|
||||
use GuzzleHttp\Client;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
use Log;
|
||||
use RunTimeException;
|
||||
use RuntimeException;
|
||||
|
||||
/**
|
||||
* Class IpifyOrg
|
||||
@ -58,7 +58,7 @@ class IpifyOrg implements IPRetrievalInterface
|
||||
}
|
||||
try {
|
||||
$body = (string)$res->getBody()->getContents();
|
||||
} catch (RunTimeException $e) {
|
||||
} catch (RuntimeException $e) {
|
||||
Log::error(sprintf('Could not get body from ipify.org result: %s', $e->getMessage()));
|
||||
$body = null;
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ trait AccountServiceTrait
|
||||
/** @var array */
|
||||
public $validCCFields = ['accountRole', 'ccMonthlyPaymentDate', 'ccType', 'accountNumber', 'currency_id', 'BIC'];
|
||||
/** @var array */
|
||||
public $validFields = ['accountNumber', 'currency_id', 'BIC','interest','interest_period'];
|
||||
public $validFields = ['accountNumber', 'currency_id', 'BIC', 'interest', 'interest_period'];
|
||||
|
||||
/**
|
||||
* @param Account $account
|
||||
|
@ -22,6 +22,7 @@
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Services\Internal\Support;
|
||||
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Factory\TransactionTypeFactory;
|
||||
use FireflyIII\Models\TransactionType;
|
||||
|
@ -51,7 +51,7 @@ class BillUpdateService
|
||||
$bill->repeat_freq = $data['repeat_freq'];
|
||||
$bill->skip = $data['skip'];
|
||||
$bill->automatch = true;
|
||||
$bill->active = $data['active']??true;
|
||||
$bill->active = $data['active'] ?? true;
|
||||
$bill->save();
|
||||
|
||||
// update note:
|
||||
|
@ -25,7 +25,6 @@ namespace FireflyIII\Services\Internal\Update;
|
||||
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Models\Recurrence;
|
||||
|
||||
use FireflyIII\Services\Internal\Support\RecurringTransactionTrait;
|
||||
use FireflyIII\Services\Internal\Support\TransactionServiceTrait;
|
||||
use FireflyIII\Services\Internal\Support\TransactionTypeTrait;
|
||||
@ -65,7 +64,7 @@ class RecurrenceUpdateService
|
||||
$recurrence->apply_rules = $data['recurrence']['apply_rules'] ?? $recurrence->apply_rules;
|
||||
$recurrence->active = $data['recurrence']['active'] ?? $recurrence->active;
|
||||
|
||||
if(isset($data['recurrence']['repetition_end'])) {
|
||||
if (isset($data['recurrence']['repetition_end'])) {
|
||||
if (\in_array($data['recurrence']['repetition_end'], ['forever ', 'until_date'])) {
|
||||
$recurrence->repetitions = 0;
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ class PwndVerifierV2 implements Verifier
|
||||
}
|
||||
try {
|
||||
$strpos = stripos($res->getBody()->getContents(), $rest);
|
||||
} catch (RunTimeException $e) {
|
||||
} catch (RuntimeException $e) {
|
||||
Log::error(sprintf('Could not get body from Pwnd result: %s', $e->getMessage()));
|
||||
$strpos = false;
|
||||
}
|
||||
|
@ -28,6 +28,7 @@ use Carbon\Carbon;
|
||||
/**
|
||||
*
|
||||
* Class Attempt
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
* @SuppressWarnings(PHPMD.ShortVariable)
|
||||
* @SuppressWarnings(PHPMD.TooManyFields)
|
||||
|
@ -28,6 +28,7 @@ use Carbon\Carbon;
|
||||
|
||||
/**
|
||||
* Class Login
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
* @SuppressWarnings(PHPMD.ShortVariable)
|
||||
* @SuppressWarnings(PHPMD.TooManyFields)
|
||||
|
@ -27,6 +27,7 @@ use Carbon\Carbon;
|
||||
|
||||
/**
|
||||
* Class Transaction
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.ShortVariable)
|
||||
|
@ -24,6 +24,7 @@ namespace FireflyIII\Services\Spectre\Request;
|
||||
|
||||
use FireflyIII\Services\Spectre\Object\Customer;
|
||||
use Log;
|
||||
|
||||
/**
|
||||
* Class NewCustomerRequest
|
||||
*/
|
||||
@ -37,12 +38,12 @@ class NewCustomerRequest extends SpectreRequest
|
||||
*/
|
||||
public function call(): void
|
||||
{
|
||||
$data = [
|
||||
$data = [
|
||||
'data' => [
|
||||
'identifier' => 'default_ff3_customer',
|
||||
],
|
||||
];
|
||||
$uri = '/api/v4/customers/';
|
||||
$uri = '/api/v4/customers/';
|
||||
Log::debug(sprintf('Going to call %s with info:', $uri), $data);
|
||||
$response = $this->sendSignedSpectrePost($uri, $data);
|
||||
// create customer:
|
||||
|
@ -211,7 +211,7 @@ abstract class SpectreRequest
|
||||
$statusCode = $res->getStatusCode();
|
||||
try {
|
||||
$returnBody = $res->getBody()->getContents();
|
||||
} catch (RunTimeException $e) {
|
||||
} catch (RuntimeException $e) {
|
||||
Log::error(sprintf('Could not get body from SpectreRequest::GET result: %s', $e->getMessage()));
|
||||
$returnBody = '';
|
||||
}
|
||||
@ -261,7 +261,7 @@ abstract class SpectreRequest
|
||||
|
||||
try {
|
||||
$body = $res->getBody()->getContents();
|
||||
} catch (RunTimeException $e) {
|
||||
} catch (RuntimeException $e) {
|
||||
Log::error(sprintf('Could not get body from SpectreRequest::POST result: %s', $e->getMessage()));
|
||||
$body = '';
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ class Amount
|
||||
$space = ' ';
|
||||
|
||||
// require space between symbol and amount?
|
||||
if ($sepBySpace === false) {
|
||||
if (false === $sepBySpace) {
|
||||
$space = ''; // no
|
||||
}
|
||||
|
||||
@ -134,8 +134,8 @@ class Amount
|
||||
// some complicated switches to format the amount correctly:
|
||||
$precedes = $amount < 0 ? $info['n_cs_precedes'] : $info['p_cs_precedes'];
|
||||
$separated = $amount < 0 ? $info['n_sep_by_space'] : $info['p_sep_by_space'];
|
||||
$space = $separated === true ? ' ' : '';
|
||||
$result = $precedes === false ? $formatted . $space . $format->symbol : $format->symbol . $space . $formatted;
|
||||
$space = true === $separated ? ' ' : '';
|
||||
$result = false === $precedes ? $formatted . $space . $format->symbol : $format->symbol . $space . $formatted;
|
||||
|
||||
if (true === $coloured) {
|
||||
if ($amount > 0) {
|
||||
|
@ -59,7 +59,7 @@ class SelectBudgetHandler implements YnabJobConfigurationInterface
|
||||
Log::debug('Now in SelectBudgetHandler::configComplete');
|
||||
$configuration = $this->repository->getConfiguration($this->importJob);
|
||||
$selectedBudget = $configuration['selected_budget'] ?? '';
|
||||
if ($selectedBudget !== '') {
|
||||
if ('' !== $selectedBudget) {
|
||||
Log::debug(sprintf('Selected budget is %s, config is complete. Return true.', $selectedBudget));
|
||||
$this->repository->setStage($this->importJob, 'get_accounts');
|
||||
|
||||
|
@ -22,6 +22,7 @@
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Support\Import\JobConfiguration\Ynab;
|
||||
|
||||
use FireflyIII\Models\ImportJob;
|
||||
use Illuminate\Support\MessageBag;
|
||||
|
||||
|
@ -147,6 +147,7 @@ class ImportableConverter
|
||||
Log::error($e->getTraceAsString());
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
@ -150,7 +150,7 @@ class ImportDataHandler
|
||||
$destination = $this->mapper->map($possibleDestinationId, $amount, $destinationData);
|
||||
if (1 === bccomp($amount, '0')) {
|
||||
[$source, $destination] = [$destination, $source];
|
||||
$type = $type === 'transfer' ? 'transfer' : 'deposit';
|
||||
$type = 'transfer' === $type ? 'transfer' : 'deposit';
|
||||
Log::debug(sprintf('Amount is %s, so switch source/dest and make this a %s', $amount, $type));
|
||||
}
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user