mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Code cleaning stuff.
This commit is contained in:
parent
9a461fc7b7
commit
71fb9d8fa5
@ -60,7 +60,7 @@ class AboutController extends Controller
|
|||||||
'driver' => $currentDriver,
|
'driver' => $currentDriver,
|
||||||
];
|
];
|
||||||
|
|
||||||
return response()->json(['data' => $data], 200)->header('Content-Type', 'application/vnd.api+json');
|
return response()->json(['data' => $data])->header('Content-Type', 'application/vnd.api+json');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -100,7 +100,7 @@ class AttachmentController extends Controller
|
|||||||
$quoted = sprintf('"%s"', addcslashes(basename($attachment->filename), '"\\'));
|
$quoted = sprintf('"%s"', addcslashes(basename($attachment->filename), '"\\'));
|
||||||
|
|
||||||
/** @var LaravelResponse $response */
|
/** @var LaravelResponse $response */
|
||||||
$response = response($content, 200);
|
$response = response($content);
|
||||||
$response
|
$response
|
||||||
->header('Content-Description', 'File Transfer')
|
->header('Content-Description', 'File Transfer')
|
||||||
->header('Content-Type', 'application/octet-stream')
|
->header('Content-Type', 'application/octet-stream')
|
||||||
|
@ -24,12 +24,10 @@ declare(strict_types=1);
|
|||||||
namespace FireflyIII\Api\V1\Controllers;
|
namespace FireflyIII\Api\V1\Controllers;
|
||||||
|
|
||||||
use FireflyIII\Api\V1\Requests\AvailableBudgetRequest;
|
use FireflyIII\Api\V1\Requests\AvailableBudgetRequest;
|
||||||
use FireflyIII\Exceptions\FireflyException;
|
|
||||||
use FireflyIII\Factory\TransactionCurrencyFactory;
|
use FireflyIII\Factory\TransactionCurrencyFactory;
|
||||||
use FireflyIII\Models\AvailableBudget;
|
use FireflyIII\Models\AvailableBudget;
|
||||||
use FireflyIII\Models\TransactionCurrency;
|
use FireflyIII\Models\TransactionCurrency;
|
||||||
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
|
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
|
||||||
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
|
|
||||||
use FireflyIII\Transformers\AvailableBudgetTransformer;
|
use FireflyIII\Transformers\AvailableBudgetTransformer;
|
||||||
use FireflyIII\User;
|
use FireflyIII\User;
|
||||||
use Illuminate\Http\JsonResponse;
|
use Illuminate\Http\JsonResponse;
|
||||||
@ -48,8 +46,6 @@ use League\Fractal\Serializer\JsonApiSerializer;
|
|||||||
*/
|
*/
|
||||||
class AvailableBudgetController extends Controller
|
class AvailableBudgetController extends Controller
|
||||||
{
|
{
|
||||||
/** @var CurrencyRepositoryInterface The currency repository */
|
|
||||||
private $currencyRepository;
|
|
||||||
/** @var BudgetRepositoryInterface The budget repository */
|
/** @var BudgetRepositoryInterface The budget repository */
|
||||||
private $repository;
|
private $repository;
|
||||||
|
|
||||||
@ -64,7 +60,6 @@ class AvailableBudgetController extends Controller
|
|||||||
/** @var User $user */
|
/** @var User $user */
|
||||||
$user = auth()->user();
|
$user = auth()->user();
|
||||||
$this->repository = app(BudgetRepositoryInterface::class);
|
$this->repository = app(BudgetRepositoryInterface::class);
|
||||||
$this->currencyRepository = app(CurrencyRepositoryInterface::class);
|
|
||||||
$this->repository->setUser($user);
|
$this->repository->setUser($user);
|
||||||
|
|
||||||
return $next($request);
|
return $next($request);
|
||||||
@ -110,9 +105,11 @@ class AvailableBudgetController extends Controller
|
|||||||
$start = $this->parameters->get('start');
|
$start = $this->parameters->get('start');
|
||||||
$end = $this->parameters->get('end');
|
$end = $this->parameters->get('end');
|
||||||
if (null !== $start && null !== $end) {
|
if (null !== $start && null !== $end) {
|
||||||
$collection = $collection->filter(function(AvailableBudget $availableBudget) use ($start, $end) {
|
$collection = $collection->filter(
|
||||||
|
function (AvailableBudget $availableBudget) use ($start, $end) {
|
||||||
return $availableBudget->start_date->gte($start) && $availableBudget->end_date->lte($end);
|
return $availableBudget->start_date->gte($start) && $availableBudget->end_date->lte($end);
|
||||||
});
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$count = $collection->count();
|
$count = $collection->count();
|
||||||
@ -164,7 +161,6 @@ class AvailableBudgetController extends Controller
|
|||||||
* @param AvailableBudgetRequest $request
|
* @param AvailableBudgetRequest $request
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
* @throws FireflyException
|
|
||||||
*/
|
*/
|
||||||
public function store(AvailableBudgetRequest $request): JsonResponse
|
public function store(AvailableBudgetRequest $request): JsonResponse
|
||||||
{
|
{
|
||||||
|
@ -156,6 +156,70 @@ class AccountController extends Controller
|
|||||||
return response()->json($chartData);
|
return response()->json($chartData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Request $request
|
||||||
|
*
|
||||||
|
* @return JsonResponse
|
||||||
|
* @throws FireflyException
|
||||||
|
*/
|
||||||
|
public function overview(Request $request): JsonResponse
|
||||||
|
{
|
||||||
|
// parameters for chart:
|
||||||
|
$start = (string)$request->get('start');
|
||||||
|
$end = (string)$request->get('end');
|
||||||
|
if ('' === $start || '' === $end) {
|
||||||
|
throw new FireflyException('Start and end are mandatory parameters.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$start = Carbon::createFromFormat('Y-m-d', $start);
|
||||||
|
$end = Carbon::createFromFormat('Y-m-d', $end);
|
||||||
|
|
||||||
|
// user's preferences
|
||||||
|
$defaultSet = $this->repository->getAccountsByType([AccountType::DEFAULT, AccountType::ASSET])->pluck('id')->toArray();
|
||||||
|
$frontPage = app('preferences')->get('frontPageAccounts', $defaultSet);
|
||||||
|
$default = app('amount')->getDefaultCurrency();
|
||||||
|
if (0 === \count($frontPage->data)) {
|
||||||
|
$frontPage->data = $defaultSet;
|
||||||
|
$frontPage->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
// get accounts:
|
||||||
|
$accounts = $this->repository->getAccountsById($frontPage->data);
|
||||||
|
$chartData = [];
|
||||||
|
/** @var Account $account */
|
||||||
|
foreach ($accounts as $account) {
|
||||||
|
$currency = $this->repository->getAccountCurrency($account);
|
||||||
|
if (null === $currency) {
|
||||||
|
$currency = $default;
|
||||||
|
}
|
||||||
|
$currentSet = [
|
||||||
|
'label' => $account->name,
|
||||||
|
'currency_id' => $currency->id,
|
||||||
|
'currency_code' => $currency->code,
|
||||||
|
'currency_symbol' => $currency->symbol,
|
||||||
|
'currency_decimal_places' => $currency->decimal_places,
|
||||||
|
'type' => 'line', // line, area or bar
|
||||||
|
'yAxisID' => 0, // 0, 1, 2
|
||||||
|
'entries' => [],
|
||||||
|
];
|
||||||
|
|
||||||
|
$currentStart = clone $start;
|
||||||
|
$range = app('steam')->balanceInRange($account, $start, clone $end);
|
||||||
|
$previous = round(array_values($range)[0], 12);
|
||||||
|
while ($currentStart <= $end) {
|
||||||
|
$format = $currentStart->format('Y-m-d');
|
||||||
|
$label = $currentStart->format('Y-m-d');
|
||||||
|
$balance = isset($range[$format]) ? round($range[$format], 12) : $previous;
|
||||||
|
$previous = $balance;
|
||||||
|
$currentStart->addDay();
|
||||||
|
$currentSet['entries'][$label] = $balance;
|
||||||
|
}
|
||||||
|
$chartData[] = $currentSet;
|
||||||
|
}
|
||||||
|
|
||||||
|
return response()->json($chartData);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
*
|
*
|
||||||
@ -244,70 +308,6 @@ class AccountController extends Controller
|
|||||||
return response()->json($chartData);
|
return response()->json($chartData);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Request $request
|
|
||||||
*
|
|
||||||
* @return JsonResponse
|
|
||||||
* @throws FireflyException
|
|
||||||
*/
|
|
||||||
public function overview(Request $request): JsonResponse
|
|
||||||
{
|
|
||||||
// parameters for chart:
|
|
||||||
$start = (string)$request->get('start');
|
|
||||||
$end = (string)$request->get('end');
|
|
||||||
if ('' === $start || '' === $end) {
|
|
||||||
throw new FireflyException('Start and end are mandatory parameters.');
|
|
||||||
}
|
|
||||||
|
|
||||||
$start = Carbon::createFromFormat('Y-m-d', $start);
|
|
||||||
$end = Carbon::createFromFormat('Y-m-d', $end);
|
|
||||||
|
|
||||||
// user's preferences
|
|
||||||
$defaultSet = $this->repository->getAccountsByType([AccountType::DEFAULT, AccountType::ASSET])->pluck('id')->toArray();
|
|
||||||
$frontPage = app('preferences')->get('frontPageAccounts', $defaultSet);
|
|
||||||
$default = app('amount')->getDefaultCurrency();
|
|
||||||
if (0 === \count($frontPage->data)) {
|
|
||||||
$frontPage->data = $defaultSet;
|
|
||||||
$frontPage->save();
|
|
||||||
}
|
|
||||||
|
|
||||||
// get accounts:
|
|
||||||
$accounts = $this->repository->getAccountsById($frontPage->data);
|
|
||||||
$chartData = [];
|
|
||||||
/** @var Account $account */
|
|
||||||
foreach ($accounts as $account) {
|
|
||||||
$currency = $this->repository->getAccountCurrency($account);
|
|
||||||
if (null === $currency) {
|
|
||||||
$currency = $default;
|
|
||||||
}
|
|
||||||
$currentSet = [
|
|
||||||
'label' => $account->name,
|
|
||||||
'currency_id' => $currency->id,
|
|
||||||
'currency_code' => $currency->code,
|
|
||||||
'currency_symbol' => $currency->symbol,
|
|
||||||
'currency_decimal_places' => $currency->decimal_places,
|
|
||||||
'type' => 'line', // line, area or bar
|
|
||||||
'yAxisID' => 0, // 0, 1, 2
|
|
||||||
'entries' => [],
|
|
||||||
];
|
|
||||||
|
|
||||||
$currentStart = clone $start;
|
|
||||||
$range = app('steam')->balanceInRange($account, $start, clone $end);
|
|
||||||
$previous = round(array_values($range)[0], 12);
|
|
||||||
while ($currentStart <= $end) {
|
|
||||||
$format = $currentStart->format('Y-m-d');
|
|
||||||
$label = $currentStart->format('Y-m-d');
|
|
||||||
$balance = isset($range[$format]) ? round($range[$format], 12) : $previous;
|
|
||||||
$previous = $balance;
|
|
||||||
$currentStart->addDay();
|
|
||||||
$currentSet['entries'][$label] = $balance;
|
|
||||||
}
|
|
||||||
$chartData[] = $currentSet;
|
|
||||||
}
|
|
||||||
|
|
||||||
return response()->json($chartData);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Small helper function for the revenue and expense account charts.
|
* Small helper function for the revenue and expense account charts.
|
||||||
* TODO should include Trait instead of doing this.
|
* TODO should include Trait instead of doing this.
|
||||||
|
@ -30,7 +30,6 @@ use FireflyIII\Models\AvailableBudget;
|
|||||||
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
|
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
|
||||||
use FireflyIII\User;
|
use FireflyIII\User;
|
||||||
use Illuminate\Http\JsonResponse;
|
use Illuminate\Http\JsonResponse;
|
||||||
use Illuminate\Http\Request;
|
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -60,13 +59,11 @@ class AvailableBudgetController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Request $request
|
|
||||||
*
|
|
||||||
* @param AvailableBudget $availableBudget
|
* @param AvailableBudget $availableBudget
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
*/
|
*/
|
||||||
public function overview(Request $request, AvailableBudget $availableBudget): JsonResponse
|
public function overview(AvailableBudget $availableBudget): JsonResponse
|
||||||
{
|
{
|
||||||
$currency = $availableBudget->transactionCurrency;
|
$currency = $availableBudget->transactionCurrency;
|
||||||
$budgets = $this->repository->getActiveBudgets();
|
$budgets = $this->repository->getActiveBudgets();
|
||||||
|
@ -54,7 +54,6 @@ class ConfigurationController extends Controller
|
|||||||
$admin = auth()->user();
|
$admin = auth()->user();
|
||||||
|
|
||||||
if (!$this->repository->hasRole($admin, 'owner')) {
|
if (!$this->repository->hasRole($admin, 'owner')) {
|
||||||
/** @noinspection ExceptionsAnnotatingAndHandlingInspection */
|
|
||||||
throw new FireflyException('No access to method.'); // @codeCoverageIgnore
|
throw new FireflyException('No access to method.'); // @codeCoverageIgnore
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,7 +71,7 @@ class ConfigurationController extends Controller
|
|||||||
{
|
{
|
||||||
$configData = $this->getConfigData();
|
$configData = $this->getConfigData();
|
||||||
|
|
||||||
return response()->json(['data' => $configData], 200)->header('Content-Type', 'application/vnd.api+json');
|
return response()->json(['data' => $configData])->header('Content-Type', 'application/vnd.api+json');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -82,7 +81,6 @@ class ConfigurationController extends Controller
|
|||||||
* @param string $name
|
* @param string $name
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
* @throws FireflyException
|
|
||||||
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
|
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
|
||||||
*/
|
*/
|
||||||
public function update(ConfigurationRequest $request, string $name): JsonResponse
|
public function update(ConfigurationRequest $request, string $name): JsonResponse
|
||||||
@ -91,7 +89,7 @@ class ConfigurationController extends Controller
|
|||||||
app('fireflyconfig')->set($name, $data['value']);
|
app('fireflyconfig')->set($name, $data['value']);
|
||||||
$configData = $this->getConfigData();
|
$configData = $this->getConfigData();
|
||||||
|
|
||||||
return response()->json(['data' => $configData], 200)->header('Content-Type', 'application/vnd.api+json');
|
return response()->json(['data' => $configData])->header('Content-Type', 'application/vnd.api+json');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -265,6 +265,8 @@ class CurrencyController extends Controller
|
|||||||
*
|
*
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
*
|
*
|
||||||
|
* @param TransactionCurrency $currency
|
||||||
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
*/
|
*/
|
||||||
public function budgetLimits(Request $request, TransactionCurrency $currency): JsonResponse
|
public function budgetLimits(Request $request, TransactionCurrency $currency): JsonResponse
|
||||||
@ -491,6 +493,8 @@ class CurrencyController extends Controller
|
|||||||
*
|
*
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
*
|
*
|
||||||
|
* @param TransactionCurrency $currency
|
||||||
|
*
|
||||||
* @return JsonResponse]
|
* @return JsonResponse]
|
||||||
*/
|
*/
|
||||||
public function recurrences(Request $request, TransactionCurrency $currency): JsonResponse
|
public function recurrences(Request $request, TransactionCurrency $currency): JsonResponse
|
||||||
|
@ -127,6 +127,7 @@ class ImportController extends Controller
|
|||||||
/**
|
/**
|
||||||
* Show all transactions
|
* Show all transactions
|
||||||
*
|
*
|
||||||
|
* @param Request $request
|
||||||
* @param ImportJob $importJob
|
* @param ImportJob $importJob
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
|
@ -90,7 +90,7 @@ class LinkTypeController extends Controller
|
|||||||
if (false === $linkType->editable) {
|
if (false === $linkType->editable) {
|
||||||
throw new FireflyException(sprintf('You cannot delete this link type (#%d, "%s")', $linkType->id, $linkType->name));
|
throw new FireflyException(sprintf('You cannot delete this link type (#%d, "%s")', $linkType->id, $linkType->name));
|
||||||
}
|
}
|
||||||
$this->repository->destroy($linkType, null);
|
$this->repository->destroy($linkType);
|
||||||
|
|
||||||
return response()->json([], 204);
|
return response()->json([], 204);
|
||||||
}
|
}
|
||||||
@ -190,6 +190,7 @@ class LinkTypeController extends Controller
|
|||||||
/**
|
/**
|
||||||
* Delete the resource.
|
* Delete the resource.
|
||||||
*
|
*
|
||||||
|
* @param Request $request
|
||||||
* @param LinkType $linkType
|
* @param LinkType $linkType
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
|
@ -59,7 +59,7 @@ class PreferenceController extends Controller
|
|||||||
// an important fallback is that the frontPageAccount array gets refilled automatically
|
// an important fallback is that the frontPageAccount array gets refilled automatically
|
||||||
// when it turns up empty.
|
// when it turns up empty.
|
||||||
$frontPageAccounts = app('preferences')->getForUser($user, 'frontPageAccounts', [])->data;
|
$frontPageAccounts = app('preferences')->getForUser($user, 'frontPageAccounts', [])->data;
|
||||||
if (\count($frontPageAccounts) === 0) {
|
if (0 === \count($frontPageAccounts)) {
|
||||||
/** @var Collection $accounts */
|
/** @var Collection $accounts */
|
||||||
$accounts = $repository->getAccountsByType([AccountType::DEFAULT, AccountType::ASSET]);
|
$accounts = $repository->getAccountsByType([AccountType::DEFAULT, AccountType::ASSET]);
|
||||||
$accountIds = $accounts->pluck('id')->toArray();
|
$accountIds = $accounts->pluck('id')->toArray();
|
||||||
|
@ -247,7 +247,7 @@ class RecurrenceController extends Controller
|
|||||||
return response()->json([], 204);
|
return response()->json([], 204);
|
||||||
}
|
}
|
||||||
if (true === $result) {
|
if (true === $result) {
|
||||||
return response()->json([], 200);
|
return response()->json();
|
||||||
}
|
}
|
||||||
|
|
||||||
return response()->json([], 418); // @codeCoverageIgnore
|
return response()->json([], 418); // @codeCoverageIgnore
|
||||||
|
@ -105,6 +105,7 @@ class SummaryController extends Controller
|
|||||||
$spentData = $this->getLeftToSpendInfo($start, $end);
|
$spentData = $this->getLeftToSpendInfo($start, $end);
|
||||||
$networthData = $this->getNetWorthInfo($start, $end);
|
$networthData = $this->getNetWorthInfo($start, $end);
|
||||||
$total = array_merge($balanceData, $billData, $spentData, $networthData);
|
$total = array_merge($balanceData, $billData, $spentData, $networthData);
|
||||||
|
|
||||||
// TODO: liabilities with icon line-chart
|
// TODO: liabilities with icon line-chart
|
||||||
|
|
||||||
return response()->json($total);
|
return response()->json($total);
|
||||||
@ -361,8 +362,11 @@ class SummaryController extends Controller
|
|||||||
*/
|
*/
|
||||||
private function getNetWorthInfo(Carbon $start, Carbon $end): array
|
private function getNetWorthInfo(Carbon $start, Carbon $end): array
|
||||||
{
|
{
|
||||||
|
/** @var User $user */
|
||||||
|
$user = auth()->user();
|
||||||
$date = Carbon::create()->startOfDay();
|
$date = Carbon::create()->startOfDay();
|
||||||
|
|
||||||
|
|
||||||
// start and end in the future? use $end
|
// start and end in the future? use $end
|
||||||
if ($this->notInDateRange($date, $start, $end)) {
|
if ($this->notInDateRange($date, $start, $end)) {
|
||||||
/** @var Carbon $date */
|
/** @var Carbon $date */
|
||||||
@ -371,7 +375,7 @@ class SummaryController extends Controller
|
|||||||
|
|
||||||
/** @var NetWorthInterface $netWorthHelper */
|
/** @var NetWorthInterface $netWorthHelper */
|
||||||
$netWorthHelper = app(NetWorthInterface::class);
|
$netWorthHelper = app(NetWorthInterface::class);
|
||||||
$netWorthHelper->setUser(auth()->user());
|
$netWorthHelper->setUser($user);
|
||||||
$allAccounts = $this->accountRepository->getActiveAccountsByType([AccountType::ASSET, AccountType::DEBT, AccountType::LOAN, AccountType::MORTGAGE]);
|
$allAccounts = $this->accountRepository->getActiveAccountsByType([AccountType::ASSET, AccountType::DEBT, AccountType::LOAN, AccountType::MORTGAGE]);
|
||||||
|
|
||||||
// filter list on preference of being included.
|
// filter list on preference of being included.
|
||||||
@ -389,7 +393,7 @@ class SummaryController extends Controller
|
|||||||
/** @var TransactionCurrency $currency */
|
/** @var TransactionCurrency $currency */
|
||||||
$currency = $data['currency'];
|
$currency = $data['currency'];
|
||||||
$amount = round($data['balance'], $currency->decimal_places);
|
$amount = round($data['balance'], $currency->decimal_places);
|
||||||
if ($amount === 0.0) {
|
if (0.0 === $amount) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// return stuff
|
// return stuff
|
||||||
|
@ -179,7 +179,7 @@ class TransactionController extends Controller
|
|||||||
$baseUrl = $request->getSchemeAndHttpHost() . '/api/v1';
|
$baseUrl = $request->getSchemeAndHttpHost() . '/api/v1';
|
||||||
$manager->setSerializer(new JsonApiSerializer($baseUrl));
|
$manager->setSerializer(new JsonApiSerializer($baseUrl));
|
||||||
|
|
||||||
$events = $this->repository->getPiggyBankEventsByTr($transaction);
|
$events = $this->repository->getPiggyBankEventsbyTr($transaction);
|
||||||
|
|
||||||
/** @var PiggyBankEventTransformer $transformer */
|
/** @var PiggyBankEventTransformer $transformer */
|
||||||
$transformer = app(PiggyBankEventTransformer::class);
|
$transformer = app(PiggyBankEventTransformer::class);
|
||||||
|
@ -29,7 +29,6 @@ use FireflyIII\Models\TransactionJournalLink;
|
|||||||
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
|
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
|
||||||
use FireflyIII\Repositories\LinkType\LinkTypeRepositoryInterface;
|
use FireflyIII\Repositories\LinkType\LinkTypeRepositoryInterface;
|
||||||
use FireflyIII\Support\Http\Api\TransactionFilter;
|
use FireflyIII\Support\Http\Api\TransactionFilter;
|
||||||
use FireflyIII\Transformers\JournalLinkTransformer;
|
|
||||||
use FireflyIII\Transformers\TransactionLinkTransformer;
|
use FireflyIII\Transformers\TransactionLinkTransformer;
|
||||||
use FireflyIII\User;
|
use FireflyIII\User;
|
||||||
use Illuminate\Http\JsonResponse;
|
use Illuminate\Http\JsonResponse;
|
||||||
|
@ -24,7 +24,6 @@ declare(strict_types=1);
|
|||||||
namespace FireflyIII\Api\V1\Requests;
|
namespace FireflyIII\Api\V1\Requests;
|
||||||
|
|
||||||
use FireflyIII\Models\Category;
|
use FireflyIII\Models\Category;
|
||||||
use FireflyIII\Rules\IsBoolean;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class CategoryRequest
|
* Class CategoryRequest
|
||||||
@ -50,7 +49,7 @@ class CategoryRequest extends Request
|
|||||||
public function getAll(): array
|
public function getAll(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'name' => $this->string('name')
|
'name' => $this->string('name'),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,7 +61,7 @@ class CategoryRequest extends Request
|
|||||||
public function rules(): array
|
public function rules(): array
|
||||||
{
|
{
|
||||||
$rules = [
|
$rules = [
|
||||||
'name' => 'required|between:1,100|uniqueObjectForUser:categories,name'
|
'name' => 'required|between:1,100|uniqueObjectForUser:categories,name',
|
||||||
];
|
];
|
||||||
switch ($this->method()) {
|
switch ($this->method()) {
|
||||||
default:
|
default:
|
||||||
|
@ -25,6 +25,7 @@ namespace FireflyIII\Api\V1\Requests;
|
|||||||
|
|
||||||
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
|
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
|
||||||
use FireflyIII\Repositories\LinkType\LinkTypeRepositoryInterface;
|
use FireflyIII\Repositories\LinkType\LinkTypeRepositoryInterface;
|
||||||
|
use FireflyIII\User;
|
||||||
use Illuminate\Validation\Validator;
|
use Illuminate\Validation\Validator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -98,13 +99,15 @@ class TransactionLinkRequest extends Request
|
|||||||
*/
|
*/
|
||||||
private function validateExistingLink(Validator $validator): void
|
private function validateExistingLink(Validator $validator): void
|
||||||
{
|
{
|
||||||
|
/** @var User $user */
|
||||||
|
$user = auth()->user();
|
||||||
/** @var LinkTypeRepositoryInterface $repository */
|
/** @var LinkTypeRepositoryInterface $repository */
|
||||||
$repository = app(LinkTypeRepositoryInterface::class);
|
$repository = app(LinkTypeRepositoryInterface::class);
|
||||||
$repository->setUser(auth()->user());
|
$repository->setUser($user);
|
||||||
|
|
||||||
/** @var JournalRepositoryInterface $journalRepos */
|
/** @var JournalRepositoryInterface $journalRepos */
|
||||||
$journalRepos = app(JournalRepositoryInterface::class);
|
$journalRepos = app(JournalRepositoryInterface::class);
|
||||||
$journalRepos->setUser(auth()->user());
|
$journalRepos->setUser($user);
|
||||||
|
|
||||||
$data = $validator->getData();
|
$data = $validator->getData();
|
||||||
$inwardId = (int)($data['inward_id'] ?? 0);
|
$inwardId = (int)($data['inward_id'] ?? 0);
|
||||||
|
@ -41,6 +41,7 @@ use Illuminate\Support\Collection;
|
|||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Class ApplyRules
|
* Class ApplyRules
|
||||||
|
*
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
*/
|
*/
|
||||||
class ApplyRules extends Command
|
class ApplyRules extends Command
|
||||||
@ -184,6 +185,8 @@ class ApplyRules extends Command
|
|||||||
private function applyRuleSelection(Collection $rules, Collection $transactions, bool $breakProcessing): void
|
private function applyRuleSelection(Collection $rules, Collection $transactions, bool $breakProcessing): void
|
||||||
{
|
{
|
||||||
$bar = $this->output->createProgressBar($rules->count() * $transactions->count());
|
$bar = $this->output->createProgressBar($rules->count() * $transactions->count());
|
||||||
|
|
||||||
|
/** @var Rule $rule */
|
||||||
foreach ($rules as $rule) {
|
foreach ($rules as $rule) {
|
||||||
/** @var Processor $processor */
|
/** @var Processor $processor */
|
||||||
$processor = app(Processor::class);
|
$processor = app(Processor::class);
|
||||||
@ -191,7 +194,7 @@ class ApplyRules extends Command
|
|||||||
|
|
||||||
/** @var Transaction $transaction */
|
/** @var Transaction $transaction */
|
||||||
foreach ($transactions as $transaction) {
|
foreach ($transactions as $transaction) {
|
||||||
/** @var Rule $rule */
|
/** @noinspection DisconnectedForeachInstructionInspection */
|
||||||
$bar->advance();
|
$bar->advance();
|
||||||
$result = $processor->handleTransaction($transaction);
|
$result = $processor->handleTransaction($transaction);
|
||||||
if (true === $result) {
|
if (true === $result) {
|
||||||
@ -210,6 +213,7 @@ class ApplyRules extends Command
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
* @throws \FireflyIII\Exceptions\FireflyException
|
||||||
*/
|
*/
|
||||||
private function grabAllRules(): void
|
private function grabAllRules(): void
|
||||||
{
|
{
|
||||||
@ -226,6 +230,7 @@ class ApplyRules extends Command
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
* @throws \FireflyIII\Exceptions\FireflyException
|
||||||
*/
|
*/
|
||||||
private function parseDates(): void
|
private function parseDates(): void
|
||||||
{
|
{
|
||||||
|
@ -97,7 +97,7 @@ class CreateImport extends Command
|
|||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (\strlen($configuration) > 0) {
|
if ('' !== $configuration) {
|
||||||
$configurationData = json_decode(file_get_contents($configuration), true);
|
$configurationData = json_decode(file_get_contents($configuration), true);
|
||||||
if (null === $configurationData) {
|
if (null === $configurationData) {
|
||||||
$this->errorLine(sprintf('Firefly III cannot read the contents of configuration file "%s" (working directory: "%s").', $configuration, $cwd));
|
$this->errorLine(sprintf('Firefly III cannot read the contents of configuration file "%s" (working directory: "%s").', $configuration, $cwd));
|
||||||
@ -136,7 +136,7 @@ class CreateImport extends Command
|
|||||||
}
|
}
|
||||||
|
|
||||||
// store file as attachment.
|
// store file as attachment.
|
||||||
if (\strlen($file) > 0) {
|
if ('' !== $file) {
|
||||||
$messages = $jobRepository->storeCLIUpload($importJob, 'import_file', $file);
|
$messages = $jobRepository->storeCLIUpload($importJob, 'import_file', $file);
|
||||||
if ($messages->count() > 0) {
|
if ($messages->count() > 0) {
|
||||||
$this->errorLine($messages->first());
|
$this->errorLine($messages->first());
|
||||||
|
@ -48,16 +48,6 @@ class Cron extends Command
|
|||||||
*/
|
*/
|
||||||
protected $signature = 'firefly:cron';
|
protected $signature = 'firefly:cron';
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new command instance.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function __construct()
|
|
||||||
{
|
|
||||||
parent::__construct();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute the console command.
|
* Execute the console command.
|
||||||
*
|
*
|
||||||
|
@ -113,7 +113,7 @@ class DecryptDatabase extends Command
|
|||||||
$configName = sprintf('is_decrypted_%s', $table);
|
$configName = sprintf('is_decrypted_%s', $table);
|
||||||
$configVar = FireflyConfig::get($configName, false);
|
$configVar = FireflyConfig::get($configName, false);
|
||||||
if (null !== $configVar) {
|
if (null !== $configVar) {
|
||||||
return $configVar->data;
|
return (bool)$configVar->data;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -130,7 +130,7 @@ class DecryptDatabase extends Command
|
|||||||
try {
|
try {
|
||||||
$value = Crypt::decrypt($value);
|
$value = Crypt::decrypt($value);
|
||||||
} catch (DecryptException $e) {
|
} catch (DecryptException $e) {
|
||||||
//Log::debug(sprintf('Could not decrypt. %s', $e->getMessage()));
|
Log::debug(sprintf('Could not decrypt. %s', $e->getMessage()));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $value;
|
return $value;
|
||||||
|
@ -35,6 +35,7 @@ use FireflyIII\Models\AccountMeta;
|
|||||||
use FireflyIII\Models\AccountType;
|
use FireflyIII\Models\AccountType;
|
||||||
use FireflyIII\Models\Attachment;
|
use FireflyIII\Models\Attachment;
|
||||||
use FireflyIII\Models\Bill;
|
use FireflyIII\Models\Bill;
|
||||||
|
use FireflyIII\Models\Budget;
|
||||||
use FireflyIII\Models\BudgetLimit;
|
use FireflyIII\Models\BudgetLimit;
|
||||||
use FireflyIII\Models\Note;
|
use FireflyIII\Models\Note;
|
||||||
use FireflyIII\Models\Preference;
|
use FireflyIII\Models\Preference;
|
||||||
@ -272,7 +273,7 @@ class UpgradeDatabase extends Command
|
|||||||
->whereNull('transactions.deleted_at')
|
->whereNull('transactions.deleted_at')
|
||||||
->groupBy(['transaction_journals.id'])
|
->groupBy(['transaction_journals.id'])
|
||||||
->select(['transaction_journals.id', DB::raw('COUNT(transactions.id) AS t_count')]);
|
->select(['transaction_journals.id', DB::raw('COUNT(transactions.id) AS t_count')]);
|
||||||
$result = DB::table(DB::raw('(' . $subQuery->toSql() . ') AS derived'))
|
$result = DB::table((string)DB::raw('(' . $subQuery->toSql() . ') AS derived'))
|
||||||
->mergeBindings($subQuery->getQuery())
|
->mergeBindings($subQuery->getQuery())
|
||||||
->where('t_count', '>', 2)
|
->where('t_count', '>', 2)
|
||||||
->select(['id', 't_count']);
|
->select(['id', 't_count']);
|
||||||
@ -448,6 +449,7 @@ class UpgradeDatabase extends Command
|
|||||||
/** @var BudgetLimit $budgetLimit */
|
/** @var BudgetLimit $budgetLimit */
|
||||||
foreach ($budgetLimits as $budgetLimit) {
|
foreach ($budgetLimits as $budgetLimit) {
|
||||||
if (null === $budgetLimit->transaction_currency_id) {
|
if (null === $budgetLimit->transaction_currency_id) {
|
||||||
|
/** @var Budget $budget */
|
||||||
$budget = $budgetLimit->budget;
|
$budget = $budgetLimit->budget;
|
||||||
if (null !== $budget) {
|
if (null !== $budget) {
|
||||||
$user = $budget->user;
|
$user = $budget->user;
|
||||||
@ -493,7 +495,7 @@ class UpgradeDatabase extends Command
|
|||||||
|
|
||||||
// move description:
|
// move description:
|
||||||
$description = (string)$att->description;
|
$description = (string)$att->description;
|
||||||
if (\strlen($description) > 0) {
|
if ('' !== $description) {
|
||||||
// find or create note:
|
// find or create note:
|
||||||
$note = $att->notes()->first();
|
$note = $att->notes()->first();
|
||||||
if (null === $note) {
|
if (null === $note) {
|
||||||
|
@ -25,7 +25,6 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Console\Commands;
|
namespace FireflyIII\Console\Commands;
|
||||||
|
|
||||||
use Crypt;
|
|
||||||
use DB;
|
use DB;
|
||||||
use FireflyIII\Models\Account;
|
use FireflyIII\Models\Account;
|
||||||
use FireflyIII\Models\AccountMeta;
|
use FireflyIII\Models\AccountMeta;
|
||||||
@ -42,10 +41,8 @@ use FireflyIII\Models\TransactionType;
|
|||||||
use FireflyIII\Repositories\User\UserRepositoryInterface;
|
use FireflyIII\Repositories\User\UserRepositoryInterface;
|
||||||
use FireflyIII\User;
|
use FireflyIII\User;
|
||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
use Illuminate\Contracts\Encryption\DecryptException;
|
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
use Log;
|
|
||||||
use Schema;
|
use Schema;
|
||||||
use stdClass;
|
use stdClass;
|
||||||
|
|
||||||
|
@ -30,6 +30,7 @@ use Log;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* File to make sure commands work.
|
* File to make sure commands work.
|
||||||
|
*
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
*/
|
*/
|
||||||
class Kernel extends ConsoleKernel
|
class Kernel extends ConsoleKernel
|
||||||
@ -54,7 +55,9 @@ class Kernel extends ConsoleKernel
|
|||||||
{
|
{
|
||||||
$schedule->call(
|
$schedule->call(
|
||||||
function () {
|
function () {
|
||||||
Log::error('Firefly III no longer users the Laravel scheduler to do cron jobs! Please read the instructions at https://firefly-iii.readthedocs.io/en/latest/');
|
Log::error(
|
||||||
|
'Firefly III no longer users the Laravel scheduler to do cron jobs! Please read the instructions at https://firefly-iii.readthedocs.io/en/latest/'
|
||||||
|
);
|
||||||
echo "\n";
|
echo "\n";
|
||||||
echo '------------';
|
echo '------------';
|
||||||
echo "\n";
|
echo "\n";
|
||||||
|
@ -30,6 +30,7 @@ use Log;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Class AdminRequestedTestMessage.
|
* Class AdminRequestedTestMessage.
|
||||||
|
*
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
*/
|
*/
|
||||||
class AdminRequestedTestMessage extends Event
|
class AdminRequestedTestMessage extends Event
|
||||||
|
@ -26,6 +26,7 @@ namespace FireflyIII\Events;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Event.
|
* Class Event.
|
||||||
|
*
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
*/
|
*/
|
||||||
abstract class Event
|
abstract class Event
|
||||||
|
@ -29,6 +29,7 @@ use Illuminate\Queue\SerializesModels;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Class RegisteredUser.
|
* Class RegisteredUser.
|
||||||
|
*
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
*/
|
*/
|
||||||
class RegisteredUser extends Event
|
class RegisteredUser extends Event
|
||||||
|
@ -29,6 +29,7 @@ use Illuminate\Queue\SerializesModels;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Class RequestedNewPassword.
|
* Class RequestedNewPassword.
|
||||||
|
*
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
*/
|
*/
|
||||||
class RequestedNewPassword extends Event
|
class RequestedNewPassword extends Event
|
||||||
|
@ -28,6 +28,7 @@ use Crypt;
|
|||||||
use FireflyIII\Models\Attachment;
|
use FireflyIII\Models\Attachment;
|
||||||
use FireflyIII\Repositories\Attachment\AttachmentRepositoryInterface;
|
use FireflyIII\Repositories\Attachment\AttachmentRepositoryInterface;
|
||||||
use Illuminate\Contracts\Encryption\DecryptException;
|
use Illuminate\Contracts\Encryption\DecryptException;
|
||||||
|
use Illuminate\Contracts\Filesystem\FileNotFoundException;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
use Log;
|
use Log;
|
||||||
use Storage;
|
use Storage;
|
||||||
@ -110,7 +111,7 @@ class AttachmentCollector extends BasicCollector implements CollectorInterface
|
|||||||
if ($this->uploadDisk->exists($file)) {
|
if ($this->uploadDisk->exists($file)) {
|
||||||
try {
|
try {
|
||||||
$decrypted = Crypt::decrypt($this->uploadDisk->get($file));
|
$decrypted = Crypt::decrypt($this->uploadDisk->get($file));
|
||||||
} catch (DecryptException $e) {
|
} catch (DecryptException|FileNotFoundException $e) {
|
||||||
Log::error('Catchable error: could not decrypt attachment #' . $attachment->id . ' because: ' . $e->getMessage());
|
Log::error('Catchable error: could not decrypt attachment #' . $attachment->id . ' because: ' . $e->getMessage());
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -110,7 +110,7 @@ class UploadCollector extends BasicCollector implements CollectorInterface
|
|||||||
Log::error(sprintf('Could not decrypt old import file "%s". Skipped because: %s', $key, $e->getMessage()));
|
Log::error(sprintf('Could not decrypt old import file "%s". Skipped because: %s', $key, $e->getMessage()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (\strlen($content) > 0) {
|
if ('' !== $content) {
|
||||||
// add to export disk.
|
// add to export disk.
|
||||||
$date = $job->created_at->format('Y-m-d');
|
$date = $job->created_at->format('Y-m-d');
|
||||||
$file = sprintf('%s-Old %s import dated %s.%s', $this->job->key, strtoupper($job->file_type), $date, $job->file_type);
|
$file = sprintf('%s-Old %s import dated %s.%s', $this->job->key, strtoupper($job->file_type), $date, $job->file_type);
|
||||||
|
@ -49,48 +49,24 @@ use FireflyIII\Models\Transaction;
|
|||||||
*/
|
*/
|
||||||
final class Entry
|
final class Entry
|
||||||
{
|
{
|
||||||
/** @var int ID of the journal */
|
|
||||||
public $journal_id;
|
|
||||||
/** @var int ID of the transaction */
|
|
||||||
public $transaction_id = 0;
|
|
||||||
/** @var string The date. */
|
|
||||||
public $date;
|
|
||||||
/** @var string The description */
|
|
||||||
public $description;
|
|
||||||
/** @var string The currency code. */
|
|
||||||
public $currency_code;
|
|
||||||
/** @var string The amount. */
|
/** @var string The amount. */
|
||||||
public $amount;
|
public $amount;
|
||||||
/** @var string The foreign currency code */
|
/** @var string Asset account BIC */
|
||||||
public $foreign_currency_code = '';
|
public $asset_account_bic;
|
||||||
/** @var string Foreign amount */
|
/** @var string Asset account IBAN */
|
||||||
public $foreign_amount = '0';
|
public $asset_account_iban;
|
||||||
/** @var string Transaction type */
|
|
||||||
public $transaction_type;
|
|
||||||
/** @var string Asset account ID */
|
/** @var string Asset account ID */
|
||||||
public $asset_account_id;
|
public $asset_account_id;
|
||||||
/** @var string Asset account name */
|
/** @var string Asset account name */
|
||||||
public $asset_account_name;
|
public $asset_account_name;
|
||||||
/** @var string Asset account IBAN */
|
|
||||||
public $asset_account_iban;
|
|
||||||
/** @var string Asset account BIC */
|
|
||||||
public $asset_account_bic;
|
|
||||||
/** @var string Asset account number */
|
/** @var string Asset account number */
|
||||||
public $asset_account_number;
|
public $asset_account_number;
|
||||||
/** @var string Asset account currency code */
|
/** @var string Asset account currency code */
|
||||||
public $asset_currency_code;
|
public $asset_currency_code;
|
||||||
/** @var string Opposing account ID */
|
/** @var string Bill ID */
|
||||||
public $opposing_account_id;
|
public $bill_id;
|
||||||
/** @var string Opposing account name */
|
/** @var string Bill name */
|
||||||
public $opposing_account_name;
|
public $bill_name;
|
||||||
/** @var string Opposing account IBAN */
|
|
||||||
public $opposing_account_iban;
|
|
||||||
/** @var string Opposing account BIC */
|
|
||||||
public $opposing_account_bic;
|
|
||||||
/** @var string Opposing account number */
|
|
||||||
public $opposing_account_number;
|
|
||||||
/** @var string Opposing account code */
|
|
||||||
public $opposing_currency_code;
|
|
||||||
/** @var string Budget ID */
|
/** @var string Budget ID */
|
||||||
public $budget_id;
|
public $budget_id;
|
||||||
/** @var string Budget name */
|
/** @var string Budget name */
|
||||||
@ -99,14 +75,38 @@ final class Entry
|
|||||||
public $category_id;
|
public $category_id;
|
||||||
/** @var string Category name */
|
/** @var string Category name */
|
||||||
public $category_name;
|
public $category_name;
|
||||||
/** @var string Bill ID */
|
/** @var string The currency code. */
|
||||||
public $bill_id;
|
public $currency_code;
|
||||||
/** @var string Bill name */
|
/** @var string The date. */
|
||||||
public $bill_name;
|
public $date;
|
||||||
|
/** @var string The description */
|
||||||
|
public $description;
|
||||||
|
/** @var string Foreign amount */
|
||||||
|
public $foreign_amount = '0';
|
||||||
|
/** @var string The foreign currency code */
|
||||||
|
public $foreign_currency_code = '';
|
||||||
|
/** @var int ID of the journal */
|
||||||
|
public $journal_id;
|
||||||
/** @var string Notes */
|
/** @var string Notes */
|
||||||
public $notes;
|
public $notes;
|
||||||
|
/** @var string Opposing account BIC */
|
||||||
|
public $opposing_account_bic;
|
||||||
|
/** @var string Opposing account IBAN */
|
||||||
|
public $opposing_account_iban;
|
||||||
|
/** @var string Opposing account ID */
|
||||||
|
public $opposing_account_id;
|
||||||
|
/** @var string Opposing account name */
|
||||||
|
public $opposing_account_name;
|
||||||
|
/** @var string Opposing account number */
|
||||||
|
public $opposing_account_number;
|
||||||
|
/** @var string Opposing account code */
|
||||||
|
public $opposing_currency_code;
|
||||||
/** @var string Tags */
|
/** @var string Tags */
|
||||||
public $tags;
|
public $tags;
|
||||||
|
/** @var int ID of the transaction */
|
||||||
|
public $transaction_id = 0;
|
||||||
|
/** @var string Transaction type */
|
||||||
|
public $transaction_type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Entry constructor.
|
* Entry constructor.
|
||||||
@ -132,7 +132,7 @@ final class Entry
|
|||||||
$entry->transaction_id = $transaction->id;
|
$entry->transaction_id = $transaction->id;
|
||||||
$entry->date = $transaction->date->format('Ymd');
|
$entry->date = $transaction->date->format('Ymd');
|
||||||
$entry->description = $transaction->description;
|
$entry->description = $transaction->description;
|
||||||
if (\strlen((string)$transaction->transaction_description) > 0) {
|
if ('' !== (string)$transaction->transaction_description) {
|
||||||
$entry->description = $transaction->transaction_description . '(' . $transaction->description . ')';
|
$entry->description = $transaction->transaction_description . '(' . $transaction->description . ')';
|
||||||
}
|
}
|
||||||
$entry->currency_code = $transaction->transactionCurrency->code;
|
$entry->currency_code = $transaction->transactionCurrency->code;
|
||||||
|
@ -25,7 +25,6 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Export;
|
namespace FireflyIII\Export;
|
||||||
|
|
||||||
use Crypt;
|
|
||||||
use DB;
|
use DB;
|
||||||
use FireflyIII\Exceptions\FireflyException;
|
use FireflyIII\Exceptions\FireflyException;
|
||||||
use FireflyIII\Export\Collector\AttachmentCollector;
|
use FireflyIII\Export\Collector\AttachmentCollector;
|
||||||
@ -41,8 +40,8 @@ use FireflyIII\Models\Transaction;
|
|||||||
use FireflyIII\Models\TransactionJournal;
|
use FireflyIII\Models\TransactionJournal;
|
||||||
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
|
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
use Log;
|
|
||||||
use Illuminate\Support\Facades\Storage;
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
use Log;
|
||||||
use ZipArchive;
|
use ZipArchive;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -339,7 +338,7 @@ class ExpandedProcessor implements ProcessorInterface
|
|||||||
$return = [];
|
$return = [];
|
||||||
/** @var Note $note */
|
/** @var Note $note */
|
||||||
foreach ($notes as $note) {
|
foreach ($notes as $note) {
|
||||||
if (\strlen(trim((string)$note->text)) > 0) {
|
if ('' !== trim((string)$note->text)) {
|
||||||
$id = (int)$note->noteable_id;
|
$id = (int)$note->noteable_id;
|
||||||
$return[$id] = $note->text;
|
$return[$id] = $note->text;
|
||||||
}
|
}
|
||||||
|
@ -25,8 +25,8 @@ declare(strict_types=1);
|
|||||||
namespace FireflyIII\Export\Exporter;
|
namespace FireflyIII\Export\Exporter;
|
||||||
|
|
||||||
use FireflyIII\Export\Entry\Entry;
|
use FireflyIII\Export\Entry\Entry;
|
||||||
use League\Csv\Writer;
|
|
||||||
use Illuminate\Support\Facades\Storage;
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
use League\Csv\Writer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class CsvExporter.
|
* Class CsvExporter.
|
||||||
|
@ -49,6 +49,7 @@ class AccountFactory
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* AccountFactory constructor.
|
* AccountFactory constructor.
|
||||||
|
*
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
|
@ -43,6 +43,7 @@ class AccountMetaFactory
|
|||||||
Log::warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this)));
|
Log::warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array $data
|
* @param array $data
|
||||||
*
|
*
|
||||||
@ -73,6 +74,7 @@ class AccountMetaFactory
|
|||||||
// if $data has field and $entry is null, create new one:
|
// if $data has field and $entry is null, create new one:
|
||||||
if (null === $entry) {
|
if (null === $entry) {
|
||||||
Log::debug(sprintf('Created meta-field "%s":"%s" for account #%d ("%s") ', $field, $value, $account->id, $account->name));
|
Log::debug(sprintf('Created meta-field "%s":"%s" for account #%d ("%s") ', $field, $value, $account->id, $account->name));
|
||||||
|
|
||||||
return $this->create(['account_id' => $account->id, 'name' => $field, 'data' => $value]);
|
return $this->create(['account_id' => $account->id, 'name' => $field, 'data' => $value]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -89,6 +91,7 @@ class AccountMetaFactory
|
|||||||
} catch (Exception $e) { // @codeCoverageIgnore
|
} catch (Exception $e) { // @codeCoverageIgnore
|
||||||
Log::debug(sprintf('Could not delete entry: %s', $e->getMessage())); // @codeCoverageIgnore
|
Log::debug(sprintf('Could not delete entry: %s', $e->getMessage())); // @codeCoverageIgnore
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,6 +38,9 @@ class BillFactory
|
|||||||
{
|
{
|
||||||
use BillServiceTrait;
|
use BillServiceTrait;
|
||||||
|
|
||||||
|
/** @var User */
|
||||||
|
private $user;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*/
|
*/
|
||||||
@ -48,9 +51,6 @@ class BillFactory
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @var User */
|
|
||||||
private $user;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array $data
|
* @param array $data
|
||||||
*
|
*
|
||||||
@ -111,7 +111,7 @@ class BillFactory
|
|||||||
}
|
}
|
||||||
|
|
||||||
// then find by name:
|
// then find by name:
|
||||||
if (null === $bill && \strlen($billName) > 0) {
|
if (null === $bill && '' !== $billName) {
|
||||||
$bill = $this->findByName($billName);
|
$bill = $this->findByName($billName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,6 +34,9 @@ use Log;
|
|||||||
*/
|
*/
|
||||||
class BudgetFactory
|
class BudgetFactory
|
||||||
{
|
{
|
||||||
|
/** @var User */
|
||||||
|
private $user;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*/
|
*/
|
||||||
@ -44,10 +47,6 @@ class BudgetFactory
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @var User */
|
|
||||||
private $user;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param int|null $budgetId
|
* @param int|null $budgetId
|
||||||
* @param null|string $budgetName
|
* @param null|string $budgetName
|
||||||
|
@ -34,6 +34,9 @@ use Log;
|
|||||||
*/
|
*/
|
||||||
class CategoryFactory
|
class CategoryFactory
|
||||||
{
|
{
|
||||||
|
/** @var User */
|
||||||
|
private $user;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*/
|
*/
|
||||||
@ -44,9 +47,6 @@ class CategoryFactory
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @var User */
|
|
||||||
private $user;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $name
|
* @param string $name
|
||||||
*
|
*
|
||||||
@ -94,7 +94,7 @@ class CategoryFactory
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (\strlen($categoryName) > 0) {
|
if ('' !== $categoryName) {
|
||||||
$category = $this->findByName($categoryName);
|
$category = $this->findByName($categoryName);
|
||||||
if (null !== $category) {
|
if (null !== $category) {
|
||||||
return $category;
|
return $category;
|
||||||
|
@ -33,6 +33,9 @@ use Log;
|
|||||||
*/
|
*/
|
||||||
class PiggyBankFactory
|
class PiggyBankFactory
|
||||||
{
|
{
|
||||||
|
/** @var User */
|
||||||
|
private $user;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*/
|
*/
|
||||||
@ -43,9 +46,6 @@ class PiggyBankFactory
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @var User */
|
|
||||||
private $user;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param int|null $piggyBankId
|
* @param int|null $piggyBankId
|
||||||
* @param null|string $piggyBankName
|
* @param null|string $piggyBankName
|
||||||
@ -70,7 +70,7 @@ class PiggyBankFactory
|
|||||||
}
|
}
|
||||||
|
|
||||||
// then find by name:
|
// then find by name:
|
||||||
if (\strlen($piggyBankName) > 0) {
|
if ('' !== $piggyBankName) {
|
||||||
/** @var PiggyBank $piggyBank */
|
/** @var PiggyBank $piggyBank */
|
||||||
$piggyBank = $this->findByName($piggyBankName);
|
$piggyBank = $this->findByName($piggyBankName);
|
||||||
if (null !== $piggyBank) {
|
if (null !== $piggyBank) {
|
||||||
|
@ -39,6 +39,11 @@ use Log;
|
|||||||
*/
|
*/
|
||||||
class RecurrenceFactory
|
class RecurrenceFactory
|
||||||
{
|
{
|
||||||
|
/** @var User */
|
||||||
|
private $user;
|
||||||
|
|
||||||
|
use TransactionTypeTrait, TransactionServiceTrait, RecurringTransactionTrait;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*/
|
*/
|
||||||
@ -49,11 +54,6 @@ class RecurrenceFactory
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
use TransactionTypeTrait, TransactionServiceTrait, RecurringTransactionTrait;
|
|
||||||
|
|
||||||
/** @var User */
|
|
||||||
private $user;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array $data
|
* @param array $data
|
||||||
*
|
*
|
||||||
|
@ -38,6 +38,7 @@ class TransactionCurrencyFactory
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* TransactionCurrencyFactory constructor.
|
* TransactionCurrencyFactory constructor.
|
||||||
|
*
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
@ -100,7 +101,7 @@ class TransactionCurrencyFactory
|
|||||||
Log::warning(sprintf('Currency ID is %d but found nothing!', $currencyId));
|
Log::warning(sprintf('Currency ID is %d but found nothing!', $currencyId));
|
||||||
}
|
}
|
||||||
// then by code:
|
// then by code:
|
||||||
if (\strlen($currencyCode) > 0) {
|
if ('' !== $currencyCode) {
|
||||||
$currency = TransactionCurrency::whereCode($currencyCode)->first();
|
$currency = TransactionCurrency::whereCode($currencyCode)->first();
|
||||||
if (null !== $currency) {
|
if (null !== $currency) {
|
||||||
return $currency;
|
return $currency;
|
||||||
|
@ -27,6 +27,7 @@ namespace FireflyIII\Factory;
|
|||||||
|
|
||||||
use FireflyIII\Models\TransactionType;
|
use FireflyIII\Models\TransactionType;
|
||||||
use Log;
|
use Log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class TransactionTypeFactory
|
* Class TransactionTypeFactory
|
||||||
*/
|
*/
|
||||||
|
@ -24,6 +24,7 @@ namespace FireflyIII\Generator\Chart\Basic;
|
|||||||
|
|
||||||
use FireflyIII\Support\ChartColour;
|
use FireflyIII\Support\ChartColour;
|
||||||
use Log;
|
use Log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class ChartJsGenerator.
|
* Class ChartJsGenerator.
|
||||||
*/
|
*/
|
||||||
@ -39,6 +40,46 @@ class ChartJsGenerator implements GeneratorInterface
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Expects data as:.
|
||||||
|
*
|
||||||
|
* key => [value => x, 'currency_symbol' => 'x']
|
||||||
|
*
|
||||||
|
* @param array $data
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function multiCurrencyPieChart(array $data): array
|
||||||
|
{
|
||||||
|
$chartData = [
|
||||||
|
'datasets' => [
|
||||||
|
0 => [],
|
||||||
|
],
|
||||||
|
'labels' => [],
|
||||||
|
];
|
||||||
|
|
||||||
|
$amounts = array_column($data, 'amount');
|
||||||
|
$next = next($amounts);
|
||||||
|
$sortFlag = SORT_ASC;
|
||||||
|
if (!\is_bool($next) && 1 === bccomp((string)$next, '0')) {
|
||||||
|
$sortFlag = SORT_DESC;
|
||||||
|
}
|
||||||
|
array_multisort($amounts, $sortFlag, $data);
|
||||||
|
unset($next, $sortFlag, $amounts);
|
||||||
|
|
||||||
|
$index = 0;
|
||||||
|
foreach ($data as $key => $valueArray) {
|
||||||
|
// make larger than 0
|
||||||
|
$chartData['datasets'][0]['data'][] = (float)app('steam')->positive((string)$valueArray['amount']);
|
||||||
|
$chartData['datasets'][0]['backgroundColor'][] = ChartColour::getColour($index);
|
||||||
|
$chartData['datasets'][0]['currency_symbol'][] = $valueArray['currency_symbol'];
|
||||||
|
$chartData['labels'][] = $key;
|
||||||
|
++$index;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $chartData;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Will generate a Chart JS compatible array from the given input. Expects this format.
|
* Will generate a Chart JS compatible array from the given input. Expects this format.
|
||||||
*
|
*
|
||||||
@ -150,46 +191,6 @@ class ChartJsGenerator implements GeneratorInterface
|
|||||||
return $chartData;
|
return $chartData;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Expects data as:.
|
|
||||||
*
|
|
||||||
* key => [value => x, 'currency_symbol' => 'x']
|
|
||||||
*
|
|
||||||
* @param array $data
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
public function multiCurrencyPieChart(array $data): array
|
|
||||||
{
|
|
||||||
$chartData = [
|
|
||||||
'datasets' => [
|
|
||||||
0 => [],
|
|
||||||
],
|
|
||||||
'labels' => [],
|
|
||||||
];
|
|
||||||
|
|
||||||
$amounts = array_column($data, 'amount');
|
|
||||||
$next = next($amounts);
|
|
||||||
$sortFlag = SORT_ASC;
|
|
||||||
if (!\is_bool($next) && 1 === bccomp((string)$next, '0')) {
|
|
||||||
$sortFlag = SORT_DESC;
|
|
||||||
}
|
|
||||||
array_multisort($amounts, $sortFlag, $data);
|
|
||||||
unset($next, $sortFlag, $amounts);
|
|
||||||
|
|
||||||
$index = 0;
|
|
||||||
foreach ($data as $key => $valueArray) {
|
|
||||||
// make larger than 0
|
|
||||||
$chartData['datasets'][0]['data'][] = (float)app('steam')->positive((string)$valueArray['amount']);
|
|
||||||
$chartData['datasets'][0]['backgroundColor'][] = ChartColour::getColour($index);
|
|
||||||
$chartData['datasets'][0]['currency_symbol'][] = $valueArray['currency_symbol'];
|
|
||||||
$chartData['labels'][] = $key;
|
|
||||||
++$index;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $chartData;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Will generate a (ChartJS) compatible array from the given input. Expects this format:.
|
* Will generate a (ChartJS) compatible array from the given input. Expects this format:.
|
||||||
*
|
*
|
||||||
|
@ -24,6 +24,7 @@ namespace FireflyIII\Generator\Report\Audit;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Class MultiYearReportGenerator.
|
* Class MultiYearReportGenerator.
|
||||||
|
*
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
*/
|
*/
|
||||||
class MultiYearReportGenerator extends MonthReportGenerator
|
class MultiYearReportGenerator extends MonthReportGenerator
|
||||||
|
@ -24,6 +24,7 @@ namespace FireflyIII\Generator\Report\Audit;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Class YearReportGenerator.
|
* Class YearReportGenerator.
|
||||||
|
*
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
*/
|
*/
|
||||||
class YearReportGenerator extends MonthReportGenerator
|
class YearReportGenerator extends MonthReportGenerator
|
||||||
|
@ -24,6 +24,7 @@ namespace FireflyIII\Generator\Report\Budget;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Class MultiYearReportGenerator.
|
* Class MultiYearReportGenerator.
|
||||||
|
*
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
*/
|
*/
|
||||||
class MultiYearReportGenerator extends MonthReportGenerator
|
class MultiYearReportGenerator extends MonthReportGenerator
|
||||||
|
@ -24,6 +24,7 @@ namespace FireflyIII\Generator\Report\Budget;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Class YearReportGenerator.
|
* Class YearReportGenerator.
|
||||||
|
*
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
*/
|
*/
|
||||||
class YearReportGenerator extends MonthReportGenerator
|
class YearReportGenerator extends MonthReportGenerator
|
||||||
|
@ -40,6 +40,7 @@ use Throwable;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Class MonthReportGenerator.
|
* Class MonthReportGenerator.
|
||||||
|
*
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
*/
|
*/
|
||||||
class MonthReportGenerator extends Support implements ReportGeneratorInterface
|
class MonthReportGenerator extends Support implements ReportGeneratorInterface
|
||||||
|
@ -24,6 +24,7 @@ namespace FireflyIII\Generator\Report\Category;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Class MultiYearReportGenerator.
|
* Class MultiYearReportGenerator.
|
||||||
|
*
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
*/
|
*/
|
||||||
class MultiYearReportGenerator extends MonthReportGenerator
|
class MultiYearReportGenerator extends MonthReportGenerator
|
||||||
|
@ -24,6 +24,7 @@ namespace FireflyIII\Generator\Report\Category;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Class YearReportGenerator.
|
* Class YearReportGenerator.
|
||||||
|
*
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
*/
|
*/
|
||||||
class YearReportGenerator extends MonthReportGenerator
|
class YearReportGenerator extends MonthReportGenerator
|
||||||
|
@ -27,6 +27,7 @@ use FireflyIII\Exceptions\FireflyException;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Class ReportGeneratorFactory.
|
* Class ReportGeneratorFactory.
|
||||||
|
*
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
*/
|
*/
|
||||||
class ReportGeneratorFactory
|
class ReportGeneratorFactory
|
||||||
|
@ -31,6 +31,7 @@ use Throwable;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Class MonthReportGenerator.
|
* Class MonthReportGenerator.
|
||||||
|
*
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
*/
|
*/
|
||||||
class MonthReportGenerator implements ReportGeneratorInterface
|
class MonthReportGenerator implements ReportGeneratorInterface
|
||||||
|
@ -30,6 +30,7 @@ use Throwable;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Class MonthReportGenerator.
|
* Class MonthReportGenerator.
|
||||||
|
*
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
*/
|
*/
|
||||||
class MultiYearReportGenerator implements ReportGeneratorInterface
|
class MultiYearReportGenerator implements ReportGeneratorInterface
|
||||||
|
@ -30,6 +30,7 @@ use Throwable;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Class MonthReportGenerator.
|
* Class MonthReportGenerator.
|
||||||
|
*
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
*/
|
*/
|
||||||
class YearReportGenerator implements ReportGeneratorInterface
|
class YearReportGenerator implements ReportGeneratorInterface
|
||||||
|
@ -31,6 +31,7 @@ use Illuminate\Support\Collection;
|
|||||||
* Class Support.
|
* Class Support.
|
||||||
* @method Collection getExpenses()
|
* @method Collection getExpenses()
|
||||||
* @method Collection getIncome()
|
* @method Collection getIncome()
|
||||||
|
*
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
*/
|
*/
|
||||||
class Support
|
class Support
|
||||||
|
@ -24,6 +24,7 @@ namespace FireflyIII\Generator\Report\Tag;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Class MultiYearReportGenerator.
|
* Class MultiYearReportGenerator.
|
||||||
|
*
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
*/
|
*/
|
||||||
class MultiYearReportGenerator extends MonthReportGenerator
|
class MultiYearReportGenerator extends MonthReportGenerator
|
||||||
|
@ -24,6 +24,7 @@ namespace FireflyIII\Generator\Report\Tag;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Class YearReportGenerator.
|
* Class YearReportGenerator.
|
||||||
|
*
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
*/
|
*/
|
||||||
class YearReportGenerator extends MonthReportGenerator
|
class YearReportGenerator extends MonthReportGenerator
|
||||||
|
@ -146,6 +146,7 @@ class UserEventHandler
|
|||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
Log::error($e->getMessage());
|
Log::error($e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
// @codeCoverageIgnoreEnd
|
// @codeCoverageIgnoreEnd
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -172,6 +173,7 @@ class UserEventHandler
|
|||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
Log::error($e->getMessage());
|
Log::error($e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
// @codeCoverageIgnoreEnd
|
// @codeCoverageIgnoreEnd
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -199,6 +201,7 @@ class UserEventHandler
|
|||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
Log::error($e->getMessage());
|
Log::error($e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
// @codeCoverageIgnoreEnd
|
// @codeCoverageIgnoreEnd
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -26,11 +26,12 @@ use Crypt;
|
|||||||
use FireflyIII\Exceptions\FireflyException;
|
use FireflyIII\Exceptions\FireflyException;
|
||||||
use FireflyIII\Models\Attachment;
|
use FireflyIII\Models\Attachment;
|
||||||
use Illuminate\Contracts\Encryption\DecryptException;
|
use Illuminate\Contracts\Encryption\DecryptException;
|
||||||
|
use Illuminate\Contracts\Filesystem\FileNotFoundException;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
use Illuminate\Support\MessageBag;
|
use Illuminate\Support\MessageBag;
|
||||||
use Log;
|
use Log;
|
||||||
use Illuminate\Support\Facades\Storage;
|
|
||||||
use Symfony\Component\HttpFoundation\File\UploadedFile;
|
use Symfony\Component\HttpFoundation\File\UploadedFile;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -85,7 +86,7 @@ class AttachmentHelper implements AttachmentHelperInterface
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$content = Crypt::decrypt($this->uploadDisk->get(sprintf('at-%d.data', $attachment->id)));
|
$content = Crypt::decrypt($this->uploadDisk->get(sprintf('at-%d.data', $attachment->id)));
|
||||||
} catch (DecryptException $e) {
|
} catch (DecryptException|FileNotFoundException $e) {
|
||||||
Log::error(sprintf('Could not decrypt data of attachment #%d: %s', $attachment->id, $e->getMessage()));
|
Log::error(sprintf('Could not decrypt data of attachment #%d: %s', $attachment->id, $e->getMessage()));
|
||||||
$content = '';
|
$content = '';
|
||||||
}
|
}
|
||||||
@ -102,8 +103,7 @@ class AttachmentHelper implements AttachmentHelperInterface
|
|||||||
*/
|
*/
|
||||||
public function getAttachmentLocation(Attachment $attachment): string
|
public function getAttachmentLocation(Attachment $attachment): string
|
||||||
{
|
{
|
||||||
$path = sprintf('%sat-%d.data', DIRECTORY_SEPARATOR, (int)$attachment->id);
|
return sprintf('%sat-%d.data', DIRECTORY_SEPARATOR, (int)$attachment->id);
|
||||||
return $path;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -186,7 +186,7 @@ class AttachmentHelper implements AttachmentHelperInterface
|
|||||||
* @param array|null $files
|
* @param array|null $files
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
* @throws \Illuminate\Contracts\Encryption\EncryptException
|
* @throws FireflyException
|
||||||
*/
|
*/
|
||||||
public function saveAttachmentsForModel(object $model, ?array $files): bool
|
public function saveAttachmentsForModel(object $model, ?array $files): bool
|
||||||
{
|
{
|
||||||
@ -265,7 +265,7 @@ class AttachmentHelper implements AttachmentHelperInterface
|
|||||||
$attachment->save();
|
$attachment->save();
|
||||||
Log::debug('Created attachment:', $attachment->toArray());
|
Log::debug('Created attachment:', $attachment->toArray());
|
||||||
|
|
||||||
$fileObject = $file->openFile('r');
|
$fileObject = $file->openFile();
|
||||||
$fileObject->rewind();
|
$fileObject->rewind();
|
||||||
|
|
||||||
if (0 === $file->getSize()) {
|
if (0 === $file->getSize()) {
|
||||||
|
@ -145,15 +145,6 @@ interface TransactionCollectorInterface
|
|||||||
*/
|
*/
|
||||||
public function setAllAssetAccounts(): TransactionCollectorInterface;
|
public function setAllAssetAccounts(): TransactionCollectorInterface;
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the required currency (local or foreign)
|
|
||||||
*
|
|
||||||
* @param TransactionCurrency $currency
|
|
||||||
*
|
|
||||||
* @return TransactionCollectorInterface
|
|
||||||
*/
|
|
||||||
public function setCurrency(TransactionCurrency $currency): TransactionCollectorInterface;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Collect transactions before a specific date.
|
* Collect transactions before a specific date.
|
||||||
*
|
*
|
||||||
@ -208,6 +199,15 @@ interface TransactionCollectorInterface
|
|||||||
*/
|
*/
|
||||||
public function setCategory(Category $category): TransactionCollectorInterface;
|
public function setCategory(Category $category): TransactionCollectorInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the required currency (local or foreign)
|
||||||
|
*
|
||||||
|
* @param TransactionCurrency $currency
|
||||||
|
*
|
||||||
|
* @return TransactionCollectorInterface
|
||||||
|
*/
|
||||||
|
public function setCurrency(TransactionCurrency $currency): TransactionCollectorInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the journal IDs to filter on.
|
* Set the journal IDs to filter on.
|
||||||
*
|
*
|
||||||
|
@ -31,6 +31,7 @@ use Illuminate\Support\Collection;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Class CountAttachmentsFilter
|
* Class CountAttachmentsFilter
|
||||||
|
*
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
*/
|
*/
|
||||||
class CountAttachmentsFilter implements FilterInterface
|
class CountAttachmentsFilter implements FilterInterface
|
||||||
|
@ -26,6 +26,7 @@ use FireflyIII\Models\Transaction;
|
|||||||
use FireflyIII\Models\TransactionType;
|
use FireflyIII\Models\TransactionType;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
use Log;
|
use Log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class TransferFilter.
|
* Class TransferFilter.
|
||||||
*
|
*
|
||||||
|
@ -25,7 +25,6 @@ namespace FireflyIII\Helpers\Help;
|
|||||||
use Cache;
|
use Cache;
|
||||||
use Exception;
|
use Exception;
|
||||||
use GuzzleHttp\Client;
|
use GuzzleHttp\Client;
|
||||||
use GuzzleHttp\Exception\GuzzleException;
|
|
||||||
use League\CommonMark\CommonMarkConverter;
|
use League\CommonMark\CommonMarkConverter;
|
||||||
use Log;
|
use Log;
|
||||||
use Route;
|
use Route;
|
||||||
@ -87,14 +86,14 @@ class Help implements HelpInterface
|
|||||||
$res = $client->request('GET', $uri, $opt);
|
$res = $client->request('GET', $uri, $opt);
|
||||||
$statusCode = $res->getStatusCode();
|
$statusCode = $res->getStatusCode();
|
||||||
$content = trim($res->getBody()->getContents());
|
$content = trim($res->getBody()->getContents());
|
||||||
} catch (GuzzleException|Exception $e) {
|
} catch (Exception $e) {
|
||||||
Log::info($e->getMessage());
|
Log::info($e->getMessage());
|
||||||
Log::info($e->getTraceAsString());
|
Log::info($e->getTraceAsString());
|
||||||
}
|
}
|
||||||
|
|
||||||
Log::debug(sprintf('Status code is %d', $statusCode));
|
Log::debug(sprintf('Status code is %d', $statusCode));
|
||||||
|
|
||||||
if (\strlen($content) > 0) {
|
if ('' !== $content) {
|
||||||
Log::debug('Content is longer than zero. Expect something.');
|
Log::debug('Content is longer than zero. Expect something.');
|
||||||
$converter = new CommonMarkConverter();
|
$converter = new CommonMarkConverter();
|
||||||
$content = $converter->convertToHtml($content);
|
$content = $converter->convertToHtml($content);
|
||||||
@ -153,7 +152,7 @@ class Help implements HelpInterface
|
|||||||
public function putInCache(string $route, string $language, string $content): void
|
public function putInCache(string $route, string $language, string $content): void
|
||||||
{
|
{
|
||||||
$key = sprintf(self::CACHEKEY, $route, $language);
|
$key = sprintf(self::CACHEKEY, $route, $language);
|
||||||
if (\strlen($content) > 0) {
|
if ('' !== $content) {
|
||||||
Log::debug(sprintf('Will store entry in cache: %s', $key));
|
Log::debug(sprintf('Will store entry in cache: %s', $key));
|
||||||
Cache::put($key, $content, 10080); // a week.
|
Cache::put($key, $content, 10080); // a week.
|
||||||
|
|
||||||
|
@ -25,7 +25,6 @@ namespace FireflyIII\Helpers\Report;
|
|||||||
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use FireflyIII\Models\Account;
|
use FireflyIII\Models\Account;
|
||||||
use FireflyIII\Models\AccountType;
|
|
||||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||||
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
|
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
|
||||||
use FireflyIII\Support\CacheProperties;
|
use FireflyIII\Support\CacheProperties;
|
||||||
|
@ -31,6 +31,7 @@ use FireflyIII\Models\TransactionType;
|
|||||||
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
|
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
use Log;
|
use Log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class PopupReport.
|
* Class PopupReport.
|
||||||
*
|
*
|
||||||
|
@ -33,6 +33,7 @@ use FireflyIII\Repositories\Bill\BillRepositoryInterface;
|
|||||||
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
|
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
use Log;
|
use Log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class ReportHelper.
|
* Class ReportHelper.
|
||||||
*
|
*
|
||||||
|
@ -96,7 +96,7 @@ trait UpdateTrait
|
|||||||
// has it been released for at least three days?
|
// has it been released for at least three days?
|
||||||
$today = new Carbon;
|
$today = new Carbon;
|
||||||
$releaseDate = $release->getUpdated();
|
$releaseDate = $release->getUpdated();
|
||||||
if ($today->diffInDays($releaseDate, true) > 3) {
|
if ($today->diffInDays($releaseDate) > 3) {
|
||||||
Log::debug('New version is older than 3 days!');
|
Log::debug('New version is older than 3 days!');
|
||||||
$monthAndDayFormat = (string)trans('config.month_and_day');
|
$monthAndDayFormat = (string)trans('config.month_and_day');
|
||||||
$return = (string)trans(
|
$return = (string)trans(
|
||||||
|
@ -112,6 +112,7 @@ class CreateController extends Controller
|
|||||||
}
|
}
|
||||||
$request->session()->forget('accounts.create.fromStore');
|
$request->session()->forget('accounts.create.fromStore');
|
||||||
Log::channel('audit')->info('Create new account.');
|
Log::channel('audit')->info('Create new account.');
|
||||||
|
|
||||||
return view('accounts.create', compact('subTitleIcon', 'what', 'interestPeriods', 'subTitle', 'roles', 'liabilityTypes'));
|
return view('accounts.create', compact('subTitleIcon', 'what', 'interestPeriods', 'subTitle', 'roles', 'liabilityTypes'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,7 +145,6 @@ class ShowController extends Controller
|
|||||||
*
|
*
|
||||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|View
|
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|View
|
||||||
*
|
*
|
||||||
* @throws FireflyException
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function showAll(Request $request, Account $account)
|
public function showAll(Request $request, Account $account)
|
||||||
|
@ -27,7 +27,6 @@ use FireflyIII\Http\Controllers\Controller;
|
|||||||
use FireflyIII\Http\Middleware\IsDemoUser;
|
use FireflyIII\Http\Middleware\IsDemoUser;
|
||||||
use FireflyIII\Http\Middleware\IsSandStormUser;
|
use FireflyIII\Http\Middleware\IsSandStormUser;
|
||||||
use FireflyIII\Http\Requests\ConfigurationRequest;
|
use FireflyIII\Http\Requests\ConfigurationRequest;
|
||||||
use FireflyIII\Support\Facades\FireflyConfig;
|
|
||||||
use Illuminate\Http\RedirectResponse;
|
use Illuminate\Http\RedirectResponse;
|
||||||
use Log;
|
use Log;
|
||||||
|
|
||||||
@ -69,8 +68,8 @@ class ConfigurationController extends Controller
|
|||||||
|
|
||||||
// all available configuration and their default value in case
|
// all available configuration and their default value in case
|
||||||
// they don't exist yet.
|
// they don't exist yet.
|
||||||
$singleUserMode = FireflyConfig::get('single_user_mode', config('firefly.configuration.single_user_mode'))->data;
|
$singleUserMode = app('fireflyconfig')->get('single_user_mode', config('firefly.configuration.single_user_mode'))->data;
|
||||||
$isDemoSite = FireflyConfig::get('is_demo_site', config('firefly.configuration.is_demo_site'))->data;
|
$isDemoSite = app('fireflyconfig')->get('is_demo_site', config('firefly.configuration.is_demo_site'))->data;
|
||||||
$siteOwner = config('firefly.site_owner');
|
$siteOwner = config('firefly.site_owner');
|
||||||
|
|
||||||
return view(
|
return view(
|
||||||
@ -94,8 +93,8 @@ class ConfigurationController extends Controller
|
|||||||
Log::channel('audit')->info('User updates global configuration.', $data);
|
Log::channel('audit')->info('User updates global configuration.', $data);
|
||||||
|
|
||||||
// store config values
|
// store config values
|
||||||
FireflyConfig::set('single_user_mode', $data['single_user_mode']);
|
app('fireflyconfig')->set('single_user_mode', $data['single_user_mode']);
|
||||||
FireflyConfig::set('is_demo_site', $data['is_demo_site']);
|
app('fireflyconfig')->set('is_demo_site', $data['is_demo_site']);
|
||||||
|
|
||||||
// flash message
|
// flash message
|
||||||
session()->flash('success', (string)trans('firefly.configuration_updated'));
|
session()->flash('success', (string)trans('firefly.configuration_updated'));
|
||||||
|
@ -23,7 +23,6 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Http\Controllers\Admin;
|
namespace FireflyIII\Http\Controllers\Admin;
|
||||||
|
|
||||||
use FireflyConfig;
|
|
||||||
use FireflyIII\Helpers\Update\UpdateTrait;
|
use FireflyIII\Helpers\Update\UpdateTrait;
|
||||||
use FireflyIII\Http\Controllers\Controller;
|
use FireflyIII\Http\Controllers\Controller;
|
||||||
use FireflyIII\Http\Middleware\IsDemoUser;
|
use FireflyIII\Http\Middleware\IsDemoUser;
|
||||||
@ -87,8 +86,8 @@ class UpdateController extends Controller
|
|||||||
public function post(Request $request)
|
public function post(Request $request)
|
||||||
{
|
{
|
||||||
$checkForUpdates = (int)$request->get('check_for_updates');
|
$checkForUpdates = (int)$request->get('check_for_updates');
|
||||||
FireflyConfig::set('permission_update_check', $checkForUpdates);
|
app('fireflyconfig')->set('permission_update_check', $checkForUpdates);
|
||||||
FireflyConfig::set('last_update_check', time());
|
app('fireflyconfig')->set('last_update_check', time());
|
||||||
session()->flash('success', (string)trans('firefly.configuration_updated'));
|
session()->flash('success', (string)trans('firefly.configuration_updated'));
|
||||||
|
|
||||||
return redirect(route('admin.update-check'));
|
return redirect(route('admin.update-check'));
|
||||||
@ -107,7 +106,7 @@ class UpdateController extends Controller
|
|||||||
// flash info
|
// flash info
|
||||||
session()->flash('info', $resultString);
|
session()->flash('info', $resultString);
|
||||||
}
|
}
|
||||||
FireflyConfig::set('last_update_check', time());
|
app('fireflyconfig')->set('last_update_check', time());
|
||||||
|
|
||||||
return response()->json(['result' => $resultString]);
|
return response()->json(['result' => $resultString]);
|
||||||
}
|
}
|
||||||
|
@ -178,7 +178,7 @@ class UserController extends Controller
|
|||||||
$data = $request->getUserData();
|
$data = $request->getUserData();
|
||||||
|
|
||||||
// update password
|
// update password
|
||||||
if (\strlen($data['password']) > 0) {
|
if ('' !== $data['password']) {
|
||||||
$repository->changePassword($user, $data['password']);
|
$repository->changePassword($user, $data['password']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,7 +111,7 @@ class AttachmentController extends Controller
|
|||||||
$quoted = sprintf('"%s"', addcslashes(basename($attachment->filename), '"\\'));
|
$quoted = sprintf('"%s"', addcslashes(basename($attachment->filename), '"\\'));
|
||||||
|
|
||||||
/** @var LaravelResponse $response */
|
/** @var LaravelResponse $response */
|
||||||
$response = response($content, 200);
|
$response = response($content);
|
||||||
$response
|
$response
|
||||||
->header('Content-Description', 'File Transfer')
|
->header('Content-Description', 'File Transfer')
|
||||||
->header('Content-Type', 'application/octet-stream')
|
->header('Content-Type', 'application/octet-stream')
|
||||||
|
@ -23,7 +23,6 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Http\Controllers\Auth;
|
namespace FireflyIII\Http\Controllers\Auth;
|
||||||
|
|
||||||
use FireflyConfig;
|
|
||||||
use FireflyIII\Http\Controllers\Controller;
|
use FireflyIII\Http\Controllers\Controller;
|
||||||
use FireflyIII\Repositories\User\UserRepositoryInterface;
|
use FireflyIII\Repositories\User\UserRepositoryInterface;
|
||||||
use FireflyIII\User;
|
use FireflyIII\User;
|
||||||
@ -65,6 +64,7 @@ class ForgotPasswordController extends Controller
|
|||||||
if ('eloquent' !== $loginProvider) {
|
if ('eloquent' !== $loginProvider) {
|
||||||
$message = sprintf('Cannot reset password when authenticating over "%s".', $loginProvider);
|
$message = sprintf('Cannot reset password when authenticating over "%s".', $loginProvider);
|
||||||
Log::error($message);
|
Log::error($message);
|
||||||
|
|
||||||
return view('error', compact('message'));
|
return view('error', compact('message'));
|
||||||
}
|
}
|
||||||
// @codeCoverageIgnoreEnd
|
// @codeCoverageIgnoreEnd
|
||||||
@ -109,7 +109,7 @@ class ForgotPasswordController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
// is allowed to?
|
// is allowed to?
|
||||||
$singleUserMode = FireflyConfig::get('single_user_mode', config('firefly.configuration.single_user_mode'))->data;
|
$singleUserMode = app('fireflyconfig')->get('single_user_mode', config('firefly.configuration.single_user_mode'))->data;
|
||||||
$userCount = User::count();
|
$userCount = User::count();
|
||||||
$allowRegistration = true;
|
$allowRegistration = true;
|
||||||
$pageTitle = (string)trans('firefly.forgot_pw_page_title');
|
$pageTitle = (string)trans('firefly.forgot_pw_page_title');
|
||||||
|
@ -24,7 +24,6 @@ declare(strict_types=1);
|
|||||||
namespace FireflyIII\Http\Controllers\Auth;
|
namespace FireflyIII\Http\Controllers\Auth;
|
||||||
|
|
||||||
use DB;
|
use DB;
|
||||||
use FireflyConfig;
|
|
||||||
use FireflyIII\Http\Controllers\Controller;
|
use FireflyIII\Http\Controllers\Controller;
|
||||||
use FireflyIII\User;
|
use FireflyIII\User;
|
||||||
use Illuminate\Cookie\CookieJar;
|
use Illuminate\Cookie\CookieJar;
|
||||||
@ -140,7 +139,7 @@ class LoginController extends Controller
|
|||||||
$request->session()->forget('twoFactorAuthenticated');
|
$request->session()->forget('twoFactorAuthenticated');
|
||||||
|
|
||||||
// is allowed to?
|
// is allowed to?
|
||||||
$singleUserMode = FireflyConfig::get('single_user_mode', config('firefly.configuration.single_user_mode'))->data;
|
$singleUserMode = app('fireflyconfig')->get('single_user_mode', config('firefly.configuration.single_user_mode'))->data;
|
||||||
$userCount = User::count();
|
$userCount = User::count();
|
||||||
$allowRegistration = true;
|
$allowRegistration = true;
|
||||||
$allowReset = true;
|
$allowReset = true;
|
||||||
|
@ -23,7 +23,6 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Http\Controllers\Auth;
|
namespace FireflyIII\Http\Controllers\Auth;
|
||||||
|
|
||||||
use FireflyConfig;
|
|
||||||
use FireflyIII\Http\Controllers\Controller;
|
use FireflyIII\Http\Controllers\Controller;
|
||||||
use FireflyIII\Support\Http\Controllers\CreateStuff;
|
use FireflyIII\Support\Http\Controllers\CreateStuff;
|
||||||
use FireflyIII\Support\Http\Controllers\RequestInformation;
|
use FireflyIII\Support\Http\Controllers\RequestInformation;
|
||||||
@ -73,7 +72,7 @@ class RegisterController extends Controller
|
|||||||
// is allowed to?
|
// is allowed to?
|
||||||
$allowRegistration = true;
|
$allowRegistration = true;
|
||||||
$loginProvider = config('firefly.login_provider');
|
$loginProvider = config('firefly.login_provider');
|
||||||
$singleUserMode = FireflyConfig::get('single_user_mode', config('firefly.configuration.single_user_mode'))->data;
|
$singleUserMode = app('fireflyconfig')->get('single_user_mode', config('firefly.configuration.single_user_mode'))->data;
|
||||||
$userCount = User::count();
|
$userCount = User::count();
|
||||||
if (true === $singleUserMode && $userCount > 0 && 'eloquent' === $loginProvider) {
|
if (true === $singleUserMode && $userCount > 0 && 'eloquent' === $loginProvider) {
|
||||||
$allowRegistration = false;
|
$allowRegistration = false;
|
||||||
@ -114,8 +113,8 @@ class RegisterController extends Controller
|
|||||||
{
|
{
|
||||||
$allowRegistration = true;
|
$allowRegistration = true;
|
||||||
$loginProvider = config('firefly.login_provider');
|
$loginProvider = config('firefly.login_provider');
|
||||||
$isDemoSite = FireflyConfig::get('is_demo_site', config('firefly.configuration.is_demo_site'))->data;
|
$isDemoSite = app('fireflyconfig')->get('is_demo_site', config('firefly.configuration.is_demo_site'))->data;
|
||||||
$singleUserMode = FireflyConfig::get('single_user_mode', config('firefly.configuration.single_user_mode'))->data;
|
$singleUserMode = app('fireflyconfig')->get('single_user_mode', config('firefly.configuration.single_user_mode'))->data;
|
||||||
$userCount = User::count();
|
$userCount = User::count();
|
||||||
$pageTitle = (string)trans('firefly.register_page_title');
|
$pageTitle = (string)trans('firefly.register_page_title');
|
||||||
|
|
||||||
|
@ -23,7 +23,6 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Http\Controllers\Auth;
|
namespace FireflyIII\Http\Controllers\Auth;
|
||||||
|
|
||||||
use FireflyConfig;
|
|
||||||
use FireflyIII\Http\Controllers\Controller;
|
use FireflyIII\Http\Controllers\Controller;
|
||||||
use FireflyIII\User;
|
use FireflyIII\User;
|
||||||
use Illuminate\Foundation\Auth\ResetsPasswords;
|
use Illuminate\Foundation\Auth\ResetsPasswords;
|
||||||
@ -121,7 +120,7 @@ class ResetPasswordController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
// is allowed to register?
|
// is allowed to register?
|
||||||
$singleUserMode = FireflyConfig::get('single_user_mode', config('firefly.configuration.single_user_mode'))->data;
|
$singleUserMode = app('fireflyconfig')->get('single_user_mode', config('firefly.configuration.single_user_mode'))->data;
|
||||||
$userCount = User::count();
|
$userCount = User::count();
|
||||||
$allowRegistration = true;
|
$allowRegistration = true;
|
||||||
$pageTitle = (string)trans('firefly.reset_pw_page_title');
|
$pageTitle = (string)trans('firefly.reset_pw_page_title');
|
||||||
|
@ -190,7 +190,9 @@ class AmountController extends Controller
|
|||||||
|
|
||||||
// if the user makes less per period, suggest that amount instead.
|
// if the user makes less per period, suggest that amount instead.
|
||||||
if (1 === bccomp($spentAverage, $earnedAverage)) {
|
if (1 === bccomp($spentAverage, $earnedAverage)) {
|
||||||
Log::debug(sprintf('Because earned average (%s) is less than spent average (%s) will suggest earned average instead.', $earnedAverage, $spentAverage));
|
Log::debug(
|
||||||
|
sprintf('Because earned average (%s) is less than spent average (%s) will suggest earned average instead.', $earnedAverage, $spentAverage)
|
||||||
|
);
|
||||||
$suggested = $earnedAverage;
|
$suggested = $earnedAverage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,6 +137,8 @@ class IndexController extends Controller
|
|||||||
/**
|
/**
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
*
|
*
|
||||||
|
* @param BudgetRepositoryInterface $repository
|
||||||
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
*/
|
*/
|
||||||
public function reorder(Request $request, BudgetRepositoryInterface $repository): JsonResponse
|
public function reorder(Request $request, BudgetRepositoryInterface $repository): JsonResponse
|
||||||
|
@ -28,9 +28,7 @@ use FireflyIII\Helpers\Collector\TransactionCollectorInterface;
|
|||||||
use FireflyIII\Helpers\Filter\InternalTransferFilter;
|
use FireflyIII\Helpers\Filter\InternalTransferFilter;
|
||||||
use FireflyIII\Http\Controllers\Controller;
|
use FireflyIII\Http\Controllers\Controller;
|
||||||
use FireflyIII\Models\Category;
|
use FireflyIII\Models\Category;
|
||||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
|
||||||
use FireflyIII\Repositories\Category\CategoryRepositoryInterface;
|
use FireflyIII\Repositories\Category\CategoryRepositoryInterface;
|
||||||
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
|
|
||||||
use FireflyIII\Support\Http\Controllers\PeriodOverview;
|
use FireflyIII\Support\Http\Controllers\PeriodOverview;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
@ -45,10 +43,6 @@ use Log;
|
|||||||
class ShowController extends Controller
|
class ShowController extends Controller
|
||||||
{
|
{
|
||||||
use PeriodOverview;
|
use PeriodOverview;
|
||||||
/** @var AccountRepositoryInterface The account repository */
|
|
||||||
private $accountRepos;
|
|
||||||
/** @var JournalRepositoryInterface Journals and transactions overview */
|
|
||||||
private $journalRepos;
|
|
||||||
/** @var CategoryRepositoryInterface The category repository */
|
/** @var CategoryRepositoryInterface The category repository */
|
||||||
private $repository;
|
private $repository;
|
||||||
|
|
||||||
@ -63,9 +57,7 @@ class ShowController extends Controller
|
|||||||
function ($request, $next) {
|
function ($request, $next) {
|
||||||
app('view')->share('title', (string)trans('firefly.categories'));
|
app('view')->share('title', (string)trans('firefly.categories'));
|
||||||
app('view')->share('mainTitleIcon', 'fa-bar-chart');
|
app('view')->share('mainTitleIcon', 'fa-bar-chart');
|
||||||
$this->journalRepos = app(JournalRepositoryInterface::class);
|
|
||||||
$this->repository = app(CategoryRepositoryInterface::class);
|
$this->repository = app(CategoryRepositoryInterface::class);
|
||||||
$this->accountRepos = app(AccountRepositoryInterface::class);
|
|
||||||
|
|
||||||
return $next($request);
|
return $next($request);
|
||||||
}
|
}
|
||||||
|
@ -168,7 +168,7 @@ class CategoryController extends Controller
|
|||||||
$cache->addProperty($end);
|
$cache->addProperty($end);
|
||||||
$cache->addProperty('chart.category.frontpage');
|
$cache->addProperty('chart.category.frontpage');
|
||||||
if ($cache->has()) {
|
if ($cache->has()) {
|
||||||
//return response()->json($cache->get()); // @codeCoverageIgnore
|
return response()->json($cache->get()); // @codeCoverageIgnore
|
||||||
}
|
}
|
||||||
|
|
||||||
// currency repos:
|
// currency repos:
|
||||||
|
@ -22,7 +22,6 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Http\Controllers;
|
namespace FireflyIII\Http\Controllers;
|
||||||
|
|
||||||
use FireflyConfig;
|
|
||||||
use FireflyIII\Support\Http\Controllers\RequestInformation;
|
use FireflyIII\Support\Http\Controllers\RequestInformation;
|
||||||
use FireflyIII\Support\Http\Controllers\UserNavigation;
|
use FireflyIII\Support\Http\Controllers\UserNavigation;
|
||||||
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
||||||
@ -61,7 +60,7 @@ class Controller extends BaseController
|
|||||||
app('view')->share('hideTags', false);
|
app('view')->share('hideTags', false);
|
||||||
|
|
||||||
// is site a demo site?
|
// is site a demo site?
|
||||||
$isDemoSite = FireflyConfig::get('is_demo_site', config('firefly.configuration.is_demo_site'))->data;
|
$isDemoSite = app('fireflyconfig')->get('is_demo_site', config('firefly.configuration.is_demo_site'))->data;
|
||||||
app('view')->share('IS_DEMO_SITE', $isDemoSite);
|
app('view')->share('IS_DEMO_SITE', $isDemoSite);
|
||||||
app('view')->share('DEMO_USERNAME', config('firefly.demo_username'));
|
app('view')->share('DEMO_USERNAME', config('firefly.demo_username'));
|
||||||
app('view')->share('DEMO_PASSWORD', config('firefly.demo_password'));
|
app('view')->share('DEMO_PASSWORD', config('firefly.demo_password'));
|
||||||
|
@ -189,6 +189,7 @@ class CurrencyController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @param Request $request
|
||||||
* @param TransactionCurrency $currency
|
* @param TransactionCurrency $currency
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
||||||
|
@ -171,7 +171,7 @@ class DebugController extends Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (strlen($logContent) > 0) {
|
if ('' !== $logContent) {
|
||||||
// last few lines
|
// last few lines
|
||||||
$logContent = 'Truncated from this point <----|' . substr($logContent, -8192);
|
$logContent = 'Truncated from this point <----|' . substr($logContent, -8192);
|
||||||
}
|
}
|
||||||
|
@ -80,7 +80,7 @@ class ExportController extends Controller
|
|||||||
|
|
||||||
$repository->changeStatus($job, 'export_downloaded');
|
$repository->changeStatus($job, 'export_downloaded');
|
||||||
/** @var LaravelResponse $response */
|
/** @var LaravelResponse $response */
|
||||||
$response = response($content, 200);
|
$response = response($content);
|
||||||
$response
|
$response
|
||||||
->header('Content-Description', 'File Transfer')
|
->header('Content-Description', 'File Transfer')
|
||||||
->header('Content-Type', 'application/octet-stream')
|
->header('Content-Type', 'application/octet-stream')
|
||||||
|
@ -92,6 +92,7 @@ class IndexController extends Controller
|
|||||||
|
|
||||||
if ($isDemoUser && !$allowedForDemo) {
|
if ($isDemoUser && !$allowedForDemo) {
|
||||||
Log::debug('User is demo and this provider doesnt work for demo users.');
|
Log::debug('User is demo and this provider doesnt work for demo users.');
|
||||||
|
|
||||||
return redirect(route('import.index'));
|
return redirect(route('import.index'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -163,7 +164,7 @@ class IndexController extends Controller
|
|||||||
$result = json_encode($config, JSON_PRETTY_PRINT);
|
$result = json_encode($config, JSON_PRETTY_PRINT);
|
||||||
$name = sprintf('"%s"', addcslashes('import-configuration-' . date('Y-m-d') . '.json', '"\\'));
|
$name = sprintf('"%s"', addcslashes('import-configuration-' . date('Y-m-d') . '.json', '"\\'));
|
||||||
/** @var LaravelResponse $response */
|
/** @var LaravelResponse $response */
|
||||||
$response = response($result, 200);
|
$response = response($result);
|
||||||
$response->header('Content-disposition', 'attachment; filename=' . $name)
|
$response->header('Content-disposition', 'attachment; filename=' . $name)
|
||||||
->header('Content-Type', 'application/json')
|
->header('Content-Type', 'application/json')
|
||||||
->header('Content-Description', 'File Transfer')
|
->header('Content-Description', 'File Transfer')
|
||||||
|
@ -154,6 +154,7 @@ class JobStatusController extends Controller
|
|||||||
// @codeCoverageIgnoreStart
|
// @codeCoverageIgnoreStart
|
||||||
$message = sprintf('Cannot find import routine class for job of type "%s".', $importProvider);
|
$message = sprintf('Cannot find import routine class for job of type "%s".', $importProvider);
|
||||||
Log::error($message);
|
Log::error($message);
|
||||||
|
|
||||||
return response()->json(
|
return response()->json(
|
||||||
['status' => 'NOK', 'message' => $message]
|
['status' => 'NOK', 'message' => $message]
|
||||||
);
|
);
|
||||||
@ -182,6 +183,7 @@ class JobStatusController extends Controller
|
|||||||
|
|
||||||
// expect nothing from routine, just return OK to user.
|
// expect nothing from routine, just return OK to user.
|
||||||
Log::info('Now finished with JobStatusController::start');
|
Log::info('Now finished with JobStatusController::start');
|
||||||
|
|
||||||
return response()->json(['status' => 'OK', 'message' => 'stage_finished']);
|
return response()->json(['status' => 'OK', 'message' => 'stage_finished']);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -227,6 +229,7 @@ class JobStatusController extends Controller
|
|||||||
$this->repository->setStatus($importJob, 'storage_finished');
|
$this->repository->setStatus($importJob, 'storage_finished');
|
||||||
|
|
||||||
Log::info('Now finished with JobStatusController::start');
|
Log::info('Now finished with JobStatusController::start');
|
||||||
|
|
||||||
// expect nothing from routine, just return OK to user.
|
// expect nothing from routine, just return OK to user.
|
||||||
return response()->json(['status' => 'OK', 'message' => 'storage_finished']);
|
return response()->json(['status' => 'OK', 'message' => 'storage_finished']);
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,7 @@ class JavascriptController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
return response()
|
return response()
|
||||||
->view('javascript.accounts', $data, 200)
|
->view('javascript.accounts', $data)
|
||||||
->header('Content-Type', 'text/javascript');
|
->header('Content-Type', 'text/javascript');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -91,7 +91,7 @@ class JavascriptController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
return response()
|
return response()
|
||||||
->view('javascript.currencies', $data, 200)
|
->view('javascript.currencies', $data)
|
||||||
->header('Content-Type', 'text/javascript');
|
->header('Content-Type', 'text/javascript');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,7 +141,7 @@ class JavascriptController extends Controller
|
|||||||
$request->session()->keep(['two-factor-secret']);
|
$request->session()->keep(['two-factor-secret']);
|
||||||
|
|
||||||
return response()
|
return response()
|
||||||
->view('javascript.variables', $data, 200)
|
->view('javascript.variables', $data)
|
||||||
->header('Content-Type', 'text/javascript');
|
->header('Content-Type', 'text/javascript');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -194,7 +194,6 @@ class ReconcileController extends Controller
|
|||||||
*
|
*
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*
|
*
|
||||||
* @throws FireflyException
|
|
||||||
*/
|
*/
|
||||||
public function transactions(Account $account, Carbon $start, Carbon $end)
|
public function transactions(Account $account, Carbon $start, Carbon $end)
|
||||||
{
|
{
|
||||||
|
@ -83,7 +83,7 @@ class RecurrenceController extends Controller
|
|||||||
|
|
||||||
// if $firstDate is beyond $end, simply return an empty array.
|
// if $firstDate is beyond $end, simply return an empty array.
|
||||||
if ($firstDate->gt($end)) {
|
if ($firstDate->gt($end)) {
|
||||||
return response()->json([]);
|
return response()->json();
|
||||||
}
|
}
|
||||||
// if $firstDate is beyond start, use that one:
|
// if $firstDate is beyond start, use that one:
|
||||||
$actualStart = clone $firstDate;
|
$actualStart = clone $firstDate;
|
||||||
|
@ -54,6 +54,7 @@ class JsonController extends Controller
|
|||||||
Log::error(sprintf('Cannot render rules.partials.action: %s', $e->getMessage()));
|
Log::error(sprintf('Cannot render rules.partials.action: %s', $e->getMessage()));
|
||||||
$view = 'Could not render view.';
|
$view = 'Could not render view.';
|
||||||
}
|
}
|
||||||
|
|
||||||
// @codeCoverageIgnoreEnd
|
// @codeCoverageIgnoreEnd
|
||||||
|
|
||||||
return response()->json(['html' => $view]);
|
return response()->json(['html' => $view]);
|
||||||
@ -85,6 +86,7 @@ class JsonController extends Controller
|
|||||||
Log::error(sprintf('Cannot render rules.partials.trigger: %s', $e->getMessage()));
|
Log::error(sprintf('Cannot render rules.partials.trigger: %s', $e->getMessage()));
|
||||||
$view = 'Could not render view.';
|
$view = 'Could not render view.';
|
||||||
}
|
}
|
||||||
|
|
||||||
// @codeCoverageIgnoreEnd
|
// @codeCoverageIgnoreEnd
|
||||||
|
|
||||||
return response()->json(['html' => $view]);
|
return response()->json(['html' => $view]);
|
||||||
|
@ -72,7 +72,7 @@ class PreferencesController extends Controller
|
|||||||
|
|
||||||
// an important fallback is that the frontPageAccount array gets refilled automatically
|
// an important fallback is that the frontPageAccount array gets refilled automatically
|
||||||
// when it turns up empty.
|
// when it turns up empty.
|
||||||
if (\count($frontPageAccounts->data) === 0) {
|
if (0 === \count($frontPageAccounts->data)) {
|
||||||
$frontPageAccounts = $accountIds;
|
$frontPageAccounts = $accountIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,6 +80,8 @@ class ProfileController extends Controller
|
|||||||
/**
|
/**
|
||||||
* Change your email address.
|
* Change your email address.
|
||||||
*
|
*
|
||||||
|
* @param Request $request
|
||||||
|
*
|
||||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||||
*/
|
*/
|
||||||
public function changeEmail(Request $request)
|
public function changeEmail(Request $request)
|
||||||
@ -104,6 +106,8 @@ class ProfileController extends Controller
|
|||||||
/**
|
/**
|
||||||
* Change your password.
|
* Change your password.
|
||||||
*
|
*
|
||||||
|
* @param Request $request
|
||||||
|
*
|
||||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||||
*/
|
*/
|
||||||
public function changePassword(Request $request)
|
public function changePassword(Request $request)
|
||||||
@ -135,7 +139,7 @@ class ProfileController extends Controller
|
|||||||
$secret = Google2FA::generateSecretKey();
|
$secret = Google2FA::generateSecretKey();
|
||||||
session()->flash('two-factor-secret', $secret);
|
session()->flash('two-factor-secret', $secret);
|
||||||
|
|
||||||
$image = Google2FA::getQRCodeInline($domain, auth()->user()->email, $secret, 200);
|
$image = Google2FA::getQRCodeInline($domain, auth()->user()->email, $secret);
|
||||||
|
|
||||||
return view('profile.code', compact('image', 'secret'));
|
return view('profile.code', compact('image', 'secret'));
|
||||||
}
|
}
|
||||||
@ -187,6 +191,8 @@ class ProfileController extends Controller
|
|||||||
/**
|
/**
|
||||||
* Delete your account view.
|
* Delete your account view.
|
||||||
*
|
*
|
||||||
|
* @param Request $request
|
||||||
|
*
|
||||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||||
*/
|
*/
|
||||||
public function deleteAccount(Request $request)
|
public function deleteAccount(Request $request)
|
||||||
|
@ -169,6 +169,7 @@ class CategoryController extends Controller
|
|||||||
Log::error(sprintf('Could not render category::expenses: %s', $e->getMessage()));
|
Log::error(sprintf('Could not render category::expenses: %s', $e->getMessage()));
|
||||||
$result = 'An error prevented Firefly III from rendering. Apologies.';
|
$result = 'An error prevented Firefly III from rendering. Apologies.';
|
||||||
}
|
}
|
||||||
|
|
||||||
// @codeCoverageIgnoreEnd
|
// @codeCoverageIgnoreEnd
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
|
@ -29,13 +29,10 @@ use FireflyIII\Http\Requests\RuleFormRequest;
|
|||||||
use FireflyIII\Models\Bill;
|
use FireflyIII\Models\Bill;
|
||||||
use FireflyIII\Models\RuleGroup;
|
use FireflyIII\Models\RuleGroup;
|
||||||
use FireflyIII\Repositories\Rule\RuleRepositoryInterface;
|
use FireflyIII\Repositories\Rule\RuleRepositoryInterface;
|
||||||
use FireflyIII\Support\Http\Controllers\AugumentData;
|
|
||||||
use FireflyIII\Support\Http\Controllers\ModelInformation;
|
use FireflyIII\Support\Http\Controllers\ModelInformation;
|
||||||
use FireflyIII\Support\Http\Controllers\RuleManagement;
|
use FireflyIII\Support\Http\Controllers\RuleManagement;
|
||||||
use Illuminate\Http\RedirectResponse;
|
use Illuminate\Http\RedirectResponse;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Log;
|
|
||||||
use Throwable;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class CreateController
|
* Class CreateController
|
||||||
|
@ -27,16 +27,11 @@ namespace FireflyIII\Http\Controllers\Rule;
|
|||||||
use FireflyIII\Http\Controllers\Controller;
|
use FireflyIII\Http\Controllers\Controller;
|
||||||
use FireflyIII\Http\Requests\RuleFormRequest;
|
use FireflyIII\Http\Requests\RuleFormRequest;
|
||||||
use FireflyIII\Models\Rule;
|
use FireflyIII\Models\Rule;
|
||||||
use FireflyIII\Models\RuleAction;
|
|
||||||
use FireflyIII\Models\RuleTrigger;
|
|
||||||
use FireflyIII\Repositories\Rule\RuleRepositoryInterface;
|
use FireflyIII\Repositories\Rule\RuleRepositoryInterface;
|
||||||
use FireflyIII\Support\Http\Controllers\ModelInformation;
|
|
||||||
use FireflyIII\Support\Http\Controllers\RenderPartialViews;
|
use FireflyIII\Support\Http\Controllers\RenderPartialViews;
|
||||||
use FireflyIII\Support\Http\Controllers\RuleManagement;
|
use FireflyIII\Support\Http\Controllers\RuleManagement;
|
||||||
use Illuminate\Http\RedirectResponse;
|
use Illuminate\Http\RedirectResponse;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Log;
|
|
||||||
use Throwable;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class EditController
|
* Class EditController
|
||||||
|
@ -107,6 +107,7 @@ class SearchController extends Controller
|
|||||||
Log::error(sprintf('Cannot render search.search: %s', $e->getMessage()));
|
Log::error(sprintf('Cannot render search.search: %s', $e->getMessage()));
|
||||||
$html = 'Could not render view.';
|
$html = 'Could not render view.';
|
||||||
}
|
}
|
||||||
|
|
||||||
// @codeCoverageIgnoreEnd
|
// @codeCoverageIgnoreEnd
|
||||||
|
|
||||||
return response()->json(['count' => $transactions->count(), 'html' => $html]);
|
return response()->json(['count' => $transactions->count(), 'html' => $html]);
|
||||||
|
@ -57,6 +57,33 @@ class InstallController extends Controller
|
|||||||
// empty on purpose.
|
// empty on purpose.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Do database decrypt.
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Http\JsonResponse
|
||||||
|
*/
|
||||||
|
public function decrypt(): JsonResponse
|
||||||
|
{
|
||||||
|
if ($this->hasForbiddenFunctions()) {
|
||||||
|
return response()->json(['error' => true, 'message' => self::FORBIDDEN_ERROR]);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
Log::debug('Am now calling decrypt database routine...');
|
||||||
|
Artisan::call('firefly:decrypt-all');
|
||||||
|
Log::debug(Artisan::output());
|
||||||
|
} catch (Exception $e) {
|
||||||
|
Log::error($e->getMessage());
|
||||||
|
Log::error($e->getTraceAsString());
|
||||||
|
if (strpos($e->getMessage(), 'open_basedir restriction in effect')) {
|
||||||
|
return response()->json(['error' => true, 'message' => self::BASEDIR_ERROR]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return response()->json(['error' => true, 'message' => self::OTHER_ERROR . ' ' . $e->getMessage()]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return response()->json(['error' => false, 'message' => 'OK']);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show index.
|
* Show index.
|
||||||
*
|
*
|
||||||
@ -153,34 +180,6 @@ class InstallController extends Controller
|
|||||||
return response()->json(['error' => false, 'message' => 'OK']);
|
return response()->json(['error' => false, 'message' => 'OK']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Do database decrypt.
|
|
||||||
*
|
|
||||||
* @return \Illuminate\Http\JsonResponse
|
|
||||||
*/
|
|
||||||
public function decrypt(): JsonResponse
|
|
||||||
{
|
|
||||||
if ($this->hasForbiddenFunctions()) {
|
|
||||||
return response()->json(['error' => true, 'message' => self::FORBIDDEN_ERROR]);
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
Log::debug('Am now calling decrypt database routine...');
|
|
||||||
Artisan::call('firefly:decrypt-all');
|
|
||||||
Log::debug(Artisan::output());
|
|
||||||
} catch (Exception $e) {
|
|
||||||
Log::error($e->getMessage());
|
|
||||||
Log::error($e->getTraceAsString());
|
|
||||||
if (strpos($e->getMessage(), 'open_basedir restriction in effect')) {
|
|
||||||
return response()->json(['error' => true, 'message' => self::BASEDIR_ERROR]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return response()->json(['error' => true, 'message' => self::OTHER_ERROR . ' ' . $e->getMessage()]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return response()->json(['error' => false, 'message' => 'OK']);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Do database verification.
|
* Do database verification.
|
||||||
*
|
*
|
||||||
|
@ -25,7 +25,6 @@ namespace FireflyIII\Http\Controllers\Transaction;
|
|||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use FireflyIII\Events\UpdatedTransactionJournal;
|
use FireflyIII\Events\UpdatedTransactionJournal;
|
||||||
use FireflyIII\Helpers\Collector\TransactionCollectorInterface;
|
use FireflyIII\Helpers\Collector\TransactionCollectorInterface;
|
||||||
use FireflyIII\Helpers\Filter\InternalTransferFilter;
|
|
||||||
use FireflyIII\Helpers\Filter\TransactionViewFilter;
|
use FireflyIII\Helpers\Filter\TransactionViewFilter;
|
||||||
use FireflyIII\Helpers\Filter\TransferFilter;
|
use FireflyIII\Helpers\Filter\TransferFilter;
|
||||||
use FireflyIII\Http\Controllers\Controller;
|
use FireflyIII\Http\Controllers\Controller;
|
||||||
|
@ -190,6 +190,7 @@ class SingleController extends Controller
|
|||||||
* Show a special JSONified view of a transaction, for easier debug purposes.
|
* Show a special JSONified view of a transaction, for easier debug purposes.
|
||||||
*
|
*
|
||||||
* @param TransactionJournal $journal
|
* @param TransactionJournal $journal
|
||||||
|
*
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
*/
|
*/
|
||||||
|
@ -26,7 +26,6 @@ namespace FireflyIII\Http\Controllers;
|
|||||||
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use FireflyIII\Exceptions\FireflyException;
|
use FireflyIII\Exceptions\FireflyException;
|
||||||
use FireflyIII\Helpers\Attachments\AttachmentHelper;
|
|
||||||
use FireflyIII\Helpers\Collector\TransactionCollectorInterface;
|
use FireflyIII\Helpers\Collector\TransactionCollectorInterface;
|
||||||
use FireflyIII\Helpers\Filter\CountAttachmentsFilter;
|
use FireflyIII\Helpers\Filter\CountAttachmentsFilter;
|
||||||
use FireflyIII\Helpers\Filter\InternalTransferFilter;
|
use FireflyIII\Helpers\Filter\InternalTransferFilter;
|
||||||
@ -218,7 +217,6 @@ class TransactionController extends Controller
|
|||||||
*
|
*
|
||||||
* @param TransactionJournal $journal
|
* @param TransactionJournal $journal
|
||||||
* @param LinkTypeRepositoryInterface $linkTypeRepository
|
* @param LinkTypeRepositoryInterface $linkTypeRepository
|
||||||
* @param AttachmentHelper $attHelper
|
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|View
|
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|View
|
||||||
* @throws FireflyException
|
* @throws FireflyException
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user