mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2024-11-23 09:26:29 -06:00
Various code cleanup.
This commit is contained in:
parent
815fd5ff6b
commit
d60650cff2
@ -164,6 +164,7 @@ class ReconcileController extends Controller
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return RedirectResponse|Redirector
|
||||
* @throws DuplicateTransactionException
|
||||
*/
|
||||
public function submit(ReconciliationStoreRequest $request, Account $account, Carbon $start, Carbon $end)
|
||||
{
|
||||
|
@ -18,7 +18,6 @@
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/** @noinspection PhpUndefinedClassInspection */
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Http\Controllers\Admin;
|
||||
@ -60,6 +59,7 @@ class ConfigurationController extends Controller
|
||||
* Show configuration index.
|
||||
*
|
||||
* @return Factory|View
|
||||
* @throws \FireflyIII\Exceptions\FireflyException
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
|
@ -60,7 +60,7 @@ class HomeController extends Controller
|
||||
$title = (string)trans('firefly.administration');
|
||||
$mainTitleIcon = 'fa-hand-spock-o';
|
||||
$email = auth()->user()->email;
|
||||
$pref = app('preferences')->get('remote_guard_alt_email', null);
|
||||
$pref = app('preferences')->get('remote_guard_alt_email');
|
||||
if (null !== $pref && is_string($pref->data)) {
|
||||
$email = $pref->data;
|
||||
}
|
||||
|
@ -18,7 +18,6 @@
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/** @noinspection PhpMethodParametersCountMismatchInspection */
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Http\Controllers\Admin;
|
||||
|
@ -57,7 +57,7 @@ class ConfirmPasswordController extends Controller
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
|
@ -18,7 +18,6 @@
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/** @noinspection PhpDynamicAsStaticMethodCallInspection */
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Http\Controllers\Auth;
|
||||
@ -111,6 +110,7 @@ class ForgotPasswordController extends Controller
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @return Factory|View
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function showLinkRequestForm()
|
||||
{
|
||||
|
@ -73,14 +73,14 @@ class LoginController extends Controller
|
||||
*
|
||||
* @param Request $request
|
||||
*
|
||||
* @return RedirectResponse|\Illuminate\Http\Response|JsonResponse
|
||||
* @return JsonResponse|RedirectResponse
|
||||
*
|
||||
* @throws ValidationException
|
||||
*/
|
||||
public function login(Request $request)
|
||||
{
|
||||
Log::channel('audit')->info(sprintf('User is trying to login using "%s"', $request->get('email')));
|
||||
Log::info(sprintf('User is trying to login.'));
|
||||
Log::info('User is trying to login.');
|
||||
if ('ldap' === config('auth.providers.users.driver')) {
|
||||
/** @var Adldap\Connections\Provider $provider */
|
||||
Adldap::getProvider('default'); // @phpstan-ignore-line
|
||||
@ -161,7 +161,7 @@ class LoginController extends Controller
|
||||
*
|
||||
* @param Request $request
|
||||
*
|
||||
* @return Response
|
||||
* @return void
|
||||
*
|
||||
* @throws ValidationException
|
||||
*/
|
||||
@ -180,7 +180,10 @@ class LoginController extends Controller
|
||||
/**
|
||||
* Show the application's login form.
|
||||
*
|
||||
* @param Request $request
|
||||
*
|
||||
* @return Factory|\Illuminate\Http\Response|View
|
||||
* @throws \FireflyIII\Exceptions\FireflyException
|
||||
*/
|
||||
public function showLoginForm(Request $request)
|
||||
{
|
||||
|
@ -18,7 +18,6 @@
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/** @noinspection PhpDynamicAsStaticMethodCallInspection */
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Http\Controllers\Auth;
|
||||
@ -78,6 +77,8 @@ class RegisterController extends Controller
|
||||
* @param Request $request
|
||||
*
|
||||
* @return Factory|RedirectResponse|Redirector|View
|
||||
* @throws FireflyException
|
||||
* @throws \Illuminate\Validation\ValidationException
|
||||
*/
|
||||
public function register(Request $request)
|
||||
{
|
||||
@ -123,6 +124,7 @@ class RegisterController extends Controller
|
||||
* @param Request $request
|
||||
*
|
||||
* @return Factory|View
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function showRegistrationForm(Request $request)
|
||||
{
|
||||
|
@ -18,7 +18,6 @@
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/** @noinspection PhpDynamicAsStaticMethodCallInspection */
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Http\Controllers\Auth;
|
||||
@ -120,10 +119,11 @@ class ResetPasswordController extends Controller
|
||||
*
|
||||
* If no token is present, display the link request form.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param string|null $token
|
||||
* @param Request $request
|
||||
* @param null $token
|
||||
*
|
||||
* @return Factory|View
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function showResetForm(Request $request, $token = null)
|
||||
{
|
||||
|
@ -38,7 +38,7 @@ class TwoFactorController extends Controller
|
||||
/**
|
||||
* What to do if 2FA lost?
|
||||
*
|
||||
* @return mixed
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function lostTwoFactor()
|
||||
{
|
||||
|
@ -70,7 +70,7 @@ class CreateController extends Controller
|
||||
*
|
||||
* @param Request $request
|
||||
*
|
||||
* @return Application|Factory|View
|
||||
* @return Factory|\Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function create(Request $request)
|
||||
{
|
||||
|
@ -70,7 +70,7 @@ class EditController extends Controller
|
||||
* @param Request $request
|
||||
* @param Bill $bill
|
||||
*
|
||||
* @return Application|Factory|View
|
||||
* @return Factory|\Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function edit(Request $request, Bill $bill)
|
||||
{
|
||||
|
@ -116,7 +116,7 @@ class IndexController extends Controller
|
||||
}
|
||||
$current = $array['pay_dates'][0] ?? null;
|
||||
if (null !== $current && !$nextExpectedMatch->isToday()) {
|
||||
$currentExpectedMatch = Carbon::createFromFormat(Carbon::ATOM, $current);
|
||||
$currentExpectedMatch = Carbon::createFromFormat('Y-m-d\TH:i:sP', $current);
|
||||
$array['next_expected_match_diff'] = $currentExpectedMatch->diffForHumans(today(), Carbon::DIFF_RELATIVE_TO_NOW);
|
||||
}
|
||||
|
||||
@ -195,7 +195,7 @@ class IndexController extends Controller
|
||||
$avg = bcdiv(bcadd((string)$bill['amount_min'], (string)$bill['amount_max']), '2');
|
||||
|
||||
Log::debug(sprintf('Amount per period for bill #%d "%s"', $bill['id'], $bill['name']));
|
||||
Log::debug(sprintf(sprintf('Average is %s', $avg)));
|
||||
Log::debug(sprintf('Average is %s', $avg));
|
||||
// calculate amount per year:
|
||||
$multiplies = [
|
||||
'yearly' => '1',
|
||||
|
@ -80,7 +80,6 @@ class ShowController extends Controller
|
||||
* @param Bill $bill
|
||||
*
|
||||
* @return RedirectResponse|Redirector
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function rescan(Request $request, Bill $bill)
|
||||
{
|
||||
|
@ -123,7 +123,7 @@ class BudgetLimitController extends Controller
|
||||
/**
|
||||
* @param Request $request
|
||||
*
|
||||
* @return JsonResponse|RedirectResponse|Redirector
|
||||
* @return JsonResponse
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function store(Request $request)
|
||||
|
@ -111,6 +111,7 @@ class CreateController extends Controller
|
||||
* @param BudgetFormStoreRequest $request
|
||||
*
|
||||
* @return RedirectResponse
|
||||
* @throws \FireflyIII\Exceptions\FireflyException
|
||||
*/
|
||||
public function store(BudgetFormStoreRequest $request): RedirectResponse
|
||||
{
|
||||
|
@ -86,6 +86,7 @@ class CreateController extends Controller
|
||||
* @param CategoryFormRequest $request
|
||||
*
|
||||
* @return $this|RedirectResponse|Redirector
|
||||
* @throws \FireflyIII\Exceptions\FireflyException
|
||||
*/
|
||||
public function store(CategoryFormRequest $request)
|
||||
{
|
||||
|
@ -168,10 +168,10 @@ class CategoryController extends Controller
|
||||
/**
|
||||
* Generate report chart for either with or without category.
|
||||
*
|
||||
* @param Collection $accounts
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
* @param Category $category
|
||||
* @param Collection $accounts
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
* @param Category|null $category
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
|
@ -184,7 +184,7 @@ class ExpenseReportController extends Controller
|
||||
$newSet = [];
|
||||
foreach ($chartData as $key => $entry) {
|
||||
if (0 === !array_sum($entry['entries'])) {
|
||||
$newSet[$key] = $chartData[$key];
|
||||
$newSet[$key] = $entry;
|
||||
}
|
||||
}
|
||||
if (0===count($newSet)) {
|
||||
|
@ -94,7 +94,6 @@ class PiggyBankController extends Controller
|
||||
|
||||
$chartData = [];
|
||||
while ($oldest <= $today) {
|
||||
/** @var Collection $filtered */
|
||||
$filtered = $set->filter(
|
||||
function (PiggyBankEvent $event) use ($oldest) {
|
||||
return $event->date->lte($oldest);
|
||||
@ -105,7 +104,6 @@ class PiggyBankController extends Controller
|
||||
$chartData[$label] = $currentSum;
|
||||
$oldest = app('navigation')->addPeriod($oldest, $step, 0);
|
||||
}
|
||||
/** @var Collection $finalFiltered */
|
||||
$finalFiltered = $set->filter(
|
||||
function (PiggyBankEvent $event) use ($today) {
|
||||
return $event->date->lte($today);
|
||||
|
@ -66,6 +66,8 @@ class IndexController extends Controller
|
||||
/**
|
||||
* @return LaravelResponse
|
||||
* @throws CannotInsertRecord
|
||||
* @throws \FireflyIII\Exceptions\FireflyException
|
||||
* @throws \League\Csv\Exception
|
||||
*/
|
||||
public function export(): LaravelResponse
|
||||
{
|
||||
@ -89,7 +91,7 @@ class IndexController extends Controller
|
||||
$quoted = sprintf('"%s"', addcslashes($name, '"\\'));
|
||||
// headers for CSV file.
|
||||
/** @var LaravelResponse $response */
|
||||
$response = response($result['transactions'], 200);
|
||||
$response = response($result['transactions']);
|
||||
$response
|
||||
->header('Content-Description', 'File Transfer')
|
||||
->header('Content-Type', 'text/x-csv')
|
||||
|
@ -102,8 +102,7 @@ class HomeController extends Controller
|
||||
*
|
||||
* @param AccountRepositoryInterface $repository
|
||||
*
|
||||
* @return Factory|RedirectResponse|Redirector|View
|
||||
* @throws Exception
|
||||
* @return mixed
|
||||
*/
|
||||
public function index(AccountRepositoryInterface $repository): mixed
|
||||
{
|
||||
|
@ -79,11 +79,15 @@ class BudgetController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* @param TransactionCurrency $currency
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function getBudgetInformation(TransactionCurrency $currency, Carbon $start, Carbon $end): JsonResponse
|
||||
{
|
||||
$budgeted = $this->blRepository->budgeted($start, $end, $currency,);
|
||||
$budgeted = $this->blRepository->budgeted($start, $end, $currency);
|
||||
$availableBudget = $this->abRepository->getByCurrencyDate($start, $end, $currency);
|
||||
$available = '0';
|
||||
$percentage = '0';
|
||||
|
@ -214,7 +214,7 @@ class ReconcileController extends Controller
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return mixed
|
||||
* @return JsonResponse
|
||||
*
|
||||
*/
|
||||
public function transactions(Account $account, Carbon $start, Carbon $end)
|
||||
|
@ -165,15 +165,15 @@ class RecurrenceController extends Controller
|
||||
$yearly = sprintf('yearly,%s', $date->format('Y-m-d'));
|
||||
$yearlyDate = $date->formatLocalized((string)trans('config.month_and_day_no_year', [], $locale));
|
||||
$result = [
|
||||
'daily' => ['label' => (string)trans('firefly.recurring_daily'), 'selected' => 0 === strpos($preSelected, 'daily')],
|
||||
'daily' => ['label' => (string)trans('firefly.recurring_daily'), 'selected' => str_starts_with($preSelected, 'daily')],
|
||||
$weekly => ['label' => (string)trans('firefly.recurring_weekly', ['weekday' => $dayOfWeek]),
|
||||
'selected' => 0 === strpos($preSelected, 'weekly')],
|
||||
'selected' => str_starts_with($preSelected, 'weekly')],
|
||||
$monthly => ['label' => (string)trans('firefly.recurring_monthly', ['dayOfMonth' => $date->day]),
|
||||
'selected' => 0 === strpos($preSelected, 'monthly')],
|
||||
'selected' => str_starts_with($preSelected, 'monthly')],
|
||||
$ndom => ['label' => (string)trans('firefly.recurring_ndom', ['weekday' => $dayOfWeek, 'dayOfMonth' => $date->weekOfMonth]),
|
||||
'selected' => 0 === strpos($preSelected, 'ndom')],
|
||||
'selected' => str_starts_with($preSelected, 'ndom')],
|
||||
$yearly => ['label' => (string)trans('firefly.recurring_yearly', ['date' => $yearlyDate]),
|
||||
'selected' => 0 === strpos($preSelected, 'yearly')],
|
||||
'selected' => str_starts_with($preSelected, 'yearly')],
|
||||
];
|
||||
}
|
||||
Log::debug('Dropdown is', $result);
|
||||
|
@ -27,8 +27,10 @@ use FireflyIII\Models\AccountType;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
|
||||
use FireflyIII\Support\Http\Controllers\CreateStuff;
|
||||
use Illuminate\Contracts\View\Factory;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Routing\Redirector;
|
||||
use Illuminate\View\View;
|
||||
|
||||
/**
|
||||
* Class NewUserController.
|
||||
@ -58,7 +60,7 @@ class NewUserController extends Controller
|
||||
/**
|
||||
* Form the user gets when he has no data in the system.
|
||||
*
|
||||
* @return RedirectResponse|Redirector|\Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
* @return RedirectResponse|Redirector|Factory|View
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
|
@ -61,6 +61,8 @@ class DeleteController extends Controller
|
||||
* Delete a piggy bank.
|
||||
*
|
||||
* @param ObjectGroup $objectGroup
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function delete(ObjectGroup $objectGroup)
|
||||
{
|
||||
@ -77,6 +79,7 @@ class DeleteController extends Controller
|
||||
* Destroy the piggy bank.
|
||||
*
|
||||
* @param ObjectGroup $objectGroup
|
||||
* @return RedirectResponse
|
||||
*/
|
||||
public function destroy(ObjectGroup $objectGroup): RedirectResponse
|
||||
{
|
||||
|
@ -61,6 +61,8 @@ class EditController extends Controller
|
||||
* Edit an object group.
|
||||
*
|
||||
* @param ObjectGroup $objectGroup
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function edit(ObjectGroup $objectGroup)
|
||||
{
|
||||
@ -80,6 +82,7 @@ class EditController extends Controller
|
||||
*
|
||||
* @param ObjectGroupFormRequest $request
|
||||
* @param ObjectGroup $objectGroup
|
||||
* @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
||||
*/
|
||||
public function update(ObjectGroupFormRequest $request, ObjectGroup $objectGroup)
|
||||
{
|
||||
|
@ -62,7 +62,7 @@ class IndexController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Application|Factory|View
|
||||
* @return Factory|\Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
@ -75,7 +75,10 @@ class IndexController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param ObjectGroup $objectGroup
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function setOrder(Request $request, ObjectGroup $objectGroup)
|
||||
{
|
||||
|
@ -88,6 +88,7 @@ class CreateController extends Controller
|
||||
* @param PiggyBankStoreRequest $request
|
||||
*
|
||||
* @return RedirectResponse|Redirector
|
||||
* @throws \FireflyIII\Exceptions\FireflyException
|
||||
*/
|
||||
public function store(PiggyBankStoreRequest $request)
|
||||
{
|
||||
|
@ -39,6 +39,7 @@ use FireflyIII\User;
|
||||
use Google2FA;
|
||||
use Hash;
|
||||
use Illuminate\Contracts\Auth\Guard;
|
||||
use Illuminate\Contracts\Foundation\Application;
|
||||
use Illuminate\Contracts\View\Factory;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
@ -105,7 +106,8 @@ class ProfileController extends Controller
|
||||
/**
|
||||
* @param Request $request
|
||||
*
|
||||
* @return \Illuminate\Contracts\Foundation\Application|RedirectResponse|Redirector
|
||||
* @return Application|RedirectResponse|Redirector
|
||||
* @throws \Illuminate\Auth\AuthenticationException
|
||||
*/
|
||||
public function postLogoutOtherSessions(Request $request)
|
||||
{
|
||||
@ -181,6 +183,9 @@ class ProfileController extends Controller
|
||||
* @param Request $request
|
||||
*
|
||||
* @return Factory|View
|
||||
* @throws \PragmaRX\Google2FA\Exceptions\IncompatibleWithGoogleAuthenticatorException
|
||||
* @throws \PragmaRX\Google2FA\Exceptions\InvalidCharactersException
|
||||
* @throws \PragmaRX\Google2FA\Exceptions\SecretKeyTooShortException
|
||||
*/
|
||||
public function code(Request $request)
|
||||
{
|
||||
@ -273,7 +278,7 @@ class ProfileController extends Controller
|
||||
*
|
||||
* @param Request $request
|
||||
*
|
||||
* @return \Illuminate\Contracts\Foundation\Application|RedirectResponse|Redirector
|
||||
* @return Application|RedirectResponse|Redirector
|
||||
*/
|
||||
public function deleteAccount(Request $request)
|
||||
{
|
||||
@ -347,6 +352,7 @@ class ProfileController extends Controller
|
||||
* Index for profile.
|
||||
*
|
||||
* @return Factory|View
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
@ -367,7 +373,7 @@ class ProfileController extends Controller
|
||||
$repository->createPersonalAccessClient(null, config('app.name') . ' Personal Access Client', 'http://localhost');
|
||||
}
|
||||
|
||||
$accessToken = app('preferences')->get('access_token', null);
|
||||
$accessToken = app('preferences')->get('access_token');
|
||||
if (null === $accessToken) {
|
||||
$token = $user->generateAccessToken();
|
||||
$accessToken = app('preferences')->set('access_token', $token);
|
||||
@ -490,7 +496,6 @@ class ProfileController extends Controller
|
||||
return redirect(route('profile.index'));
|
||||
}
|
||||
|
||||
/** @noinspection PhpUnusedParameterInspection */
|
||||
/**
|
||||
* Submit 2FA for the first time.
|
||||
*
|
||||
@ -570,7 +575,10 @@ class ProfileController extends Controller
|
||||
/**
|
||||
* Regenerate access token.
|
||||
*
|
||||
* @param Request $request
|
||||
*
|
||||
* @return RedirectResponse|Redirector
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function regenerate(Request $request)
|
||||
{
|
||||
|
@ -122,6 +122,8 @@ class CreateController extends Controller
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param TransactionJournal $journal
|
||||
*
|
||||
* @return Factory|\Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function createFromJournal(Request $request, TransactionJournal $journal)
|
||||
{
|
||||
@ -214,6 +216,7 @@ class CreateController extends Controller
|
||||
* @param RecurrenceFormRequest $request
|
||||
*
|
||||
* @return RedirectResponse|Redirector
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function store(RecurrenceFormRequest $request)
|
||||
{
|
||||
|
@ -18,7 +18,6 @@
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/** @noinspection PhpMethodParametersCountMismatchInspection */
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Http\Controllers\Recurring;
|
||||
|
@ -64,7 +64,7 @@ class BalanceController extends Controller
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return mixed|string
|
||||
* @return string
|
||||
*/
|
||||
public function general(Collection $accounts, Carbon $start, Carbon $end)
|
||||
{
|
||||
|
@ -40,6 +40,9 @@ class BillController extends Controller
|
||||
* @param Collection $accounts
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return mixed|string
|
||||
* @throws \JsonException
|
||||
*/
|
||||
public function overview(Collection $accounts, Carbon $start, Carbon $end)
|
||||
{ // chart properties for cache:
|
||||
|
@ -160,7 +160,7 @@ class BudgetController extends Controller
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return array|string
|
||||
* @return string
|
||||
*/
|
||||
public function avgExpenses(Collection $accounts, Collection $budgets, Carbon $start, Carbon $end)
|
||||
{
|
||||
@ -281,7 +281,7 @@ class BudgetController extends Controller
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return mixed|string
|
||||
* @return string
|
||||
*/
|
||||
public function general(Collection $accounts, Carbon $start, Carbon $end)
|
||||
{
|
||||
@ -369,7 +369,7 @@ class BudgetController extends Controller
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return array|string
|
||||
* @return string
|
||||
*/
|
||||
public function topExpenses(Collection $accounts, Collection $budgets, Carbon $start, Carbon $end)
|
||||
{
|
||||
|
@ -274,7 +274,7 @@ class CategoryController extends Controller
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return array|string
|
||||
* @return string
|
||||
*/
|
||||
public function avgExpenses(Collection $accounts, Collection $categories, Carbon $start, Carbon $end)
|
||||
{
|
||||
@ -326,7 +326,7 @@ class CategoryController extends Controller
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return array|string
|
||||
* @return string
|
||||
*/
|
||||
public function avgIncome(Collection $accounts, Collection $categories, Carbon $start, Carbon $end)
|
||||
{
|
||||
@ -685,7 +685,7 @@ class CategoryController extends Controller
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return array|string
|
||||
* @return string
|
||||
*/
|
||||
public function topExpenses(Collection $accounts, Collection $categories, Carbon $start, Carbon $end)
|
||||
{
|
||||
@ -735,7 +735,7 @@ class CategoryController extends Controller
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return array|string
|
||||
* @return string
|
||||
*/
|
||||
public function topIncome(Collection $accounts, Collection $categories, Carbon $start, Carbon $end)
|
||||
{
|
||||
|
@ -74,7 +74,7 @@ class DoubleController extends Controller
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return array|string
|
||||
* @return string
|
||||
*/
|
||||
public function avgExpenses(Collection $accounts, Collection $doubles, Carbon $start, Carbon $end)
|
||||
{
|
||||
@ -126,7 +126,7 @@ class DoubleController extends Controller
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return array|string
|
||||
* @return string
|
||||
*/
|
||||
public function avgIncome(Collection $accounts, Collection $doubles, Carbon $start, Carbon $end)
|
||||
{
|
||||
@ -422,7 +422,7 @@ class DoubleController extends Controller
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return array|string
|
||||
* @return string
|
||||
*/
|
||||
public function topExpenses(Collection $accounts, Collection $doubles, Carbon $start, Carbon $end)
|
||||
{
|
||||
@ -472,7 +472,7 @@ class DoubleController extends Controller
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return array|string
|
||||
* @return string
|
||||
*/
|
||||
public function topIncome(Collection $accounts, Collection $doubles, Carbon $start, Carbon $end)
|
||||
{
|
||||
|
@ -268,7 +268,7 @@ class TagController extends Controller
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return array|string
|
||||
* @return string
|
||||
*/
|
||||
public function avgExpenses(Collection $accounts, Collection $tags, Carbon $start, Carbon $end)
|
||||
{
|
||||
@ -320,7 +320,7 @@ class TagController extends Controller
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return array|string
|
||||
* @return string
|
||||
*/
|
||||
public function avgIncome(Collection $accounts, Collection $tags, Carbon $start, Carbon $end)
|
||||
{
|
||||
@ -480,7 +480,7 @@ class TagController extends Controller
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return array|string
|
||||
* @return string
|
||||
*/
|
||||
public function topExpenses(Collection $accounts, Collection $tags, Carbon $start, Carbon $end)
|
||||
{
|
||||
@ -530,7 +530,7 @@ class TagController extends Controller
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return array|string
|
||||
* @return string
|
||||
*/
|
||||
public function topIncome(Collection $accounts, Collection $tags, Carbon $start, Carbon $end)
|
||||
{
|
||||
|
@ -227,7 +227,7 @@ class ReportController extends Controller
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return Factory|View|string
|
||||
* @return string
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function doubleReport(Collection $accounts, Collection $expense, Carbon $start, Carbon $end)
|
||||
@ -299,7 +299,7 @@ class ReportController extends Controller
|
||||
*
|
||||
* @param string $reportType
|
||||
*
|
||||
* @return mixed
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*
|
||||
*/
|
||||
public function options(string $reportType)
|
||||
|
@ -187,6 +187,8 @@ class CreateController extends Controller
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param TransactionJournal $journal
|
||||
*
|
||||
* @return Factory|\Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function createFromJournal(Request $request, TransactionJournal $journal)
|
||||
{
|
||||
@ -239,7 +241,6 @@ class CreateController extends Controller
|
||||
*/
|
||||
public function duplicate(Rule $rule): RedirectResponse
|
||||
{
|
||||
/** @var Rule $newRule */
|
||||
$newRule = $this->ruleRepos->duplicate($rule);
|
||||
|
||||
session()->flash('success', trans('firefly.duplicated_rule', ['title' => $rule->title, 'newTitle' => $newRule->title]));
|
||||
|
@ -99,7 +99,6 @@ class IndexController extends Controller
|
||||
* @param Rule $rule
|
||||
*
|
||||
* @return RedirectResponse
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function search(Rule $rule): RedirectResponse
|
||||
{
|
||||
|
@ -31,7 +31,7 @@ use Log;
|
||||
class CronController
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
* @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\Routing\ResponseFactory|\Illuminate\Http\Response
|
||||
*/
|
||||
public function cron()
|
||||
{
|
||||
|
@ -18,7 +18,6 @@
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/** @noinspection PhpMethodParametersCountMismatchInspection */
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Http\Controllers;
|
||||
@ -229,7 +228,7 @@ class TagController extends Controller
|
||||
* @param Carbon|null $end
|
||||
*
|
||||
* @return Factory|View
|
||||
*
|
||||
* @throws \FireflyIII\Exceptions\FireflyException
|
||||
*/
|
||||
public function show(Request $request, Tag $tag, Carbon $start = null, Carbon $end = null)
|
||||
{
|
||||
|
@ -90,7 +90,7 @@ class BulkController extends Controller
|
||||
*
|
||||
* @param BulkEditJournalRequest $request
|
||||
*
|
||||
* @return mixed
|
||||
* @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
||||
*/
|
||||
public function update(BulkEditJournalRequest $request)
|
||||
{
|
||||
|
@ -283,7 +283,6 @@ class ConvertController extends Controller
|
||||
*
|
||||
* @return RedirectResponse|Redirector
|
||||
*
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function postIndex(Request $request, TransactionType $destinationType, TransactionGroup $group)
|
||||
{
|
||||
|
@ -66,7 +66,7 @@ class DeleteController extends Controller
|
||||
*
|
||||
* @param TransactionGroup $group
|
||||
*
|
||||
* @return mixed
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\Contracts\View\View|Redirector|RedirectResponse
|
||||
*/
|
||||
public function delete(TransactionGroup $group)
|
||||
{
|
||||
|
@ -91,7 +91,7 @@ class MassController extends Controller
|
||||
*
|
||||
* @param MassDeleteJournalRequest $request
|
||||
*
|
||||
* @return mixed
|
||||
* @return \Illuminate\Contracts\Foundation\Application|Redirector|RedirectResponse
|
||||
*
|
||||
*/
|
||||
public function destroy(MassDeleteJournalRequest $request)
|
||||
|
@ -73,6 +73,7 @@ class ShowController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param TransactionGroup $transactionGroup
|
||||
*
|
||||
* @return Factory|View
|
||||
|
@ -44,7 +44,6 @@ class InstallationId
|
||||
*
|
||||
* @return mixed
|
||||
*
|
||||
* @throws FireflyException
|
||||
*
|
||||
*/
|
||||
public function handle($request, Closure $next)
|
||||
|
@ -27,14 +27,15 @@ use FireflyIII\User;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
|
||||
/**
|
||||
* FireflyIII\Models\Preference
|
||||
*
|
||||
* @property int $id
|
||||
* @property \Illuminate\Support\Carbon|null $created_at
|
||||
* @property \Illuminate\Support\Carbon|null $updated_at
|
||||
* @property Carbon|null $created_at
|
||||
* @property Carbon|null $updated_at
|
||||
* @property int $user_id
|
||||
* @property string $name
|
||||
* @property int|string|array|null $data
|
||||
|
@ -33,6 +33,7 @@ use FireflyIII\Models\TransactionJournal;
|
||||
use FireflyIII\Models\TransactionType;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Log;
|
||||
use stdClass;
|
||||
|
||||
/**
|
||||
* Class AccountDestroyService
|
||||
@ -130,7 +131,7 @@ class AccountDestroyService
|
||||
/** @var JournalDestroyService $service */
|
||||
$service = app(JournalDestroyService::class);
|
||||
$user = $account->user;
|
||||
/** @var \stdClass $row */
|
||||
/** @var stdClass $row */
|
||||
foreach ($collection as $row) {
|
||||
if ((int)$row->the_count > 1) {
|
||||
$journalId = (int)$row->transaction_journal_id;
|
||||
|
@ -275,7 +275,6 @@ trait AccountServiceTrait
|
||||
* @param string $currencyCode
|
||||
*
|
||||
* @return TransactionCurrency
|
||||
* @throws JsonException
|
||||
*/
|
||||
protected function getCurrency(int $currencyId, string $currencyCode): TransactionCurrency
|
||||
{
|
||||
|
@ -49,7 +49,6 @@ trait BillServiceTrait
|
||||
return;
|
||||
}
|
||||
$ruleIds = $bill->user->rules()->get(['id'])->pluck('id')->toArray();
|
||||
/** @var Collection $set */
|
||||
$set = RuleAction::whereIn('rule_id', $ruleIds)
|
||||
->where('action_type', 'link_to_bill')
|
||||
->where('action_value', $oldName)->get();
|
||||
|
@ -194,7 +194,7 @@ trait JournalServiceTrait
|
||||
* @param array $data
|
||||
* @param string $preferredType
|
||||
*
|
||||
* @return Account
|
||||
* @return Account|null
|
||||
* @throws FireflyException
|
||||
*/
|
||||
private function createAccount(?Account $account, array $data, string $preferredType): ?Account
|
||||
@ -302,7 +302,7 @@ trait JournalServiceTrait
|
||||
/**
|
||||
* @param string|null $amount
|
||||
*
|
||||
* @return string
|
||||
* @return string|null
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
protected function getForeignAmount(?string $amount): ?string
|
||||
@ -372,7 +372,7 @@ trait JournalServiceTrait
|
||||
|
||||
/**
|
||||
* @param TransactionJournal $journal
|
||||
* @param string $notes
|
||||
* @param string|null $notes
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
@ -405,7 +405,7 @@ trait JournalServiceTrait
|
||||
* Link tags to journal.
|
||||
*
|
||||
* @param TransactionJournal $journal
|
||||
* @param array $tags
|
||||
* @param array|null $tags
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
|
@ -257,6 +257,8 @@ trait RecurringTransactionTrait
|
||||
/**
|
||||
* @param RecurrenceTransaction $transaction
|
||||
* @param int $categoryId
|
||||
*
|
||||
* @throws FireflyException
|
||||
*/
|
||||
private function setCategory(RecurrenceTransaction $transaction, int $categoryId): void
|
||||
{
|
||||
|
@ -77,6 +77,8 @@ class AccountUpdateService
|
||||
* @param array $data
|
||||
*
|
||||
* @return Account
|
||||
* @throws FireflyException
|
||||
* @throws \JsonException
|
||||
*/
|
||||
public function update(Account $account, array $data): Account
|
||||
{
|
||||
@ -179,6 +181,8 @@ class AccountUpdateService
|
||||
|
||||
/**
|
||||
* @param string $type
|
||||
*
|
||||
* @return AccountType
|
||||
*/
|
||||
private function getAccountType(string $type): AccountType
|
||||
{
|
||||
@ -219,7 +223,7 @@ class AccountUpdateService
|
||||
$this->user->accounts()->where('accounts.order', '<=', $newOrder)->where('accounts.order', '>', $oldOrder)
|
||||
->where('accounts.id', '!=', $account->id)
|
||||
->whereIn('accounts.account_type_id', $list)
|
||||
->decrement('order', 1);
|
||||
->decrement('order');
|
||||
$account->order = $newOrder;
|
||||
Log::debug(sprintf('Order of account #%d ("%s") is now %d', $account->id, $account->name, $newOrder));
|
||||
$account->save();
|
||||
@ -230,7 +234,7 @@ class AccountUpdateService
|
||||
$this->user->accounts()->where('accounts.order', '>=', $newOrder)->where('accounts.order', '<', $oldOrder)
|
||||
->where('accounts.id', '!=', $account->id)
|
||||
->whereIn('accounts.account_type_id', $list)
|
||||
->increment('order', 1);
|
||||
->increment('order');
|
||||
$account->order = $newOrder;
|
||||
Log::debug(sprintf('Order of account #%d ("%s") is now %d', $account->id, $account->name, $newOrder));
|
||||
$account->save();
|
||||
@ -339,6 +343,8 @@ class AccountUpdateService
|
||||
|
||||
/**
|
||||
* @param Account $account
|
||||
*
|
||||
* @throws FireflyException
|
||||
*/
|
||||
private function updatePreferences(Account $account): void
|
||||
{
|
||||
|
@ -184,14 +184,14 @@ class BillUpdateService
|
||||
if ($newOrder > $oldOrder) {
|
||||
$this->user->bills()->where('order', '<=', $newOrder)->where('order', '>', $oldOrder)
|
||||
->where('bills.id', '!=', $bill->id)
|
||||
->decrement('bills.order', 1);
|
||||
->decrement('bills.order');
|
||||
$bill->order = $newOrder;
|
||||
$bill->save();
|
||||
}
|
||||
if ($newOrder < $oldOrder) {
|
||||
$this->user->bills()->where('order', '>=', $newOrder)->where('order', '<', $oldOrder)
|
||||
->where('bills.id', '!=', $bill->id)
|
||||
->increment('bills.order', 1);
|
||||
->increment('bills.order');
|
||||
$bill->order = $newOrder;
|
||||
$bill->save();
|
||||
}
|
||||
|
@ -62,6 +62,7 @@ class CategoryUpdateService
|
||||
* @param array $data
|
||||
*
|
||||
* @return Category
|
||||
* @throws Exception
|
||||
*/
|
||||
public function update(Category $category, array $data): Category
|
||||
{
|
||||
|
@ -165,6 +165,7 @@ class GroupUpdateService
|
||||
* @param array $data
|
||||
*
|
||||
* @throws FireflyException
|
||||
* @throws \FireflyIII\Exceptions\DuplicateTransactionException
|
||||
*/
|
||||
private function createTransactionJournal(TransactionGroup $transactionGroup, array $data): void
|
||||
{
|
||||
|
@ -143,6 +143,8 @@ class RecurrenceUpdateService
|
||||
*
|
||||
* @param Recurrence $recurrence
|
||||
* @param array $repetitions
|
||||
*
|
||||
* @throws FireflyException
|
||||
*/
|
||||
private function updateRepetitions(Recurrence $recurrence, array $repetitions): void
|
||||
{
|
||||
@ -184,7 +186,8 @@ class RecurrenceUpdateService
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $data
|
||||
* @param Recurrence $recurrence
|
||||
* @param array $data
|
||||
*
|
||||
* @return RecurrenceRepetition|null
|
||||
*/
|
||||
@ -308,7 +311,8 @@ class RecurrenceUpdateService
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $data
|
||||
* @param Recurrence $recurrence
|
||||
* @param array $data
|
||||
*
|
||||
* @return RecurrenceTransaction|null
|
||||
*/
|
||||
|
@ -193,7 +193,7 @@ trait CalculateRangeOccurrences
|
||||
if (0 === $attempts % $skipMod) {
|
||||
$return[] = clone $obj;
|
||||
}
|
||||
$obj->addYears(1);
|
||||
$obj->addYears();
|
||||
$count++;
|
||||
$attempts++;
|
||||
}
|
||||
|
@ -200,7 +200,7 @@ trait CalculateXOccurrences
|
||||
$return[] = clone $obj;
|
||||
$total++;
|
||||
}
|
||||
$obj->addYears(1);
|
||||
$obj->addYears();
|
||||
$attempts++;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user