mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Various code cleanup.
This commit is contained in:
parent
5af026674f
commit
f0d3ca5d53
@ -84,7 +84,7 @@ class RecurrenceRequest extends Request
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
$today = Carbon::create()->addDay();
|
||||
$today = Carbon::now()->addDay();
|
||||
|
||||
return [
|
||||
'type' => 'required|in:withdrawal,transfer,deposit',
|
||||
|
@ -25,6 +25,8 @@ namespace FireflyIII\Generator\Report\Account;
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Generator\Report\ReportGeneratorInterface;
|
||||
use Illuminate\Support\Collection;
|
||||
use Log;
|
||||
use Throwable;
|
||||
|
||||
/**
|
||||
* Class MonthReportGenerator.
|
||||
@ -44,7 +46,6 @@ class MonthReportGenerator implements ReportGeneratorInterface
|
||||
* Generate the report.
|
||||
*
|
||||
* @return string
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function generate(): string
|
||||
{
|
||||
@ -52,11 +53,17 @@ class MonthReportGenerator implements ReportGeneratorInterface
|
||||
$expenseIds = implode(',', $this->expense->pluck('id')->toArray());
|
||||
$reportType = 'account';
|
||||
$preferredPeriod = $this->preferredPeriod();
|
||||
try {
|
||||
$result = view(
|
||||
'reports.account.report',
|
||||
compact('accountIds', 'reportType', 'expenseIds', 'preferredPeriod')
|
||||
)->with('start', $this->start)->with('end', $this->end)->render();
|
||||
} catch (Throwable $e) {
|
||||
Log::error(sprintf('Cannot render reports.account.report: %s', $e->getMessage()));
|
||||
$result = 'Could not render report view.';
|
||||
}
|
||||
|
||||
return view(
|
||||
'reports.account.report',
|
||||
compact('accountIds', 'reportType', 'expenseIds', 'preferredPeriod')
|
||||
)->with('start', $this->start)->with('end', $this->end)->render();
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -34,6 +34,8 @@ use FireflyIII\Models\Transaction;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
|
||||
use Illuminate\Support\Collection;
|
||||
use Log;
|
||||
use Throwable;
|
||||
|
||||
/**
|
||||
* Class MonthReportGenerator.
|
||||
@ -52,7 +54,6 @@ class MonthReportGenerator implements ReportGeneratorInterface
|
||||
*
|
||||
* @return string
|
||||
* @throws FireflyException
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function generate(): string
|
||||
{
|
||||
@ -78,10 +79,16 @@ class MonthReportGenerator implements ReportGeneratorInterface
|
||||
'internal_reference', 'notes',
|
||||
'create_date', 'update_date',
|
||||
];
|
||||
try {
|
||||
$result = view('reports.audit.report', compact('reportType', 'accountIds', 'auditData', 'hideable', 'defaultShow'))
|
||||
->with('start', $this->start)->with('end', $this->end)->with('accounts', $this->accounts)
|
||||
->render();
|
||||
} catch (Throwable $e) {
|
||||
Log::error(sprintf('Cannot render reports.audit.report: %s', $e->getMessage()));
|
||||
$result = 'Could not render report view.';
|
||||
}
|
||||
|
||||
return view('reports.audit.report', compact('reportType', 'accountIds', 'auditData', 'hideable', 'defaultShow'))
|
||||
->with('start', $this->start)->with('end', $this->end)->with('accounts', $this->accounts)
|
||||
->render();
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -35,6 +35,7 @@ use FireflyIII\Models\Transaction;
|
||||
use FireflyIII\Models\TransactionType;
|
||||
use Illuminate\Support\Collection;
|
||||
use Log;
|
||||
use Throwable;
|
||||
|
||||
/**
|
||||
* Class MonthReportGenerator.
|
||||
@ -64,7 +65,6 @@ class MonthReportGenerator extends Support implements ReportGeneratorInterface
|
||||
* Generates the report.
|
||||
*
|
||||
* @return string
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function generate(): string
|
||||
{
|
||||
@ -77,11 +77,17 @@ class MonthReportGenerator extends Support implements ReportGeneratorInterface
|
||||
$topExpenses = $this->getTopExpenses();
|
||||
|
||||
// render!
|
||||
return view('reports.budget.month', compact('accountIds', 'budgetIds', 'accountSummary', 'budgetSummary', 'averageExpenses', 'topExpenses'))
|
||||
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();
|
||||
} catch (Throwable $e) {
|
||||
Log::error(sprintf('Cannot render reports.account.report: %s', $e->getMessage()));
|
||||
$result = 'Could not render report view.';
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -36,6 +36,7 @@ use FireflyIII\Models\Transaction;
|
||||
use FireflyIII\Models\TransactionType;
|
||||
use Illuminate\Support\Collection;
|
||||
use Log;
|
||||
use Throwable;
|
||||
|
||||
/**
|
||||
* Class MonthReportGenerator.
|
||||
@ -68,7 +69,6 @@ class MonthReportGenerator extends Support implements ReportGeneratorInterface
|
||||
* Generates the report.
|
||||
*
|
||||
* @return string
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function generate(): string
|
||||
{
|
||||
@ -85,24 +85,23 @@ class MonthReportGenerator extends Support implements ReportGeneratorInterface
|
||||
$topIncome = $this->getTopIncome();
|
||||
|
||||
// render!
|
||||
return view(
|
||||
'reports.category.month',
|
||||
compact(
|
||||
'accountIds',
|
||||
'categoryIds',
|
||||
'topIncome',
|
||||
'reportType',
|
||||
'accountSummary',
|
||||
'categorySummary',
|
||||
'averageExpenses',
|
||||
'averageIncome',
|
||||
'topExpenses'
|
||||
try {
|
||||
return view(
|
||||
'reports.category.month', compact(
|
||||
'accountIds', 'categoryIds', 'topIncome', 'reportType', 'accountSummary', 'categorySummary', 'averageExpenses',
|
||||
'averageIncome', 'topExpenses'
|
||||
)
|
||||
)
|
||||
)
|
||||
->with('start', $this->start)->with('end', $this->end)
|
||||
->with('categories', $this->categories)
|
||||
->with('accounts', $this->accounts)
|
||||
->render();
|
||||
->with('start', $this->start)->with('end', $this->end)
|
||||
->with('categories', $this->categories)
|
||||
->with('accounts', $this->accounts)
|
||||
->render();
|
||||
} catch (Throwable $e) {
|
||||
Log::error(sprintf('Cannot render reports.category.month: %s', $e->getMessage()));
|
||||
$result = 'Could not render report view.';
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -26,6 +26,8 @@ use Carbon\Carbon;
|
||||
use FireflyIII\Generator\Report\ReportGeneratorInterface;
|
||||
use FireflyIII\Helpers\Report\ReportHelperInterface;
|
||||
use Illuminate\Support\Collection;
|
||||
use Log;
|
||||
use Throwable;
|
||||
|
||||
/**
|
||||
* Class MonthReportGenerator.
|
||||
@ -43,7 +45,6 @@ class MonthReportGenerator implements ReportGeneratorInterface
|
||||
* Generates the report.
|
||||
*
|
||||
* @return string
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function generate(): string
|
||||
{
|
||||
@ -53,11 +54,17 @@ class MonthReportGenerator implements ReportGeneratorInterface
|
||||
$accountIds = implode(',', $this->accounts->pluck('id')->toArray());
|
||||
$reportType = 'default';
|
||||
|
||||
// continue!
|
||||
return view(
|
||||
'reports.default.month',
|
||||
compact('bills', 'accountIds', 'reportType')
|
||||
)->with('start', $this->start)->with('end', $this->end)->render();
|
||||
try {
|
||||
return view(
|
||||
'reports.default.month',
|
||||
compact('bills', 'accountIds', 'reportType')
|
||||
)->with('start', $this->start)->with('end', $this->end)->render();
|
||||
} catch (Throwable $e) {
|
||||
Log::error(sprintf('Cannot render reports.default.month: %s', $e->getMessage()));
|
||||
$result = 'Could not render report view.';
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -25,6 +25,8 @@ namespace FireflyIII\Generator\Report\Standard;
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Generator\Report\ReportGeneratorInterface;
|
||||
use Illuminate\Support\Collection;
|
||||
use Log;
|
||||
use Throwable;
|
||||
|
||||
/**
|
||||
* Class MonthReportGenerator.
|
||||
@ -42,7 +44,6 @@ class MultiYearReportGenerator implements ReportGeneratorInterface
|
||||
* Generates the report.
|
||||
*
|
||||
* @return string
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function generate(): string
|
||||
{
|
||||
@ -50,11 +51,17 @@ class MultiYearReportGenerator implements ReportGeneratorInterface
|
||||
$accountIds = implode(',', $this->accounts->pluck('id')->toArray());
|
||||
$reportType = 'default';
|
||||
|
||||
// continue!
|
||||
return view(
|
||||
'reports.default.multi-year',
|
||||
compact('accountIds', 'reportType')
|
||||
)->with('start', $this->start)->with('end', $this->end)->render();
|
||||
try {
|
||||
return view(
|
||||
'reports.default.multi-year',
|
||||
compact('accountIds', 'reportType')
|
||||
)->with('start', $this->start)->with('end', $this->end)->render();
|
||||
} catch (Throwable $e) {
|
||||
Log::error(sprintf('Cannot render reports.default.multi-year: %s', $e->getMessage()));
|
||||
$result = 'Could not render report view.';
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -25,6 +25,8 @@ namespace FireflyIII\Generator\Report\Standard;
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Generator\Report\ReportGeneratorInterface;
|
||||
use Illuminate\Support\Collection;
|
||||
use Log;
|
||||
use Throwable;
|
||||
|
||||
/**
|
||||
* Class MonthReportGenerator.
|
||||
@ -42,7 +44,6 @@ class YearReportGenerator implements ReportGeneratorInterface
|
||||
* Generates the report.
|
||||
*
|
||||
* @return string
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function generate(): string
|
||||
{
|
||||
@ -50,13 +51,20 @@ class YearReportGenerator implements ReportGeneratorInterface
|
||||
$accountIds = implode(',', $this->accounts->pluck('id')->toArray());
|
||||
$reportType = 'default';
|
||||
|
||||
// continue!
|
||||
return view(
|
||||
'reports.default.year',
|
||||
compact('accountIds', 'reportType')
|
||||
)->with('start', $this->start)->with('end', $this->end)->render();
|
||||
try {
|
||||
$result = view(
|
||||
'reports.default.year',
|
||||
compact('accountIds', 'reportType')
|
||||
)->with('start', $this->start)->with('end', $this->end)->render();
|
||||
} catch (Throwable $e) {
|
||||
Log::error(sprintf('Cannot render reports.account.report: %s', $e->getMessage()));
|
||||
$result = 'Could not render report view.';
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the accounts.
|
||||
*
|
||||
|
@ -38,6 +38,7 @@ use FireflyIII\Models\Transaction;
|
||||
use FireflyIII\Models\TransactionType;
|
||||
use Illuminate\Support\Collection;
|
||||
use Log;
|
||||
use Throwable;
|
||||
|
||||
/**
|
||||
* Class MonthReportGenerator.
|
||||
@ -70,7 +71,6 @@ class MonthReportGenerator extends Support implements ReportGeneratorInterface
|
||||
* Generate the report.
|
||||
*
|
||||
* @return string
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function generate(): string
|
||||
{
|
||||
@ -87,20 +87,18 @@ class MonthReportGenerator extends Support implements ReportGeneratorInterface
|
||||
$topIncome = $this->getTopIncome();
|
||||
|
||||
// render!
|
||||
return view(
|
||||
'reports.tag.month',
|
||||
compact(
|
||||
'accountIds',
|
||||
'tagTags',
|
||||
'reportType',
|
||||
'accountSummary',
|
||||
'tagSummary',
|
||||
'averageExpenses',
|
||||
'averageIncome',
|
||||
'topIncome',
|
||||
'topExpenses'
|
||||
try {
|
||||
$result = view(
|
||||
'reports.tag.month', compact(
|
||||
'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();
|
||||
)->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()));
|
||||
$result = 'Could not render report view.';
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -142,7 +142,7 @@ class ShowController extends Controller
|
||||
public function show(Request $request, Budget $budget)
|
||||
{
|
||||
/** @var Carbon $start */
|
||||
$start = session('first', Carbon::create()->startOfYear());
|
||||
$start = session('first', Carbon::now()->startOfYear());
|
||||
$end = new Carbon;
|
||||
$page = (int)$request->get('page');
|
||||
$pageSize = (int)app('preferences')->get('listPageSize', 50)->data;
|
||||
@ -196,7 +196,7 @@ class ShowController extends Controller
|
||||
$transactions = $collector->getPaginatedJournals();
|
||||
$transactions->setPath(route('budgets.show', [$budget->id, $budgetLimit->id]));
|
||||
/** @var Carbon $start */
|
||||
$start = session('first', Carbon::create()->startOfYear());
|
||||
$start = session('first', Carbon::now()->startOfYear());
|
||||
$end = new Carbon;
|
||||
$limits = $this->getLimits($budget, $start, $end);
|
||||
|
||||
|
@ -90,9 +90,9 @@ class ShowController extends Controller
|
||||
{
|
||||
Log::debug('Now in show()');
|
||||
/** @var Carbon $start */
|
||||
$start = $start ?? session('start', Carbon::create()->startOfMonth());
|
||||
$start = $start ?? session('start', Carbon::now()->startOfMonth());
|
||||
/** @var Carbon $end */
|
||||
$end = $end ?? session('end', Carbon::create()->startOfMonth());
|
||||
$end = $end ?? session('end', Carbon::now()->startOfMonth());
|
||||
$subTitleIcon = 'fa-bar-chart';
|
||||
$moment = '';
|
||||
$page = (int)$request->get('page');
|
||||
|
@ -120,7 +120,7 @@ class DebugController extends Controller
|
||||
$phpVersion = str_replace($search, $replace, PHP_VERSION);
|
||||
$phpOs = str_replace($search, $replace, PHP_OS);
|
||||
$interface = PHP_SAPI;
|
||||
$now = Carbon::create()->format('Y-m-d H:i:s e');
|
||||
$now = Carbon::now()->format('Y-m-d H:i:s e');
|
||||
$extensions = implode(', ', get_loaded_extensions());
|
||||
$drivers = implode(', ', DB::availableDrivers());
|
||||
$currentDriver = DB::getDriverName();
|
||||
|
@ -125,7 +125,7 @@ class ExportController extends Controller
|
||||
$formats = array_keys(config('firefly.export_formats'));
|
||||
$defaultFormat = app('preferences')->get('export_format', config('firefly.default_export_format'))->data;
|
||||
$first = session('first')->format('Y-m-d');
|
||||
$today = Carbon::create()->format('Y-m-d');
|
||||
$today = Carbon::now()->format('Y-m-d');
|
||||
|
||||
return view('export.index', compact('job', 'formats', 'defaultFormat', 'first', 'today'));
|
||||
}
|
||||
|
@ -36,6 +36,8 @@ class CallbackController extends Controller
|
||||
{
|
||||
|
||||
/**
|
||||
* Callback specifically for YNAB logins.
|
||||
*
|
||||
* @param Request $request
|
||||
*
|
||||
* @param ImportJobRepositoryInterface $repository
|
||||
|
@ -37,7 +37,7 @@ use Log;
|
||||
*/
|
||||
class IndexController extends Controller
|
||||
{
|
||||
/** @var array */
|
||||
/** @var array All available providers */
|
||||
public $providers;
|
||||
/** @var ImportJobRepositoryInterface The import job repository */
|
||||
public $repository;
|
||||
|
@ -26,6 +26,8 @@ use FireflyIII\Http\Controllers\Controller;
|
||||
use FireflyIII\Models\PiggyBank;
|
||||
use FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Log;
|
||||
use Throwable;
|
||||
|
||||
/**
|
||||
* Class FrontpageController.
|
||||
@ -38,7 +40,6 @@ class FrontpageController extends Controller
|
||||
* @param PiggyBankRepositoryInterface $repository
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function piggyBanks(PiggyBankRepositoryInterface $repository): JsonResponse
|
||||
{
|
||||
@ -64,7 +65,12 @@ class FrontpageController extends Controller
|
||||
}
|
||||
$html = '';
|
||||
if (\count($info) > 0) {
|
||||
$html = view('json.piggy-banks', compact('info'))->render();
|
||||
try {
|
||||
$html = view('json.piggy-banks', compact('info'))->render();
|
||||
} catch (Throwable $e) {
|
||||
Log::error(sprintf('Cannot render json.piggy-banks: %s', $e->getMessage()));
|
||||
$html = 'Could not render view.';
|
||||
}
|
||||
}
|
||||
|
||||
return response()->json(['html' => $html]);
|
||||
|
@ -24,6 +24,8 @@ namespace FireflyIII\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Log;
|
||||
use Throwable;
|
||||
|
||||
/**
|
||||
* Class JsonController.
|
||||
@ -36,7 +38,6 @@ class JsonController extends Controller
|
||||
* @param Request $request
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function action(Request $request): JsonResponse
|
||||
{
|
||||
@ -46,7 +47,12 @@ class JsonController extends Controller
|
||||
foreach ($keys as $key) {
|
||||
$actions[$key] = (string)trans('firefly.rule_action_' . $key . '_choice');
|
||||
}
|
||||
$view = view('rules.partials.action', compact('actions', 'count'))->render();
|
||||
try {
|
||||
$view = view('rules.partials.action', compact('actions', 'count'))->render();
|
||||
} catch (Throwable $e) {
|
||||
Log::error(sprintf('Cannot render rules.partials.action: %s', $e->getMessage()));
|
||||
$view = 'Could not render view.';
|
||||
}
|
||||
|
||||
return response()->json(['html' => $view]);
|
||||
}
|
||||
@ -57,7 +63,6 @@ class JsonController extends Controller
|
||||
* @param Request $request
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function trigger(Request $request): JsonResponse
|
||||
{
|
||||
@ -71,7 +76,12 @@ class JsonController extends Controller
|
||||
}
|
||||
asort($triggers);
|
||||
|
||||
$view = view('rules.partials.trigger', compact('triggers', 'count'))->render();
|
||||
try {
|
||||
$view = view('rules.partials.trigger', compact('triggers', 'count'))->render();
|
||||
} catch (Throwable $e) {
|
||||
Log::error(sprintf('Cannot render rules.partials.trigger: %s', $e->getMessage()));
|
||||
$view = 'Could not render view.';
|
||||
}
|
||||
|
||||
return response()->json(['html' => $view]);
|
||||
}
|
||||
|
@ -274,7 +274,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::create()->startOfMonth();
|
||||
$date = Carbon::now()->startOfMonth();
|
||||
$attributes['startDate'] = $date;
|
||||
}
|
||||
|
||||
@ -282,7 +282,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::create()->startOfMonth();
|
||||
$date = Carbon::now()->startOfMonth();
|
||||
$attributes['endDate'] = $date;
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,7 @@ class OperationsController extends Controller
|
||||
private $tasker;
|
||||
|
||||
/**
|
||||
*
|
||||
* OperationsController constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
|
@ -36,6 +36,7 @@ use FireflyIII\Repositories\Tag\TagRepositoryInterface;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Support\Collection;
|
||||
use Log;
|
||||
use Throwable;
|
||||
|
||||
/**
|
||||
* Class ReportController.
|
||||
@ -277,7 +278,6 @@ class ReportController extends Controller
|
||||
*
|
||||
* @return mixed
|
||||
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function options(string $reportType)
|
||||
{
|
||||
@ -391,7 +391,6 @@ class ReportController extends Controller
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View|string
|
||||
*
|
||||
* @throws \FireflyIII\Exceptions\FireflyException
|
||||
*/
|
||||
public function tagReport(Collection $accounts, Collection $tags, Carbon $start, Carbon $end)
|
||||
@ -423,7 +422,6 @@ class ReportController extends Controller
|
||||
* Get options for account report.
|
||||
*
|
||||
* @return string
|
||||
* @throws \Throwable
|
||||
*/
|
||||
private function accountReportOptions(): string
|
||||
{
|
||||
@ -438,52 +436,77 @@ class ReportController extends Controller
|
||||
$set->push($exp);
|
||||
}
|
||||
}
|
||||
try {
|
||||
$result = view('reports.options.account', compact('set'))->render();
|
||||
} catch (Throwable $e) {
|
||||
Log::error(sprintf('Cannot render reports.options.tag: %s', $e->getMessage()));
|
||||
$result = 'Could not render view.';
|
||||
}
|
||||
|
||||
return view('reports.options.account', compact('set'))->render();
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get options for budget report.
|
||||
*
|
||||
* @return string
|
||||
* @throws \Throwable
|
||||
*/
|
||||
private function budgetReportOptions(): string
|
||||
{
|
||||
/** @var BudgetRepositoryInterface $repository */
|
||||
$repository = app(BudgetRepositoryInterface::class);
|
||||
$budgets = $repository->getBudgets();
|
||||
try {
|
||||
$result = view('reports.options.budget', compact('budgets'))->render();
|
||||
} catch (Throwable $e) {
|
||||
Log::error(sprintf('Cannot render reports.options.tag: %s', $e->getMessage()));
|
||||
$result = 'Could not render view.';
|
||||
}
|
||||
|
||||
return view('reports.options.budget', compact('budgets'))->render();
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get options for category report.
|
||||
*
|
||||
* @return string
|
||||
* @throws \Throwable
|
||||
*/
|
||||
private function categoryReportOptions(): string
|
||||
{
|
||||
/** @var CategoryRepositoryInterface $repository */
|
||||
$repository = app(CategoryRepositoryInterface::class);
|
||||
$categories = $repository->getCategories();
|
||||
try {
|
||||
$result = view('reports.options.category', compact('categories'))->render();
|
||||
} catch (Throwable $e) {
|
||||
Log::error(sprintf('Cannot render reports.options.category: %s', $e->getMessage()));
|
||||
$result = 'Could not render view.';
|
||||
}
|
||||
|
||||
return view('reports.options.category', compact('categories'))->render();
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get options for default report.
|
||||
*
|
||||
* @return string
|
||||
* @throws \Throwable
|
||||
*/
|
||||
private function noReportOptions(): string
|
||||
{
|
||||
return view('reports.options.no-options')->render();
|
||||
try {
|
||||
$result = view('reports.options.no-options')->render();
|
||||
} catch (Throwable $e) {
|
||||
Log::error(sprintf('Cannot render reports.options.no-options: %s', $e->getMessage()));
|
||||
$result = 'Could not render view.';
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get options for tag report.
|
||||
*
|
||||
* @return string
|
||||
* @throws \Throwable
|
||||
*/
|
||||
private function tagReportOptions(): string
|
||||
{
|
||||
@ -494,7 +517,13 @@ class ReportController extends Controller
|
||||
return $tag->tag;
|
||||
}
|
||||
);
|
||||
try {
|
||||
$result = view('reports.options.tag', compact('tags'))->render();
|
||||
} catch (Throwable $e) {
|
||||
Log::error(sprintf('Cannot render reports.options.tag: %s', $e->getMessage()));
|
||||
$result = 'Could not render view.';
|
||||
}
|
||||
|
||||
return view('reports.options.tag', compact('tags'))->render();
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
@ -118,7 +118,7 @@ class SelectController extends Controller
|
||||
{
|
||||
// does the user have shared accounts?
|
||||
$first = session('first')->format('Y-m-d');
|
||||
$today = Carbon::create()->format('Y-m-d');
|
||||
$today = Carbon::now()->format('Y-m-d');
|
||||
$subTitle = (string)trans('firefly.apply_rule_selection', ['title' => $rule->title]);
|
||||
|
||||
return view('rules.rule.select-transactions', compact('first', 'today', 'rule', 'subTitle'));
|
||||
|
@ -208,7 +208,7 @@ class RuleGroupController extends Controller
|
||||
public function selectTransactions(RuleGroup $ruleGroup)
|
||||
{
|
||||
$first = session('first')->format('Y-m-d');
|
||||
$today = Carbon::create()->format('Y-m-d');
|
||||
$today = Carbon::now()->format('Y-m-d');
|
||||
$subTitle = (string)trans('firefly.apply_rule_group_selection', ['title' => $ruleGroup->title]);
|
||||
|
||||
return view('rules.rule-group.select-transactions', compact('first', 'today', 'ruleGroup', 'subTitle'));
|
||||
|
@ -27,6 +27,8 @@ use FireflyIII\Support\Search\SearchInterface;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Collection;
|
||||
use Log;
|
||||
use Throwable;
|
||||
|
||||
/**
|
||||
* Class SearchController.
|
||||
@ -77,7 +79,6 @@ class SearchController extends Controller
|
||||
* @param SearchInterface $searcher
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function search(Request $request, SearchInterface $searcher): JsonResponse
|
||||
{
|
||||
@ -99,8 +100,12 @@ class SearchController extends Controller
|
||||
$transactions = $searcher->searchTransactions();
|
||||
$cache->store($transactions);
|
||||
}
|
||||
|
||||
$html = view('search.search', compact('transactions'))->render();
|
||||
try {
|
||||
$html = view('search.search', compact('transactions'))->render();
|
||||
} catch (Throwable $e) {
|
||||
Log::error(sprintf('Cannot render search.search: %s', $e->getMessage()));
|
||||
$html = 'Could not render view.';
|
||||
}
|
||||
|
||||
return response()->json(['count' => $transactions->count(), 'html' => $html]);
|
||||
}
|
||||
|
@ -262,7 +262,7 @@ class TransactionController extends Controller
|
||||
{
|
||||
$range = app('preferences')->get('viewRange', '1M')->data;
|
||||
$first = $this->repository->firstNull();
|
||||
$start = Carbon::create()->subYear();
|
||||
$start = Carbon::now()->subYear();
|
||||
$types = config('firefly.transactionTypesByWhat.' . $what);
|
||||
$entries = new Collection;
|
||||
if (null !== $first) {
|
||||
|
@ -48,7 +48,7 @@ class AccountFormRequest extends Request
|
||||
*/
|
||||
public function getAccountData(): array
|
||||
{
|
||||
return [
|
||||
$data = [
|
||||
'name' => $this->string('name'),
|
||||
'active' => $this->boolean('active'),
|
||||
'accountType' => $this->string('what'),
|
||||
@ -64,7 +64,22 @@ class AccountFormRequest extends Request
|
||||
'ccType' => $this->string('ccType'),
|
||||
'ccMonthlyPaymentDate' => $this->string('ccMonthlyPaymentDate'),
|
||||
'notes' => $this->string('notes'),
|
||||
'interest' => $this->string('interest'),
|
||||
'interest_period' => $this->string('interest_period'),
|
||||
];
|
||||
|
||||
// if the account type is "liabilities" there are actually four types of liability
|
||||
// that could have been selected.
|
||||
if ($data['accountType'] === 'liabilities') {
|
||||
$data['accountType'] = null;
|
||||
$data['account_type_id'] = $this->integer('liability_type_id');
|
||||
// also reverse the opening balance:
|
||||
if ('' !== $data['openingBalance']) {
|
||||
$data['openingBalance'] = bcmul($data['openingBalance'], '-1');
|
||||
}
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -93,8 +108,14 @@ class AccountFormRequest extends Request
|
||||
'amount_currency_id_openingBalance' => 'exists:transaction_currencies,id',
|
||||
'amount_currency_id_virtualBalance' => 'exists:transaction_currencies,id',
|
||||
'what' => 'in:' . $types,
|
||||
'interest_period' => 'in:daily,monthly,yearly',
|
||||
];
|
||||
|
||||
if ('liabilities' === $this->get('what')) {
|
||||
$rules['openingBalance'] = 'numeric|required|more:0';
|
||||
$rules['openingBalanceDate'] = 'date|required';
|
||||
}
|
||||
|
||||
/** @var Account $account */
|
||||
$account = $this->route()->parameter('account');
|
||||
if (null !== $account) {
|
||||
|
@ -50,7 +50,7 @@ class ExportFormRequest extends Request
|
||||
/** @var Carbon $sessionFirst */
|
||||
$sessionFirst = clone session('first');
|
||||
$first = $sessionFirst->subDay()->format('Y-m-d');
|
||||
$today = Carbon::create()->addDay()->format('Y-m-d');
|
||||
$today = Carbon::now()->addDay()->format('Y-m-d');
|
||||
$formats = implode(',', array_keys(config('firefly.export_formats')));
|
||||
|
||||
// fixed
|
||||
|
@ -149,7 +149,7 @@ class RecurrenceFormRequest extends Request
|
||||
public function rules(): array
|
||||
{
|
||||
$today = new Carbon;
|
||||
$tomorrow = Carbon::create()->addDay();
|
||||
$tomorrow = Carbon::now()->addDay();
|
||||
$rules = [
|
||||
// mandatory info for recurrence.
|
||||
'title' => 'required|between:1,255|uniqueObjectForUser:recurrences,title',
|
||||
|
@ -53,7 +53,7 @@ class SelectTransactionsRequest extends Request
|
||||
/** @var Carbon $sessionFirst */
|
||||
$sessionFirst = clone session('first');
|
||||
$first = $sessionFirst->subDay()->format('Y-m-d');
|
||||
$today = Carbon::create()->addDay()->format('Y-m-d');
|
||||
$today = Carbon::now()->addDay()->format('Y-m-d');
|
||||
|
||||
return [
|
||||
'start_date' => 'required|date|after:' . $first,
|
||||
|
@ -26,6 +26,7 @@ namespace FireflyIII\Import\Storage;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use DB;
|
||||
use FireflyIII\Events\RequestedReportOnJournals;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Helpers\Collector\JournalCollectorInterface;
|
||||
use FireflyIII\Helpers\Filter\InternalTransferFilter;
|
||||
@ -114,6 +115,9 @@ class ImportArrayStorage
|
||||
|
||||
app('preferences')->mark();
|
||||
|
||||
// email about this:
|
||||
event(new RequestedReportOnJournals($this->importJob->user_id, $collection));
|
||||
|
||||
return $collection;
|
||||
}
|
||||
|
||||
|
@ -75,18 +75,20 @@ class Account extends Model
|
||||
'active' => 'boolean',
|
||||
'encrypted' => 'boolean',
|
||||
];
|
||||
/** @var array */
|
||||
/** @var array Fields that can be filled */
|
||||
protected $fillable = ['user_id', 'account_type_id', 'name', 'active', 'virtual_balance', 'iban'];
|
||||
/** @var array */
|
||||
/** @var array Hidden from view */
|
||||
protected $hidden = ['encrypted'];
|
||||
/** @var bool */
|
||||
private $joinedAccountTypes;
|
||||
|
||||
/**
|
||||
* Route binder. Converts the key in the URL to the specified object (or throw 404).
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return Account
|
||||
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
|
||||
* @throws NotFoundHttpException
|
||||
*/
|
||||
public static function routeBinder(string $value): Account
|
||||
{
|
||||
|
@ -44,11 +44,9 @@ class AccountMeta extends Model
|
||||
'created_at' => 'datetime',
|
||||
'updated_at' => 'datetime',
|
||||
];
|
||||
/** @var array */
|
||||
/** @var array Fields that can be filled */
|
||||
protected $fillable = ['account_id', 'name', 'data'];
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
/** @var string The table to store the data in */
|
||||
protected $table = 'account_meta';
|
||||
|
||||
/**
|
||||
|
@ -35,25 +35,43 @@ 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 */
|
||||
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';
|
||||
/**
|
||||
* The attributes that should be casted to native types.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts
|
||||
= [
|
||||
'created_at' => 'datetime',
|
||||
'updated_at' => 'datetime',
|
||||
];
|
||||
/** @var array */
|
||||
/** @var array Fields that can be filled */
|
||||
protected $fillable = ['type'];
|
||||
|
||||
/**
|
||||
|
@ -66,14 +66,16 @@ class Attachment extends Model
|
||||
'deleted_at' => 'datetime',
|
||||
'uploaded' => 'boolean',
|
||||
];
|
||||
/** @var array */
|
||||
/** @var array Fields that can be filled */
|
||||
protected $fillable = ['attachable_id', 'attachable_type', 'user_id', 'md5', 'filename', 'mime', 'title', 'description', 'size', 'uploaded'];
|
||||
|
||||
/**
|
||||
* Route binder. Converts the key in the URL to the specified object (or throw 404).
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return Attachment
|
||||
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
|
||||
* @throws NotFoundHttpException
|
||||
*/
|
||||
public static function routeBinder(string $value): Attachment
|
||||
{
|
||||
|
@ -58,14 +58,16 @@ class AvailableBudget extends Model
|
||||
'start_date' => 'date',
|
||||
'end_date' => 'date',
|
||||
];
|
||||
/** @var array */
|
||||
/** @var array Fields that can be filled */
|
||||
protected $fillable = ['user_id', 'transaction_currency_id', 'amount', 'start_date', 'end_date'];
|
||||
|
||||
/**
|
||||
* Route binder. Converts the key in the URL to the specified object (or throw 404).
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return AvailableBudget
|
||||
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
|
||||
* @throws NotFoundHttpException
|
||||
*/
|
||||
public static function routeBinder(string $value): AvailableBudget
|
||||
{
|
||||
@ -84,7 +86,7 @@ class AvailableBudget extends Model
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function transactionCurrency(): BelongsTo
|
||||
{
|
||||
|
@ -77,22 +77,21 @@ class Bill extends Model
|
||||
'name_encrypted' => 'boolean',
|
||||
'match_encrypted' => 'boolean',
|
||||
];
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
|
||||
/** @var array Fields that can be filled */
|
||||
protected $fillable
|
||||
= ['name', 'match', 'amount_min', 'match_encrypted', 'name_encrypted', 'user_id', 'amount_max', 'date', 'repeat_freq', 'skip',
|
||||
'automatch', 'active', 'transaction_currency_id'];
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
/** @var array Hidden from view */
|
||||
protected $hidden = ['amount_min_encrypted', 'amount_max_encrypted', 'name_encrypted', 'match_encrypted'];
|
||||
|
||||
/**
|
||||
* Route binder. Converts the key in the URL to the specified object (or throw 404).
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return Bill
|
||||
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
|
||||
* @throws NotFoundHttpException
|
||||
*/
|
||||
public static function routeBinder(string $value): Bill
|
||||
{
|
||||
|
@ -26,6 +26,8 @@ use Crypt;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Support\Collection;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
@ -58,16 +60,18 @@ class Budget extends Model
|
||||
'active' => 'boolean',
|
||||
'encrypted' => 'boolean',
|
||||
];
|
||||
/** @var array */
|
||||
/** @var array Fields that can be filled */
|
||||
protected $fillable = ['user_id', 'name', 'active'];
|
||||
/** @var array */
|
||||
/** @var array Hidden from view */
|
||||
protected $hidden = ['encrypted'];
|
||||
|
||||
/**
|
||||
* Route binder. Converts the key in the URL to the specified object (or throw 404).
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return Budget
|
||||
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
|
||||
* @throws NotFoundHttpException
|
||||
*/
|
||||
public static function routeBinder(string $value): Budget
|
||||
{
|
||||
@ -86,9 +90,9 @@ class Budget extends Model
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
* @return HasMany
|
||||
*/
|
||||
public function budgetlimits(): \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
public function budgetlimits(): HasMany
|
||||
{
|
||||
return $this->hasMany(BudgetLimit::class);
|
||||
}
|
||||
@ -126,18 +130,18 @@ class Budget extends Model
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
|
||||
* @return BelongsToMany
|
||||
*/
|
||||
public function transactionJournals(): \Illuminate\Database\Eloquent\Relations\BelongsToMany
|
||||
public function transactionJournals(): BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(TransactionJournal::class, 'budget_transaction_journal', 'budget_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
|
||||
* @return BelongsToMany
|
||||
*/
|
||||
public function transactions(): \Illuminate\Database\Eloquent\Relations\BelongsToMany
|
||||
public function transactions(): BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(Transaction::class, 'budget_transaction', 'budget_id');
|
||||
}
|
||||
|
@ -54,13 +54,17 @@ class BudgetLimit extends Model
|
||||
'start_date' => 'date',
|
||||
'end_date' => 'date',
|
||||
];
|
||||
|
||||
/** @var array Fields that can be filled */
|
||||
protected $fillable = ['budget_id', 'start_date', 'end_date', 'amount'];
|
||||
|
||||
/**
|
||||
* Route binder. Converts the key in the URL to the specified object (or throw 404).
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return mixed
|
||||
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
|
||||
* @throws NotFoundHttpException
|
||||
*/
|
||||
public static function routeBinder(string $value): BudgetLimit
|
||||
{
|
||||
|
@ -18,6 +18,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Models;
|
||||
@ -27,6 +28,7 @@ use Crypt;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
|
||||
@ -55,16 +57,18 @@ class Category extends Model
|
||||
'deleted_at' => 'datetime',
|
||||
'encrypted' => 'boolean',
|
||||
];
|
||||
/** @var array */
|
||||
/** @var array Fields that can be filled */
|
||||
protected $fillable = ['user_id', 'name'];
|
||||
/** @var array */
|
||||
/** @var array Hidden from view */
|
||||
protected $hidden = ['encrypted'];
|
||||
|
||||
/**
|
||||
* Route binder. Converts the key in the URL to the specified object (or throw 404).
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return Category
|
||||
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
|
||||
* @throws NotFoundHttpException
|
||||
*/
|
||||
public static function routeBinder(string $value): Category
|
||||
{
|
||||
@ -114,18 +118,18 @@ class Category extends Model
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
|
||||
* @return BelongsToMany
|
||||
*/
|
||||
public function transactionJournals(): \Illuminate\Database\Eloquent\Relations\BelongsToMany
|
||||
public function transactionJournals(): BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(TransactionJournal::class, 'category_transaction_journal', 'category_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
|
||||
* @return BelongsToMany
|
||||
*/
|
||||
public function transactions(): \Illuminate\Database\Eloquent\Relations\BelongsToMany
|
||||
public function transactions(): BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(Transaction::class, 'category_transaction', 'category_id');
|
||||
}
|
||||
|
@ -44,10 +44,9 @@ class Configuration extends Model
|
||||
= [
|
||||
'created_at' => 'datetime',
|
||||
'updated_at' => 'datetime',
|
||||
'deleted_at' => 'datetime',
|
||||
];
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
/** @var string The table to store the data in */
|
||||
protected $table = 'configuration';
|
||||
|
||||
/**
|
||||
|
@ -43,8 +43,16 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
*/
|
||||
class CurrencyExchangeRate extends Model
|
||||
{
|
||||
/** @var array */
|
||||
protected $dates = ['date'];
|
||||
/** @var array Convert these fields to other data types */
|
||||
protected $casts
|
||||
= [
|
||||
'created_at' => 'datetime',
|
||||
'updated_at' => 'datetime',
|
||||
'user_id' => 'int',
|
||||
'from_currency_id' => 'int',
|
||||
'to_currency_id' => 'int',
|
||||
'date' => 'datetime',
|
||||
];
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
|
@ -24,6 +24,7 @@ namespace FireflyIII\Models;
|
||||
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
|
||||
/**
|
||||
@ -37,7 +38,11 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
*/
|
||||
class ExportJob extends Model
|
||||
{
|
||||
/** @var array */
|
||||
/**
|
||||
* The attributes that should be casted to native types.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts
|
||||
= [
|
||||
'created_at' => 'datetime',
|
||||
@ -45,6 +50,8 @@ class ExportJob extends Model
|
||||
];
|
||||
|
||||
/**
|
||||
* Route binder. Converts the key in the URL to the specified object (or throw 404).
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return ExportJob
|
||||
@ -67,9 +74,12 @@ class ExportJob extends Model
|
||||
}
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
* Change the status of this export job.
|
||||
*
|
||||
* @param $status
|
||||
*
|
||||
* @deprecated
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function change($status): void
|
||||
{
|
||||
@ -78,10 +88,13 @@ class ExportJob extends Model
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the user this objects belongs to.
|
||||
*
|
||||
*
|
||||
* @return BelongsTo
|
||||
* @codeCoverageIgnore
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function user(): \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
public function user(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
|
@ -24,6 +24,7 @@ namespace FireflyIII\Models;
|
||||
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
|
||||
/**
|
||||
@ -61,10 +62,12 @@ class ImportJob extends Model
|
||||
'transactions' => 'array',
|
||||
'errors' => 'array',
|
||||
];
|
||||
/** @var array */
|
||||
/** @var array Fields that can be filled */
|
||||
protected $fillable = ['key', 'user_id', 'file_type', 'provider', 'status', 'stage', 'configuration', 'extended_status', 'transactions', 'errors'];
|
||||
|
||||
/**
|
||||
* Route binder. Converts the key in the URL to the specified object (or throw 404).
|
||||
*
|
||||
* @param $value
|
||||
*
|
||||
* @return mixed
|
||||
@ -97,18 +100,18 @@ class ImportJob extends Model
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function tag(): \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
public function tag(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Tag::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function user(): \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
public function user(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
|
@ -24,6 +24,7 @@ namespace FireflyIII\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
|
||||
@ -55,10 +56,12 @@ class LinkType extends Model
|
||||
'editable' => 'boolean',
|
||||
];
|
||||
|
||||
/** @var array */
|
||||
/** @var array Fields that can be filled */
|
||||
protected $fillable = ['name', 'inward', 'outward', 'editable'];
|
||||
|
||||
/**
|
||||
* Route binder. Converts the key in the URL to the specified object (or throw 404).
|
||||
*
|
||||
* @param $value
|
||||
*
|
||||
* @return LinkType
|
||||
@ -79,9 +82,9 @@ class LinkType extends Model
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
* @return HasMany
|
||||
*/
|
||||
public function transactionJournalLinks(): \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
public function transactionJournalLinks(): HasMany
|
||||
{
|
||||
return $this->hasMany(TransactionJournalLink::class);
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ class Note extends Model
|
||||
'updated_at' => 'datetime',
|
||||
'deleted_at' => 'datetime',
|
||||
];
|
||||
/** @var array */
|
||||
/** @var array Fields that can be filled */
|
||||
protected $fillable = ['title', 'text', 'noteable_id', 'noteable_type'];
|
||||
|
||||
/**
|
||||
|
@ -26,6 +26,7 @@ use Carbon\Carbon;
|
||||
use Crypt;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
@ -67,18 +68,18 @@ class PiggyBank extends Model
|
||||
'active' => 'boolean',
|
||||
'encrypted' => 'boolean',
|
||||
];
|
||||
/** @var array */
|
||||
protected $dates = ['startdate', 'targetdate'];
|
||||
/** @var array */
|
||||
/** @var array Fields that can be filled */
|
||||
protected $fillable = ['name', 'account_id', 'order', 'targetamount', 'startdate', 'targetdate', 'active'];
|
||||
/** @var array */
|
||||
/** @var array Hidden from view */
|
||||
protected $hidden = ['targetamount_encrypted', 'encrypted'];
|
||||
|
||||
/**
|
||||
* Route binder. Converts the key in the URL to the specified object (or throw 404).
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return PiggyBank
|
||||
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
|
||||
* @throws NotFoundHttpException
|
||||
*/
|
||||
public static function routeBinder(string $value): PiggyBank
|
||||
{
|
||||
@ -96,7 +97,7 @@ class PiggyBank extends Model
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function account(): BelongsTo
|
||||
{
|
||||
@ -131,18 +132,18 @@ class PiggyBank extends Model
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
* @return HasMany
|
||||
*/
|
||||
public function piggyBankEvents(): \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
public function piggyBankEvents(): HasMany
|
||||
{
|
||||
return $this->hasMany(PiggyBankEvent::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
* @return HasMany
|
||||
*/
|
||||
public function piggyBankRepetitions(): \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
public function piggyBankRepetitions(): HasMany
|
||||
{
|
||||
return $this->hasMany(PiggyBankRepetition::class);
|
||||
}
|
||||
|
@ -24,6 +24,7 @@ namespace FireflyIII\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
/**
|
||||
* Class PiggyBankEvent.
|
||||
@ -47,22 +48,16 @@ class PiggyBankEvent extends Model
|
||||
'updated_at' => 'datetime',
|
||||
'date' => 'date',
|
||||
];
|
||||
/** @var array */
|
||||
protected $dates = ['date'];
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
/** @var array Fields that can be filled */
|
||||
protected $fillable = ['piggy_bank_id', 'transaction_journal_id', 'date', 'amount'];
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
/** @var array Hidden from view */
|
||||
protected $hidden = ['amount_encrypted'];
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function piggyBank(): \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
public function piggyBank(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(PiggyBank::class);
|
||||
}
|
||||
@ -79,9 +74,9 @@ class PiggyBankEvent extends Model
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function transactionJournal(): \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
public function transactionJournal(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(TransactionJournal::class);
|
||||
}
|
||||
|
@ -25,6 +25,7 @@ namespace FireflyIII\Models;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Builder as EloquentBuilder;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
/**
|
||||
* Class PiggyBankRepetition.
|
||||
@ -44,20 +45,17 @@ class PiggyBankRepetition extends Model
|
||||
= [
|
||||
'created_at' => 'datetime',
|
||||
'updated_at' => 'datetime',
|
||||
'deleted_at' => 'datetime',
|
||||
'startdate' => 'date',
|
||||
'targetdate' => 'date',
|
||||
];
|
||||
/** @var array */
|
||||
protected $dates = ['startdate', 'targetdate'];
|
||||
/** @var array */
|
||||
/** @var array Fields that can be filled */
|
||||
protected $fillable = ['piggy_bank_id', 'startdate', 'targetdate', 'currentamount'];
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function piggyBank(): \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
public function piggyBank(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(PiggyBank::class);
|
||||
}
|
||||
|
@ -29,6 +29,7 @@ use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Contracts\Encryption\DecryptException;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Log;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
|
||||
@ -55,14 +56,16 @@ class Preference extends Model
|
||||
'updated_at' => 'datetime',
|
||||
];
|
||||
|
||||
/** @var array */
|
||||
/** @var array Fields that can be filled */
|
||||
protected $fillable = ['user_id', 'data', 'name'];
|
||||
|
||||
/**
|
||||
* Route binder. Converts the key in the URL to the specified object (or throw 404).
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return Preference
|
||||
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
|
||||
* @throws NotFoundHttpException
|
||||
*/
|
||||
public static function routeBinder(string $value): Preference
|
||||
{
|
||||
@ -129,9 +132,9 @@ class Preference extends Model
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function user(): \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
public function user(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
|
@ -82,17 +82,19 @@ class Recurrence extends Model
|
||||
'active' => 'bool',
|
||||
'apply_rules' => 'bool',
|
||||
];
|
||||
/** @var array */
|
||||
/** @var array Fields that can be filled */
|
||||
protected $fillable
|
||||
= ['user_id', 'transaction_type_id', 'title', 'description', 'first_date', 'repeat_until', 'latest_date', 'repetitions', 'apply_rules', 'active'];
|
||||
/** @var string */
|
||||
/** @var string The table to store the data in */
|
||||
protected $table = 'recurrences';
|
||||
|
||||
/**
|
||||
* Route binder. Converts the key in the URL to the specified object (or throw 404).
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return Recurrence
|
||||
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
|
||||
* @throws NotFoundHttpException
|
||||
*/
|
||||
public static function routeBinder(string $value): Recurrence
|
||||
{
|
||||
|
@ -37,7 +37,11 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
class RecurrenceMeta extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
/** @var array */
|
||||
/**
|
||||
* The attributes that should be casted to native types.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts
|
||||
= [
|
||||
'created_at' => 'datetime',
|
||||
@ -46,9 +50,9 @@ class RecurrenceMeta extends Model
|
||||
'name' => 'string',
|
||||
'value' => 'string',
|
||||
];
|
||||
/** @var array */
|
||||
/** @var array Fields that can be filled */
|
||||
protected $fillable = ['recurrence_id', 'name', 'value'];
|
||||
/** @var string */
|
||||
/** @var string The table to store the data in */
|
||||
protected $table = 'recurrences_meta';
|
||||
|
||||
/**
|
||||
|
@ -51,7 +51,11 @@ class RecurrenceRepetition extends Model
|
||||
/** @var int */
|
||||
public const WEEKEND_TO_MONDAY = 4;
|
||||
use SoftDeletes;
|
||||
/** @var array */
|
||||
/**
|
||||
* The attributes that should be casted to native types.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts
|
||||
= [
|
||||
'created_at' => 'datetime',
|
||||
@ -62,8 +66,9 @@ class RecurrenceRepetition extends Model
|
||||
'repetition_skip' => 'int',
|
||||
'weekend' => 'int',
|
||||
];
|
||||
/** @var array Fields that can be filled */
|
||||
protected $fillable = ['recurrence_id', 'weekend', 'repetition_type', 'repetition_moment', 'repetition_skip'];
|
||||
/** @var string */
|
||||
/** @var string The table to store the data in */
|
||||
protected $table = 'recurrences_repetitions';
|
||||
|
||||
/**
|
||||
|
@ -51,7 +51,11 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
class RecurrenceTransaction extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
/** @var array */
|
||||
/**
|
||||
* The attributes that should be casted to native types.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts
|
||||
= [
|
||||
'created_at' => 'datetime',
|
||||
@ -61,16 +65,16 @@ class RecurrenceTransaction extends Model
|
||||
'foreign_amount' => 'string',
|
||||
'description' => 'string',
|
||||
];
|
||||
/** @var array */
|
||||
/** @var array Fields that can be filled */
|
||||
protected $fillable
|
||||
= ['recurrence_id', 'transaction_currency_id', 'foreign_currency_id', 'source_id', 'destination_id', 'amount', 'foreign_amount',
|
||||
'description'];
|
||||
/** @var string */
|
||||
/** @var string The table to store the data in */
|
||||
protected $table = 'recurrences_transactions';
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function destinationAccount(): BelongsTo
|
||||
{
|
||||
@ -106,7 +110,7 @@ class RecurrenceTransaction extends Model
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function sourceAccount(): BelongsTo
|
||||
{
|
||||
|
@ -37,7 +37,11 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
class RecurrenceTransactionMeta extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
/** @var array */
|
||||
/**
|
||||
* The attributes that should be casted to native types.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts
|
||||
= [
|
||||
'created_at' => 'datetime',
|
||||
@ -46,8 +50,9 @@ class RecurrenceTransactionMeta extends Model
|
||||
'name' => 'string',
|
||||
'value' => 'string',
|
||||
];
|
||||
/** @var array Fields that can be filled */
|
||||
protected $fillable = ['rt_id', 'name', 'value'];
|
||||
/** @var string */
|
||||
/** @var string The table to store the data in */
|
||||
protected $table = 'rt_meta';
|
||||
|
||||
/**
|
||||
|
@ -45,14 +45,12 @@ class Role extends Model
|
||||
'updated_at' => 'datetime',
|
||||
];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
/** @var array Fields that can be filled */
|
||||
protected $fillable = ['name', 'display_name', 'description'];
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
|
||||
* @return BelongsToMany
|
||||
*/
|
||||
public function users(): BelongsToMany
|
||||
{
|
||||
|
@ -70,14 +70,16 @@ class Rule extends Model
|
||||
'id' => 'int',
|
||||
'strict' => 'boolean',
|
||||
];
|
||||
/** @var array */
|
||||
/** @var array Fields that can be filled */
|
||||
protected $fillable = ['rule_group_id', 'order', 'active', 'title', 'description', 'user_id', 'strict'];
|
||||
|
||||
/**
|
||||
* Route binder. Converts the key in the URL to the specified object (or throw 404).
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return Rule
|
||||
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
|
||||
* @throws NotFoundHttpException
|
||||
*/
|
||||
public static function routeBinder(string $value): Rule
|
||||
{
|
||||
|
@ -24,6 +24,7 @@ namespace FireflyIII\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
/**
|
||||
* Class RuleAction.
|
||||
@ -54,14 +55,14 @@ class RuleAction extends Model
|
||||
'stop_processing' => 'boolean',
|
||||
];
|
||||
|
||||
/** @var array */
|
||||
/** @var array Fields that can be filled */
|
||||
protected $fillable = ['rule_id', 'action_type', 'action_value', 'order', 'active', 'stop_processing'];
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function rule(): \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
public function rule(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Rule::class);
|
||||
}
|
||||
|
@ -25,6 +25,8 @@ namespace FireflyIII\Models;
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Support\Collection;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
@ -60,16 +62,16 @@ class RuleGroup extends Model
|
||||
'order' => 'int',
|
||||
];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
/** @var array Fields that can be filled */
|
||||
protected $fillable = ['user_id', 'order', 'title', 'description', 'active'];
|
||||
|
||||
/**
|
||||
* Route binder. Converts the key in the URL to the specified object (or throw 404).
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return RuleGroup
|
||||
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
|
||||
* @throws NotFoundHttpException
|
||||
*/
|
||||
public static function routeBinder(string $value): RuleGroup
|
||||
{
|
||||
@ -88,18 +90,18 @@ class RuleGroup extends Model
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
* @return HasMany
|
||||
*/
|
||||
public function rules(): \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
public function rules(): HasMany
|
||||
{
|
||||
return $this->hasMany(Rule::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function user(): \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
public function user(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
|
@ -24,6 +24,7 @@ namespace FireflyIII\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
/**
|
||||
* Class RuleTrigger.
|
||||
@ -53,14 +54,14 @@ class RuleTrigger extends Model
|
||||
'stop_processing' => 'boolean',
|
||||
];
|
||||
|
||||
/** @var array */
|
||||
/** @var array Fields that can be filled */
|
||||
protected $fillable = ['rule_id', 'trigger_type', 'trigger_value', 'order', 'active', 'stop_processing'];
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function rule(): \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
public function rule(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Rule::class);
|
||||
}
|
||||
|
@ -25,6 +25,8 @@ namespace FireflyIII\Models;
|
||||
use Crypt;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Support\Collection;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
@ -60,16 +62,16 @@ class Tag extends Model
|
||||
'date' => 'date',
|
||||
'zoomLevel' => 'int',
|
||||
];
|
||||
/** @var array */
|
||||
protected $dates = ['date'];
|
||||
/** @var array */
|
||||
/** @var array Fields that can be filled */
|
||||
protected $fillable = ['user_id', 'tag', 'date', 'description', 'longitude', 'latitude', 'zoomLevel', 'tagMode'];
|
||||
|
||||
/**
|
||||
* Route binder. Converts the key in the URL to the specified object (or throw 404).
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return Tag
|
||||
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
|
||||
* @throws NotFoundHttpException
|
||||
*/
|
||||
public static function routeBinder(string $value): Tag
|
||||
{
|
||||
@ -146,18 +148,18 @@ class Tag extends Model
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
|
||||
* @return BelongsToMany
|
||||
*/
|
||||
public function transactionJournals(): \Illuminate\Database\Eloquent\Relations\BelongsToMany
|
||||
public function transactionJournals(): BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(TransactionJournal::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function user(): \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
public function user(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
|
@ -27,6 +27,7 @@ use FireflyIII\User;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
|
||||
@ -100,6 +101,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
*/
|
||||
class Transaction extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
/**
|
||||
* The attributes that should be casted to native types.
|
||||
*
|
||||
@ -115,24 +117,23 @@ class Transaction extends Model
|
||||
'bill_name_encrypted' => 'boolean',
|
||||
'reconciled' => 'boolean',
|
||||
];
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
/** @var array Fields that can be filled */
|
||||
protected $fillable
|
||||
= ['account_id', 'transaction_journal_id', 'description', 'amount', 'identifier', 'transaction_currency_id', 'foreign_currency_id',
|
||||
'foreign_amount', 'reconciled'];
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
/** @var array Hidden from view */
|
||||
protected $hidden = ['encrypted'];
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
* Check if a table is joined.
|
||||
*
|
||||
*
|
||||
*
|
||||
* @param Builder $query
|
||||
* @param string $table
|
||||
*
|
||||
* @return bool
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public static function isJoined(Builder $query, string $table): bool
|
||||
{
|
||||
@ -150,10 +151,12 @@ class Transaction extends Model
|
||||
}
|
||||
|
||||
/**
|
||||
* Route binder. Converts the key in the URL to the specified object (or throw 404).
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return Transaction
|
||||
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
|
||||
* @throws NotFoundHttpException
|
||||
*/
|
||||
public static function routeBinder(string $value): Transaction
|
||||
{
|
||||
@ -171,11 +174,12 @@ class Transaction extends Model
|
||||
throw new NotFoundHttpException;
|
||||
}
|
||||
|
||||
use SoftDeletes;
|
||||
|
||||
/**
|
||||
* Get the account this object belongs to.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function account(): BelongsTo
|
||||
{
|
||||
@ -183,26 +187,32 @@ class Transaction extends Model
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the budget(s) this object belongs to.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
|
||||
* @return BelongsToMany
|
||||
*/
|
||||
public function budgets(): \Illuminate\Database\Eloquent\Relations\BelongsToMany
|
||||
public function budgets(): BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(Budget::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the category(ies) this object belongs to.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
|
||||
* @return BelongsToMany
|
||||
*/
|
||||
public function categories(): \Illuminate\Database\Eloquent\Relations\BelongsToMany
|
||||
public function categories(): BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(Category::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the currency this object belongs to.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function foreignCurrency(): BelongsTo
|
||||
{
|
||||
@ -210,6 +220,8 @@ class Transaction extends Model
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for transactions AFTER a specified date.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @param Builder $query
|
||||
@ -224,6 +236,7 @@ class Transaction extends Model
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for transactions BEFORE the specified date.
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @param Builder $query
|
||||
|
@ -23,6 +23,7 @@ declare(strict_types=1);
|
||||
namespace FireflyIII\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
|
||||
@ -52,16 +53,16 @@ class TransactionCurrency extends Model
|
||||
'deleted_at' => 'datetime',
|
||||
'decimal_places' => 'int',
|
||||
];
|
||||
/** @var array */
|
||||
protected $dates = ['date'];
|
||||
/** @var array */
|
||||
/** @var array Fields that can be filled */
|
||||
protected $fillable = ['name', 'code', 'symbol', 'decimal_places'];
|
||||
|
||||
/**
|
||||
* Route binder. Converts the key in the URL to the specified object (or throw 404).
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return TransactionCurrency
|
||||
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
|
||||
* @throws NotFoundHttpException
|
||||
*/
|
||||
public static function routeBinder(string $value): TransactionCurrency
|
||||
{
|
||||
@ -77,9 +78,9 @@ class TransactionCurrency extends Model
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
* @return HasMany
|
||||
*/
|
||||
public function transactionJournals(): \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
public function transactionJournals(): HasMany
|
||||
{
|
||||
return $this->hasMany(TransactionJournal::class);
|
||||
}
|
||||
|
@ -28,6 +28,7 @@ use FireflyIII\User;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Builder as EloquentBuilder;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphMany;
|
||||
@ -91,15 +92,17 @@ class TransactionJournal extends Model
|
||||
'completed' => 'boolean',
|
||||
];
|
||||
|
||||
/** @var array */
|
||||
/** @var array Fields that can be filled */
|
||||
protected $fillable
|
||||
= ['user_id', 'transaction_type_id', 'bill_id', 'interest_date', 'book_date', 'process_date',
|
||||
'transaction_currency_id', 'description', 'completed',
|
||||
'date', 'rent_date', 'encrypted', 'tag_count',];
|
||||
/** @var array */
|
||||
/** @var array Hidden from view */
|
||||
protected $hidden = ['encrypted'];
|
||||
|
||||
/**
|
||||
* Checks if tables are joined.
|
||||
*
|
||||
* @param Builder $query
|
||||
* @param string $table
|
||||
*
|
||||
@ -121,10 +124,12 @@ class TransactionJournal extends Model
|
||||
}
|
||||
|
||||
/**
|
||||
* Route binder. Converts the key in the URL to the specified object (or throw 404).
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return TransactionJournal
|
||||
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
|
||||
* @throws NotFoundHttpException
|
||||
*/
|
||||
public static function routeBinder(string $value): TransactionJournal
|
||||
{
|
||||
@ -154,16 +159,16 @@ class TransactionJournal extends Model
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function bill(): \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
public function bill(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Bill::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
|
||||
* @return BelongsToMany
|
||||
*/
|
||||
public function budgets(): BelongsToMany
|
||||
{
|
||||
@ -172,7 +177,7 @@ class TransactionJournal extends Model
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
|
||||
* @return BelongsToMany
|
||||
*/
|
||||
public function categories(): BelongsToMany
|
||||
{
|
||||
@ -259,7 +264,7 @@ class TransactionJournal extends Model
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
* @return HasMany
|
||||
*/
|
||||
public function piggyBankEvents(): HasMany
|
||||
{
|
||||
@ -333,7 +338,7 @@ class TransactionJournal extends Model
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
|
||||
* @return BelongsToMany
|
||||
*/
|
||||
public function tags(): BelongsToMany
|
||||
{
|
||||
@ -342,9 +347,9 @@ class TransactionJournal extends Model
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function transactionCurrency(): \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
public function transactionCurrency(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(TransactionCurrency::class);
|
||||
}
|
||||
@ -360,9 +365,9 @@ class TransactionJournal extends Model
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function transactionType(): \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
public function transactionType(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(TransactionType::class);
|
||||
}
|
||||
@ -378,9 +383,9 @@ class TransactionJournal extends Model
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function user(): \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
public function user(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
|
@ -45,12 +45,23 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
*/
|
||||
class TransactionJournalLink extends Model
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
/** @var string The table to store the data in */
|
||||
protected $table = 'journal_links';
|
||||
|
||||
/**
|
||||
* The attributes that should be casted to native types.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts
|
||||
= [
|
||||
'created_at' => 'datetime',
|
||||
'updated_at' => 'datetime',
|
||||
];
|
||||
|
||||
/**
|
||||
* Route binder. Converts the key in the URL to the specified object (or throw 404).
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return mixed
|
||||
@ -76,7 +87,7 @@ class TransactionJournalLink extends Model
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function destination(): BelongsTo
|
||||
{
|
||||
@ -101,7 +112,7 @@ class TransactionJournalLink extends Model
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function linkType(): BelongsTo
|
||||
{
|
||||
@ -136,7 +147,7 @@ class TransactionJournalLink extends Model
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function source(): BelongsTo
|
||||
{
|
||||
|
@ -49,9 +49,9 @@ class TransactionJournalMeta extends Model
|
||||
'updated_at' => 'datetime',
|
||||
'deleted_at' => 'datetime',
|
||||
];
|
||||
/** @var array */
|
||||
/** @var array Fields that can be filled */
|
||||
protected $fillable = ['transaction_journal_id', 'name', 'data', 'hash'];
|
||||
/** @var string */
|
||||
/** @var string The table to store the data in */
|
||||
protected $table = 'journal_meta';
|
||||
|
||||
/**
|
||||
@ -80,7 +80,7 @@ class TransactionJournalMeta extends Model
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function transactionJournal(): BelongsTo
|
||||
{
|
||||
|
@ -23,6 +23,7 @@ declare(strict_types=1);
|
||||
namespace FireflyIII\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
|
||||
@ -67,14 +68,16 @@ class TransactionType extends Model
|
||||
'updated_at' => 'datetime',
|
||||
'deleted_at' => 'datetime',
|
||||
];
|
||||
/** @var array */
|
||||
/** @var array Fields that can be filled */
|
||||
protected $fillable = ['type'];
|
||||
|
||||
/**
|
||||
* Route binder. Converts the key in the URL to the specified object (or throw 404).
|
||||
*
|
||||
* @param string $type
|
||||
*
|
||||
* @return Model|null|static
|
||||
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
|
||||
* @throws NotFoundHttpException
|
||||
*/
|
||||
public static function routeBinder(string $type): TransactionType
|
||||
{
|
||||
@ -126,9 +129,9 @@ class TransactionType extends Model
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
* @return HasMany
|
||||
*/
|
||||
public function transactionJournals(): \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
public function transactionJournals(): HasMany
|
||||
{
|
||||
return $this->hasMany(TransactionJournal::class);
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ declare(strict_types=1);
|
||||
namespace FireflyIII\Repositories\ExportJob;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Exception;
|
||||
use FireflyIII\Models\ExportJob;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Contracts\Filesystem\FileNotFoundException;
|
||||
@ -54,11 +55,10 @@ class ExportJobRepository implements ExportJobRepositoryInterface
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function cleanup(): bool
|
||||
{
|
||||
$dayAgo = Carbon::create()->subDay();
|
||||
$dayAgo = Carbon::now()->subDay();
|
||||
$set = ExportJob::where('created_at', '<', $dayAgo->format('Y-m-d H:i:s'))
|
||||
->whereIn('status', ['never_started', 'export_status_finished', 'export_downloaded'])
|
||||
->get();
|
||||
@ -74,7 +74,11 @@ class ExportJobRepository implements ExportJobRepositoryInterface
|
||||
unlink(storage_path('export') . DIRECTORY_SEPARATOR . $file);
|
||||
}
|
||||
}
|
||||
$entry->delete();
|
||||
try {
|
||||
$entry->delete();
|
||||
} catch (Exception $e) {
|
||||
Log::debug(sprintf('Could not delete object: %s', $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -142,8 +146,8 @@ class ExportJobRepository implements ExportJobRepositoryInterface
|
||||
*/
|
||||
public function getContent(ExportJob $job): string
|
||||
{
|
||||
$disk = Storage::disk('export');
|
||||
$file = $job->key . '.zip';
|
||||
$disk = Storage::disk('export');
|
||||
$file = $job->key . '.zip';
|
||||
|
||||
try {
|
||||
$content = $disk->get($file);
|
||||
|
@ -375,7 +375,7 @@ class RecurringRepository implements RecurringRepositoryInterface
|
||||
}
|
||||
if ('yearly' === $repetition->repetition_type) {
|
||||
//
|
||||
$today = Carbon::create()->endOfYear();
|
||||
$today = Carbon::now()->endOfYear();
|
||||
$repDate = Carbon::createFromFormat('Y-m-d', $repetition->repetition_moment);
|
||||
$diffInYears = $today->diffInYears($repDate);
|
||||
$repDate->addYears($diffInYears); // technically not necessary.
|
||||
|
@ -267,6 +267,7 @@ class ConfigureMappingHandler implements FileConfigurationInterface
|
||||
* - Add the value to the list of "values" that the user must map.
|
||||
*
|
||||
* @param Reader $reader
|
||||
* @param array $config
|
||||
* @param array $columnConfig
|
||||
*
|
||||
* @return array
|
||||
|
@ -101,7 +101,7 @@ class NewFileJobHandler implements FileConfigurationInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ImportJob $job
|
||||
* @param ImportJob $importJob
|
||||
*/
|
||||
public function setImportJob(ImportJob $importJob): void
|
||||
{
|
||||
@ -114,7 +114,6 @@ class NewFileJobHandler implements FileConfigurationInterface
|
||||
/**
|
||||
* Store config from job.
|
||||
*
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function storeConfiguration(): void
|
||||
{
|
||||
|
@ -87,6 +87,8 @@ class NewYnabJobHandler implements YnabJobConfigurationInterface
|
||||
* Get data for config view.
|
||||
*
|
||||
* @return array
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
*/
|
||||
public function getNextData(): array
|
||||
{
|
||||
@ -134,6 +136,8 @@ class NewYnabJobHandler implements YnabJobConfigurationInterface
|
||||
|
||||
|
||||
/**
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws FireflyException
|
||||
*/
|
||||
private function getAccessToken(): void
|
||||
@ -231,6 +235,8 @@ class NewYnabJobHandler implements YnabJobConfigurationInterface
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
*/
|
||||
private function hasRefreshToken(): bool
|
||||
{
|
||||
|
@ -218,7 +218,7 @@ class SelectAccountsHandler implements YnabJobConfigurationInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $accountId
|
||||
* @param string $accountId
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -111,6 +111,7 @@ class StageImportDataHandler
|
||||
* @param LocalAccount $source
|
||||
*
|
||||
* @return array
|
||||
* @throws FireflyException
|
||||
*/
|
||||
private function convertPayment(BunqPayment $payment, LocalAccount $source): array
|
||||
{
|
||||
|
@ -47,7 +47,7 @@ class StageFinalHandler
|
||||
for ($i = 0; $i < 5; $i++) {
|
||||
$transaction = [
|
||||
'type' => 'withdrawal',
|
||||
'date' => Carbon::create()->format('Y-m-d'),
|
||||
'date' => Carbon::now()->format('Y-m-d'),
|
||||
'tags' => '',
|
||||
'user' => $this->importJob->user_id,
|
||||
|
||||
|
@ -71,7 +71,7 @@ class CurrencyMapper
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
if (!isset($data['code']) || null === $data['code']) {
|
||||
if (!isset($data['code'])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -212,7 +212,7 @@ class ImportableConverter
|
||||
|
||||
return [
|
||||
'type' => $transactionType,
|
||||
'date' => $this->convertDateValue($importable->date) ?? Carbon::create()->format('Y-m-d'),
|
||||
'date' => $this->convertDateValue($importable->date) ?? Carbon::now()->format('Y-m-d'),
|
||||
'tags' => $importable->tags,
|
||||
'user' => $this->importJob->user_id,
|
||||
'notes' => $importable->note,
|
||||
|
@ -64,7 +64,7 @@ class ImportDataHandler
|
||||
|
||||
/**
|
||||
* @var string $ynabId
|
||||
* @var int $localId
|
||||
* @var string $localId
|
||||
*/
|
||||
foreach ($mapping as $ynabId => $localId) {
|
||||
$localAccount = $this->getLocalAccount((int)$localId);
|
||||
@ -252,7 +252,6 @@ class ImportDataHandler
|
||||
|
||||
/**
|
||||
* @param string $token
|
||||
* @param string $budget
|
||||
* @param string $account
|
||||
*
|
||||
* @return array
|
||||
|
@ -45,6 +45,8 @@ class StageGetAccessHandler
|
||||
/**
|
||||
* Send a token request to YNAB. Return with access token (if all goes well).
|
||||
*
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function run(): void
|
||||
|
@ -171,10 +171,7 @@ class Preferences
|
||||
if (\is_array($lastActivity)) {
|
||||
$lastActivity = implode(',', $lastActivity);
|
||||
}
|
||||
$hash = md5($lastActivity);
|
||||
//Log::debug(sprintf('Value of last activity is %s, hash is %s', $lastActivity, $hash));
|
||||
|
||||
return $hash;
|
||||
return md5($lastActivity);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -246,7 +246,7 @@ class Search implements SearchInterface
|
||||
private function extractModifier(string $string): void
|
||||
{
|
||||
$parts = explode(':', $string);
|
||||
if (2 === \count($parts) && \strlen(trim((string)$parts[0])) > 0 && '' !== trim((string)$parts[1])) {
|
||||
if (2 === \count($parts) && '' !== trim((string)$parts[1]) && \strlen(trim((string)$parts[0])) > 0) {
|
||||
$type = trim((string)$parts[0]);
|
||||
$value = trim((string)$parts[1]);
|
||||
if (\in_array($type, $this->validModifiers, true)) {
|
||||
|
@ -132,6 +132,7 @@ class AmountFormat extends Twig_Extension
|
||||
{
|
||||
return new Twig_SimpleFunction(
|
||||
'formatAmountBySymbol',
|
||||
/** @noinspection MoreThanThreeArgumentsInspection */
|
||||
function (string $amount, string $symbol, int $decimalPlaces = null, bool $coloured = null): string {
|
||||
$decimalPlaces = $decimalPlaces ?? 2;
|
||||
$coloured = $coloured ?? true;
|
||||
|
@ -136,7 +136,7 @@ class TransactionJournal extends Twig_Extension
|
||||
/**
|
||||
* @param JournalModel $journal
|
||||
*
|
||||
* @return string
|
||||
* @return array
|
||||
*/
|
||||
private function getTotalAmount(JournalModel $journal): array
|
||||
{
|
||||
|
@ -103,9 +103,7 @@ class General extends Twig_Extension
|
||||
return new Twig_SimpleFunction(
|
||||
'activeRoutePartialWhat',
|
||||
function ($context): string {
|
||||
$args = \func_get_args();
|
||||
$route = $args[1]; // name of the route.
|
||||
$what = $args[2]; // name of the route.
|
||||
[, $route, $what] = \func_get_args();
|
||||
$activeWhat = $context['what'] ?? false;
|
||||
|
||||
if ($what === $activeWhat && !(false === stripos(Route::getCurrentRoute()->getName(), $route))) {
|
||||
|
@ -302,7 +302,7 @@ class User extends Authenticatable
|
||||
*
|
||||
* @param string $token
|
||||
*/
|
||||
public function sendPasswordResetNotification($token)
|
||||
public function sendPasswordResetNotification($token): void
|
||||
{
|
||||
$ipAddress = Request::ip();
|
||||
|
||||
|
@ -112,10 +112,10 @@ trait TransactionValidation
|
||||
{
|
||||
$data = $validator->getData();
|
||||
$transactions = $data['transactions'] ?? [];
|
||||
$journalDescription = (string)($data['description'] ?? '');
|
||||
$journalDescription = (string)($data['description'] ?? null);
|
||||
$validDescriptions = 0;
|
||||
foreach ($transactions as $index => $transaction) {
|
||||
if (\strlen((string)($transaction['description'] ?? '')) > 0) {
|
||||
if (\strlen((string)($transaction['description'] ?? null)) > 0) {
|
||||
$validDescriptions++;
|
||||
}
|
||||
}
|
||||
@ -157,9 +157,9 @@ trait TransactionValidation
|
||||
{
|
||||
$data = $validator->getData();
|
||||
$transactions = $data['transactions'] ?? [];
|
||||
$journalDescription = (string)($data['description'] ?? '');
|
||||
$journalDescription = (string)($data['description'] ?? null);
|
||||
foreach ($transactions as $index => $transaction) {
|
||||
$description = (string)($transaction['description'] ?? '');
|
||||
$description = (string)($transaction['description'] ?? null);
|
||||
// description cannot be equal to journal description.
|
||||
if ($description === $journalDescription) {
|
||||
$validator->errors()->add('transactions.' . $index . '.description', (string)trans('validation.equal_description'));
|
||||
@ -249,7 +249,7 @@ trait TransactionValidation
|
||||
$data = $validator->getData();
|
||||
$transactions = $data['transactions'] ?? [];
|
||||
foreach ($transactions as $index => $transaction) {
|
||||
$description = (string)($transaction['description'] ?? '');
|
||||
$description = (string)($transaction['description'] ?? null);
|
||||
// filled description is mandatory for split transactions.
|
||||
if ('' === $description && \count($transactions) > 1) {
|
||||
$validator->errors()->add(
|
||||
|
@ -50,7 +50,7 @@ return [
|
||||
'at_least_one_action' => 'Rule must have at least one action.',
|
||||
'base64' => 'This is not valid base64 encoded data.',
|
||||
'model_id_invalid' => 'The given ID seems invalid for this model.',
|
||||
'more' => ':attribute must be larger than :value.',
|
||||
'more' => ':attribute must be larger than zero.',
|
||||
'less' => ':attribute must be less than 10,000,000',
|
||||
'active_url' => 'The :attribute is not a valid URL.',
|
||||
'after' => 'The :attribute must be a date after :date.',
|
||||
|
@ -2,6 +2,7 @@
|
||||
<label for="{{ options.id }}" class="col-sm-4 control-label">{{ label }}</label>
|
||||
<div class="col-sm-8">
|
||||
{{ Form.input('number', name, value, options) }}
|
||||
{% include 'form/help' %}
|
||||
{% include 'form/feedback' %}
|
||||
</div>
|
||||
</div>
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
<div class="col-sm-8">
|
||||
{{ Form.input('number', name, value, options) }}
|
||||
{% include 'form/help' %}
|
||||
{% include 'form/feedback' %}
|
||||
</div>
|
||||
</div>
|
||||
|
@ -426,8 +426,8 @@
|
||||
<div class="col-sm-10">
|
||||
<select id="link_type" class="form-control" name="link_type">
|
||||
{% for linkType in linkTypes %}
|
||||
<option label="{{ trans('firefly.link_'~linkType.inward) }}" value="{{ linkType.id }}_inward">{{ trans('firefly.link_'~linkType.inward) }}</option>
|
||||
<option label="{{ trans('firefly.link_'~linkType.outward) }}" value="{{ linkType.id }}_outward">{{ trans('firefly.link_'~linkType.outward) }}</option>
|
||||
<option label="{{ journalLinkTranslation('inward', linkType.inward) }}" value="{{ linkType.id }}_inward">{{ journalLinkTranslation('inward', linkType.inward) }}</option>
|
||||
<option label="{{ journalLinkTranslation('outward', linkType.outward) }}" value="{{ linkType.id }}_outward">{{ journalLinkTranslation('outward', linkType.outward) }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user