mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-22 03:56:42 +00:00
Reformat various code.
This commit is contained in:
@@ -30,6 +30,6 @@ namespace FireflyIII\Enums;
|
|||||||
class ClauseType
|
class ClauseType
|
||||||
{
|
{
|
||||||
public const TRANSACTION = 'transaction';
|
public const TRANSACTION = 'transaction';
|
||||||
public const WHERE = 'where';
|
|
||||||
public const UPDATE = 'update';
|
public const UPDATE = 'update';
|
||||||
|
public const WHERE = 'where';
|
||||||
}
|
}
|
||||||
|
@@ -37,8 +37,8 @@ class WarnUserAboutBill extends Event
|
|||||||
use SerializesModels;
|
use SerializesModels;
|
||||||
|
|
||||||
public Bill $bill;
|
public Bill $bill;
|
||||||
public string $field;
|
|
||||||
public int $diff;
|
public int $diff;
|
||||||
|
public string $field;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Bill $bill
|
* @param Bill $bill
|
||||||
|
@@ -64,6 +64,16 @@ class MonthReportGenerator implements ReportGeneratorInterface
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the preferred period.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
protected function preferredPeriod(): string
|
||||||
|
{
|
||||||
|
return 'day';
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set accounts.
|
* Set accounts.
|
||||||
*
|
*
|
||||||
@@ -155,14 +165,4 @@ class MonthReportGenerator implements ReportGeneratorInterface
|
|||||||
{
|
{
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the preferred period.
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
protected function preferredPeriod(): string
|
|
||||||
{
|
|
||||||
return 'day';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -90,6 +90,80 @@ class MonthReportGenerator implements ReportGeneratorInterface
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the audit report.
|
||||||
|
*
|
||||||
|
* @param Account $account
|
||||||
|
* @param Carbon $date
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
* @throws FireflyException
|
||||||
|
* @throws JsonException
|
||||||
|
*/
|
||||||
|
#[ArrayShape(['journals' => "array", 'currency' => "mixed", 'exists' => "bool", 'end' => "string", 'endBalance' => "mixed", 'dayBefore' => "string",
|
||||||
|
'dayBeforeBalance' => "mixed"])] public function getAuditReport(Account $account, Carbon $date): array
|
||||||
|
{
|
||||||
|
/** @var AccountRepositoryInterface $accountRepository */
|
||||||
|
$accountRepository = app(AccountRepositoryInterface::class);
|
||||||
|
$accountRepository->setUser($account->user);
|
||||||
|
|
||||||
|
/** @var JournalRepositoryInterface $journalRepository */
|
||||||
|
$journalRepository = app(JournalRepositoryInterface::class);
|
||||||
|
$journalRepository->setUser($account->user);
|
||||||
|
|
||||||
|
/** @var GroupCollectorInterface $collector */
|
||||||
|
$collector = app(GroupCollectorInterface::class);
|
||||||
|
$collector->setAccounts(new Collection([$account]))->setRange($this->start, $this->end)->withAccountInformation()
|
||||||
|
->withBudgetInformation()->withCategoryInformation()->withBillInformation();
|
||||||
|
$journals = $collector->getExtractedJournals();
|
||||||
|
$journals = array_reverse($journals, true);
|
||||||
|
$dayBeforeBalance = app('steam')->balance($account, $date);
|
||||||
|
$startBalance = $dayBeforeBalance;
|
||||||
|
$defaultCurrency = app('amount')->getDefaultCurrencyByUser($account->user);
|
||||||
|
$currency = $accountRepository->getAccountCurrency($account) ?? $defaultCurrency;
|
||||||
|
|
||||||
|
foreach ($journals as $index => $journal) {
|
||||||
|
$journals[$index]['balance_before'] = $startBalance;
|
||||||
|
$transactionAmount = $journal['amount'];
|
||||||
|
|
||||||
|
// make sure amount is in the right "direction".
|
||||||
|
if ($account->id === $journal['destination_account_id']) {
|
||||||
|
$transactionAmount = app('steam')->positive($journal['amount']);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($currency->id === $journal['foreign_currency_id']) {
|
||||||
|
$transactionAmount = $journal['foreign_amount'];
|
||||||
|
if ($account->id === $journal['destination_account_id']) {
|
||||||
|
$transactionAmount = app('steam')->positive($journal['foreign_amount']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$newBalance = bcadd($startBalance, $transactionAmount);
|
||||||
|
$journals[$index]['balance_after'] = $newBalance;
|
||||||
|
$startBalance = $newBalance;
|
||||||
|
|
||||||
|
// add meta dates for each journal.
|
||||||
|
$journals[$index]['interest_date'] = $journalRepository->getMetaDateById($journal['transaction_journal_id'], 'interest_date');
|
||||||
|
$journals[$index]['book_date'] = $journalRepository->getMetaDateById($journal['transaction_journal_id'], 'book_date');
|
||||||
|
$journals[$index]['process_date'] = $journalRepository->getMetaDateById($journal['transaction_journal_id'], 'process_date');
|
||||||
|
$journals[$index]['due_date'] = $journalRepository->getMetaDateById($journal['transaction_journal_id'], 'due_date');
|
||||||
|
$journals[$index]['payment_date'] = $journalRepository->getMetaDateById($journal['transaction_journal_id'], 'payment_date');
|
||||||
|
$journals[$index]['invoice_date'] = $journalRepository->getMetaDateById($journal['transaction_journal_id'], 'invoice_date');
|
||||||
|
|
||||||
|
}
|
||||||
|
$locale = app('steam')->getLocale();
|
||||||
|
|
||||||
|
return [
|
||||||
|
'journals' => $journals,
|
||||||
|
'currency' => $currency,
|
||||||
|
'exists' => !empty($journals),
|
||||||
|
'end' => $this->end->isoFormat((string) trans('config.month_and_day_moment_js', [], $locale)),
|
||||||
|
'endBalance' => app('steam')->balance($account, $this->end),
|
||||||
|
'dayBefore' => $date->isoFormat((string) trans('config.month_and_day_moment_js', [], $locale)),
|
||||||
|
'dayBeforeBalance' => $dayBeforeBalance,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Account collection setter.
|
* Account collection setter.
|
||||||
*
|
*
|
||||||
@@ -187,78 +261,4 @@ class MonthReportGenerator implements ReportGeneratorInterface
|
|||||||
{
|
{
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the audit report.
|
|
||||||
*
|
|
||||||
* @param Account $account
|
|
||||||
* @param Carbon $date
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
* @throws FireflyException
|
|
||||||
* @throws JsonException
|
|
||||||
*/
|
|
||||||
#[ArrayShape(['journals' => "array", 'currency' => "mixed", 'exists' => "bool", 'end' => "string", 'endBalance' => "mixed", 'dayBefore' => "string",
|
|
||||||
'dayBeforeBalance' => "mixed"])] public function getAuditReport(Account $account, Carbon $date): array
|
|
||||||
{
|
|
||||||
/** @var AccountRepositoryInterface $accountRepository */
|
|
||||||
$accountRepository = app(AccountRepositoryInterface::class);
|
|
||||||
$accountRepository->setUser($account->user);
|
|
||||||
|
|
||||||
/** @var JournalRepositoryInterface $journalRepository */
|
|
||||||
$journalRepository = app(JournalRepositoryInterface::class);
|
|
||||||
$journalRepository->setUser($account->user);
|
|
||||||
|
|
||||||
/** @var GroupCollectorInterface $collector */
|
|
||||||
$collector = app(GroupCollectorInterface::class);
|
|
||||||
$collector->setAccounts(new Collection([$account]))->setRange($this->start, $this->end)->withAccountInformation()
|
|
||||||
->withBudgetInformation()->withCategoryInformation()->withBillInformation();
|
|
||||||
$journals = $collector->getExtractedJournals();
|
|
||||||
$journals = array_reverse($journals, true);
|
|
||||||
$dayBeforeBalance = app('steam')->balance($account, $date);
|
|
||||||
$startBalance = $dayBeforeBalance;
|
|
||||||
$defaultCurrency = app('amount')->getDefaultCurrencyByUser($account->user);
|
|
||||||
$currency = $accountRepository->getAccountCurrency($account) ?? $defaultCurrency;
|
|
||||||
|
|
||||||
foreach ($journals as $index => $journal) {
|
|
||||||
$journals[$index]['balance_before'] = $startBalance;
|
|
||||||
$transactionAmount = $journal['amount'];
|
|
||||||
|
|
||||||
// make sure amount is in the right "direction".
|
|
||||||
if ($account->id === $journal['destination_account_id']) {
|
|
||||||
$transactionAmount = app('steam')->positive($journal['amount']);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($currency->id === $journal['foreign_currency_id']) {
|
|
||||||
$transactionAmount = $journal['foreign_amount'];
|
|
||||||
if ($account->id === $journal['destination_account_id']) {
|
|
||||||
$transactionAmount = app('steam')->positive($journal['foreign_amount']);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$newBalance = bcadd($startBalance, $transactionAmount);
|
|
||||||
$journals[$index]['balance_after'] = $newBalance;
|
|
||||||
$startBalance = $newBalance;
|
|
||||||
|
|
||||||
// add meta dates for each journal.
|
|
||||||
$journals[$index]['interest_date'] = $journalRepository->getMetaDateById($journal['transaction_journal_id'], 'interest_date');
|
|
||||||
$journals[$index]['book_date'] = $journalRepository->getMetaDateById($journal['transaction_journal_id'], 'book_date');
|
|
||||||
$journals[$index]['process_date'] = $journalRepository->getMetaDateById($journal['transaction_journal_id'], 'process_date');
|
|
||||||
$journals[$index]['due_date'] = $journalRepository->getMetaDateById($journal['transaction_journal_id'], 'due_date');
|
|
||||||
$journals[$index]['payment_date'] = $journalRepository->getMetaDateById($journal['transaction_journal_id'], 'payment_date');
|
|
||||||
$journals[$index]['invoice_date'] = $journalRepository->getMetaDateById($journal['transaction_journal_id'], 'invoice_date');
|
|
||||||
|
|
||||||
}
|
|
||||||
$locale = app('steam')->getLocale();
|
|
||||||
|
|
||||||
return [
|
|
||||||
'journals' => $journals,
|
|
||||||
'currency' => $currency,
|
|
||||||
'exists' => !empty($journals),
|
|
||||||
'end' => $this->end->isoFormat((string)trans('config.month_and_day_moment_js', [], $locale)),
|
|
||||||
'endBalance' => app('steam')->balance($account, $this->end),
|
|
||||||
'dayBefore' => $date->isoFormat((string)trans('config.month_and_day_moment_js', [], $locale)),
|
|
||||||
'dayBeforeBalance' => $dayBeforeBalance,
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -66,38 +66,6 @@ class StandardMessageGenerator implements MessageGeneratorInterface
|
|||||||
$this->run();
|
$this->run();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @inheritDoc
|
|
||||||
*/
|
|
||||||
public function getVersion(): int
|
|
||||||
{
|
|
||||||
return $this->version;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Collection $objects
|
|
||||||
*/
|
|
||||||
public function setObjects(Collection $objects): void
|
|
||||||
{
|
|
||||||
$this->objects = $objects;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param int $trigger
|
|
||||||
*/
|
|
||||||
public function setTrigger(int $trigger): void
|
|
||||||
{
|
|
||||||
$this->trigger = $trigger;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param User $user
|
|
||||||
*/
|
|
||||||
public function setUser(User $user): void
|
|
||||||
{
|
|
||||||
$this->user = $user;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Collection
|
* @return Collection
|
||||||
*/
|
*/
|
||||||
@@ -197,6 +165,14 @@ class StandardMessageGenerator implements MessageGeneratorInterface
|
|||||||
$this->storeMessage($webhook, $basicMessage);
|
$this->storeMessage($webhook, $basicMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function getVersion(): int
|
||||||
|
{
|
||||||
|
return $this->version;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param TransactionGroup $transactionGroup
|
* @param TransactionGroup $transactionGroup
|
||||||
*
|
*
|
||||||
@@ -235,4 +211,28 @@ class StandardMessageGenerator implements MessageGeneratorInterface
|
|||||||
|
|
||||||
return $webhookMessage;
|
return $webhookMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Collection $objects
|
||||||
|
*/
|
||||||
|
public function setObjects(Collection $objects): void
|
||||||
|
{
|
||||||
|
$this->objects = $objects;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param int $trigger
|
||||||
|
*/
|
||||||
|
public function setTrigger(int $trigger): void
|
||||||
|
{
|
||||||
|
$this->trigger = $trigger;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param User $user
|
||||||
|
*/
|
||||||
|
public function setUser(User $user): void
|
||||||
|
{
|
||||||
|
$this->user = $user;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -30,7 +30,6 @@ use FireflyIII\Repositories\User\UserRepositoryInterface;
|
|||||||
use Laravel\Passport\Events\AccessTokenCreated;
|
use Laravel\Passport\Events\AccessTokenCreated;
|
||||||
use Log;
|
use Log;
|
||||||
use Mail;
|
use Mail;
|
||||||
use Request;
|
|
||||||
use Session;
|
use Session;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -31,7 +31,6 @@ use FireflyIII\Support\CacheProperties;
|
|||||||
use FireflyIII\User;
|
use FireflyIII\User;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
use JsonException;
|
use JsonException;
|
||||||
use Log;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@@ -128,6 +128,37 @@ class LoginController extends Controller
|
|||||||
$this->sendFailedLoginResponse($request);
|
$this->sendFailedLoginResponse($request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the login username to be used by the controller.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function username()
|
||||||
|
{
|
||||||
|
return $this->username;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the failed login response instance.
|
||||||
|
*
|
||||||
|
* @param Request $request
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*
|
||||||
|
* @throws ValidationException
|
||||||
|
*/
|
||||||
|
protected function sendFailedLoginResponse(Request $request)
|
||||||
|
{
|
||||||
|
$exception = ValidationException::withMessages(
|
||||||
|
[
|
||||||
|
$this->username() => [trans('auth.failed')],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
$exception->redirectTo = route('login');
|
||||||
|
|
||||||
|
throw $exception;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Log the user out of the application.
|
* Log the user out of the application.
|
||||||
*
|
*
|
||||||
@@ -165,27 +196,6 @@ class LoginController extends Controller
|
|||||||
: redirect('/');
|
: redirect('/');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the failed login response instance.
|
|
||||||
*
|
|
||||||
* @param Request $request
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*
|
|
||||||
* @throws ValidationException
|
|
||||||
*/
|
|
||||||
protected function sendFailedLoginResponse(Request $request)
|
|
||||||
{
|
|
||||||
$exception = ValidationException::withMessages(
|
|
||||||
[
|
|
||||||
$this->username() => [trans('auth.failed')],
|
|
||||||
]
|
|
||||||
);
|
|
||||||
$exception->redirectTo = route('login');
|
|
||||||
|
|
||||||
throw $exception;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show the application's login form.
|
* Show the application's login form.
|
||||||
*
|
*
|
||||||
@@ -232,14 +242,4 @@ class LoginController extends Controller
|
|||||||
|
|
||||||
return view('auth.login', compact('allowRegistration', 'email', 'remember', 'allowReset', 'title', 'usernameField'));
|
return view('auth.login', compact('allowRegistration', 'email', 'remember', 'allowReset', 'title', 'usernameField'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the login username to be used by the controller.
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function username()
|
|
||||||
{
|
|
||||||
return $this->username;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -107,6 +107,29 @@ class RegisterController extends Controller
|
|||||||
return redirect($this->redirectPath());
|
return redirect($this->redirectPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
protected function allowedToRegister(): bool
|
||||||
|
{
|
||||||
|
// is allowed to register?
|
||||||
|
$allowRegistration = true;
|
||||||
|
try {
|
||||||
|
$singleUserMode = app('fireflyconfig')->get('single_user_mode', config('firefly.configuration.single_user_mode'))->data;
|
||||||
|
} catch (ContainerExceptionInterface|NotFoundExceptionInterface $e) {
|
||||||
|
$singleUserMode = true;
|
||||||
|
}
|
||||||
|
$userCount = User::count();
|
||||||
|
$guard = config('auth.defaults.guard');
|
||||||
|
if (true === $singleUserMode && $userCount > 0 && 'web' === $guard) {
|
||||||
|
$allowRegistration = false;
|
||||||
|
}
|
||||||
|
if ('web' !== $guard) {
|
||||||
|
$allowRegistration = false;
|
||||||
|
}
|
||||||
|
return $allowRegistration;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show the application registration form.
|
* Show the application registration form.
|
||||||
*
|
*
|
||||||
@@ -131,26 +154,4 @@ class RegisterController extends Controller
|
|||||||
|
|
||||||
return view('auth.register', compact('isDemoSite', 'email', 'pageTitle'));
|
return view('auth.register', compact('isDemoSite', 'email', 'pageTitle'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return bool
|
|
||||||
*/
|
|
||||||
protected function allowedToRegister(): bool {
|
|
||||||
// is allowed to register?
|
|
||||||
$allowRegistration = true;
|
|
||||||
try {
|
|
||||||
$singleUserMode = app('fireflyconfig')->get('single_user_mode', config('firefly.configuration.single_user_mode'))->data;
|
|
||||||
} catch (ContainerExceptionInterface|NotFoundExceptionInterface $e) {
|
|
||||||
$singleUserMode = true;
|
|
||||||
}
|
|
||||||
$userCount = User::count();
|
|
||||||
$guard = config('auth.defaults.guard');
|
|
||||||
if (true === $singleUserMode && $userCount > 0 && 'web' === $guard) {
|
|
||||||
$allowRegistration = false;
|
|
||||||
}
|
|
||||||
if('web' !== $guard) {
|
|
||||||
$allowRegistration = false;
|
|
||||||
}
|
|
||||||
return $allowRegistration;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
<?php /**
|
<?php
|
||||||
|
/**
|
||||||
* BudgetReportController.php
|
* BudgetReportController.php
|
||||||
* Copyright (c) 2020 james@firefly-iii.org
|
* Copyright (c) 2020 james@firefly-iii.org
|
||||||
*
|
*
|
||||||
|
@@ -27,7 +27,6 @@ use Exception;
|
|||||||
use FireflyIII\Events\RequestedVersionCheckStatus;
|
use FireflyIII\Events\RequestedVersionCheckStatus;
|
||||||
use FireflyIII\Helpers\Collector\GroupCollectorInterface;
|
use FireflyIII\Helpers\Collector\GroupCollectorInterface;
|
||||||
use FireflyIII\Http\Middleware\Installer;
|
use FireflyIII\Http\Middleware\Installer;
|
||||||
use FireflyIII\Mail\UndoEmailChangeMail;
|
|
||||||
use FireflyIII\Models\AccountType;
|
use FireflyIII\Models\AccountType;
|
||||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||||
use FireflyIII\Repositories\Bill\BillRepositoryInterface;
|
use FireflyIII\Repositories\Bill\BillRepositoryInterface;
|
||||||
@@ -36,7 +35,6 @@ use Illuminate\Http\JsonResponse;
|
|||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
use Log;
|
use Log;
|
||||||
use Mail;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class HomeController.
|
* Class HomeController.
|
||||||
|
@@ -24,13 +24,13 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Http\Controllers\PiggyBank;
|
namespace FireflyIII\Http\Controllers\PiggyBank;
|
||||||
|
|
||||||
|
use Amount;
|
||||||
use FireflyIII\Helpers\Attachments\AttachmentHelperInterface;
|
use FireflyIII\Helpers\Attachments\AttachmentHelperInterface;
|
||||||
use FireflyIII\Http\Controllers\Controller;
|
use FireflyIII\Http\Controllers\Controller;
|
||||||
use FireflyIII\Http\Requests\PiggyBankUpdateRequest;
|
use FireflyIII\Http\Requests\PiggyBankUpdateRequest;
|
||||||
use FireflyIII\Models\PiggyBank;
|
use FireflyIII\Models\PiggyBank;
|
||||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||||
use FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface;
|
use FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface;
|
||||||
use Amount;
|
|
||||||
use Illuminate\Contracts\View\Factory;
|
use Illuminate\Contracts\View\Factory;
|
||||||
use Illuminate\Http\RedirectResponse;
|
use Illuminate\Http\RedirectResponse;
|
||||||
use Illuminate\Routing\Redirector;
|
use Illuminate\Routing\Redirector;
|
||||||
@@ -41,9 +41,9 @@ use Illuminate\View\View;
|
|||||||
*/
|
*/
|
||||||
class EditController extends Controller
|
class EditController extends Controller
|
||||||
{
|
{
|
||||||
|
private AccountRepositoryInterface $accountRepository;
|
||||||
private AttachmentHelperInterface $attachments;
|
private AttachmentHelperInterface $attachments;
|
||||||
private PiggyBankRepositoryInterface $piggyRepos;
|
private PiggyBankRepositoryInterface $piggyRepos;
|
||||||
private AccountRepositoryInterface $accountRepository;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PiggyBankController constructor.
|
* PiggyBankController constructor.
|
||||||
|
@@ -62,6 +62,32 @@ class EditController extends Controller
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Edit a rule group.
|
||||||
|
*
|
||||||
|
* @param Request $request
|
||||||
|
* @param RuleGroup $ruleGroup
|
||||||
|
*
|
||||||
|
* @return Factory|View
|
||||||
|
*/
|
||||||
|
public function edit(Request $request, RuleGroup $ruleGroup)
|
||||||
|
{
|
||||||
|
$subTitle = (string) trans('firefly.edit_rule_group', ['title' => $ruleGroup->title]);
|
||||||
|
|
||||||
|
$hasOldInput = null !== $request->old('_token');
|
||||||
|
$preFilled = [
|
||||||
|
'active' => $hasOldInput ? (bool) $request->old('active') : $ruleGroup->active,
|
||||||
|
];
|
||||||
|
// put previous url in session if not redirect from store (not "return_to_edit").
|
||||||
|
if (true !== session('rule-groups.edit.fromUpdate')) {
|
||||||
|
$this->rememberPreviousUri('rule-groups.edit.uri');
|
||||||
|
}
|
||||||
|
session()->forget('rule-groups.edit.fromUpdate');
|
||||||
|
session()->flash('preFilled', $preFilled);
|
||||||
|
|
||||||
|
return view('rules.rule-group.edit', compact('ruleGroup', 'subTitle'));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Move a rule group in either direction.
|
* Move a rule group in either direction.
|
||||||
*
|
*
|
||||||
@@ -94,33 +120,6 @@ class EditController extends Controller
|
|||||||
return new JsonResponse(['OK']);
|
return new JsonResponse(['OK']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Edit a rule group.
|
|
||||||
*
|
|
||||||
* @param Request $request
|
|
||||||
* @param RuleGroup $ruleGroup
|
|
||||||
*
|
|
||||||
* @return Factory|View
|
|
||||||
*/
|
|
||||||
public function edit(Request $request, RuleGroup $ruleGroup)
|
|
||||||
{
|
|
||||||
$subTitle = (string)trans('firefly.edit_rule_group', ['title' => $ruleGroup->title]);
|
|
||||||
|
|
||||||
$hasOldInput = null !== $request->old('_token');
|
|
||||||
$preFilled = [
|
|
||||||
'active' => $hasOldInput ? (bool)$request->old('active') : $ruleGroup->active,
|
|
||||||
];
|
|
||||||
// put previous url in session if not redirect from store (not "return_to_edit").
|
|
||||||
if (true !== session('rule-groups.edit.fromUpdate')) {
|
|
||||||
$this->rememberPreviousUri('rule-groups.edit.uri');
|
|
||||||
}
|
|
||||||
session()->forget('rule-groups.edit.fromUpdate');
|
|
||||||
session()->flash('preFilled', $preFilled);
|
|
||||||
|
|
||||||
return view('rules.rule-group.edit', compact('ruleGroup', 'subTitle'));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the rule group.
|
* Update the rule group.
|
||||||
*
|
*
|
||||||
|
@@ -47,8 +47,8 @@ class InstallController extends Controller
|
|||||||
{
|
{
|
||||||
use GetConfigurationData;
|
use GetConfigurationData;
|
||||||
|
|
||||||
public const FORBIDDEN_ERROR = 'Internal PHP function "proc_close" is disabled for your installation. Auto-migration is not possible.';
|
|
||||||
public const BASEDIR_ERROR = 'Firefly III cannot execute the upgrade commands. It is not allowed to because of an open_basedir restriction.';
|
public const BASEDIR_ERROR = 'Firefly III cannot execute the upgrade commands. It is not allowed to because of an open_basedir restriction.';
|
||||||
|
public const FORBIDDEN_ERROR = 'Internal PHP function "proc_close" is disabled for your installation. Auto-migration is not possible.';
|
||||||
public const OTHER_ERROR = 'An unknown error prevented Firefly III from executing the upgrade commands. Sorry.';
|
public const OTHER_ERROR = 'An unknown error prevented Firefly III from executing the upgrade commands. Sorry.';
|
||||||
private string $lastError;
|
private string $lastError;
|
||||||
private array $upgradeCommands;
|
private array $upgradeCommands;
|
||||||
|
@@ -32,7 +32,6 @@ use Illuminate\Http\RedirectResponse;
|
|||||||
use Illuminate\Routing\Redirector;
|
use Illuminate\Routing\Redirector;
|
||||||
use Log;
|
use Log;
|
||||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||||
use URL;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class DeleteController
|
* Class DeleteController
|
||||||
|
@@ -34,7 +34,6 @@ use Illuminate\Http\Request;
|
|||||||
use Illuminate\Routing\Redirector;
|
use Illuminate\Routing\Redirector;
|
||||||
use Illuminate\View\View;
|
use Illuminate\View\View;
|
||||||
use Log;
|
use Log;
|
||||||
use URL;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class LinkController.
|
* Class LinkController.
|
||||||
|
@@ -25,7 +25,6 @@ namespace FireflyIII\Http\Middleware;
|
|||||||
use Illuminate\Contracts\Session\Session;
|
use Illuminate\Contracts\Session\Session;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Session\Middleware\StartSession;
|
use Illuminate\Session\Middleware\StartSession;
|
||||||
use Log;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class StartFireflySession.
|
* Class StartFireflySession.
|
||||||
|
Reference in New Issue
Block a user