mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Use PSR-12 code style
This commit is contained in:
@@ -117,7 +117,7 @@ class Amount
|
||||
*/
|
||||
public function getCurrencyCode(): string
|
||||
{
|
||||
$cache = new CacheProperties;
|
||||
$cache = new CacheProperties();
|
||||
$cache->addProperty('getCurrencyCode');
|
||||
if ($cache->has()) {
|
||||
return $cache->get();
|
||||
@@ -155,7 +155,7 @@ class Amount
|
||||
*/
|
||||
public function getDefaultCurrencyByUser(User $user): TransactionCurrency
|
||||
{
|
||||
$cache = new CacheProperties;
|
||||
$cache = new CacheProperties();
|
||||
$cache->addProperty('getDefaultCurrency');
|
||||
$cache->addProperty($user->id);
|
||||
if ($cache->has()) {
|
||||
|
@@ -38,8 +38,8 @@ use Log;
|
||||
class RemoteUserGuard implements Guard
|
||||
{
|
||||
protected Application $application;
|
||||
protected $provider;
|
||||
protected $user;
|
||||
protected $provider;
|
||||
protected $user;
|
||||
|
||||
/**
|
||||
* Create a new authentication guard.
|
||||
|
@@ -37,7 +37,6 @@ use Str;
|
||||
*/
|
||||
class RemoteUserProvider implements UserProvider
|
||||
{
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
@@ -65,7 +64,7 @@ class RemoteUserProvider implements UserProvider
|
||||
]
|
||||
);
|
||||
// if this is the first user, give them admin as well.
|
||||
if(1 === User::count()) {
|
||||
if (1 === User::count()) {
|
||||
$roleObject = Role::where('name', 'owner')->first();
|
||||
$user->roles()->attach($roleObject);
|
||||
}
|
||||
|
@@ -33,7 +33,6 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
*/
|
||||
class AccountList implements BinderInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
* @param Route $route
|
||||
@@ -45,7 +44,7 @@ class AccountList implements BinderInterface
|
||||
public static function routeBinder(string $value, Route $route): Collection
|
||||
{
|
||||
if (auth()->check()) {
|
||||
$collection = new Collection;
|
||||
$collection = new Collection();
|
||||
if ('allAssetAccounts' === $value) {
|
||||
/** @var Collection $collection */
|
||||
$collection = auth()->user()->accounts()
|
||||
@@ -70,6 +69,6 @@ class AccountList implements BinderInterface
|
||||
}
|
||||
}
|
||||
Log::error(sprintf('Trying to show account list (%s), but user is not logged in or list is empty.', $route->uri));
|
||||
throw new NotFoundHttpException;
|
||||
throw new NotFoundHttpException();
|
||||
}
|
||||
}
|
||||
|
@@ -44,7 +44,6 @@ class BudgetList implements BinderInterface
|
||||
public static function routeBinder(string $value, Route $route): Collection
|
||||
{
|
||||
if (auth()->check()) {
|
||||
|
||||
if ('allBudgets' === $value) {
|
||||
return auth()->user()->budgets()->where('active', true)
|
||||
->orderBy('order', 'ASC')
|
||||
@@ -57,7 +56,7 @@ class BudgetList implements BinderInterface
|
||||
|
||||
if (empty($list)) {
|
||||
Log::warning('Budget list count is zero, return 404.');
|
||||
throw new NotFoundHttpException;
|
||||
throw new NotFoundHttpException();
|
||||
}
|
||||
|
||||
|
||||
@@ -69,15 +68,14 @@ class BudgetList implements BinderInterface
|
||||
|
||||
// add empty budget if applicable.
|
||||
if (in_array(0, $list, true)) {
|
||||
$collection->push(new Budget);
|
||||
$collection->push(new Budget());
|
||||
}
|
||||
|
||||
if ($collection->count() > 0) {
|
||||
|
||||
return $collection;
|
||||
}
|
||||
}
|
||||
Log::warning('BudgetList fallback to 404.');
|
||||
throw new NotFoundHttpException;
|
||||
throw new NotFoundHttpException();
|
||||
}
|
||||
}
|
||||
|
@@ -34,7 +34,6 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
*/
|
||||
class CLIToken implements BinderInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
* @param Route $route
|
||||
@@ -62,6 +61,6 @@ class CLIToken implements BinderInterface
|
||||
}
|
||||
}
|
||||
Log::error(sprintf('Recognized no users by access token "%s"', $value));
|
||||
throw new NotFoundHttpException;
|
||||
throw new NotFoundHttpException();
|
||||
}
|
||||
}
|
||||
|
@@ -51,7 +51,7 @@ class CategoryList implements BinderInterface
|
||||
|
||||
$list = array_unique(array_map('\intval', explode(',', $value)));
|
||||
if (empty($list)) {
|
||||
throw new NotFoundHttpException;
|
||||
throw new NotFoundHttpException();
|
||||
}
|
||||
|
||||
/** @var Collection $collection */
|
||||
@@ -61,13 +61,13 @@ class CategoryList implements BinderInterface
|
||||
|
||||
// add empty category if applicable.
|
||||
if (in_array(0, $list, true)) {
|
||||
$collection->push(new Category);
|
||||
$collection->push(new Category());
|
||||
}
|
||||
|
||||
if ($collection->count() > 0) {
|
||||
return $collection;
|
||||
}
|
||||
}
|
||||
throw new NotFoundHttpException;
|
||||
throw new NotFoundHttpException();
|
||||
}
|
||||
}
|
||||
|
@@ -46,6 +46,6 @@ class CurrencyCode implements BinderInterface
|
||||
return $currency;
|
||||
}
|
||||
}
|
||||
throw new NotFoundHttpException;
|
||||
throw new NotFoundHttpException();
|
||||
}
|
||||
}
|
||||
|
@@ -73,7 +73,7 @@ class Date implements BinderInterface
|
||||
$result = new Carbon($value);
|
||||
} catch (Exception $e) { // @phpstan-ignore-line
|
||||
Log::error(sprintf('Could not parse date "%s" for user #%d: %s', $value, auth()->user()->id, $e->getMessage()));
|
||||
throw new NotFoundHttpException;
|
||||
throw new NotFoundHttpException();
|
||||
}
|
||||
|
||||
return $result;
|
||||
|
@@ -31,7 +31,6 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
*/
|
||||
class DynamicConfigKey
|
||||
{
|
||||
|
||||
public static array $accepted
|
||||
= [
|
||||
'configuration.is_demo_site',
|
||||
@@ -52,7 +51,6 @@ class DynamicConfigKey
|
||||
if (in_array($value, self::$accepted, true)) {
|
||||
return $value;
|
||||
}
|
||||
throw new NotFoundHttpException;
|
||||
throw new NotFoundHttpException();
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -68,6 +68,6 @@ class EitherConfigKey
|
||||
if (in_array($value, self::$static, true) || in_array($value, DynamicConfigKey::$accepted, true)) {
|
||||
return $value;
|
||||
}
|
||||
throw new NotFoundHttpException;
|
||||
throw new NotFoundHttpException();
|
||||
}
|
||||
}
|
||||
|
@@ -53,12 +53,12 @@ class JournalList implements BinderInterface
|
||||
$collector->setJournalIds($list);
|
||||
$result = $collector->getExtractedJournals();
|
||||
if (empty($result)) {
|
||||
throw new NotFoundHttpException;
|
||||
throw new NotFoundHttpException();
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
throw new NotFoundHttpException;
|
||||
throw new NotFoundHttpException();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -70,7 +70,7 @@ class JournalList implements BinderInterface
|
||||
{
|
||||
$list = array_unique(array_map('\intval', explode(',', $value)));
|
||||
if (empty($list)) {
|
||||
throw new NotFoundHttpException;
|
||||
throw new NotFoundHttpException();
|
||||
}
|
||||
|
||||
return $list;
|
||||
|
@@ -44,7 +44,6 @@ class TagList implements BinderInterface
|
||||
public static function routeBinder(string $value, Route $route): Collection
|
||||
{
|
||||
if (auth()->check()) {
|
||||
|
||||
if ('allTags' === $value) {
|
||||
return auth()->user()->tags()
|
||||
->orderBy('tag', 'ASC')
|
||||
@@ -55,7 +54,7 @@ class TagList implements BinderInterface
|
||||
|
||||
if (empty($list)) {
|
||||
Log::error('Tag list is empty.');
|
||||
throw new NotFoundHttpException;
|
||||
throw new NotFoundHttpException();
|
||||
}
|
||||
|
||||
|
||||
@@ -82,6 +81,6 @@ class TagList implements BinderInterface
|
||||
}
|
||||
}
|
||||
Log::error('TagList: user is not logged in.');
|
||||
throw new NotFoundHttpException;
|
||||
throw new NotFoundHttpException();
|
||||
}
|
||||
}
|
||||
|
@@ -54,9 +54,9 @@ class TagOrId implements BinderInterface
|
||||
return $result;
|
||||
}
|
||||
Log::error('TagOrId: tag not found.');
|
||||
throw new NotFoundHttpException;
|
||||
throw new NotFoundHttpException();
|
||||
}
|
||||
Log::error('TagOrId: user is not logged in.');
|
||||
throw new NotFoundHttpException;
|
||||
throw new NotFoundHttpException();
|
||||
}
|
||||
}
|
||||
|
@@ -41,7 +41,7 @@ class CacheProperties
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->properties = new Collection;
|
||||
$this->properties = new Collection();
|
||||
if (auth()->check()) {
|
||||
$this->addProperty(auth()->user()->id);
|
||||
$this->addProperty(app('preferences')->lastActivity());
|
||||
|
@@ -64,7 +64,6 @@ class FrontpageChartGenerator
|
||||
$this->accountRepos = app(AccountRepositoryInterface::class);
|
||||
$this->opsRepos = app(OperationsRepositoryInterface::class);
|
||||
$this->noCatRepos = app(NoCategoryRepositoryInterface::class);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -200,10 +199,8 @@ class FrontpageChartGenerator
|
||||
$category = $array['name'];
|
||||
$amount = $array['sum_float'] < 0 ? $array['sum_float'] * -1 : $array['sum_float'];
|
||||
$currencyData[$key]['entries'][$category] = $amount;
|
||||
|
||||
}
|
||||
|
||||
return $currencyData;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -124,7 +124,6 @@ class WholePeriodChartGenerator
|
||||
*/
|
||||
protected function calculateStep(Carbon $start, Carbon $end): string
|
||||
{
|
||||
|
||||
$step = '1D';
|
||||
$months = $start->diffInMonths($end);
|
||||
if ($months > 3) {
|
||||
@@ -165,5 +164,4 @@ class WholePeriodChartGenerator
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -74,5 +74,4 @@ abstract class AbstractCronjob
|
||||
{
|
||||
$this->force = $force;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -34,7 +34,6 @@ use Log;
|
||||
*/
|
||||
class AutoBudgetCronjob extends AbstractCronjob
|
||||
{
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
|
@@ -34,7 +34,6 @@ use Log;
|
||||
*/
|
||||
class ExchangeRatesCronjob extends AbstractCronjob
|
||||
{
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
|
@@ -340,7 +340,6 @@ class ExpandedForm
|
||||
*/
|
||||
public function password(string $name, array $options = null): string
|
||||
{
|
||||
|
||||
$label = $this->label($name, $options);
|
||||
$options = $this->expandOptionArray($name, $label, $options);
|
||||
$classes = $this->getHolderClasses($name);
|
||||
|
@@ -82,7 +82,7 @@ class ExportDataGenerator
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->accounts = new Collection;
|
||||
$this->accounts = new Collection();
|
||||
$this->start = today(config('app.timezone'));
|
||||
$this->start->subYear();
|
||||
$this->end = today(config('app.timezone'));
|
||||
@@ -310,7 +310,6 @@ class ExportDataGenerator
|
||||
}
|
||||
|
||||
return $string;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -737,7 +736,6 @@ class ExportDataGenerator
|
||||
$metaData['recurrence_total'],
|
||||
$metaData['recurrence_count'],
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
//load the CSV document from a string
|
||||
@@ -883,5 +881,4 @@ class ExportDataGenerator
|
||||
{
|
||||
$this->user = $user;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -35,7 +35,6 @@ use Illuminate\Database\QueryException;
|
||||
*/
|
||||
class FireflyConfig
|
||||
{
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
*/
|
||||
@@ -97,7 +96,7 @@ class FireflyConfig
|
||||
try {
|
||||
$config = Configuration::whereName($name)->whereNull('deleted_at')->first();
|
||||
} catch (QueryException|Exception $e) { // @phpstan-ignore-line
|
||||
$item = new Configuration;
|
||||
$item = new Configuration();
|
||||
$item->name = $name;
|
||||
$item->data = $value;
|
||||
|
||||
@@ -105,7 +104,7 @@ class FireflyConfig
|
||||
}
|
||||
|
||||
if (null === $config) {
|
||||
$item = new Configuration;
|
||||
$item = new Configuration();
|
||||
$item->name = $name;
|
||||
$item->data = $value;
|
||||
$item->save();
|
||||
@@ -128,10 +127,8 @@ class FireflyConfig
|
||||
*/
|
||||
public function getFresh(string $name, $default = null): ?Configuration
|
||||
{
|
||||
|
||||
$config = Configuration::where('name', $name)->first(['id', 'name', 'data']);
|
||||
if ($config) {
|
||||
|
||||
return $config;
|
||||
}
|
||||
// no preference found and default is null:
|
||||
|
@@ -224,5 +224,4 @@ class CurrencyForm
|
||||
|
||||
return $this->select($name, $array, $value, $options);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -87,7 +87,6 @@ trait ConvertsExchangeRates
|
||||
$entry['native_decimal_places'] = $native->decimal_places;
|
||||
}
|
||||
$return[] = $entry;
|
||||
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
@@ -267,5 +266,4 @@ trait ConvertsExchangeRates
|
||||
{
|
||||
$this->enabled = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -59,7 +59,7 @@ trait AugumentData
|
||||
$combined = [];
|
||||
/** @var Account $expenseAccount */
|
||||
foreach ($accounts as $expenseAccount) {
|
||||
$collection = new Collection;
|
||||
$collection = new Collection();
|
||||
$collection->push($expenseAccount);
|
||||
|
||||
$revenue = $repository->findByName($expenseAccount->name, [AccountType::REVENUE]);
|
||||
@@ -200,7 +200,7 @@ trait AugumentData
|
||||
/** @var BudgetLimitRepositoryInterface $blRepository */
|
||||
$blRepository = app(BudgetLimitRepositoryInterface::class);
|
||||
// properties for cache
|
||||
$cache = new CacheProperties;
|
||||
$cache = new CacheProperties();
|
||||
$cache->addProperty($start);
|
||||
$cache->addProperty($end);
|
||||
$cache->addProperty($budget->id);
|
||||
@@ -240,7 +240,6 @@ trait AugumentData
|
||||
*/
|
||||
protected function groupByName(array $array): array // filter + group data
|
||||
{
|
||||
|
||||
// group by opposing account name.
|
||||
$grouped = [];
|
||||
/** @var array $journal */
|
||||
|
@@ -52,7 +52,6 @@ trait ChartGeneration
|
||||
*/
|
||||
protected function accountBalanceChart(Collection $accounts, Carbon $start, Carbon $end): array // chart helper method.
|
||||
{
|
||||
|
||||
// chart properties for cache:
|
||||
$cache = new CacheProperties();
|
||||
$cache->addProperty($start);
|
||||
|
@@ -39,7 +39,6 @@ use phpseclib3\Crypt\RSA;
|
||||
*/
|
||||
trait CreateStuff
|
||||
{
|
||||
|
||||
/**
|
||||
* Creates an asset account.
|
||||
*
|
||||
@@ -61,7 +60,7 @@ trait CreateStuff
|
||||
'active' => true,
|
||||
'account_role' => 'defaultAsset',
|
||||
'opening_balance' => $request->input('bank_balance'),
|
||||
'opening_balance_date' => new Carbon,
|
||||
'opening_balance_date' => new Carbon(),
|
||||
'currency_id' => $currency->id,
|
||||
];
|
||||
|
||||
@@ -120,7 +119,7 @@ trait CreateStuff
|
||||
if (class_exists(LegacyRSA::class)) {
|
||||
// PHP 7
|
||||
Log::info('Will run PHP7 code.');
|
||||
$keys = (new LegacyRSA)->createKey(4096);
|
||||
$keys = (new LegacyRSA())->createKey(4096);
|
||||
}
|
||||
|
||||
if (!class_exists(LegacyRSA::class)) {
|
||||
@@ -158,7 +157,7 @@ trait CreateStuff
|
||||
'active' => true,
|
||||
'account_role' => 'savingAsset',
|
||||
'opening_balance' => $request->input('savings_balance'),
|
||||
'opening_balance_date' => new Carbon,
|
||||
'opening_balance_date' => new Carbon(),
|
||||
'currency_id' => $currency->id,
|
||||
];
|
||||
$repository->store($savingsAccount);
|
||||
@@ -182,5 +181,4 @@ trait CreateStuff
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -93,8 +93,5 @@ trait CronRunner
|
||||
'job_errored' => $recurring->jobErrored,
|
||||
'message' => $recurring->message,
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@@ -84,7 +84,6 @@ trait DateCalculation
|
||||
*/
|
||||
protected function calculateStep(Carbon $start, Carbon $end): string
|
||||
{
|
||||
|
||||
$step = '1D';
|
||||
$months = $start->diffInMonths($end);
|
||||
if ($months > 3) {
|
||||
@@ -167,5 +166,4 @@ trait DateCalculation
|
||||
|
||||
return $loop;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -140,26 +140,26 @@ trait GetConfigurationData
|
||||
// last seven days:
|
||||
$seven = Carbon::now()->subDays(7);
|
||||
$index = (string) trans('firefly.last_seven_days');
|
||||
$ranges[$index] = [$seven, new Carbon];
|
||||
$ranges[$index] = [$seven, new Carbon()];
|
||||
|
||||
// last 30 days:
|
||||
$thirty = Carbon::now()->subDays(30);
|
||||
$index = (string) trans('firefly.last_thirty_days');
|
||||
$ranges[$index] = [$thirty, new Carbon];
|
||||
$ranges[$index] = [$thirty, new Carbon()];
|
||||
|
||||
// month to date:
|
||||
$monthBegin = Carbon::now()->startOfMonth();
|
||||
$index = (string) trans('firefly.month_to_date');
|
||||
$ranges[$index] = [$monthBegin, new Carbon];
|
||||
$ranges[$index] = [$monthBegin, new Carbon()];
|
||||
|
||||
// year to date:
|
||||
$yearBegin = Carbon::now()->startOfYear();
|
||||
$index = (string) trans('firefly.year_to_date');
|
||||
$ranges[$index] = [$yearBegin, new Carbon];
|
||||
$ranges[$index] = [$yearBegin, new Carbon()];
|
||||
|
||||
// everything
|
||||
$index = (string) trans('firefly.everything');
|
||||
$ranges[$index] = [$first, new Carbon];
|
||||
$ranges[$index] = [$first, new Carbon()];
|
||||
|
||||
return [
|
||||
'title' => $title,
|
||||
|
@@ -119,7 +119,6 @@ trait ModelInformation
|
||||
$triggers = [];
|
||||
foreach ($operators as $key => $operator) {
|
||||
if ('user_action' !== $key && false === $operator['alias']) {
|
||||
|
||||
$triggers[$key] = (string) trans(sprintf('firefly.rule_trigger_%s_choice', $key));
|
||||
}
|
||||
}
|
||||
@@ -146,7 +145,6 @@ trait ModelInformation
|
||||
]
|
||||
)->render();
|
||||
} catch (Throwable $e) { // @phpstan-ignore-line
|
||||
|
||||
Log::debug(sprintf('Throwable was thrown in getTriggersForBill(): %s', $e->getMessage()));
|
||||
Log::debug($e->getTraceAsString());
|
||||
$string = '';
|
||||
@@ -171,7 +169,6 @@ trait ModelInformation
|
||||
$triggers = [];
|
||||
foreach ($operators as $key => $operator) {
|
||||
if ('user_action' !== $key && false === $operator['alias']) {
|
||||
|
||||
$triggers[$key] = (string) trans(sprintf('firefly.rule_trigger_%s_choice', $key));
|
||||
}
|
||||
}
|
||||
@@ -262,7 +259,6 @@ trait ModelInformation
|
||||
]
|
||||
)->render();
|
||||
} catch (Throwable $e) { // @phpstan-ignore-line
|
||||
|
||||
Log::debug(sprintf('Throwable was thrown in getTriggersForJournal(): %s', $e->getMessage()));
|
||||
Log::debug($e->getTraceAsString());
|
||||
$string = '';
|
||||
|
@@ -88,7 +88,7 @@ trait PeriodOverview
|
||||
[$start, $end] = $end < $start ? [$end, $start] : [$start, $end];
|
||||
|
||||
// properties for cache
|
||||
$cache = new CacheProperties;
|
||||
$cache = new CacheProperties();
|
||||
$cache->addProperty($start);
|
||||
$cache->addProperty($end);
|
||||
$cache->addProperty('account-show-period-entries');
|
||||
@@ -252,12 +252,10 @@ trait PeriodOverview
|
||||
'currency_symbol' => $journal['foreign_currency_symbol'],
|
||||
'currency_decimal_places' => $journal['foreign_currency_decimal_places'],
|
||||
];
|
||||
|
||||
}
|
||||
$return[$foreignCurrencyId]['count']++;
|
||||
$return[$foreignCurrencyId]['amount'] = bcadd($return[$foreignCurrencyId]['amount'], $journal['foreign_amount']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $return;
|
||||
@@ -361,7 +359,7 @@ trait PeriodOverview
|
||||
|
||||
[$start, $end] = $end < $start ? [$end, $start] : [$start, $end];
|
||||
|
||||
$cache = new CacheProperties;
|
||||
$cache = new CacheProperties();
|
||||
$cache->addProperty($start);
|
||||
$cache->addProperty($end);
|
||||
$cache->addProperty('no-budget-period-entries');
|
||||
@@ -415,7 +413,7 @@ trait PeriodOverview
|
||||
Log::debug(sprintf('Now in getNoCategoryPeriodOverview(%s)', $theDate->format('Y-m-d')));
|
||||
$range = app('preferences')->get('viewRange', '1M')->data;
|
||||
$first = $this->journalRepos->firstNull();
|
||||
$start = null === $first ? new Carbon : $first->date;
|
||||
$start = null === $first ? new Carbon() : $first->date;
|
||||
$end = $theDate ?? today(config('app.timezone'));
|
||||
|
||||
Log::debug(sprintf('Start for getNoCategoryPeriodOverview() is %s', $start->format('Y-m-d')));
|
||||
@@ -484,12 +482,11 @@ trait PeriodOverview
|
||||
*/
|
||||
protected function getTagPeriodOverview(Tag $tag, Carbon $start, Carbon $end): array // period overview for tags.
|
||||
{
|
||||
|
||||
$range = app('preferences')->get('viewRange', '1M')->data;
|
||||
[$start, $end] = $end < $start ? [$end, $start] : [$start, $end];
|
||||
|
||||
// properties for cache
|
||||
$cache = new CacheProperties;
|
||||
$cache = new CacheProperties();
|
||||
$cache->addProperty($start);
|
||||
$cache->addProperty($end);
|
||||
$cache->addProperty('tag-period-entries');
|
||||
@@ -565,7 +562,7 @@ trait PeriodOverview
|
||||
[$start, $end] = $end < $start ? [$end, $start] : [$start, $end];
|
||||
|
||||
// properties for cache
|
||||
$cache = new CacheProperties;
|
||||
$cache = new CacheProperties();
|
||||
$cache->addProperty($start);
|
||||
$cache->addProperty($end);
|
||||
$cache->addProperty('transactions-period-entries');
|
||||
|
@@ -44,7 +44,6 @@ use Throwable;
|
||||
*/
|
||||
trait RenderPartialViews
|
||||
{
|
||||
|
||||
/**
|
||||
* View for transactions in a budget for an account.
|
||||
*
|
||||
@@ -114,7 +113,7 @@ trait RenderPartialViews
|
||||
|
||||
$budget = $budgetRepository->find((int) $attributes['budgetId']);
|
||||
if (null === $budget) {
|
||||
$budget = new Budget;
|
||||
$budget = new Budget();
|
||||
}
|
||||
$journals = $popupHelper->byBudget($budget, $attributes);
|
||||
|
||||
@@ -276,7 +275,6 @@ trait RenderPartialViews
|
||||
'count' => $count,
|
||||
]
|
||||
)->render();
|
||||
|
||||
} catch (Throwable $e) { // @phpstan-ignore-line
|
||||
Log::debug(sprintf('Throwable was thrown in getCurrentActions(): %s', $e->getMessage()));
|
||||
Log::error($e->getTraceAsString());
|
||||
@@ -303,7 +301,6 @@ trait RenderPartialViews
|
||||
$triggers = [];
|
||||
foreach ($operators as $key => $operator) {
|
||||
if ('user_action' !== $key && false === $operator['alias']) {
|
||||
|
||||
$triggers[$key] = (string) trans(sprintf('firefly.rule_trigger_%s_choice', $key));
|
||||
}
|
||||
}
|
||||
@@ -318,7 +315,7 @@ trait RenderPartialViews
|
||||
$count = ($index + 1);
|
||||
try {
|
||||
$rootOperator = OperatorQuerySearch::getRootOperator($entry->trigger_type);
|
||||
if(str_starts_with($rootOperator, '-')) {
|
||||
if (str_starts_with($rootOperator, '-')) {
|
||||
$rootOperator = substr($rootOperator, 1);
|
||||
}
|
||||
$renderedEntries[] = view(
|
||||
@@ -332,7 +329,6 @@ trait RenderPartialViews
|
||||
'triggers' => $triggers,
|
||||
]
|
||||
)->render();
|
||||
|
||||
} catch (Throwable $e) { // @phpstan-ignore-line
|
||||
Log::debug(sprintf('Throwable was thrown in getCurrentTriggers(): %s', $e->getMessage()));
|
||||
Log::error($e->getTraceAsString());
|
||||
@@ -384,7 +380,6 @@ trait RenderPartialViews
|
||||
*/
|
||||
protected function noReportOptions(): string // render a view
|
||||
{
|
||||
|
||||
try {
|
||||
$result = view('reports.options.no-options')->render();
|
||||
} catch (Throwable $e) { // @phpstan-ignore-line
|
||||
|
@@ -228,5 +228,4 @@ trait RequestInformation
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -35,7 +35,6 @@ use Throwable;
|
||||
*/
|
||||
trait RuleManagement
|
||||
{
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
*
|
||||
@@ -83,7 +82,6 @@ trait RuleManagement
|
||||
$triggers = [];
|
||||
foreach ($operators as $key => $operator) {
|
||||
if ('user_action' !== $key && false === $operator['alias']) {
|
||||
|
||||
$triggers[$key] = (string) trans(sprintf('firefly.rule_trigger_%s_choice', $key));
|
||||
}
|
||||
}
|
||||
@@ -130,7 +128,6 @@ trait RuleManagement
|
||||
$triggers = [];
|
||||
foreach ($operators as $key => $operator) {
|
||||
if ('user_action' !== $key && false === $operator['alias']) {
|
||||
|
||||
$triggers[$key] = (string) trans(sprintf('firefly.rule_trigger_%s_choice', $key));
|
||||
}
|
||||
}
|
||||
|
@@ -183,5 +183,4 @@ trait TransactionCalculation
|
||||
|
||||
return $collector->getExtractedJournals();
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -39,7 +39,6 @@ use Log;
|
||||
*/
|
||||
trait UserNavigation
|
||||
{
|
||||
|
||||
/**
|
||||
* Functionality:.
|
||||
*
|
||||
|
@@ -44,13 +44,12 @@ class AuditLogger
|
||||
*/
|
||||
public function __invoke(Logger $logger)
|
||||
{
|
||||
$processor = new AuditProcessor;
|
||||
$processor = new AuditProcessor();
|
||||
/** @var AbstractProcessingHandler $handler */
|
||||
foreach ($logger->getHandlers() as $handler) {
|
||||
$formatter = new LineFormatter("[%datetime%] %channel%.%level_name%: %message% %context% %extra%\n");
|
||||
$handler->setFormatter($formatter);
|
||||
$handler->pushProcessor($processor);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -39,13 +39,13 @@ class AuditProcessor
|
||||
public function __invoke(array $record): array
|
||||
{
|
||||
if (auth()->check()) {
|
||||
|
||||
$record['message'] = sprintf(
|
||||
'AUDIT: %s (%s (%s) -> %s:%s)',
|
||||
$record['message'],
|
||||
app('request')->ip(),
|
||||
auth()->user()->email,
|
||||
request()->method(), request()->url()
|
||||
request()->method(),
|
||||
request()->url()
|
||||
);
|
||||
|
||||
return $record;
|
||||
@@ -55,7 +55,8 @@ class AuditProcessor
|
||||
'AUDIT: %s (%s -> %s:%s)',
|
||||
$record['message'],
|
||||
app('request')->ip(),
|
||||
request()->method(), request()->url()
|
||||
request()->method(),
|
||||
request()->url()
|
||||
);
|
||||
|
||||
return $record;
|
||||
|
@@ -207,7 +207,6 @@ class Navigation
|
||||
Log::error(sprintf('Cannot do startOfPeriod for $repeat_freq "%s"', $repeatFreq));
|
||||
|
||||
return $theDate;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -426,7 +425,6 @@ class Navigation
|
||||
Log::error(sprintf('No date formats for frequency "%s"!', $repeatFrequency));
|
||||
|
||||
return $date->format('Y-m-d');
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -585,12 +583,12 @@ class Navigation
|
||||
switch ($repeatFreq) {
|
||||
default:
|
||||
break;
|
||||
case 'last7';
|
||||
$date->subDays(7);
|
||||
return $date;
|
||||
case 'last30';
|
||||
$date->subDays(30);
|
||||
return $date;
|
||||
case 'last7':
|
||||
$date->subDays(7);
|
||||
return $date;
|
||||
case 'last30':
|
||||
$date->subDays(30);
|
||||
return $date;
|
||||
case 'last90':
|
||||
$date->subDays(90);
|
||||
return $date;
|
||||
@@ -658,8 +656,8 @@ class Navigation
|
||||
switch ($range) {
|
||||
default:
|
||||
break;
|
||||
case 'last7';
|
||||
case 'last30';
|
||||
case 'last7':
|
||||
case 'last30':
|
||||
case 'last90':
|
||||
case 'last365':
|
||||
case 'YTD':
|
||||
@@ -715,12 +713,12 @@ class Navigation
|
||||
switch ($range) {
|
||||
default:
|
||||
break;
|
||||
case 'last7';
|
||||
$start->subDays(7);
|
||||
return $start;
|
||||
case 'last30';
|
||||
$start->subDays(30);
|
||||
return $start;
|
||||
case 'last7':
|
||||
$start->subDays(7);
|
||||
return $start;
|
||||
case 'last30':
|
||||
$start->subDays(30);
|
||||
return $start;
|
||||
case 'last90':
|
||||
$start->subDays(90);
|
||||
return $start;
|
||||
|
@@ -95,7 +95,6 @@ class ParseDateString
|
||||
|
||||
// if + or -:
|
||||
if (str_starts_with($date, '+') || str_starts_with($date, '-')) {
|
||||
|
||||
return $this->parseRelativeDate($date);
|
||||
}
|
||||
if ('xxxx-xx-xx' === strtolower($date)) {
|
||||
@@ -204,7 +203,6 @@ class ParseDateString
|
||||
Log::debug(sprintf('Will now do %s(%d) on %s', $func, $number, $today->format('Y-m-d')));
|
||||
$today->$func($number);
|
||||
Log::debug(sprintf('Resulting date is %s', $today->format('Y-m-d')));
|
||||
|
||||
}
|
||||
|
||||
return $today;
|
||||
@@ -464,5 +462,4 @@ class ParseDateString
|
||||
'month' => $parts[1],
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -45,7 +45,7 @@ class Preferences
|
||||
{
|
||||
$user = auth()->user();
|
||||
if (null === $user) {
|
||||
return new Collection;
|
||||
return new Collection();
|
||||
}
|
||||
|
||||
return Preference::where('user_id', $user->id)->get();
|
||||
@@ -139,7 +139,7 @@ class Preferences
|
||||
/** @var User|null $user */
|
||||
$user = auth()->user();
|
||||
if (null === $user) {
|
||||
$preference = new Preference;
|
||||
$preference = new Preference();
|
||||
$preference->data = $default;
|
||||
|
||||
return $preference;
|
||||
@@ -183,7 +183,6 @@ class Preferences
|
||||
}
|
||||
|
||||
if (null !== $preference) {
|
||||
|
||||
return $preference;
|
||||
}
|
||||
// no preference found and default is null:
|
||||
@@ -217,13 +216,13 @@ class Preferences
|
||||
throw new FireflyException(sprintf('Could not delete preference: %s', $e->getMessage()), 0, $e);
|
||||
}
|
||||
|
||||
return new Preference;
|
||||
return new Preference();
|
||||
}
|
||||
if (null === $value) {
|
||||
return new Preference;
|
||||
return new Preference();
|
||||
}
|
||||
if (null === $pref) {
|
||||
$pref = new Preference;
|
||||
$pref = new Preference();
|
||||
$pref->user_id = $user->id;
|
||||
$pref->name = $name;
|
||||
}
|
||||
@@ -269,7 +268,7 @@ class Preferences
|
||||
/** @var User|null $user */
|
||||
$user = auth()->user();
|
||||
if (null === $user) {
|
||||
$preference = new Preference;
|
||||
$preference = new Preference();
|
||||
$preference->data = $default;
|
||||
|
||||
return $preference;
|
||||
@@ -299,7 +298,7 @@ class Preferences
|
||||
$user = auth()->user();
|
||||
if (null === $user) {
|
||||
// make new preference, return it:
|
||||
$pref = new Preference;
|
||||
$pref = new Preference();
|
||||
$pref->name = $name;
|
||||
$pref->data = $value;
|
||||
|
||||
|
@@ -69,7 +69,6 @@ class BudgetReportGenerator
|
||||
*/
|
||||
public function accountPerBudget(): void
|
||||
{
|
||||
|
||||
$spent = $this->opsRepository->listExpenses($this->start, $this->end, $this->accounts, $this->budgets);
|
||||
$this->report = [];
|
||||
/** @var Account $account */
|
||||
@@ -87,7 +86,6 @@ class BudgetReportGenerator
|
||||
foreach ($spent as $currency) {
|
||||
$this->processExpenses($currency);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -251,7 +249,6 @@ class BudgetReportGenerator
|
||||
|
||||
$noBudget = $this->nbRepository->sumExpenses($this->start, $this->end, $this->accounts);
|
||||
foreach ($noBudget as $noBudgetEntry) {
|
||||
|
||||
// currency information:
|
||||
$nbCurrencyId = (int) ($noBudgetEntry['currency_id'] ?? $this->currency->id);
|
||||
$nbCurrencyCode = $noBudgetEntry['currency_code'] ?? $this->currency->code;
|
||||
|
@@ -210,5 +210,4 @@ class CategoryReportGenerator
|
||||
$this->noCatRepository->setUser($user);
|
||||
$this->opsRepository->setUser($user);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -32,7 +32,6 @@ use Illuminate\Support\Facades\Log;
|
||||
*/
|
||||
trait CalculateRangeOccurrences
|
||||
{
|
||||
|
||||
/**
|
||||
* Get the number of daily occurrences for a recurring transaction until date $end is reached. Will skip every $skipMod-1 occurrences.
|
||||
*
|
||||
@@ -185,7 +184,6 @@ trait CalculateRangeOccurrences
|
||||
$return = [];
|
||||
if ($start > $date) {
|
||||
$date->addYear();
|
||||
|
||||
}
|
||||
|
||||
// is $date between $start and $end?
|
||||
@@ -201,6 +199,5 @@ trait CalculateRangeOccurrences
|
||||
}
|
||||
|
||||
return $return;
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -31,7 +31,6 @@ use Carbon\Carbon;
|
||||
*/
|
||||
trait CalculateXOccurrences
|
||||
{
|
||||
|
||||
/**
|
||||
* Calculates the number of daily occurrences for a recurring transaction, starting at the date, until $count is reached. It will skip
|
||||
* over $skipMod -1 recurrences.
|
||||
@@ -210,6 +209,5 @@ trait CalculateXOccurrences
|
||||
}
|
||||
|
||||
return $return;
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -32,7 +32,6 @@ use Log;
|
||||
*/
|
||||
trait CalculateXOccurrencesSince
|
||||
{
|
||||
|
||||
/**
|
||||
* Calculates the number of daily occurrences for a recurring transaction, starting at the date, until $count is reached. It will skip
|
||||
* over $skipMod -1 recurrences.
|
||||
@@ -234,6 +233,5 @@ trait CalculateXOccurrencesSince
|
||||
}
|
||||
|
||||
return $return;
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -34,7 +34,6 @@ use Illuminate\Support\Facades\Log;
|
||||
*/
|
||||
trait FiltersWeekends
|
||||
{
|
||||
|
||||
/**
|
||||
* Filters out all weekend entries, if necessary.
|
||||
*
|
||||
|
@@ -240,13 +240,12 @@ trait AppendsLocationData
|
||||
$zoomLevelKey = $this->getLocationKey($prefix, 'zoom_level');
|
||||
|
||||
return (
|
||||
null === $this->get($longitudeKey)
|
||||
&& null === $this->get($latitudeKey)
|
||||
&& null === $this->get($zoomLevelKey))
|
||||
&& ('PUT' === $this->method()
|
||||
|| ('POST' === $this->method() && $this->routeIs('*.update'))
|
||||
null === $this->get($longitudeKey)
|
||||
&& null === $this->get($latitudeKey)
|
||||
&& null === $this->get($zoomLevelKey))
|
||||
&& (
|
||||
'PUT' === $this->method()
|
||||
|| ('POST' === $this->method() && $this->routeIs('*.update'))
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -28,5 +28,4 @@ namespace FireflyIII\Support\Request;
|
||||
*/
|
||||
trait ConvertAPIDataTypes
|
||||
{
|
||||
|
||||
}
|
||||
|
@@ -314,5 +314,4 @@ trait ConvertsDataTypes
|
||||
|
||||
return (int) $value;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -86,5 +86,4 @@ trait GetRecurrenceData
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -28,7 +28,6 @@ namespace FireflyIII\Support\Request;
|
||||
*/
|
||||
trait GetRuleConfiguration
|
||||
{
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
|
@@ -59,7 +59,6 @@ class AccountSearch implements GenericSearchInterface
|
||||
*/
|
||||
public function search(): Collection
|
||||
{
|
||||
|
||||
$searchQuery = $this->user->accounts()
|
||||
->leftJoin('account_types', 'accounts.account_type_id', '=', 'account_types.id')
|
||||
->leftJoin('account_meta', 'accounts.id', '=', 'account_meta.account_id')
|
||||
@@ -140,5 +139,4 @@ class AccountSearch implements GenericSearchInterface
|
||||
{
|
||||
$this->user = $user;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -35,5 +35,4 @@ interface GenericSearchInterface
|
||||
* @return Collection
|
||||
*/
|
||||
public function search(): Collection;
|
||||
|
||||
}
|
||||
|
@@ -88,7 +88,7 @@ class OperatorQuerySearch implements SearchInterface
|
||||
public function __construct()
|
||||
{
|
||||
Log::debug('Constructed OperatorQuerySearch');
|
||||
$this->operators = new Collection;
|
||||
$this->operators = new Collection();
|
||||
$this->page = 1;
|
||||
$this->words = [];
|
||||
$this->prohibitedWords = [];
|
||||
@@ -241,7 +241,6 @@ class OperatorQuerySearch implements SearchInterface
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -267,13 +266,13 @@ class OperatorQuerySearch implements SearchInterface
|
||||
default:
|
||||
Log::error(sprintf('No such operator: %s', $operator));
|
||||
throw new FireflyException(sprintf('Unsupported search operator: "%s"', $operator));
|
||||
// some search operators are ignored, basically:
|
||||
// some search operators are ignored, basically:
|
||||
case 'user_action':
|
||||
Log::info(sprintf('Ignore search operator "%s"', $operator));
|
||||
|
||||
return false;
|
||||
//
|
||||
// all account related searches:
|
||||
// all account related searches:
|
||||
//
|
||||
case 'account_is':
|
||||
$this->searchAccount($value, 3, 4);
|
||||
@@ -475,7 +474,7 @@ class OperatorQuerySearch implements SearchInterface
|
||||
break;
|
||||
case 'account_id':
|
||||
$parts = explode(',', $value);
|
||||
$collection = new Collection;
|
||||
$collection = new Collection();
|
||||
foreach ($parts as $accountId) {
|
||||
$account = $this->accountRepository->find((int) $accountId);
|
||||
if (null !== $account) {
|
||||
@@ -491,7 +490,7 @@ class OperatorQuerySearch implements SearchInterface
|
||||
break;
|
||||
case '-account_id':
|
||||
$parts = explode(',', $value);
|
||||
$collection = new Collection;
|
||||
$collection = new Collection();
|
||||
foreach ($parts as $accountId) {
|
||||
$account = $this->accountRepository->find((int) $accountId);
|
||||
if (null !== $account) {
|
||||
@@ -506,7 +505,7 @@ class OperatorQuerySearch implements SearchInterface
|
||||
}
|
||||
break;
|
||||
//
|
||||
// cash account
|
||||
// cash account
|
||||
//
|
||||
case 'source_is_cash':
|
||||
$account = $this->getCashAccount();
|
||||
@@ -533,7 +532,7 @@ class OperatorQuerySearch implements SearchInterface
|
||||
$this->collector->excludeAccounts(new Collection([$account]));
|
||||
break;
|
||||
//
|
||||
// description
|
||||
// description
|
||||
//
|
||||
case 'description_starts':
|
||||
$this->collector->descriptionStarts([$value]);
|
||||
@@ -562,7 +561,7 @@ class OperatorQuerySearch implements SearchInterface
|
||||
$this->collector->descriptionIsNot($value);
|
||||
break;
|
||||
//
|
||||
// currency
|
||||
// currency
|
||||
//
|
||||
case 'currency_is':
|
||||
$currency = $this->findCurrency($value);
|
||||
@@ -601,7 +600,7 @@ class OperatorQuerySearch implements SearchInterface
|
||||
}
|
||||
break;
|
||||
//
|
||||
// attachments
|
||||
// attachments
|
||||
//
|
||||
case 'has_attachments':
|
||||
case '-has_no_attachments':
|
||||
@@ -614,7 +613,7 @@ class OperatorQuerySearch implements SearchInterface
|
||||
$this->collector->hasNoAttachments();
|
||||
break;
|
||||
//
|
||||
// categories
|
||||
// categories
|
||||
case '-has_any_category':
|
||||
case 'has_no_category':
|
||||
$this->collector->withoutCategory();
|
||||
@@ -693,7 +692,7 @@ class OperatorQuerySearch implements SearchInterface
|
||||
}
|
||||
break;
|
||||
//
|
||||
// budgets
|
||||
// budgets
|
||||
//
|
||||
case '-has_any_budget':
|
||||
case 'has_no_budget':
|
||||
@@ -774,7 +773,7 @@ class OperatorQuerySearch implements SearchInterface
|
||||
}
|
||||
break;
|
||||
//
|
||||
// bill
|
||||
// bill
|
||||
//
|
||||
case '-has_any_bill':
|
||||
case 'has_no_bill':
|
||||
@@ -853,7 +852,7 @@ class OperatorQuerySearch implements SearchInterface
|
||||
}
|
||||
break;
|
||||
//
|
||||
// tags
|
||||
// tags
|
||||
//
|
||||
case '-has_any_tag':
|
||||
case 'has_no_tag':
|
||||
@@ -883,7 +882,7 @@ class OperatorQuerySearch implements SearchInterface
|
||||
}
|
||||
break;
|
||||
//
|
||||
// notes
|
||||
// notes
|
||||
//
|
||||
case 'notes_contains':
|
||||
$this->collector->notesContain($value);
|
||||
@@ -924,7 +923,7 @@ class OperatorQuerySearch implements SearchInterface
|
||||
$this->collector->isNotReconciled();
|
||||
break;
|
||||
//
|
||||
// amount
|
||||
// amount
|
||||
//
|
||||
case 'amount_is':
|
||||
// strip comma's, make dots.
|
||||
@@ -997,7 +996,7 @@ class OperatorQuerySearch implements SearchInterface
|
||||
$this->collector->foreignAmountMore($amount);
|
||||
break;
|
||||
//
|
||||
// transaction type
|
||||
// transaction type
|
||||
//
|
||||
case 'transaction_type':
|
||||
$this->collector->setTypes([ucfirst($value)]);
|
||||
@@ -1008,7 +1007,7 @@ class OperatorQuerySearch implements SearchInterface
|
||||
Log::debug(sprintf('Set "%s" using collector with value "%s"', $operator, $value));
|
||||
break;
|
||||
//
|
||||
// dates
|
||||
// dates
|
||||
//
|
||||
case '-date_on':
|
||||
case 'date_on':
|
||||
@@ -1160,7 +1159,7 @@ class OperatorQuerySearch implements SearchInterface
|
||||
$this->setObjectDateAfterParams('updated_at', $range);
|
||||
return false;
|
||||
//
|
||||
// external URL
|
||||
// external URL
|
||||
//
|
||||
case '-any_external_url':
|
||||
case 'no_external_url':
|
||||
@@ -1197,7 +1196,7 @@ class OperatorQuerySearch implements SearchInterface
|
||||
break;
|
||||
|
||||
//
|
||||
// other fields
|
||||
// other fields
|
||||
//
|
||||
case 'external_id_is':
|
||||
$this->collector->setExternalId($value);
|
||||
@@ -1310,7 +1309,6 @@ class OperatorQuerySearch implements SearchInterface
|
||||
case '-exists':
|
||||
$this->collector->findNothing();
|
||||
break;
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -1550,7 +1548,7 @@ class OperatorQuerySearch implements SearchInterface
|
||||
*/
|
||||
private function parseDateRange(string $value): array
|
||||
{
|
||||
$parser = new ParseDateString;
|
||||
$parser = new ParseDateString();
|
||||
if ($parser->isDateRange($value)) {
|
||||
return $parser->parseRange($value);
|
||||
}
|
||||
@@ -2044,7 +2042,6 @@ class OperatorQuerySearch implements SearchInterface
|
||||
$this->collector->withAccountInformation()->withCategoryInformation()->withBudgetInformation();
|
||||
|
||||
$this->setLimit((int) app('preferences')->getForUser($user, 'listPageSize', 50)->data);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -43,7 +43,6 @@ use ValueError;
|
||||
*/
|
||||
class Steam
|
||||
{
|
||||
|
||||
/**
|
||||
* @param Account $account
|
||||
* @param Carbon $date
|
||||
@@ -53,7 +52,7 @@ class Steam
|
||||
public function balanceIgnoreVirtual(Account $account, Carbon $date): string
|
||||
{
|
||||
// abuse chart properties:
|
||||
$cache = new CacheProperties;
|
||||
$cache = new CacheProperties();
|
||||
$cache->addProperty($account->id);
|
||||
$cache->addProperty('balance-no-virtual');
|
||||
$cache->addProperty($date);
|
||||
@@ -124,7 +123,7 @@ class Steam
|
||||
public function balanceInRange(Account $account, Carbon $start, Carbon $end, ?TransactionCurrency $currency = null): array
|
||||
{
|
||||
// abuse chart properties:
|
||||
$cache = new CacheProperties;
|
||||
$cache = new CacheProperties();
|
||||
$cache->addProperty($account->id);
|
||||
$cache->addProperty('balance-in-range');
|
||||
$cache->addProperty($currency ? $currency->id : 0);
|
||||
@@ -210,7 +209,7 @@ class Steam
|
||||
public function balance(Account $account, Carbon $date, ?TransactionCurrency $currency = null): string
|
||||
{
|
||||
// abuse chart properties:
|
||||
$cache = new CacheProperties;
|
||||
$cache = new CacheProperties();
|
||||
$cache->addProperty($account->id);
|
||||
$cache->addProperty('balance');
|
||||
$cache->addProperty($date);
|
||||
@@ -259,7 +258,7 @@ class Steam
|
||||
{
|
||||
$ids = $accounts->pluck('id')->toArray();
|
||||
// cache this property.
|
||||
$cache = new CacheProperties;
|
||||
$cache = new CacheProperties();
|
||||
$cache->addProperty($ids);
|
||||
$cache->addProperty('balances');
|
||||
$cache->addProperty($date);
|
||||
@@ -292,7 +291,7 @@ class Steam
|
||||
{
|
||||
$ids = $accounts->pluck('id')->toArray();
|
||||
// cache this property.
|
||||
$cache = new CacheProperties;
|
||||
$cache = new CacheProperties();
|
||||
$cache->addProperty($ids);
|
||||
$cache->addProperty('balances-per-currency');
|
||||
$cache->addProperty($date);
|
||||
@@ -321,7 +320,7 @@ class Steam
|
||||
public function balancePerCurrency(Account $account, Carbon $date): array
|
||||
{
|
||||
// abuse chart properties:
|
||||
$cache = new CacheProperties;
|
||||
$cache = new CacheProperties();
|
||||
$cache->addProperty($account->id);
|
||||
$cache->addProperty('balance-per-currency');
|
||||
$cache->addProperty($date);
|
||||
|
@@ -58,5 +58,4 @@ trait GeneratesInstallationId
|
||||
app('fireflyconfig')->set('installation_id', $uniqueId);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -146,5 +146,4 @@ class OAuthKeys
|
||||
file_put_contents($public, $publicContent);
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -120,11 +120,10 @@ class AmountFormat extends AbstractExtension
|
||||
{
|
||||
return new TwigFunction(
|
||||
'formatAmountBySymbol',
|
||||
|
||||
static function (string $amount, string $symbol, int $decimalPlaces = null, bool $coloured = null): string {
|
||||
$decimalPlaces = $decimalPlaces ?? 2;
|
||||
$coloured = $coloured ?? true;
|
||||
$currency = new TransactionCurrency;
|
||||
$currency = new TransactionCurrency();
|
||||
$currency->symbol = $symbol;
|
||||
$currency->decimal_places = $decimalPlaces;
|
||||
|
||||
|
@@ -114,7 +114,7 @@ class General extends AbstractExtension
|
||||
return 'fa-file-o';
|
||||
case 'application/pdf':
|
||||
return 'fa-file-pdf-o';
|
||||
/* image */
|
||||
/* image */
|
||||
case 'image/png':
|
||||
case 'image/jpeg':
|
||||
case 'image/svg+xml':
|
||||
@@ -122,7 +122,7 @@ class General extends AbstractExtension
|
||||
case 'image/heic-sequence':
|
||||
case 'application/vnd.oasis.opendocument.image':
|
||||
return 'fa-file-image-o';
|
||||
/* MS word */
|
||||
/* MS word */
|
||||
case 'application/msword':
|
||||
case 'application/vnd.openxmlformats-officedocument.wordprocessingml.document':
|
||||
case 'application/vnd.openxmlformats-officedocument.wordprocessingml.template':
|
||||
@@ -137,7 +137,7 @@ class General extends AbstractExtension
|
||||
case 'application/vnd.oasis.opendocument.text-web':
|
||||
case 'application/vnd.oasis.opendocument.text-master':
|
||||
return 'fa-file-word-o';
|
||||
/* MS excel */
|
||||
/* MS excel */
|
||||
case 'application/vnd.ms-excel':
|
||||
case 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet':
|
||||
case 'application/vnd.openxmlformats-officedocument.spreadsheetml.template':
|
||||
@@ -147,7 +147,7 @@ class General extends AbstractExtension
|
||||
case 'application/vnd.oasis.opendocument.spreadsheet':
|
||||
case 'application/vnd.oasis.opendocument.spreadsheet-template':
|
||||
return 'fa-file-excel-o';
|
||||
/* MS powerpoint */
|
||||
/* MS powerpoint */
|
||||
case 'application/vnd.ms-powerpoint':
|
||||
case 'application/vnd.openxmlformats-officedocument.presentationml.presentation':
|
||||
case 'application/vnd.openxmlformats-officedocument.presentationml.template':
|
||||
@@ -158,7 +158,7 @@ class General extends AbstractExtension
|
||||
case 'application/vnd.oasis.opendocument.presentation':
|
||||
case 'application/vnd.oasis.opendocument.presentation-template':
|
||||
return 'fa-file-powerpoint-o';
|
||||
/* calc */
|
||||
/* calc */
|
||||
case 'application/vnd.sun.xml.draw':
|
||||
case 'application/vnd.sun.xml.draw.template':
|
||||
case 'application/vnd.stardivision.draw':
|
||||
@@ -171,7 +171,6 @@ class General extends AbstractExtension
|
||||
case 'application/vnd.oasis.opendocument.formula':
|
||||
case 'application/vnd.oasis.opendocument.database':
|
||||
return 'fa-calculator';
|
||||
|
||||
}
|
||||
},
|
||||
['is_safe' => ['html']]
|
||||
@@ -184,9 +183,8 @@ class General extends AbstractExtension
|
||||
protected function markdown(): TwigFilter
|
||||
{
|
||||
return new TwigFilter(
|
||||
'markdown',
|
||||
'markdown',
|
||||
static function (string $text): string {
|
||||
|
||||
$converter = new GithubFlavoredMarkdownConverter(
|
||||
[
|
||||
'allow_unsafe_links' => false,
|
||||
@@ -196,7 +194,8 @@ class General extends AbstractExtension
|
||||
);
|
||||
|
||||
return (string) $converter->convert($text);
|
||||
}, ['is_safe' => ['html']]
|
||||
},
|
||||
['is_safe' => ['html']]
|
||||
);
|
||||
}
|
||||
|
||||
|
@@ -112,7 +112,6 @@ class TransactionGroupTwig extends AbstractExtension
|
||||
*/
|
||||
private function signAmount(string $amount, string $transactionType, string $sourceType): string
|
||||
{
|
||||
|
||||
// withdrawals stay negative
|
||||
if ($transactionType !== TransactionType::WITHDRAWAL) {
|
||||
$amount = bcmul($amount, '-1');
|
||||
|
Reference in New Issue
Block a user