mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-05 12:12:18 +00:00
Clean up code.
This commit is contained in:
@@ -36,10 +36,12 @@ $finder = PhpCsFixer\Finder::create()
|
||||
|
||||
$config = new PhpCsFixer\Config();
|
||||
return $config->setRules([
|
||||
'@PHP83Migration' => true,
|
||||
'@PhpCsFixer:risky' => true,
|
||||
'@PSR12:risky' => true,
|
||||
'declare_strict_types' => true,
|
||||
'strict_param' => true,
|
||||
'comment_to_phpdoc' => false, // breaks phpstan lines in combination with PHPStorm.
|
||||
'array_syntax' => ['syntax' => 'short'],
|
||||
'native_function_invocation' => false, // annoying
|
||||
'php_unit_data_provider_name' => false, // bloody annoying long test names
|
||||
|
14
.ci/php-cs-fixer/composer.lock
generated
14
.ci/php-cs-fixer/composer.lock
generated
@@ -226,16 +226,16 @@
|
||||
},
|
||||
{
|
||||
"name": "friendsofphp/php-cs-fixer",
|
||||
"version": "v3.40.1",
|
||||
"version": "v3.41.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git",
|
||||
"reference": "7002f09c9593f515625a9f9717b10c2ab64dd3d5"
|
||||
"reference": "7d8d18e19095a939b8a3b8046f57108feaad6134"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/7002f09c9593f515625a9f9717b10c2ab64dd3d5",
|
||||
"reference": "7002f09c9593f515625a9f9717b10c2ab64dd3d5",
|
||||
"url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/7d8d18e19095a939b8a3b8046f57108feaad6134",
|
||||
"reference": "7d8d18e19095a939b8a3b8046f57108feaad6134",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -265,8 +265,6 @@
|
||||
"php-cs-fixer/accessible-object": "^1.1",
|
||||
"php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.4",
|
||||
"php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.4",
|
||||
"phpspec/prophecy": "^1.17",
|
||||
"phpspec/prophecy-phpunit": "^2.0",
|
||||
"phpunit/phpunit": "^9.6",
|
||||
"symfony/phpunit-bridge": "^6.3.8 || ^7.0",
|
||||
"symfony/yaml": "^5.4 || ^6.0 || ^7.0"
|
||||
@@ -307,7 +305,7 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues",
|
||||
"source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.40.1"
|
||||
"source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.41.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -315,7 +313,7 @@
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2023-12-02T23:18:26+00:00"
|
||||
"time": "2023-12-08T22:54:33+00:00"
|
||||
},
|
||||
{
|
||||
"name": "psr/container",
|
||||
|
@@ -92,7 +92,7 @@ class BillController extends Controller
|
||||
$foreignKey = sprintf('%d-%d', $billId, $foreignCurrencyId);
|
||||
|
||||
if (0 !== $currencyId) {
|
||||
$response[$key] = $response[$key] ?? [
|
||||
$response[$key] ??= [
|
||||
'id' => (string)$billId,
|
||||
'name' => $journal['bill_name'],
|
||||
'difference' => '0',
|
||||
@@ -104,7 +104,7 @@ class BillController extends Controller
|
||||
$response[$key]['difference_float'] = (float)$response[$key]['difference']; // intentional float
|
||||
}
|
||||
if (0 !== $foreignCurrencyId) {
|
||||
$response[$foreignKey] = $response[$foreignKey] ?? [
|
||||
$response[$foreignKey] ??= [
|
||||
'difference' => '0',
|
||||
'difference_float' => 0,
|
||||
'currency_id' => (string)$foreignCurrencyId,
|
||||
@@ -147,7 +147,7 @@ class BillController extends Controller
|
||||
$foreignCurrencyId = (int)$journal['foreign_currency_id'];
|
||||
|
||||
if (0 !== $currencyId) {
|
||||
$response[$currencyId] = $response[$currencyId] ?? [
|
||||
$response[$currencyId] ??= [
|
||||
'difference' => '0',
|
||||
'difference_float' => 0,
|
||||
'currency_id' => (string)$currencyId,
|
||||
@@ -157,7 +157,7 @@ class BillController extends Controller
|
||||
$response[$currencyId]['difference_float'] = (float)$response[$currencyId]['difference']; // intentional float
|
||||
}
|
||||
if (0 !== $foreignCurrencyId) {
|
||||
$response[$foreignCurrencyId] = $response[$foreignCurrencyId] ?? [
|
||||
$response[$foreignCurrencyId] ??= [
|
||||
'difference' => '0',
|
||||
'difference_float' => 0,
|
||||
'currency_id' => (string)$foreignCurrencyId,
|
||||
|
@@ -58,7 +58,7 @@ class PeriodController extends Controller
|
||||
$foreignCurrencyId = (int)$journal['foreign_currency_id'];
|
||||
|
||||
if (0 !== $currencyId) {
|
||||
$response[$currencyId] = $response[$currencyId] ?? [
|
||||
$response[$currencyId] ??= [
|
||||
'difference' => '0',
|
||||
'difference_float' => 0,
|
||||
'currency_id' => (string)$currencyId,
|
||||
@@ -68,7 +68,7 @@ class PeriodController extends Controller
|
||||
$response[$currencyId]['difference_float'] = (float)$response[$currencyId]['difference']; // intentional float
|
||||
}
|
||||
if (0 !== $foreignCurrencyId) {
|
||||
$response[$foreignCurrencyId] = $response[$foreignCurrencyId] ?? [
|
||||
$response[$foreignCurrencyId] ??= [
|
||||
'difference' => '0',
|
||||
'difference_float' => 0,
|
||||
'currency_id' => (string)$foreignCurrencyId,
|
||||
|
@@ -83,7 +83,7 @@ class TagController extends Controller
|
||||
$foreignCurrencyId = (int)$journal['foreign_currency_id'];
|
||||
|
||||
if (0 !== $currencyId) {
|
||||
$response[$currencyId] = $response[$currencyId] ?? [
|
||||
$response[$currencyId] ??= [
|
||||
'difference' => '0',
|
||||
'difference_float' => 0,
|
||||
'currency_id' => (string)$currencyId,
|
||||
@@ -93,7 +93,7 @@ class TagController extends Controller
|
||||
$response[$currencyId]['difference_float'] = (float)$response[$currencyId]['difference']; // float but on purpose.
|
||||
}
|
||||
if (0 !== $foreignCurrencyId) {
|
||||
$response[$foreignCurrencyId] = $response[$foreignCurrencyId] ?? [
|
||||
$response[$foreignCurrencyId] ??= [
|
||||
'difference' => '0',
|
||||
'difference_float' => 0,
|
||||
'currency_id' => (string)$foreignCurrencyId,
|
||||
@@ -148,7 +148,7 @@ class TagController extends Controller
|
||||
|
||||
// on currency ID
|
||||
if (0 !== $currencyId) {
|
||||
$response[$key] = $response[$key] ?? [
|
||||
$response[$key] ??= [
|
||||
'id' => (string)$tagId,
|
||||
'name' => $tag['name'],
|
||||
'difference' => '0',
|
||||
|
@@ -58,7 +58,7 @@ class PeriodController extends Controller
|
||||
$foreignCurrencyId = (int)$journal['foreign_currency_id'];
|
||||
|
||||
if (0 !== $currencyId) {
|
||||
$response[$currencyId] = $response[$currencyId] ?? [
|
||||
$response[$currencyId] ??= [
|
||||
'difference' => '0',
|
||||
'difference_float' => 0,
|
||||
'currency_id' => (string)$currencyId,
|
||||
@@ -68,7 +68,7 @@ class PeriodController extends Controller
|
||||
$response[$currencyId]['difference_float'] = (float)$response[$currencyId]['difference']; // float but on purpose.
|
||||
}
|
||||
if (0 !== $foreignCurrencyId) {
|
||||
$response[$foreignCurrencyId] = $response[$foreignCurrencyId] ?? [
|
||||
$response[$foreignCurrencyId] ??= [
|
||||
'difference' => '0',
|
||||
'difference_float' => 0,
|
||||
'currency_id' => (string)$foreignCurrencyId,
|
||||
|
@@ -84,7 +84,7 @@ class TagController extends Controller
|
||||
$foreignCurrencyId = (int)$journal['foreign_currency_id'];
|
||||
|
||||
if (0 !== $currencyId) {
|
||||
$response[$currencyId] = $response[$currencyId] ?? [
|
||||
$response[$currencyId] ??= [
|
||||
'difference' => '0',
|
||||
'difference_float' => 0,
|
||||
'currency_id' => (string)$currencyId,
|
||||
@@ -94,7 +94,7 @@ class TagController extends Controller
|
||||
$response[$currencyId]['difference_float'] = (float)$response[$currencyId]['difference'];
|
||||
}
|
||||
if (0 !== $foreignCurrencyId) {
|
||||
$response[$foreignCurrencyId] = $response[$foreignCurrencyId] ?? [
|
||||
$response[$foreignCurrencyId] ??= [
|
||||
'difference' => '0',
|
||||
'difference_float' => 0,
|
||||
'currency_id' => (string)$foreignCurrencyId,
|
||||
@@ -152,7 +152,7 @@ class TagController extends Controller
|
||||
|
||||
// on currency ID
|
||||
if (0 !== $currencyId) {
|
||||
$response[$key] = $response[$key] ?? [
|
||||
$response[$key] ??= [
|
||||
'id' => (string)$tagId,
|
||||
'name' => $tag['name'],
|
||||
'difference' => '0',
|
||||
|
@@ -58,7 +58,7 @@ class PeriodController extends Controller
|
||||
$foreignCurrencyId = (int)$journal['foreign_currency_id'];
|
||||
|
||||
if (0 !== $currencyId) {
|
||||
$response[$currencyId] = $response[$currencyId] ?? [
|
||||
$response[$currencyId] ??= [
|
||||
'difference' => '0',
|
||||
'difference_float' => 0,
|
||||
'currency_id' => (string)$currencyId,
|
||||
@@ -68,7 +68,7 @@ class PeriodController extends Controller
|
||||
$response[$currencyId]['difference_float'] = (float)$response[$currencyId]['difference'];
|
||||
}
|
||||
if (0 !== $foreignCurrencyId) {
|
||||
$response[$foreignCurrencyId] = $response[$foreignCurrencyId] ?? [
|
||||
$response[$foreignCurrencyId] ??= [
|
||||
'difference' => '0',
|
||||
'difference_float' => 0,
|
||||
'currency_id' => (string)$foreignCurrencyId,
|
||||
|
@@ -81,7 +81,7 @@ class TagController extends Controller
|
||||
$foreignCurrencyId = (int)$journal['foreign_currency_id'];
|
||||
|
||||
if (0 !== $currencyId) {
|
||||
$response[$currencyId] = $response[$currencyId] ?? [
|
||||
$response[$currencyId] ??= [
|
||||
'difference' => '0',
|
||||
'difference_float' => 0,
|
||||
'currency_id' => (string)$currencyId,
|
||||
@@ -91,7 +91,7 @@ class TagController extends Controller
|
||||
$response[$currencyId]['difference_float'] = (float)$response[$currencyId]['difference'];
|
||||
}
|
||||
if (0 !== $foreignCurrencyId) {
|
||||
$response[$foreignCurrencyId] = $response[$foreignCurrencyId] ?? [
|
||||
$response[$foreignCurrencyId] ??= [
|
||||
'difference' => '0',
|
||||
'difference_float' => 0,
|
||||
'currency_id' => (string)$foreignCurrencyId,
|
||||
@@ -149,7 +149,7 @@ class TagController extends Controller
|
||||
|
||||
// on currency ID
|
||||
if (0 !== $currencyId) {
|
||||
$response[$key] = $response[$key] ?? [
|
||||
$response[$key] ??= [
|
||||
'id' => (string)$tagId,
|
||||
'name' => $tag['name'],
|
||||
'difference' => '0',
|
||||
|
@@ -33,7 +33,6 @@ use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
|
||||
use FireflyIII\Transformers\BudgetLimitTransformer;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Pagination\LengthAwarePaginator;
|
||||
use League\Fractal\Pagination\IlluminatePaginatorAdapter;
|
||||
use League\Fractal\Resource\Collection as FractalCollection;
|
||||
|
@@ -24,13 +24,11 @@ declare(strict_types=1);
|
||||
namespace FireflyIII\Api\V1\Controllers\Models\ObjectGroup;
|
||||
|
||||
use FireflyIII\Api\V1\Controllers\Controller;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Models\ObjectGroup;
|
||||
use FireflyIII\Repositories\ObjectGroup\ObjectGroupRepositoryInterface;
|
||||
use FireflyIII\Transformers\ObjectGroupTransformer;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Pagination\LengthAwarePaginator;
|
||||
use League\Fractal\Pagination\IlluminatePaginatorAdapter;
|
||||
use League\Fractal\Resource\Collection as FractalCollection;
|
||||
|
@@ -148,12 +148,12 @@ class BasicController extends Controller
|
||||
/** @var array $transactionJournal */
|
||||
foreach ($set as $transactionJournal) {
|
||||
$currencyId = (int)$transactionJournal['currency_id'];
|
||||
$incomes[$currencyId] = $incomes[$currencyId] ?? '0';
|
||||
$incomes[$currencyId] ??= '0';
|
||||
$incomes[$currencyId] = bcadd(
|
||||
$incomes[$currencyId],
|
||||
bcmul($transactionJournal['amount'], '-1')
|
||||
);
|
||||
$sums[$currencyId] = $sums[$currencyId] ?? '0';
|
||||
$sums[$currencyId] ??= '0';
|
||||
$sums[$currencyId] = bcadd($sums[$currencyId], bcmul($transactionJournal['amount'], '-1'));
|
||||
}
|
||||
|
||||
@@ -171,9 +171,9 @@ class BasicController extends Controller
|
||||
/** @var array $transactionJournal */
|
||||
foreach ($set as $transactionJournal) {
|
||||
$currencyId = (int)$transactionJournal['currency_id'];
|
||||
$expenses[$currencyId] = $expenses[$currencyId] ?? '0';
|
||||
$expenses[$currencyId] ??= '0';
|
||||
$expenses[$currencyId] = bcadd($expenses[$currencyId], $transactionJournal['amount']);
|
||||
$sums[$currencyId] = $sums[$currencyId] ?? '0';
|
||||
$sums[$currencyId] ??= '0';
|
||||
$sums[$currencyId] = bcadd($sums[$currencyId], $transactionJournal['amount']);
|
||||
}
|
||||
|
||||
|
@@ -102,7 +102,7 @@ class AccountController extends Controller
|
||||
$nameWithBalance = sprintf('%s (%s)', $account->name, app('amount')->formatAnything($currency, $balance, false));
|
||||
}
|
||||
$type = (string)trans(sprintf('firefly.%s', $account->accountType->type));
|
||||
$groupedResult[$type] = $groupedResult[$type] ?? [
|
||||
$groupedResult[$type] ??= [
|
||||
'group ' => $type,
|
||||
'items' => [],
|
||||
];
|
||||
|
@@ -27,7 +27,6 @@ namespace FireflyIII\Api\V2\Controllers\Chart;
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Api\V2\Controllers\Controller;
|
||||
use FireflyIII\Api\V2\Request\Chart\DashboardChartRequest;
|
||||
use FireflyIII\Api\V2\Request\Generic\DateRequest;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Models\Account;
|
||||
use FireflyIII\Models\AccountType;
|
||||
|
@@ -121,7 +121,7 @@ class BalanceController extends Controller
|
||||
$currencies[$currencyId] = $currency; // may just re-assign itself, don't mind.
|
||||
|
||||
// set the array with monetary info, if it does not exist.
|
||||
$data[$currencyId] = $data[$currencyId] ?? [
|
||||
$data[$currencyId] ??= [
|
||||
'currency_id' => (string)$currencyId,
|
||||
'currency_symbol' => $journal['currency_symbol'],
|
||||
'currency_code' => $journal['currency_code'],
|
||||
@@ -135,7 +135,7 @@ class BalanceController extends Controller
|
||||
];
|
||||
|
||||
// set the array (in monetary info) with spent/earned in this $period, if it does not exist.
|
||||
$data[$currencyId][$period] = $data[$currencyId][$period] ?? [
|
||||
$data[$currencyId][$period] ??= [
|
||||
'period' => $period,
|
||||
'spent' => '0',
|
||||
'earned' => '0',
|
||||
|
@@ -198,8 +198,8 @@ class BudgetController extends Controller
|
||||
* @var array $block
|
||||
*/
|
||||
foreach ($array as $currencyId => $block) {
|
||||
$this->currencies[$currencyId] = $this->currencies[$currencyId] ?? TransactionCurrency::find($currencyId);
|
||||
$return[$currencyId] = $return[$currencyId] ?? [
|
||||
$this->currencies[$currencyId] ??= TransactionCurrency::find($currencyId);
|
||||
$return[$currencyId] ??= [
|
||||
'currency_id' => (string)$currencyId,
|
||||
'currency_code' => $block['currency_code'],
|
||||
'currency_name' => $block['currency_name'],
|
||||
|
@@ -109,7 +109,7 @@ class CategoryController extends Controller
|
||||
$nativeAmount = app('steam')->positive($journal['foreign_amount']);
|
||||
}
|
||||
// create arrays
|
||||
$return[$key] = $return[$key] ?? [
|
||||
$return[$key] ??= [
|
||||
'label' => $categoryName,
|
||||
'currency_id' => (string)$currency->id,
|
||||
'currency_code' => $currency->code,
|
||||
|
@@ -28,7 +28,6 @@ use FireflyIII\Api\V2\Controllers\Controller;
|
||||
use FireflyIII\Models\Account;
|
||||
use FireflyIII\Transformers\V2\AccountTransformer;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
/**
|
||||
* Show = show a single account.
|
||||
|
@@ -30,7 +30,6 @@ use FireflyIII\Repositories\UserGroups\Bill\BillRepositoryInterface;
|
||||
use FireflyIII\Support\Http\Api\ValidatesUserGroupTrait;
|
||||
use FireflyIII\Transformers\V2\BillTransformer;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Pagination\LengthAwarePaginator;
|
||||
|
||||
/**
|
||||
|
@@ -31,7 +31,6 @@ use FireflyIII\Repositories\UserGroups\Bill\BillRepositoryInterface;
|
||||
use FireflyIII\Support\Http\Api\ValidatesUserGroupTrait;
|
||||
use FireflyIII\Transformers\V2\BillTransformer;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
/**
|
||||
* Class ShowController
|
||||
|
@@ -28,7 +28,6 @@ use FireflyIII\Api\V2\Controllers\Controller;
|
||||
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
|
||||
use FireflyIII\Transformers\V2\BudgetTransformer;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Pagination\LengthAwarePaginator;
|
||||
|
||||
/**
|
||||
|
@@ -25,8 +25,6 @@ declare(strict_types=1);
|
||||
namespace FireflyIII\Api\V2\Controllers\Model\BudgetLimit;
|
||||
|
||||
use FireflyIII\Api\V2\Controllers\Controller;
|
||||
use FireflyIII\Api\V2\Request\Generic\DateRequest;
|
||||
use FireflyIII\Models\Budget;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
|
||||
/**
|
||||
|
@@ -30,7 +30,6 @@ use FireflyIII\Repositories\UserGroups\PiggyBank\PiggyBankRepositoryInterface;
|
||||
use FireflyIII\Support\Http\Api\ValidatesUserGroupTrait;
|
||||
use FireflyIII\Transformers\V2\PiggyBankTransformer;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Pagination\LengthAwarePaginator;
|
||||
|
||||
/**
|
||||
|
@@ -169,10 +169,10 @@ class BasicController extends Controller
|
||||
$nativeAmount = $transactionJournal['foreign_amount'];
|
||||
}
|
||||
// prep the arrays
|
||||
$incomes[$currencyId] = $incomes[$currencyId] ?? '0';
|
||||
$incomes['native'] = $incomes['native'] ?? '0';
|
||||
$sums[$currencyId] = $sums[$currencyId] ?? '0';
|
||||
$sums['native'] = $sums['native'] ?? '0';
|
||||
$incomes[$currencyId] ??= '0';
|
||||
$incomes['native'] ??= '0';
|
||||
$sums[$currencyId] ??= '0';
|
||||
$sums['native'] ??= '0';
|
||||
|
||||
// add values:
|
||||
$incomes[$currencyId] = bcadd($incomes[$currencyId], $amount);
|
||||
@@ -208,10 +208,10 @@ class BasicController extends Controller
|
||||
}
|
||||
|
||||
// prep arrays
|
||||
$expenses[$currencyId] = $expenses[$currencyId] ?? '0';
|
||||
$expenses['native'] = $expenses['native'] ?? '0';
|
||||
$sums[$currencyId] = $sums[$currencyId] ?? '0';
|
||||
$sums['native'] = $sums['native'] ?? '0';
|
||||
$expenses[$currencyId] ??= '0';
|
||||
$expenses['native'] ??= '0';
|
||||
$sums[$currencyId] ??= '0';
|
||||
$sums['native'] ??= '0';
|
||||
|
||||
// add values
|
||||
$expenses[$currencyId] = bcadd($expenses[$currencyId], $amount);
|
||||
|
@@ -31,7 +31,6 @@ use FireflyIII\Models\UserGroup;
|
||||
use FireflyIII\Repositories\UserGroup\UserGroupRepositoryInterface;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
|
||||
/**
|
||||
|
@@ -30,7 +30,6 @@ use FireflyIII\Models\UserGroup;
|
||||
use FireflyIII\Repositories\UserGroup\UserGroupRepositoryInterface;
|
||||
use FireflyIII\Transformers\V2\UserGroupTransformer;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Pagination\LengthAwarePaginator;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
|
@@ -27,7 +27,6 @@ use FireflyIII\Enums\UserRoleEnum;
|
||||
use FireflyIII\Models\AccountType;
|
||||
use FireflyIII\Support\Request\ChecksLogin;
|
||||
use FireflyIII\Support\Request\ConvertsDataTypes;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
/**
|
||||
|
@@ -55,7 +55,7 @@ class AutoSum
|
||||
/** @var string $amount */
|
||||
$amount = $getSum($object);
|
||||
|
||||
$return[$currency->id] = $return[$currency->id] ?? [
|
||||
$return[$currency->id] ??= [
|
||||
'id' => (string)$currency->id,
|
||||
'name' => $currency->name,
|
||||
'symbol' => $currency->symbol,
|
||||
|
@@ -61,7 +61,8 @@ class DeleteEmptyJournals extends Command
|
||||
{
|
||||
$set = Transaction::whereNull('deleted_at')
|
||||
->groupBy('transactions.transaction_journal_id')
|
||||
->get([DB::raw('COUNT(transactions.transaction_journal_id) as the_count'), 'transaction_journal_id']); /** @phpstan-ignore-line */
|
||||
->get([DB::raw('COUNT(transactions.transaction_journal_id) as the_count'), 'transaction_journal_id']);
|
||||
/** @phpstan-ignore-line */
|
||||
$total = 0;
|
||||
/** @var Transaction $row */
|
||||
foreach ($set as $row) {
|
||||
|
@@ -28,7 +28,6 @@ use FireflyIII\Console\Commands\ShowsFriendlyMessages;
|
||||
use FireflyIII\Models\AccountType;
|
||||
use FireflyIII\Models\Preference;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
use FireflyIII\Support\Facades\Preferences;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
|
@@ -91,7 +91,7 @@ class FixIbans extends Command
|
||||
/** @var Account $account */
|
||||
foreach ($accounts as $account) {
|
||||
$userId = $account->user_id;
|
||||
$set[$userId] = $set[$userId] ?? [];
|
||||
$set[$userId] ??= [];
|
||||
$iban = (string)$account->iban;
|
||||
if ('' === $iban) {
|
||||
continue;
|
||||
|
@@ -27,9 +27,7 @@ namespace FireflyIII\Console\Commands\System;
|
||||
use FireflyIII\Console\Commands\ShowsFriendlyMessages;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Illuminate\Filesystem\FilesystemAdapter;
|
||||
use League\Flysystem\FilesystemException;
|
||||
use League\Flysystem\FilesystemReader;
|
||||
use Storage;
|
||||
|
||||
/**
|
||||
|
@@ -33,7 +33,8 @@ class DestroyedTransactionLink extends Event
|
||||
{
|
||||
use SerializesModels;
|
||||
|
||||
private TransactionJournalLink $link; /** @phpstan-ignore-line */
|
||||
private TransactionJournalLink $link;
|
||||
/** @phpstan-ignore-line */
|
||||
|
||||
/**
|
||||
* DestroyedTransactionLink constructor.
|
||||
|
@@ -26,15 +26,12 @@ namespace FireflyIII\Exceptions;
|
||||
|
||||
use ErrorException;
|
||||
use FireflyIII\Jobs\MailError;
|
||||
use FireflyIII\Models\ObjectGroup;
|
||||
use Illuminate\Auth\AuthenticationException;
|
||||
use Illuminate\Contracts\Foundation\Application;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Routing\Redirector;
|
||||
use Illuminate\Session\TokenMismatchException;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Validation\ValidationException as LaravelValidationException;
|
||||
|
@@ -59,7 +59,8 @@ final class IntervalException extends Exception
|
||||
array $intervals,
|
||||
int $code = 0,
|
||||
?Throwable $previous = null
|
||||
): self {
|
||||
): self
|
||||
{
|
||||
$message = sprintf(
|
||||
'The periodicity %s is unknown. Choose one of available periodicity: %s',
|
||||
$periodicity->name,
|
||||
|
@@ -29,7 +29,6 @@ use Exception;
|
||||
use FireflyIII\Exceptions\DuplicateTransactionException;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Models\Account;
|
||||
use FireflyIII\Models\Preference;
|
||||
use FireflyIII\Models\Transaction;
|
||||
use FireflyIII\Models\TransactionCurrency;
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
|
@@ -121,7 +121,7 @@ class NetWorth implements NetWorthInterface
|
||||
$nativeVirtualBalance = $converter->convert($default, $currency, $account->created_at, $virtualBalance);
|
||||
$nativeBalance = bcsub($nativeBalance, $nativeVirtualBalance);
|
||||
}
|
||||
$netWorth[$currencyId] = $netWorth[$currencyId] ?? [
|
||||
$netWorth[$currencyId] ??= [
|
||||
'balance' => '0',
|
||||
'native_balance' => '0',
|
||||
'currency_id' => $currencyId,
|
||||
@@ -208,7 +208,7 @@ class NetWorth implements NetWorthInterface
|
||||
$balance = bcsub($balance, $virtualBalance);
|
||||
}
|
||||
|
||||
$return[$currency->id] = $return[$currency->id] ?? [
|
||||
$return[$currency->id] ??= [
|
||||
'id' => (string)$currency->id,
|
||||
'name' => $currency->name,
|
||||
'symbol' => $currency->symbol,
|
||||
|
@@ -97,9 +97,9 @@ class ShowController extends Controller
|
||||
}
|
||||
|
||||
/** @var Carbon $start */
|
||||
$start = $start ?? session('start');
|
||||
$start ??= session('start');
|
||||
/** @var Carbon $end */
|
||||
$end = $end ?? session('end');
|
||||
$end ??= session('end');
|
||||
|
||||
if ($end < $start) {
|
||||
[$start, $end] = [$end, $start];
|
||||
|
@@ -109,7 +109,7 @@ class IndexController extends Controller
|
||||
$array = $transformer->transform($bill);
|
||||
$groupOrder = (int)$array['object_group_order'];
|
||||
// make group array if necessary:
|
||||
$bills[$groupOrder] = $bills[$groupOrder] ?? [
|
||||
$bills[$groupOrder] ??= [
|
||||
'object_group_id' => $array['object_group_id'],
|
||||
'object_group_title' => $array['object_group_title'],
|
||||
'bills' => [],
|
||||
@@ -159,7 +159,7 @@ class IndexController extends Controller
|
||||
}
|
||||
|
||||
$currencyId = $bill['currency_id'];
|
||||
$sums[$groupOrder][$currencyId] = $sums[$groupOrder][$currencyId] ?? [
|
||||
$sums[$groupOrder][$currencyId] ??= [
|
||||
'currency_id' => $currencyId,
|
||||
'currency_code' => $bill['currency_code'],
|
||||
'currency_name' => $bill['currency_name'],
|
||||
@@ -249,7 +249,7 @@ class IndexController extends Controller
|
||||
* @var array $entry
|
||||
*/
|
||||
foreach ($array as $currencyId => $entry) {
|
||||
$totals[$currencyId] = $totals[$currencyId] ?? [
|
||||
$totals[$currencyId] ??= [
|
||||
'currency_id' => $currencyId,
|
||||
'currency_code' => $entry['currency_code'],
|
||||
'currency_name' => $entry['currency_name'],
|
||||
|
@@ -105,14 +105,14 @@ class IndexController extends Controller
|
||||
$range = app('navigation')->getViewRange(true);
|
||||
$isCustomRange = session('is_custom_range', false);
|
||||
if (false === $isCustomRange) {
|
||||
$start = $start ?? session('start', today(config('app.timezone'))->startOfMonth());
|
||||
$end = $end ?? app('navigation')->endOfPeriod($start, $range);
|
||||
$start ??= session('start', today(config('app.timezone'))->startOfMonth());
|
||||
$end ??= app('navigation')->endOfPeriod($start, $range);
|
||||
}
|
||||
|
||||
// overrule start and end if necessary:
|
||||
if (true === $isCustomRange) {
|
||||
$start = $start ?? session('start', today(config('app.timezone'))->startOfMonth());
|
||||
$end = $end ?? session('end', today(config('app.timezone'))->endOfMonth());
|
||||
$start ??= session('start', today(config('app.timezone'))->startOfMonth());
|
||||
$end ??= session('end', today(config('app.timezone'))->endOfMonth());
|
||||
}
|
||||
|
||||
|
||||
@@ -283,8 +283,8 @@ class IndexController extends Controller
|
||||
foreach ($budget['spent'] as $spent) {
|
||||
$currencyId = $spent['currency_id'];
|
||||
$sums['spent'][$currencyId]
|
||||
= $sums['spent'][$currencyId]
|
||||
?? [
|
||||
??=
|
||||
[
|
||||
'amount' => '0',
|
||||
'currency_id' => $spent['currency_id'],
|
||||
'currency_symbol' => $spent['currency_symbol'],
|
||||
@@ -297,8 +297,8 @@ class IndexController extends Controller
|
||||
foreach ($budget['budgeted'] as $budgeted) {
|
||||
$currencyId = $budgeted['currency_id'];
|
||||
$sums['budgeted'][$currencyId]
|
||||
= $sums['budgeted'][$currencyId]
|
||||
?? [
|
||||
??=
|
||||
[
|
||||
'amount' => '0',
|
||||
'currency_id' => $budgeted['currency_id'],
|
||||
'currency_symbol' => $budgeted['currency_symbol'],
|
||||
@@ -307,8 +307,8 @@ class IndexController extends Controller
|
||||
$sums['budgeted'][$currencyId]['amount'] = bcadd($sums['budgeted'][$currencyId]['amount'], $budgeted['amount']);
|
||||
|
||||
// also calculate how much left from budgeted:
|
||||
$sums['left'][$currencyId] = $sums['left'][$currencyId]
|
||||
?? [
|
||||
$sums['left'][$currencyId] ??=
|
||||
[
|
||||
'amount' => '0',
|
||||
'currency_id' => $budgeted['currency_id'],
|
||||
'currency_symbol' => $budgeted['currency_symbol'],
|
||||
|
@@ -88,9 +88,9 @@ class ShowController extends Controller
|
||||
public function noBudget(Request $request, Carbon $start = null, Carbon $end = null)
|
||||
{
|
||||
/** @var Carbon $start */
|
||||
$start = $start ?? session('start');
|
||||
$start ??= session('start');
|
||||
/** @var Carbon $end */
|
||||
$end = $end ?? session('end');
|
||||
$end ??= session('end');
|
||||
$subTitle = trans(
|
||||
'firefly.without_budget_between',
|
||||
['start' => $start->isoFormat($this->monthAndDayFormat), 'end' => $end->isoFormat($this->monthAndDayFormat)]
|
||||
|
@@ -84,9 +84,9 @@ class NoCategoryController extends Controller
|
||||
{
|
||||
app('log')->debug('Start of noCategory()');
|
||||
/** @var Carbon $start */
|
||||
$start = $start ?? session('start');
|
||||
$start ??= session('start');
|
||||
/** @var Carbon $end */
|
||||
$end = $end ?? session('end');
|
||||
$end ??= session('end');
|
||||
$page = (int)$request->get('page');
|
||||
$pageSize = (int)app('preferences')->get('listPageSize', 50)->data;
|
||||
$subTitle = trans(
|
||||
|
@@ -86,9 +86,9 @@ class ShowController extends Controller
|
||||
public function show(Request $request, Category $category, Carbon $start = null, Carbon $end = null)
|
||||
{
|
||||
/** @var Carbon $start */
|
||||
$start = $start ?? session('start', today(config('app.timezone'))->startOfMonth());
|
||||
$start ??= session('start', today(config('app.timezone'))->startOfMonth());
|
||||
/** @var Carbon $end */
|
||||
$end = $end ?? session('end', today(config('app.timezone'))->endOfMonth());
|
||||
$end ??= session('end', today(config('app.timezone'))->endOfMonth());
|
||||
$subTitleIcon = 'fa-bookmark';
|
||||
$page = (int)$request->get('page');
|
||||
$attachments = $this->repository->getAttachments($category);
|
||||
|
@@ -125,7 +125,7 @@ class AccountController extends Controller
|
||||
// grab the difference and find the currency.
|
||||
$startAmount = (string)($startBalances[$accountId][$currencyId] ?? '0');
|
||||
$diff = bcsub((string)$endAmount, $startAmount);
|
||||
$currencies[$currencyId] = $currencies[$currencyId] ?? $this->currencyRepository->find($currencyId);
|
||||
$currencies[$currencyId] ??= $this->currencyRepository->find($currencyId);
|
||||
if (0 !== bccomp($diff, '0')) {
|
||||
// store the values in a temporary array.
|
||||
$tempData[] = [
|
||||
@@ -585,7 +585,7 @@ class AccountController extends Controller
|
||||
// grab the difference and find the currency.
|
||||
$startAmount = (string)($startBalances[$accountId][$currencyId] ?? '0');
|
||||
$diff = bcsub((string)$endAmount, $startAmount);
|
||||
$currencies[$currencyId] = $currencies[$currencyId] ?? $this->currencyRepository->find($currencyId);
|
||||
$currencies[$currencyId] ??= $this->currencyRepository->find($currencyId);
|
||||
if (0 !== bccomp($diff, '0')) {
|
||||
// store the values in a temporary array.
|
||||
$tempData[] = [
|
||||
|
@@ -117,7 +117,7 @@ class BudgetController extends Controller
|
||||
|
||||
foreach ($spent as $row) {
|
||||
$currencyId = $row['currency_id'];
|
||||
$currencies[$currencyId] = $currencies[$currencyId] ?? $row; // don't mind the field 'sum'
|
||||
$currencies[$currencyId] ??= $row; // don't mind the field 'sum'
|
||||
// also store this day's sum:
|
||||
$currencies[$currencyId]['spent'][$label] = $row['sum'];
|
||||
}
|
||||
@@ -237,7 +237,7 @@ class BudgetController extends Controller
|
||||
// group by asset account ID:
|
||||
foreach ($journals as $journal) {
|
||||
$key = sprintf('%d-%d', (int)$journal['source_account_id'], $journal['currency_id']);
|
||||
$result[$key] = $result[$key] ?? [
|
||||
$result[$key] ??= [
|
||||
'amount' => '0',
|
||||
'currency_symbol' => $journal['currency_symbol'],
|
||||
'currency_code' => $journal['currency_code'],
|
||||
@@ -302,7 +302,7 @@ class BudgetController extends Controller
|
||||
$chartData = [];
|
||||
foreach ($journals as $journal) {
|
||||
$key = sprintf('%d-%d', $journal['category_id'], $journal['currency_id']);
|
||||
$result[$key] = $result[$key] ?? [
|
||||
$result[$key] ??= [
|
||||
'amount' => '0',
|
||||
'currency_symbol' => $journal['currency_symbol'],
|
||||
'currency_code' => $journal['currency_code'],
|
||||
@@ -367,7 +367,7 @@ class BudgetController extends Controller
|
||||
/** @var array $journal */
|
||||
foreach ($journals as $journal) {
|
||||
$key = sprintf('%d-%d', $journal['destination_account_id'], $journal['currency_id']);
|
||||
$result[$key] = $result[$key] ?? [
|
||||
$result[$key] ??= [
|
||||
'amount' => '0',
|
||||
'currency_symbol' => $journal['currency_symbol'],
|
||||
'currency_code' => $journal['currency_code'],
|
||||
|
@@ -87,7 +87,7 @@ class BudgetReportController extends Controller
|
||||
foreach ($spent as $currency) {
|
||||
foreach ($currency['budgets'] as $budget) {
|
||||
$title = sprintf('%s (%s)', $budget['name'], $currency['currency_name']);
|
||||
$result[$title] = $result[$title] ?? [
|
||||
$result[$title] ??= [
|
||||
'amount' => '0',
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_code' => $currency['currency_code'],
|
||||
@@ -124,7 +124,7 @@ class BudgetReportController extends Controller
|
||||
foreach ($budget['transaction_journals'] as $journal) {
|
||||
$categoryName = $journal['category_name'] ?? trans('firefly.no_category');
|
||||
$title = sprintf('%s (%s)', $categoryName, $currency['currency_name']);
|
||||
$result[$title] = $result[$title] ?? [
|
||||
$result[$title] ??= [
|
||||
'amount' => '0',
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_code' => $currency['currency_code'],
|
||||
@@ -161,7 +161,7 @@ class BudgetReportController extends Controller
|
||||
foreach ($currency['budgets'] as $budget) {
|
||||
foreach ($budget['transaction_journals'] as $journal) {
|
||||
$title = sprintf('%s (%s)', $journal['destination_account_name'], $currency['currency_name']);
|
||||
$result[$title] = $result[$title] ?? [
|
||||
$result[$title] ??= [
|
||||
'amount' => '0',
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_code' => $currency['currency_code'],
|
||||
@@ -198,7 +198,7 @@ class BudgetReportController extends Controller
|
||||
foreach ($spent as $currency) {
|
||||
// add things to chart Data for each currency:
|
||||
$spentKey = sprintf('%d-spent', $currency['currency_id']);
|
||||
$chartData[$spentKey] = $chartData[$spentKey] ?? [
|
||||
$chartData[$spentKey] ??= [
|
||||
'label' => sprintf(
|
||||
'%s (%s)',
|
||||
(string)trans('firefly.spent_in_specific_budget', ['budget' => $budget->name]),
|
||||
@@ -215,7 +215,7 @@ class BudgetReportController extends Controller
|
||||
foreach ($currentBudget['transaction_journals'] as $journal) {
|
||||
$key = $journal['date']->isoFormat($format);
|
||||
$amount = app('steam')->positive($journal['amount']);
|
||||
$chartData[$spentKey]['entries'][$key] = $chartData[$spentKey]['entries'][$key] ?? '0';
|
||||
$chartData[$spentKey]['entries'][$key] ??= '0';
|
||||
$chartData[$spentKey]['entries'][$key] = bcadd($chartData[$spentKey]['entries'][$key], $amount);
|
||||
}
|
||||
}
|
||||
@@ -269,7 +269,7 @@ class BudgetReportController extends Controller
|
||||
foreach ($currency['budgets'] as $budget) {
|
||||
foreach ($budget['transaction_journals'] as $journal) {
|
||||
$title = sprintf('%s (%s)', $journal['source_account_name'], $currency['currency_name']);
|
||||
$result[$title] = $result[$title] ?? [
|
||||
$result[$title] ??= [
|
||||
'amount' => '0',
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_code' => $currency['currency_code'],
|
||||
|
@@ -235,7 +235,7 @@ class CategoryController extends Controller
|
||||
foreach ($outSet['transaction_journals'] as $journal) {
|
||||
$amount = app('steam')->positive($journal['amount']);
|
||||
$date = $journal['date']->isoFormat($format);
|
||||
$chartData[$outKey]['entries'][$date] = $chartData[$outKey]['entries'][$date] ?? '0';
|
||||
$chartData[$outKey]['entries'][$date] ??= '0';
|
||||
|
||||
$chartData[$outKey]['entries'][$date] = bcadd($amount, $chartData[$outKey]['entries'][$date]);
|
||||
}
|
||||
@@ -244,7 +244,7 @@ class CategoryController extends Controller
|
||||
foreach ($inSet['transaction_journals'] as $journal) {
|
||||
$amount = app('steam')->positive($journal['amount']);
|
||||
$date = $journal['date']->isoFormat($format);
|
||||
$chartData[$inKey]['entries'][$date] = $chartData[$inKey]['entries'][$date] ?? '0';
|
||||
$chartData[$inKey]['entries'][$date] ??= '0';
|
||||
$chartData[$inKey]['entries'][$date] = bcadd($amount, $chartData[$inKey]['entries'][$date]);
|
||||
}
|
||||
}
|
||||
|
@@ -86,7 +86,7 @@ class CategoryReportController extends Controller
|
||||
foreach ($category['transaction_journals'] as $journal) {
|
||||
$objectName = $journal['budget_name'] ?? trans('firefly.no_budget');
|
||||
$title = sprintf('%s (%s)', $objectName, $currency['currency_name']);
|
||||
$result[$title] = $result[$title] ?? [
|
||||
$result[$title] ??= [
|
||||
'amount' => '0',
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_code' => $currency['currency_code'],
|
||||
@@ -120,7 +120,7 @@ class CategoryReportController extends Controller
|
||||
/** @var array $category */
|
||||
foreach ($currency['categories'] as $category) {
|
||||
$title = sprintf('%s (%s)', $category['name'], $currency['currency_name']);
|
||||
$result[$title] = $result[$title] ?? [
|
||||
$result[$title] ??= [
|
||||
'amount' => '0',
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_code' => $currency['currency_code'],
|
||||
@@ -155,7 +155,7 @@ class CategoryReportController extends Controller
|
||||
/** @var array $category */
|
||||
foreach ($currency['categories'] as $category) {
|
||||
$title = sprintf('%s (%s)', $category['name'], $currency['currency_name']);
|
||||
$result[$title] = $result[$title] ?? [
|
||||
$result[$title] ??= [
|
||||
'amount' => '0',
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_code' => $currency['currency_code'],
|
||||
@@ -192,7 +192,7 @@ class CategoryReportController extends Controller
|
||||
foreach ($category['transaction_journals'] as $journal) {
|
||||
$objectName = $journal['destination_account_name'] ?? trans('firefly.empty');
|
||||
$title = sprintf('%s (%s)', $objectName, $currency['currency_name']);
|
||||
$result[$title] = $result[$title] ?? [
|
||||
$result[$title] ??= [
|
||||
'amount' => '0',
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_code' => $currency['currency_code'],
|
||||
@@ -228,7 +228,7 @@ class CategoryReportController extends Controller
|
||||
foreach ($category['transaction_journals'] as $journal) {
|
||||
$objectName = $journal['destination_account_name'] ?? trans('firefly.empty');
|
||||
$title = sprintf('%s (%s)', $objectName, $currency['currency_name']);
|
||||
$result[$title] = $result[$title] ?? [
|
||||
$result[$title] ??= [
|
||||
'amount' => '0',
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_code' => $currency['currency_code'],
|
||||
@@ -264,7 +264,7 @@ class CategoryReportController extends Controller
|
||||
foreach ($spent as $currency) {
|
||||
// add things to chart Data for each currency:
|
||||
$spentKey = sprintf('%d-spent', $currency['currency_id']);
|
||||
$chartData[$spentKey] = $chartData[$spentKey] ?? [
|
||||
$chartData[$spentKey] ??= [
|
||||
'label' => sprintf(
|
||||
'%s (%s)',
|
||||
(string)trans('firefly.spent_in_specific_category', ['category' => $category->name]),
|
||||
@@ -281,7 +281,7 @@ class CategoryReportController extends Controller
|
||||
foreach ($currentCategory['transaction_journals'] as $journal) {
|
||||
$key = $journal['date']->isoFormat($format);
|
||||
$amount = app('steam')->positive($journal['amount']);
|
||||
$chartData[$spentKey]['entries'][$key] = $chartData[$spentKey]['entries'][$key] ?? '0';
|
||||
$chartData[$spentKey]['entries'][$key] ??= '0';
|
||||
$chartData[$spentKey]['entries'][$key] = bcadd($chartData[$spentKey]['entries'][$key], $amount);
|
||||
}
|
||||
}
|
||||
@@ -291,7 +291,7 @@ class CategoryReportController extends Controller
|
||||
foreach ($earned as $currency) {
|
||||
// add things to chart Data for each currency:
|
||||
$spentKey = sprintf('%d-earned', $currency['currency_id']);
|
||||
$chartData[$spentKey] = $chartData[$spentKey] ?? [
|
||||
$chartData[$spentKey] ??= [
|
||||
'label' => sprintf(
|
||||
'%s (%s)',
|
||||
(string)trans('firefly.earned_in_specific_category', ['category' => $category->name]),
|
||||
@@ -308,7 +308,7 @@ class CategoryReportController extends Controller
|
||||
foreach ($currentCategory['transaction_journals'] as $journal) {
|
||||
$key = $journal['date']->isoFormat($format);
|
||||
$amount = app('steam')->positive($journal['amount']);
|
||||
$chartData[$spentKey]['entries'][$key] = $chartData[$spentKey]['entries'][$key] ?? '0';
|
||||
$chartData[$spentKey]['entries'][$key] ??= '0';
|
||||
$chartData[$spentKey]['entries'][$key] = bcadd($chartData[$spentKey]['entries'][$key], $amount);
|
||||
}
|
||||
}
|
||||
@@ -364,7 +364,7 @@ class CategoryReportController extends Controller
|
||||
foreach ($category['transaction_journals'] as $journal) {
|
||||
$objectName = $journal['source_account_name'] ?? trans('firefly.empty');
|
||||
$title = sprintf('%s (%s)', $objectName, $currency['currency_name']);
|
||||
$result[$title] = $result[$title] ?? [
|
||||
$result[$title] ??= [
|
||||
'amount' => '0',
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_code' => $currency['currency_code'],
|
||||
@@ -400,7 +400,7 @@ class CategoryReportController extends Controller
|
||||
foreach ($category['transaction_journals'] as $journal) {
|
||||
$objectName = $journal['source_account_name'] ?? trans('firefly.empty');
|
||||
$title = sprintf('%s (%s)', $objectName, $currency['currency_name']);
|
||||
$result[$title] = $result[$title] ?? [
|
||||
$result[$title] ??= [
|
||||
'amount' => '0',
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_code' => $currency['currency_code'],
|
||||
|
@@ -85,7 +85,7 @@ class DoubleReportController extends Controller
|
||||
foreach ($currency['transaction_journals'] as $journal) {
|
||||
$categoryName = $journal['budget_name'] ?? trans('firefly.no_budget');
|
||||
$title = sprintf('%s (%s)', $categoryName, $currency['currency_name']);
|
||||
$result[$title] = $result[$title] ?? [
|
||||
$result[$title] ??= [
|
||||
'amount' => '0',
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_code' => $currency['currency_code'],
|
||||
@@ -120,7 +120,7 @@ class DoubleReportController extends Controller
|
||||
foreach ($currency['transaction_journals'] as $journal) {
|
||||
$categoryName = $journal['category_name'] ?? trans('firefly.no_category');
|
||||
$title = sprintf('%s (%s)', $categoryName, $currency['currency_name']);
|
||||
$result[$title] = $result[$title] ?? [
|
||||
$result[$title] ??= [
|
||||
'amount' => '0',
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_code' => $currency['currency_code'],
|
||||
@@ -155,7 +155,7 @@ class DoubleReportController extends Controller
|
||||
foreach ($currency['transaction_journals'] as $journal) {
|
||||
$categoryName = $journal['category_name'] ?? trans('firefly.no_category');
|
||||
$title = sprintf('%s (%s)', $categoryName, $currency['currency_name']);
|
||||
$result[$title] = $result[$title] ?? [
|
||||
$result[$title] ??= [
|
||||
'amount' => '0',
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_code' => $currency['currency_code'],
|
||||
@@ -195,7 +195,7 @@ class DoubleReportController extends Controller
|
||||
$spentKey = sprintf('%d-spent', $currency['currency_id']);
|
||||
$name = $this->getCounterpartName($accounts, $account->id, $account->name, $account->iban);
|
||||
|
||||
$chartData[$spentKey] = $chartData[$spentKey] ?? [
|
||||
$chartData[$spentKey] ??= [
|
||||
'label' => sprintf(
|
||||
'%s (%s)',
|
||||
(string)trans('firefly.spent_in_specific_double', ['account' => $name]),
|
||||
@@ -211,7 +211,7 @@ class DoubleReportController extends Controller
|
||||
foreach ($currency['transaction_journals'] as $journal) {
|
||||
$key = $journal['date']->isoFormat($format);
|
||||
$amount = app('steam')->positive($journal['amount']);
|
||||
$chartData[$spentKey]['entries'][$key] = $chartData[$spentKey]['entries'][$key] ?? '0';
|
||||
$chartData[$spentKey]['entries'][$key] ??= '0';
|
||||
$chartData[$spentKey]['entries'][$key] = bcadd($chartData[$spentKey]['entries'][$key], $amount);
|
||||
}
|
||||
}
|
||||
@@ -221,7 +221,7 @@ class DoubleReportController extends Controller
|
||||
$earnedKey = sprintf('%d-earned', $currency['currency_id']);
|
||||
$name = $this->getCounterpartName($accounts, $account->id, $account->name, $account->iban);
|
||||
|
||||
$chartData[$earnedKey] = $chartData[$earnedKey] ?? [
|
||||
$chartData[$earnedKey] ??= [
|
||||
'label' => sprintf(
|
||||
'%s (%s)',
|
||||
(string)trans('firefly.earned_in_specific_double', ['account' => $name]),
|
||||
@@ -237,7 +237,7 @@ class DoubleReportController extends Controller
|
||||
foreach ($currency['transaction_journals'] as $journal) {
|
||||
$key = $journal['date']->isoFormat($format);
|
||||
$amount = app('steam')->positive($journal['amount']);
|
||||
$chartData[$earnedKey]['entries'][$key] = $chartData[$earnedKey]['entries'][$key] ?? '0';
|
||||
$chartData[$earnedKey]['entries'][$key] ??= '0';
|
||||
$chartData[$earnedKey]['entries'][$key] = bcadd($chartData[$earnedKey]['entries'][$key], $amount);
|
||||
}
|
||||
}
|
||||
@@ -323,7 +323,7 @@ class DoubleReportController extends Controller
|
||||
// do something
|
||||
$tagName = trans('firefly.no_tags');
|
||||
$title = sprintf('%s (%s)', $tagName, $currency['currency_name']);
|
||||
$result[$title] = $result[$title] ?? [
|
||||
$result[$title] ??= [
|
||||
'amount' => '0',
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_code' => $currency['currency_code'],
|
||||
@@ -341,7 +341,7 @@ class DoubleReportController extends Controller
|
||||
// do something
|
||||
$tagName = $tag['name'];
|
||||
$title = sprintf('%s (%s)', $tagName, $currency['currency_name']);
|
||||
$result[$title] = $result[$title] ?? [
|
||||
$result[$title] ??= [
|
||||
'amount' => '0',
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_code' => $currency['currency_code'],
|
||||
@@ -383,7 +383,7 @@ class DoubleReportController extends Controller
|
||||
// do something
|
||||
$tagName = trans('firefly.no_tags');
|
||||
$title = sprintf('%s (%s)', $tagName, $currency['currency_name']);
|
||||
$result[$title] = $result[$title] ?? [
|
||||
$result[$title] ??= [
|
||||
'amount' => '0',
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_code' => $currency['currency_code'],
|
||||
@@ -401,7 +401,7 @@ class DoubleReportController extends Controller
|
||||
// do something
|
||||
$tagName = $tag['name'];
|
||||
$title = sprintf('%s (%s)', $tagName, $currency['currency_name']);
|
||||
$result[$title] = $result[$title] ?? [
|
||||
$result[$title] ??= [
|
||||
'amount' => '0',
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_code' => $currency['currency_code'],
|
||||
|
@@ -166,8 +166,8 @@ class ExpenseReportController extends Controller
|
||||
$currentExpense = $expenses[$name] ?? '0';
|
||||
|
||||
// add to sum:
|
||||
$sumOfIncome[$exp->id] = $sumOfIncome[$exp->id] ?? '0';
|
||||
$sumOfExpense[$exp->id] = $sumOfExpense[$exp->id] ?? '0';
|
||||
$sumOfIncome[$exp->id] ??= '0';
|
||||
$sumOfExpense[$exp->id] ??= '0';
|
||||
$sumOfIncome[$exp->id] = bcadd($sumOfIncome[$exp->id], $currentIncome);
|
||||
$sumOfExpense[$exp->id] = bcadd($sumOfExpense[$exp->id], $currentExpense);
|
||||
|
||||
|
@@ -182,14 +182,14 @@ class ReportController extends Controller
|
||||
foreach ($journals as $journal) {
|
||||
$period = $journal['date']->format($format);
|
||||
$currencyId = (int)$journal['currency_id'];
|
||||
$data[$currencyId] = $data[$currencyId] ?? [
|
||||
$data[$currencyId] ??= [
|
||||
'currency_id' => $currencyId,
|
||||
'currency_symbol' => $journal['currency_symbol'],
|
||||
'currency_code' => $journal['currency_code'],
|
||||
'currency_name' => $journal['currency_name'],
|
||||
'currency_decimal_places' => (int)$journal['currency_decimal_places'],
|
||||
];
|
||||
$data[$currencyId][$period] = $data[$currencyId][$period] ?? [
|
||||
$data[$currencyId][$period] ??= [
|
||||
'period' => $period,
|
||||
'spent' => '0',
|
||||
'earned' => '0',
|
||||
|
@@ -87,7 +87,7 @@ class TagReportController extends Controller
|
||||
foreach ($tag['transaction_journals'] as $journal) {
|
||||
$objectName = $journal['budget_name'] ?? trans('firefly.no_budget');
|
||||
$title = sprintf('%s (%s)', $objectName, $currency['currency_name']);
|
||||
$result[$title] = $result[$title] ?? [
|
||||
$result[$title] ??= [
|
||||
'amount' => '0',
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_code' => $currency['currency_code'],
|
||||
@@ -123,7 +123,7 @@ class TagReportController extends Controller
|
||||
foreach ($tag['transaction_journals'] as $journal) {
|
||||
$objectName = $journal['category_name'] ?? trans('firefly.no_category');
|
||||
$title = sprintf('%s (%s)', $objectName, $currency['currency_name']);
|
||||
$result[$title] = $result[$title] ?? [
|
||||
$result[$title] ??= [
|
||||
'amount' => '0',
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_code' => $currency['currency_code'],
|
||||
@@ -159,7 +159,7 @@ class TagReportController extends Controller
|
||||
foreach ($tag['transaction_journals'] as $journal) {
|
||||
$objectName = $journal['category_name'] ?? trans('firefly.no_category');
|
||||
$title = sprintf('%s (%s)', $objectName, $currency['currency_name']);
|
||||
$result[$title] = $result[$title] ?? [
|
||||
$result[$title] ??= [
|
||||
'amount' => '0',
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_code' => $currency['currency_code'],
|
||||
@@ -195,7 +195,7 @@ class TagReportController extends Controller
|
||||
foreach ($tag['transaction_journals'] as $journal) {
|
||||
$objectName = $journal['destination_account_name'] ?? trans('firefly.empty');
|
||||
$title = sprintf('%s (%s)', $objectName, $currency['currency_name']);
|
||||
$result[$title] = $result[$title] ?? [
|
||||
$result[$title] ??= [
|
||||
'amount' => '0',
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_code' => $currency['currency_code'],
|
||||
@@ -231,7 +231,7 @@ class TagReportController extends Controller
|
||||
foreach ($tag['transaction_journals'] as $journal) {
|
||||
$objectName = $journal['destination_account_name'] ?? trans('firefly.empty');
|
||||
$title = sprintf('%s (%s)', $objectName, $currency['currency_name']);
|
||||
$result[$title] = $result[$title] ?? [
|
||||
$result[$title] ??= [
|
||||
'amount' => '0',
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_code' => $currency['currency_code'],
|
||||
@@ -269,7 +269,7 @@ class TagReportController extends Controller
|
||||
foreach ($spent as $currency) {
|
||||
// add things to chart Data for each currency:
|
||||
$spentKey = sprintf('%d-spent', $currency['currency_id']);
|
||||
$chartData[$spentKey] = $chartData[$spentKey] ?? [
|
||||
$chartData[$spentKey] ??= [
|
||||
'label' => sprintf(
|
||||
'%s (%s)',
|
||||
(string)trans('firefly.spent_in_specific_tag', ['tag' => $tag->tag]),
|
||||
@@ -286,7 +286,7 @@ class TagReportController extends Controller
|
||||
foreach ($currentTag['transaction_journals'] as $journal) {
|
||||
$key = $journal['date']->isoFormat($format);
|
||||
$amount = app('steam')->positive($journal['amount']);
|
||||
$chartData[$spentKey]['entries'][$key] = $chartData[$spentKey]['entries'][$key] ?? '0';
|
||||
$chartData[$spentKey]['entries'][$key] ??= '0';
|
||||
$chartData[$spentKey]['entries'][$key] = bcadd($chartData[$spentKey]['entries'][$key], $amount);
|
||||
}
|
||||
}
|
||||
@@ -296,7 +296,7 @@ class TagReportController extends Controller
|
||||
foreach ($earned as $currency) {
|
||||
// add things to chart Data for each currency:
|
||||
$spentKey = sprintf('%d-earned', $currency['currency_id']);
|
||||
$chartData[$spentKey] = $chartData[$spentKey] ?? [
|
||||
$chartData[$spentKey] ??= [
|
||||
'label' => sprintf(
|
||||
'%s (%s)',
|
||||
(string)trans('firefly.earned_in_specific_tag', ['tag' => $tag->tag]),
|
||||
@@ -313,7 +313,7 @@ class TagReportController extends Controller
|
||||
foreach ($currentTag['transaction_journals'] as $journal) {
|
||||
$key = $journal['date']->isoFormat($format);
|
||||
$amount = app('steam')->positive($journal['amount']);
|
||||
$chartData[$spentKey]['entries'][$key] = $chartData[$spentKey]['entries'][$key] ?? '0';
|
||||
$chartData[$spentKey]['entries'][$key] ??= '0';
|
||||
$chartData[$spentKey]['entries'][$key] = bcadd($chartData[$spentKey]['entries'][$key], $amount);
|
||||
}
|
||||
}
|
||||
@@ -369,7 +369,7 @@ class TagReportController extends Controller
|
||||
foreach ($tag['transaction_journals'] as $journal) {
|
||||
$objectName = $journal['source_account_name'] ?? trans('firefly.empty');
|
||||
$title = sprintf('%s (%s)', $objectName, $currency['currency_name']);
|
||||
$result[$title] = $result[$title] ?? [
|
||||
$result[$title] ??= [
|
||||
'amount' => '0',
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_code' => $currency['currency_code'],
|
||||
@@ -405,7 +405,7 @@ class TagReportController extends Controller
|
||||
foreach ($tag['transaction_journals'] as $journal) {
|
||||
$objectName = $journal['source_account_name'] ?? trans('firefly.empty');
|
||||
$title = sprintf('%s (%s)', $objectName, $currency['currency_name']);
|
||||
$result[$title] = $result[$title] ?? [
|
||||
$result[$title] ??= [
|
||||
'amount' => '0',
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_code' => $currency['currency_code'],
|
||||
@@ -439,7 +439,7 @@ class TagReportController extends Controller
|
||||
/** @var array $tag */
|
||||
foreach ($currency['tags'] as $tag) {
|
||||
$title = sprintf('%s (%s)', $tag['name'], $currency['currency_name']);
|
||||
$result[$title] = $result[$title] ?? [
|
||||
$result[$title] ??= [
|
||||
'amount' => '0',
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_code' => $currency['currency_code'],
|
||||
@@ -473,7 +473,7 @@ class TagReportController extends Controller
|
||||
/** @var array $tag */
|
||||
foreach ($currency['tags'] as $tag) {
|
||||
$title = sprintf('%s (%s)', $tag['name'], $currency['currency_name']);
|
||||
$result[$title] = $result[$title] ?? [
|
||||
$result[$title] ??= [
|
||||
'amount' => '0',
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_code' => $currency['currency_code'],
|
||||
|
@@ -78,7 +78,7 @@ class TransactionController extends Controller
|
||||
foreach ($result as $journal) {
|
||||
$budget = $journal['budget_name'] ?? (string)trans('firefly.no_budget');
|
||||
$title = sprintf('%s (%s)', $budget, $journal['currency_symbol']);
|
||||
$data[$title] = $data[$title] ?? [
|
||||
$data[$title] ??= [
|
||||
'amount' => '0',
|
||||
'currency_symbol' => $journal['currency_symbol'],
|
||||
'currency_code' => $journal['currency_code'],
|
||||
@@ -131,7 +131,7 @@ class TransactionController extends Controller
|
||||
foreach ($result as $journal) {
|
||||
$category = $journal['category_name'] ?? (string)trans('firefly.no_category');
|
||||
$title = sprintf('%s (%s)', $category, $journal['currency_symbol']);
|
||||
$data[$title] = $data[$title] ?? [
|
||||
$data[$title] ??= [
|
||||
'amount' => '0',
|
||||
'currency_symbol' => $journal['currency_symbol'],
|
||||
'currency_code' => $journal['currency_code'],
|
||||
@@ -184,7 +184,7 @@ class TransactionController extends Controller
|
||||
foreach ($result as $journal) {
|
||||
$name = $journal['destination_account_name'];
|
||||
$title = sprintf('%s (%s)', $name, $journal['currency_symbol']);
|
||||
$data[$title] = $data[$title] ?? [
|
||||
$data[$title] ??= [
|
||||
'amount' => '0',
|
||||
'currency_symbol' => $journal['currency_symbol'],
|
||||
'currency_code' => $journal['currency_code'],
|
||||
@@ -237,7 +237,7 @@ class TransactionController extends Controller
|
||||
foreach ($result as $journal) {
|
||||
$name = $journal['source_account_name'];
|
||||
$title = sprintf('%s (%s)', $name, $journal['currency_symbol']);
|
||||
$data[$title] = $data[$title] ?? [
|
||||
$data[$title] ??= [
|
||||
'amount' => '0',
|
||||
'currency_symbol' => $journal['currency_symbol'],
|
||||
'currency_code' => $journal['currency_code'],
|
||||
|
@@ -179,9 +179,9 @@ class BoxController extends Controller
|
||||
foreach ($set as $journal) {
|
||||
$currencyId = (int)$journal['currency_id'];
|
||||
$amount = $journal['amount'] ?? '0';
|
||||
$incomes[$currencyId] = $incomes[$currencyId] ?? '0';
|
||||
$incomes[$currencyId] ??= '0';
|
||||
$incomes[$currencyId] = bcadd($incomes[$currencyId], app('steam')->positive($amount));
|
||||
$sums[$currencyId] = $sums[$currencyId] ?? '0';
|
||||
$sums[$currencyId] ??= '0';
|
||||
$sums[$currencyId] = bcadd($sums[$currencyId], app('steam')->positive($amount));
|
||||
}
|
||||
|
||||
@@ -194,9 +194,9 @@ class BoxController extends Controller
|
||||
/** @var array $journal */
|
||||
foreach ($set as $journal) {
|
||||
$currencyId = (int)$journal['currency_id'];
|
||||
$expenses[$currencyId] = $expenses[$currencyId] ?? '0';
|
||||
$expenses[$currencyId] ??= '0';
|
||||
$expenses[$currencyId] = bcadd($expenses[$currencyId], $journal['amount'] ?? '0');
|
||||
$sums[$currencyId] = $sums[$currencyId] ?? '0';
|
||||
$sums[$currencyId] ??= '0';
|
||||
$sums[$currencyId] = bcadd($sums[$currencyId], $journal['amount']);
|
||||
}
|
||||
|
||||
|
@@ -46,7 +46,7 @@ class IntroController extends Controller
|
||||
public function getIntroSteps(string $route, string $specificPage = null): JsonResponse
|
||||
{
|
||||
app('log')->debug(sprintf('getIntroSteps for route "%s" and page "%s"', $route, $specificPage));
|
||||
$specificPage = $specificPage ?? '';
|
||||
$specificPage ??= '';
|
||||
$steps = $this->getBasicSteps($route);
|
||||
$specificSteps = $this->getSpecificSteps($route, $specificPage);
|
||||
if (0 === count($specificSteps)) {
|
||||
@@ -106,7 +106,7 @@ class IntroController extends Controller
|
||||
*/
|
||||
public function postEnable(string $route, string $specialPage = null): JsonResponse
|
||||
{
|
||||
$specialPage = $specialPage ?? '';
|
||||
$specialPage ??= '';
|
||||
$route = str_replace('.', '_', $route);
|
||||
$key = 'shown_demo_' . $route;
|
||||
if ('' !== $specialPage) {
|
||||
@@ -130,7 +130,7 @@ class IntroController extends Controller
|
||||
*/
|
||||
public function postFinished(string $route, string $specialPage = null): JsonResponse
|
||||
{
|
||||
$specialPage = $specialPage ?? '';
|
||||
$specialPage ??= '';
|
||||
$key = 'shown_demo_' . $route;
|
||||
if ('' !== $specialPage) {
|
||||
$key .= '_' . $specialPage;
|
||||
|
@@ -106,7 +106,7 @@ class IndexController extends Controller
|
||||
$array = $transformer->transform($piggy);
|
||||
$groupOrder = (int)$array['object_group_order'];
|
||||
// make group array if necessary:
|
||||
$piggyBanks[$groupOrder] = $piggyBanks[$groupOrder] ?? [
|
||||
$piggyBanks[$groupOrder] ??= [
|
||||
'object_group_id' => $array['object_group_id'] ?? 0,
|
||||
'object_group_title' => $array['object_group_title'] ?? trans('firefly.default_group_title_name'),
|
||||
'piggy_banks' => [],
|
||||
@@ -154,7 +154,7 @@ class IndexController extends Controller
|
||||
$groupId = $group['object_group_id'];
|
||||
foreach ($group['piggy_banks'] as $piggy) {
|
||||
$currencyId = $piggy['currency_id'];
|
||||
$sums[$groupId][$currencyId] = $sums[$groupId][$currencyId] ?? [
|
||||
$sums[$groupId][$currencyId] ??= [
|
||||
'target' => '0',
|
||||
'saved' => '0',
|
||||
'left_to_save' => '0',
|
||||
|
@@ -104,7 +104,7 @@ class BalanceController extends Controller
|
||||
foreach ($journals as $journal) {
|
||||
$sourceAccount = $journal['source_account_id'];
|
||||
$currencyId = $journal['currency_id'];
|
||||
$spent[$sourceAccount] = $spent[$sourceAccount] ?? [
|
||||
$spent[$sourceAccount] ??= [
|
||||
'source_account_id' => $sourceAccount,
|
||||
'currency_id' => $journal['currency_id'],
|
||||
'currency_code' => $journal['currency_code'],
|
||||
@@ -116,7 +116,7 @@ class BalanceController extends Controller
|
||||
$spent[$sourceAccount]['spent'] = bcadd($spent[$sourceAccount]['spent'], $journal['amount']);
|
||||
|
||||
// also fix sum:
|
||||
$report['sums'][$budgetId][$currencyId] = $report['sums'][$budgetId][$currencyId] ?? [
|
||||
$report['sums'][$budgetId][$currencyId] ??= [
|
||||
'sum' => '0',
|
||||
'currency_id' => $journal['currency_id'],
|
||||
'currency_code' => $journal['currency_code'],
|
||||
|
@@ -109,7 +109,7 @@ class BudgetController extends Controller
|
||||
/** @var Account $account */
|
||||
foreach ($accounts as $account) {
|
||||
$accountId = $account->id;
|
||||
$report[$accountId] = $report[$accountId] ?? [
|
||||
$report[$accountId] ??= [
|
||||
'name' => $account->name,
|
||||
'id' => $account->id,
|
||||
'iban' => $account->iban,
|
||||
@@ -120,7 +120,7 @@ class BudgetController extends Controller
|
||||
// loop expenses.
|
||||
foreach ($spent as $currency) {
|
||||
$currencyId = $currency['currency_id'];
|
||||
$sums[$currencyId] = $sums[$currencyId] ?? [
|
||||
$sums[$currencyId] ??= [
|
||||
'currency_id' => $currency['currency_id'],
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_name' => $currency['currency_name'],
|
||||
@@ -130,7 +130,7 @@ class BudgetController extends Controller
|
||||
foreach ($currency['budgets'] as $budget) {
|
||||
foreach ($budget['transaction_journals'] as $journal) {
|
||||
$sourceAccountId = $journal['source_account_id'];
|
||||
$report[$sourceAccountId]['currencies'][$currencyId] = $report[$sourceAccountId]['currencies'][$currencyId] ?? [
|
||||
$report[$sourceAccountId]['currencies'][$currencyId] ??= [
|
||||
'currency_id' => $currency['currency_id'],
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_name' => $currency['currency_name'],
|
||||
@@ -167,7 +167,7 @@ class BudgetController extends Controller
|
||||
foreach ($budget['transaction_journals'] as $journal) {
|
||||
$destinationId = $journal['destination_account_id'];
|
||||
$key = sprintf('%d-%d', $destinationId, $currency['currency_id']);
|
||||
$result[$key] = $result[$key] ?? [
|
||||
$result[$key] ??= [
|
||||
'transactions' => 0,
|
||||
'sum' => '0',
|
||||
'avg' => '0',
|
||||
@@ -219,7 +219,7 @@ class BudgetController extends Controller
|
||||
/** @var Budget $budget */
|
||||
foreach ($budgets as $budget) {
|
||||
$budgetId = $budget->id;
|
||||
$report[$budgetId] = $report[$budgetId] ?? [
|
||||
$report[$budgetId] ??= [
|
||||
'name' => $budget->name,
|
||||
'id' => $budget->id,
|
||||
'currencies' => [],
|
||||
@@ -227,7 +227,7 @@ class BudgetController extends Controller
|
||||
}
|
||||
foreach ($spent as $currency) {
|
||||
$currencyId = $currency['currency_id'];
|
||||
$sums[$currencyId] = $sums[$currencyId] ?? [
|
||||
$sums[$currencyId] ??= [
|
||||
'currency_id' => $currency['currency_id'],
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_name' => $currency['currency_name'],
|
||||
@@ -240,7 +240,7 @@ class BudgetController extends Controller
|
||||
|
||||
foreach ($budget['transaction_journals'] as $journal) {
|
||||
// add currency info to report array:
|
||||
$report[$budgetId]['currencies'][$currencyId] = $report[$budgetId]['currencies'][$currencyId] ?? [
|
||||
$report[$budgetId]['currencies'][$currencyId] ??= [
|
||||
'sum' => '0',
|
||||
'sum_pct' => '0',
|
||||
'currency_id' => $currency['currency_id'],
|
||||
@@ -332,7 +332,7 @@ class BudgetController extends Controller
|
||||
$count++;
|
||||
$key = sprintf('%d-%d', $budget['id'], $currency['currency_id']);
|
||||
$dateKey = $journal['date']->format($keyFormat);
|
||||
$report[$key] = $report[$key] ?? [
|
||||
$report[$key] ??= [
|
||||
'id' => $budget['id'],
|
||||
'name' => sprintf('%s (%s)', $budget['name'], $currency['currency_name']),
|
||||
'sum' => '0',
|
||||
@@ -343,7 +343,7 @@ class BudgetController extends Controller
|
||||
'currency_decimal_places' => $currency['currency_decimal_places'],
|
||||
'entries' => [],
|
||||
];
|
||||
$report[$key]['entries'][$dateKey] = $report[$key] ['entries'][$dateKey] ?? '0';
|
||||
$report[$key]['entries'][$dateKey] ??= '0';
|
||||
$report[$key]['entries'][$dateKey] = bcadd($journal['amount'], $report[$key] ['entries'][$dateKey]);
|
||||
$report[$key]['sum'] = bcadd($report[$key] ['sum'], $journal['amount']);
|
||||
$report[$key]['avg'] = bcdiv($report[$key]['sum'], (string)count($periods));
|
||||
|
@@ -82,7 +82,7 @@ class CategoryController extends Controller
|
||||
/** @var Account $account */
|
||||
foreach ($accounts as $account) {
|
||||
$accountId = $account->id;
|
||||
$report[$accountId] = $report[$accountId] ?? [
|
||||
$report[$accountId] ??= [
|
||||
'name' => $account->name,
|
||||
'id' => $account->id,
|
||||
'iban' => $account->iban,
|
||||
@@ -98,7 +98,7 @@ class CategoryController extends Controller
|
||||
foreach ($currency['categories'] as $category) {
|
||||
foreach ($category['transaction_journals'] as $journal) {
|
||||
$sourceAccountId = $journal['source_account_id'];
|
||||
$report[$sourceAccountId]['currencies'][$currencyId] = $report[$sourceAccountId]['currencies'][$currencyId] ?? [
|
||||
$report[$sourceAccountId]['currencies'][$currencyId] ??= [
|
||||
'currency_id' => $currency['currency_id'],
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_name' => $currency['currency_name'],
|
||||
@@ -107,8 +107,8 @@ class CategoryController extends Controller
|
||||
];
|
||||
|
||||
$report[$sourceAccountId]['currencies'][$currencyId]['categories'][$category['id']]
|
||||
= $report[$sourceAccountId]['currencies'][$currencyId]['categories'][$category['id']]
|
||||
??
|
||||
??=
|
||||
|
||||
[
|
||||
'spent' => '0',
|
||||
'earned' => '0',
|
||||
@@ -134,8 +134,8 @@ class CategoryController extends Controller
|
||||
foreach ($category['transaction_journals'] as $journal) {
|
||||
$destinationId = $journal['destination_account_id'];
|
||||
$report[$destinationId]['currencies'][$currencyId]
|
||||
= $report[$destinationId]['currencies'][$currencyId]
|
||||
?? [
|
||||
??=
|
||||
[
|
||||
'currency_id' => $currency['currency_id'],
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_name' => $currency['currency_name'],
|
||||
@@ -143,8 +143,8 @@ class CategoryController extends Controller
|
||||
'categories' => [],
|
||||
];
|
||||
$report[$destinationId]['currencies'][$currencyId]['categories'][$category['id']]
|
||||
= $report[$destinationId]['currencies'][$currencyId]['categories'][$category['id']]
|
||||
??
|
||||
??=
|
||||
|
||||
[
|
||||
'spent' => '0',
|
||||
'earned' => '0',
|
||||
@@ -182,7 +182,7 @@ class CategoryController extends Controller
|
||||
/** @var Account $account */
|
||||
foreach ($accounts as $account) {
|
||||
$accountId = $account->id;
|
||||
$report[$accountId] = $report[$accountId] ?? [
|
||||
$report[$accountId] ??= [
|
||||
'name' => $account->name,
|
||||
'id' => $account->id,
|
||||
'iban' => $account->iban,
|
||||
@@ -193,7 +193,7 @@ class CategoryController extends Controller
|
||||
// loop expenses.
|
||||
foreach ($spent as $currency) {
|
||||
$currencyId = $currency['currency_id'];
|
||||
$sums[$currencyId] = $sums[$currencyId] ?? [
|
||||
$sums[$currencyId] ??= [
|
||||
'currency_id' => $currency['currency_id'],
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_name' => $currency['currency_name'],
|
||||
@@ -205,7 +205,7 @@ class CategoryController extends Controller
|
||||
foreach ($currency['categories'] as $category) {
|
||||
foreach ($category['transaction_journals'] as $journal) {
|
||||
$sourceAccountId = $journal['source_account_id'];
|
||||
$report[$sourceAccountId]['currencies'][$currencyId] = $report[$sourceAccountId]['currencies'][$currencyId] ?? [
|
||||
$report[$sourceAccountId]['currencies'][$currencyId] ??= [
|
||||
'currency_id' => $currency['currency_id'],
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_name' => $currency['currency_name'],
|
||||
@@ -231,7 +231,7 @@ class CategoryController extends Controller
|
||||
// loop income.
|
||||
foreach ($earned as $currency) {
|
||||
$currencyId = $currency['currency_id'];
|
||||
$sums[$currencyId] = $sums[$currencyId] ?? [
|
||||
$sums[$currencyId] ??= [
|
||||
'currency_id' => $currency['currency_id'],
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_name' => $currency['currency_name'],
|
||||
@@ -243,7 +243,7 @@ class CategoryController extends Controller
|
||||
foreach ($currency['categories'] as $category) {
|
||||
foreach ($category['transaction_journals'] as $journal) {
|
||||
$destinationAccountId = $journal['destination_account_id'];
|
||||
$report[$destinationAccountId]['currencies'][$currencyId] = $report[$destinationAccountId]['currencies'][$currencyId] ?? [
|
||||
$report[$destinationAccountId]['currencies'][$currencyId] ??= [
|
||||
'currency_id' => $currency['currency_id'],
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_name' => $currency['currency_name'],
|
||||
@@ -287,7 +287,7 @@ class CategoryController extends Controller
|
||||
foreach ($category['transaction_journals'] as $journal) {
|
||||
$destinationId = $journal['destination_account_id'];
|
||||
$key = sprintf('%d-%d', $destinationId, $currency['currency_id']);
|
||||
$result[$key] = $result[$key] ?? [
|
||||
$result[$key] ??= [
|
||||
'transactions' => 0,
|
||||
'sum' => '0',
|
||||
'avg' => '0',
|
||||
@@ -340,7 +340,7 @@ class CategoryController extends Controller
|
||||
foreach ($category['transaction_journals'] as $journal) {
|
||||
$sourceId = $journal['source_account_id'];
|
||||
$key = sprintf('%d-%d', $sourceId, $currency['currency_id']);
|
||||
$result[$key] = $result[$key] ?? [
|
||||
$result[$key] ??= [
|
||||
'transactions' => 0,
|
||||
'sum' => '0',
|
||||
'avg' => '0',
|
||||
@@ -392,7 +392,7 @@ class CategoryController extends Controller
|
||||
/** @var Category $category */
|
||||
foreach ($categories as $category) {
|
||||
$categoryId = $category->id;
|
||||
$report[$categoryId] = $report[$categoryId] ?? [
|
||||
$report[$categoryId] ??= [
|
||||
'name' => $category->name,
|
||||
'id' => $category->id,
|
||||
'currencies' => [],
|
||||
@@ -400,7 +400,7 @@ class CategoryController extends Controller
|
||||
}
|
||||
foreach ($spent as $currency) {
|
||||
$currencyId = $currency['currency_id'];
|
||||
$sums[$currencyId] = $sums[$currencyId] ?? [
|
||||
$sums[$currencyId] ??= [
|
||||
'currency_id' => $currency['currency_id'],
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_name' => $currency['currency_name'],
|
||||
@@ -415,7 +415,7 @@ class CategoryController extends Controller
|
||||
|
||||
foreach ($category['transaction_journals'] as $journal) {
|
||||
// add currency info to report array:
|
||||
$report[$categoryId]['currencies'][$currencyId] = $report[$categoryId]['currencies'][$currencyId] ?? [
|
||||
$report[$categoryId]['currencies'][$currencyId] ??= [
|
||||
'spent' => '0',
|
||||
'earned' => '0',
|
||||
'sum' => '0',
|
||||
@@ -441,7 +441,7 @@ class CategoryController extends Controller
|
||||
|
||||
foreach ($earned as $currency) {
|
||||
$currencyId = $currency['currency_id'];
|
||||
$sums[$currencyId] = $sums[$currencyId] ?? [
|
||||
$sums[$currencyId] ??= [
|
||||
'currency_id' => $currency['currency_id'],
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_name' => $currency['currency_name'],
|
||||
@@ -456,7 +456,7 @@ class CategoryController extends Controller
|
||||
|
||||
foreach ($category['transaction_journals'] as $journal) {
|
||||
// add currency info to report array:
|
||||
$report[$categoryId]['currencies'][$currencyId] = $report[$categoryId]['currencies'][$currencyId] ?? [
|
||||
$report[$categoryId]['currencies'][$currencyId] ??= [
|
||||
'spent' => '0',
|
||||
'earned' => '0',
|
||||
'sum' => '0',
|
||||
@@ -523,7 +523,7 @@ class CategoryController extends Controller
|
||||
foreach ($set as $currencyId => $currencyRow) {
|
||||
foreach ($currencyRow['categories'] as $categoryId => $categoryRow) {
|
||||
$key = sprintf('%d-%d', $currencyId, $categoryId);
|
||||
$data[$key] = $data[$key] ?? [
|
||||
$data[$key] ??= [
|
||||
'id' => $categoryRow['id'],
|
||||
'title' => sprintf('%s (%s)', $categoryRow['name'], $currencyRow['currency_name']),
|
||||
'currency_id' => $currencyRow['currency_id'],
|
||||
@@ -537,7 +537,7 @@ class CategoryController extends Controller
|
||||
];
|
||||
foreach ($categoryRow['transaction_journals'] as $journal) {
|
||||
$date = $journal['date']->format($format);
|
||||
$data[$key]['entries'][$date] = $data[$key]['entries'][$date] ?? '0';
|
||||
$data[$key]['entries'][$date] ??= '0';
|
||||
$data[$key]['entries'][$date] = bcadd($data[$key]['entries'][$date], $journal['amount']);
|
||||
$data[$key]['sum'] = bcadd($data[$key]['sum'], $journal['amount']);
|
||||
}
|
||||
@@ -604,7 +604,7 @@ class CategoryController extends Controller
|
||||
foreach ($set as $currencyId => $currencyRow) {
|
||||
foreach ($currencyRow['categories'] as $categoryId => $categoryRow) {
|
||||
$key = sprintf('%d-%d', $currencyId, $categoryId);
|
||||
$data[$key] = $data[$key] ?? [
|
||||
$data[$key] ??= [
|
||||
'id' => $categoryRow['id'],
|
||||
'title' => sprintf('%s (%s)', $categoryRow['name'], $currencyRow['currency_name']),
|
||||
'currency_id' => $currencyRow['currency_id'],
|
||||
@@ -618,7 +618,7 @@ class CategoryController extends Controller
|
||||
];
|
||||
foreach ($categoryRow['transaction_journals'] as $journal) {
|
||||
$date = $journal['date']->format($format);
|
||||
$data[$key]['entries'][$date] = $data[$key]['entries'][$date] ?? '0';
|
||||
$data[$key]['entries'][$date] ??= '0';
|
||||
$data[$key]['entries'][$date] = bcadd($data[$key]['entries'][$date], $journal['amount']);
|
||||
$data[$key]['sum'] = bcadd($data[$key]['sum'], $journal['amount']);
|
||||
}
|
||||
|
@@ -88,7 +88,7 @@ class DoubleController extends Controller
|
||||
foreach ($currency['transaction_journals'] as $journal) {
|
||||
$sourceId = $journal['source_account_id'];
|
||||
$key = sprintf('%d-%d', $sourceId, $currency['currency_id']);
|
||||
$result[$key] = $result[$key] ?? [
|
||||
$result[$key] ??= [
|
||||
'transactions' => 0,
|
||||
'sum' => '0',
|
||||
'avg' => '0',
|
||||
@@ -141,7 +141,7 @@ class DoubleController extends Controller
|
||||
foreach ($currency['transaction_journals'] as $journal) {
|
||||
$destinationId = $journal['destination_account_id'];
|
||||
$key = sprintf('%d-%d', $destinationId, $currency['currency_id']);
|
||||
$result[$key] = $result[$key] ?? [
|
||||
$result[$key] ??= [
|
||||
'transactions' => 0,
|
||||
'sum' => '0',
|
||||
'avg' => '0',
|
||||
@@ -198,7 +198,7 @@ class DoubleController extends Controller
|
||||
foreach ($spent as $currency) {
|
||||
$currencyId = $currency['currency_id'];
|
||||
|
||||
$sums[$currencyId] = $sums[$currencyId] ?? [
|
||||
$sums[$currencyId] ??= [
|
||||
'spent' => '0',
|
||||
'earned' => '0',
|
||||
'sum' => '0',
|
||||
@@ -216,7 +216,7 @@ class DoubleController extends Controller
|
||||
$destIban = $journal['destination_account_iban'];
|
||||
$genericName = $this->getCounterpartName($withCounterpart, $destId, $destName, $destIban);
|
||||
$objectName = sprintf('%s (%s)', $genericName, $currency['currency_name']);
|
||||
$report[$objectName] = $report[$objectName] ?? [
|
||||
$report[$objectName] ??= [
|
||||
'dest_name' => '',
|
||||
'dest_iban' => '',
|
||||
'source_name' => '',
|
||||
@@ -246,7 +246,7 @@ class DoubleController extends Controller
|
||||
foreach ($earned as $currency) {
|
||||
$currencyId = $currency['currency_id'];
|
||||
|
||||
$sums[$currencyId] = $sums[$currencyId] ?? [
|
||||
$sums[$currencyId] ??= [
|
||||
'spent' => '0',
|
||||
'earned' => '0',
|
||||
'sum' => '0',
|
||||
@@ -264,7 +264,7 @@ class DoubleController extends Controller
|
||||
$sourceIban = $journal['source_account_iban'];
|
||||
$genericName = $this->getCounterpartName($withCounterpart, $sourceId, $sourceName, $sourceIban);
|
||||
$objectName = sprintf('%s (%s)', $genericName, $currency['currency_name']);
|
||||
$report[$objectName] = $report[$objectName] ?? [
|
||||
$report[$objectName] ??= [
|
||||
'dest_name' => '',
|
||||
'dest_iban' => '',
|
||||
'source_name' => '',
|
||||
@@ -342,7 +342,7 @@ class DoubleController extends Controller
|
||||
foreach ($spent as $currency) {
|
||||
$currencyId = $currency['currency_id'];
|
||||
|
||||
$sums[$currencyId] = $sums[$currencyId] ?? [
|
||||
$sums[$currencyId] ??= [
|
||||
'spent' => '0',
|
||||
'earned' => '0',
|
||||
'sum' => '0',
|
||||
@@ -356,7 +356,7 @@ class DoubleController extends Controller
|
||||
/** @var array $journal */
|
||||
foreach ($currency['transaction_journals'] as $journal) {
|
||||
$objectName = sprintf('%s (%s)', $journal['source_account_name'], $currency['currency_name']);
|
||||
$report[$objectName] = $report[$objectName] ?? [
|
||||
$report[$objectName] ??= [
|
||||
'account_id' => $journal['source_account_id'],
|
||||
'account_name' => $objectName,
|
||||
'currency_id' => $currency['currency_id'],
|
||||
@@ -381,7 +381,7 @@ class DoubleController extends Controller
|
||||
foreach ($earned as $currency) {
|
||||
$currencyId = $currency['currency_id'];
|
||||
|
||||
$sums[$currencyId] = $sums[$currencyId] ?? [
|
||||
$sums[$currencyId] ??= [
|
||||
'spent' => '0',
|
||||
'earned' => '0',
|
||||
'sum' => '0',
|
||||
@@ -395,7 +395,7 @@ class DoubleController extends Controller
|
||||
/** @var array $journal */
|
||||
foreach ($currency['transaction_journals'] as $journal) {
|
||||
$objectName = sprintf('%s (%s)', $journal['destination_account_name'], $currency['currency_name']);
|
||||
$report[$objectName] = $report[$objectName] ?? [
|
||||
$report[$objectName] ??= [
|
||||
'account_id' => $journal['destination_account_id'],
|
||||
'account_name' => $objectName,
|
||||
'currency_id' => $currency['currency_id'],
|
||||
|
@@ -162,7 +162,7 @@ class OperationsController extends Controller
|
||||
/** @var int $currencyId */
|
||||
foreach ($keys as $currencyId) {
|
||||
$currencyInfo = $incomes['sums'][$currencyId] ?? $expenses['sums'][$currencyId];
|
||||
$sums[$currencyId] = $sums[$currencyId] ?? [
|
||||
$sums[$currencyId] ??= [
|
||||
'currency_id' => $currencyId,
|
||||
'currency_name' => $currencyInfo['currency_name'],
|
||||
'currency_code' => $currencyInfo['currency_code'],
|
||||
|
@@ -75,7 +75,7 @@ class TagController extends Controller
|
||||
/** @var Account $account */
|
||||
foreach ($accounts as $account) {
|
||||
$accountId = $account->id;
|
||||
$report[$accountId] = $report[$accountId] ?? [
|
||||
$report[$accountId] ??= [
|
||||
'name' => $account->name,
|
||||
'id' => $account->id,
|
||||
'iban' => $account->iban,
|
||||
@@ -91,7 +91,7 @@ class TagController extends Controller
|
||||
foreach ($currency['tags'] as $tag) {
|
||||
foreach ($tag['transaction_journals'] as $journal) {
|
||||
$sourceAccountId = $journal['source_account_id'];
|
||||
$report[$sourceAccountId]['currencies'][$currencyId] = $report[$sourceAccountId]['currencies'][$currencyId] ?? [
|
||||
$report[$sourceAccountId]['currencies'][$currencyId] ??= [
|
||||
'currency_id' => $currency['currency_id'],
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_name' => $currency['currency_name'],
|
||||
@@ -100,8 +100,8 @@ class TagController extends Controller
|
||||
];
|
||||
|
||||
$report[$sourceAccountId]['currencies'][$currencyId]['tags'][$tag['id']]
|
||||
= $report[$sourceAccountId]['currencies'][$currencyId]['tags'][$tag['id']]
|
||||
??
|
||||
??=
|
||||
|
||||
[
|
||||
'spent' => '0',
|
||||
'earned' => '0',
|
||||
@@ -127,8 +127,8 @@ class TagController extends Controller
|
||||
foreach ($tag['transaction_journals'] as $journal) {
|
||||
$destinationId = $journal['destination_account_id'];
|
||||
$report[$destinationId]['currencies'][$currencyId]
|
||||
= $report[$destinationId]['currencies'][$currencyId]
|
||||
?? [
|
||||
??=
|
||||
[
|
||||
'currency_id' => $currency['currency_id'],
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_name' => $currency['currency_name'],
|
||||
@@ -136,8 +136,8 @@ class TagController extends Controller
|
||||
'tags' => [],
|
||||
];
|
||||
$report[$destinationId]['currencies'][$currencyId]['tags'][$tag['id']]
|
||||
= $report[$destinationId]['currencies'][$currencyId]['tags'][$tag['id']]
|
||||
??
|
||||
??=
|
||||
|
||||
[
|
||||
'spent' => '0',
|
||||
'earned' => '0',
|
||||
@@ -175,7 +175,7 @@ class TagController extends Controller
|
||||
/** @var Account $account */
|
||||
foreach ($accounts as $account) {
|
||||
$accountId = $account->id;
|
||||
$report[$accountId] = $report[$accountId] ?? [
|
||||
$report[$accountId] ??= [
|
||||
'name' => $account->name,
|
||||
'id' => $account->id,
|
||||
'iban' => $account->iban,
|
||||
@@ -186,7 +186,7 @@ class TagController extends Controller
|
||||
// loop expenses.
|
||||
foreach ($spent as $currency) {
|
||||
$currencyId = $currency['currency_id'];
|
||||
$sums[$currencyId] = $sums[$currencyId] ?? [
|
||||
$sums[$currencyId] ??= [
|
||||
'currency_id' => $currency['currency_id'],
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_name' => $currency['currency_name'],
|
||||
@@ -198,7 +198,7 @@ class TagController extends Controller
|
||||
foreach ($currency['tags'] as $tag) {
|
||||
foreach ($tag['transaction_journals'] as $journal) {
|
||||
$sourceAccountId = $journal['source_account_id'];
|
||||
$report[$sourceAccountId]['currencies'][$currencyId] = $report[$sourceAccountId]['currencies'][$currencyId] ?? [
|
||||
$report[$sourceAccountId]['currencies'][$currencyId] ??= [
|
||||
'currency_id' => $currency['currency_id'],
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_name' => $currency['currency_name'],
|
||||
@@ -224,7 +224,7 @@ class TagController extends Controller
|
||||
// loop income.
|
||||
foreach ($earned as $currency) {
|
||||
$currencyId = $currency['currency_id'];
|
||||
$sums[$currencyId] = $sums[$currencyId] ?? [
|
||||
$sums[$currencyId] ??= [
|
||||
'currency_id' => $currency['currency_id'],
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_name' => $currency['currency_name'],
|
||||
@@ -236,7 +236,7 @@ class TagController extends Controller
|
||||
foreach ($currency['tags'] as $tag) {
|
||||
foreach ($tag['transaction_journals'] as $journal) {
|
||||
$destinationAccountId = $journal['destination_account_id'];
|
||||
$report[$destinationAccountId]['currencies'][$currencyId] = $report[$destinationAccountId]['currencies'][$currencyId] ?? [
|
||||
$report[$destinationAccountId]['currencies'][$currencyId] ??= [
|
||||
'currency_id' => $currency['currency_id'],
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_name' => $currency['currency_name'],
|
||||
@@ -280,7 +280,7 @@ class TagController extends Controller
|
||||
foreach ($tag['transaction_journals'] as $journal) {
|
||||
$destinationId = $journal['destination_account_id'];
|
||||
$key = sprintf('%d-%d', $destinationId, $currency['currency_id']);
|
||||
$result[$key] = $result[$key] ?? [
|
||||
$result[$key] ??= [
|
||||
'transactions' => 0,
|
||||
'sum' => '0',
|
||||
'avg' => '0',
|
||||
@@ -333,7 +333,7 @@ class TagController extends Controller
|
||||
foreach ($tag['transaction_journals'] as $journal) {
|
||||
$sourceId = $journal['source_account_id'];
|
||||
$key = sprintf('%d-%d', $sourceId, $currency['currency_id']);
|
||||
$result[$key] = $result[$key] ?? [
|
||||
$result[$key] ??= [
|
||||
'transactions' => 0,
|
||||
'sum' => '0',
|
||||
'avg' => '0',
|
||||
@@ -385,7 +385,7 @@ class TagController extends Controller
|
||||
/** @var Tag $tag */
|
||||
foreach ($tags as $tag) {
|
||||
$tagId = $tag->id;
|
||||
$report[$tagId] = $report[$tagId] ?? [
|
||||
$report[$tagId] ??= [
|
||||
'name' => $tag->tag,
|
||||
'id' => $tag->id,
|
||||
'currencies' => [],
|
||||
@@ -393,7 +393,7 @@ class TagController extends Controller
|
||||
}
|
||||
foreach ($spent as $currency) {
|
||||
$currencyId = $currency['currency_id'];
|
||||
$sums[$currencyId] = $sums[$currencyId] ?? [
|
||||
$sums[$currencyId] ??= [
|
||||
'currency_id' => $currency['currency_id'],
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_name' => $currency['currency_name'],
|
||||
@@ -408,7 +408,7 @@ class TagController extends Controller
|
||||
|
||||
foreach ($tag['transaction_journals'] as $journal) {
|
||||
// add currency info to report array:
|
||||
$report[$tagId]['currencies'][$currencyId] = $report[$tagId]['currencies'][$currencyId] ?? [
|
||||
$report[$tagId]['currencies'][$currencyId] ??= [
|
||||
'spent' => '0',
|
||||
'earned' => '0',
|
||||
'sum' => '0',
|
||||
@@ -434,7 +434,7 @@ class TagController extends Controller
|
||||
|
||||
foreach ($earned as $currency) {
|
||||
$currencyId = $currency['currency_id'];
|
||||
$sums[$currencyId] = $sums[$currencyId] ?? [
|
||||
$sums[$currencyId] ??= [
|
||||
'currency_id' => $currency['currency_id'],
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_name' => $currency['currency_name'],
|
||||
@@ -449,7 +449,7 @@ class TagController extends Controller
|
||||
|
||||
foreach ($tag['transaction_journals'] as $journal) {
|
||||
// add currency info to report array:
|
||||
$report[$tagId]['currencies'][$currencyId] = $report[$tagId]['currencies'][$currencyId] ?? [
|
||||
$report[$tagId]['currencies'][$currencyId] ??= [
|
||||
'spent' => '0',
|
||||
'earned' => '0',
|
||||
'sum' => '0',
|
||||
|
@@ -100,7 +100,7 @@ class CreateController extends Controller
|
||||
session()->flash('warning', trans('firefly.rule_from_search_words', ['string' => $words]));
|
||||
$operators[] = [
|
||||
'type' => 'description_contains',
|
||||
'value' => $words
|
||||
'value' => $words,
|
||||
];
|
||||
}
|
||||
$oldTriggers = $this->parseFromOperators($operators);
|
||||
|
@@ -243,8 +243,8 @@ class TagController extends Controller
|
||||
$subTitleIcon = 'fa-tag';
|
||||
$page = (int)$request->get('page');
|
||||
$pageSize = (int)app('preferences')->get('listPageSize', 50)->data;
|
||||
$start = $start ?? session('start');
|
||||
$end = $end ?? session('end');
|
||||
$start ??= session('start');
|
||||
$end ??= session('end');
|
||||
$location = $this->repository->getLocation($tag);
|
||||
$attachments = $this->repository->getAttachments($tag);
|
||||
$subTitle = trans(
|
||||
@@ -257,7 +257,7 @@ class TagController extends Controller
|
||||
);
|
||||
|
||||
$startPeriod = $this->repository->firstUseDate($tag);
|
||||
$startPeriod = $startPeriod ?? today(config('app.timezone'));
|
||||
$startPeriod ??= today(config('app.timezone'));
|
||||
$endPeriod = clone $end;
|
||||
$periods = $this->getTagPeriodOverview($tag, $startPeriod, $endPeriod);
|
||||
$path = route('tags.show', [$tag->id, $start->format('Y-m-d'), $end->format('Y-m-d')]);
|
||||
|
@@ -71,7 +71,7 @@ class AccountTasker implements AccountTaskerInterface
|
||||
foreach ($accounts as $account) {
|
||||
$id = $account->id;
|
||||
$currency = $repository->getAccountCurrency($account) ?? $defaultCurrency;
|
||||
$return['sums'][$currency->id] = $return['sums'][$currency->id] ?? [
|
||||
$return['sums'][$currency->id] ??= [
|
||||
'start' => '0',
|
||||
'end' => '0',
|
||||
'difference' => '0',
|
||||
@@ -174,8 +174,8 @@ class AccountTasker implements AccountTaskerInterface
|
||||
$sourceId = (int)$journal['destination_account_id'];
|
||||
$currencyId = (int)$journal['currency_id'];
|
||||
$key = sprintf('%s-%s', $sourceId, $currencyId);
|
||||
$currencies[$currencyId] = $currencies[$currencyId] ?? $currencyRepos->find($currencyId);
|
||||
$report['accounts'][$key] = $report['accounts'][$key] ?? [
|
||||
$currencies[$currencyId] ??= $currencyRepos->find($currencyId);
|
||||
$report['accounts'][$key] ??= [
|
||||
'id' => $sourceId,
|
||||
'name' => $journal['destination_account_name'],
|
||||
'sum' => '0',
|
||||
@@ -200,7 +200,7 @@ class AccountTasker implements AccountTaskerInterface
|
||||
$report['accounts'][$key]['average'] = bcdiv($report['accounts'][$key]['sum'], (string)$report['accounts'][$key]['count']);
|
||||
}
|
||||
$currencyId = $report['accounts'][$key]['currency_id'];
|
||||
$report['sums'][$currencyId] = $report['sums'][$currencyId] ?? [
|
||||
$report['sums'][$currencyId] ??= [
|
||||
'sum' => '0',
|
||||
'currency_id' => $report['accounts'][$key]['currency_id'],
|
||||
'currency_name' => $report['accounts'][$key]['currency_name'],
|
||||
@@ -272,7 +272,7 @@ class AccountTasker implements AccountTaskerInterface
|
||||
$currencyId = (int)$journal['currency_id'];
|
||||
$key = sprintf('%s-%s', $sourceId, $currencyId);
|
||||
if (!array_key_exists($key, $report['accounts'])) {
|
||||
$currencies[$currencyId] = $currencies[$currencyId] ?? $currencyRepos->find($currencyId);
|
||||
$currencies[$currencyId] ??= $currencyRepos->find($currencyId);
|
||||
$report['accounts'][$key] = [
|
||||
'id' => $sourceId,
|
||||
'name' => $journal['source_account_name'],
|
||||
@@ -296,7 +296,7 @@ class AccountTasker implements AccountTaskerInterface
|
||||
$report['accounts'][$key]['average'] = bcdiv($report['accounts'][$key]['sum'], (string)$report['accounts'][$key]['count']);
|
||||
}
|
||||
$currencyId = $report['accounts'][$key]['currency_id'];
|
||||
$report['sums'][$currencyId] = $report['sums'][$currencyId] ?? [
|
||||
$report['sums'][$currencyId] ??= [
|
||||
'sum' => '0',
|
||||
'currency_id' => $report['accounts'][$key]['currency_id'],
|
||||
'currency_name' => $report['accounts'][$key]['currency_name'],
|
||||
|
@@ -100,7 +100,7 @@ class OperationsRepository implements OperationsRepositoryInterface
|
||||
foreach ($journals as $journal) {
|
||||
$currencyId = (int)$journal['currency_id'];
|
||||
$journalId = (int)$journal['transaction_journal_id'];
|
||||
$array[$currencyId] = $array[$currencyId] ?? [
|
||||
$array[$currencyId] ??= [
|
||||
|
||||
'currency_id' => $journal['currency_id'],
|
||||
'currency_name' => $journal['currency_name'],
|
||||
@@ -264,7 +264,7 @@ class OperationsRepository implements OperationsRepositoryInterface
|
||||
|
||||
foreach ($journals as $journal) {
|
||||
$currencyId = (int)$journal['currency_id'];
|
||||
$array[$currencyId] = $array[$currencyId] ?? [
|
||||
$array[$currencyId] ??= [
|
||||
'sum' => '0',
|
||||
'currency_id' => $currencyId,
|
||||
'currency_name' => $journal['currency_name'],
|
||||
@@ -277,7 +277,7 @@ class OperationsRepository implements OperationsRepositoryInterface
|
||||
// also do foreign amount:
|
||||
$foreignId = (int)$journal['foreign_currency_id'];
|
||||
if (0 !== $foreignId) {
|
||||
$array[$foreignId] = $array[$foreignId] ?? [
|
||||
$array[$foreignId] ??= [
|
||||
'sum' => '0',
|
||||
'currency_id' => $foreignId,
|
||||
'currency_name' => $journal['foreign_currency_name'],
|
||||
@@ -324,7 +324,7 @@ class OperationsRepository implements OperationsRepositoryInterface
|
||||
|
||||
foreach ($journals as $journal) {
|
||||
$key = sprintf('%s-%s', $journal[$idKey], $journal['currency_id']);
|
||||
$array[$key] = $array[$key] ?? [
|
||||
$array[$key] ??= [
|
||||
'id' => $journal[$idKey],
|
||||
'name' => $journal[$nameKey],
|
||||
'sum' => '0',
|
||||
@@ -339,7 +339,7 @@ class OperationsRepository implements OperationsRepositoryInterface
|
||||
// also do foreign amount:
|
||||
if (0 !== (int)$journal['foreign_currency_id']) {
|
||||
$key = sprintf('%s-%s', $journal[$idKey], $journal['foreign_currency_id']);
|
||||
$array[$key] = $array[$key] ?? [
|
||||
$array[$key] ??= [
|
||||
'id' => $journal[$idKey],
|
||||
'name' => $journal[$nameKey],
|
||||
'sum' => '0',
|
||||
@@ -473,7 +473,7 @@ class OperationsRepository implements OperationsRepositoryInterface
|
||||
$amount = app('steam')->positive($journal['amount']);
|
||||
|
||||
// source first
|
||||
$return[$sourceKey] = $return[$sourceKey] ?? [
|
||||
$return[$sourceKey] ??= [
|
||||
'id' => (string)$sourceId,
|
||||
'name' => $journal['source_account_name'],
|
||||
'difference' => '0',
|
||||
@@ -487,7 +487,7 @@ class OperationsRepository implements OperationsRepositoryInterface
|
||||
];
|
||||
|
||||
// dest next:
|
||||
$return[$destKey] = $return[$destKey] ?? [
|
||||
$return[$destKey] ??= [
|
||||
'id' => (string)$destinationId,
|
||||
'name' => $journal['destination_account_name'],
|
||||
'difference' => '0',
|
||||
@@ -517,7 +517,7 @@ class OperationsRepository implements OperationsRepositoryInterface
|
||||
|
||||
// same as above:
|
||||
// source first
|
||||
$return[$sourceKey] = $return[$sourceKey] ?? [
|
||||
$return[$sourceKey] ??= [
|
||||
'id' => (string)$sourceId,
|
||||
'name' => $journal['source_account_name'],
|
||||
'difference' => '0',
|
||||
@@ -531,7 +531,7 @@ class OperationsRepository implements OperationsRepositoryInterface
|
||||
];
|
||||
|
||||
// dest next:
|
||||
$return[$destKey] = $return[$destKey] ?? [
|
||||
$return[$destKey] ??= [
|
||||
'id' => (string)$destinationId,
|
||||
'name' => $journal['destination_account_name'],
|
||||
'difference' => '0',
|
||||
|
@@ -311,7 +311,7 @@ class BillRepository implements BillRepositoryInterface
|
||||
$transaction = $journal->transactions()->where('amount', '<', 0)->first();
|
||||
$currencyId = (int)$journal->transaction_currency_id;
|
||||
$currency = $journal->transactionCurrency;
|
||||
$result[$currencyId] = $result[$currencyId] ?? [
|
||||
$result[$currencyId] ??= [
|
||||
'sum' => '0',
|
||||
'count' => 0,
|
||||
'avg' => '0',
|
||||
@@ -416,7 +416,7 @@ class BillRepository implements BillRepositoryInterface
|
||||
$array = [];
|
||||
/** @var Rule $rule */
|
||||
foreach ($rules as $rule) {
|
||||
$array[$rule->action_value] = $array[$rule->action_value] ?? [];
|
||||
$array[$rule->action_value] ??= [];
|
||||
$array[$rule->action_value][] = ['id' => $rule->id, 'title' => $rule->title, 'active' => $rule->active];
|
||||
}
|
||||
$return = [];
|
||||
@@ -456,7 +456,7 @@ class BillRepository implements BillRepositoryInterface
|
||||
}
|
||||
$currencyId = (int)$journal->transaction_currency_id;
|
||||
$currency = $journal->transactionCurrency;
|
||||
$result[$currencyId] = $result[$currencyId] ?? [
|
||||
$result[$currencyId] ??= [
|
||||
'sum' => '0',
|
||||
'count' => 0,
|
||||
'avg' => '0',
|
||||
@@ -619,7 +619,7 @@ class BillRepository implements BillRepositoryInterface
|
||||
$set = $bill->transactionJournals()->after($start)->before($end)->get(['transaction_journals.*']);
|
||||
$currency = $bill->transactionCurrency;
|
||||
|
||||
$return[$currency->id] = $return[$currency->id] ?? [
|
||||
$return[$currency->id] ??= [
|
||||
'id' => (string)$currency->id,
|
||||
'name' => $currency->name,
|
||||
'symbol' => $currency->symbol,
|
||||
@@ -676,7 +676,7 @@ class BillRepository implements BillRepositoryInterface
|
||||
if ($total > 0) {
|
||||
$currency = $bill->transactionCurrency;
|
||||
$average = bcdiv(bcadd($bill->amount_max, $bill->amount_min), '2');
|
||||
$return[$currency->id] = $return[$currency->id] ?? [
|
||||
$return[$currency->id] ??= [
|
||||
'id' => (string)$currency->id,
|
||||
'name' => $currency->name,
|
||||
'symbol' => $currency->symbol,
|
||||
|
@@ -104,7 +104,7 @@ class BudgetRepository implements BudgetRepositoryInterface
|
||||
foreach ($limits as $limit) {
|
||||
app('log')->debug(sprintf('Budget limit #%d', $limit->id));
|
||||
$currency = $limit->transactionCurrency;
|
||||
$return[$currency->id] = $return[$currency->id] ?? [
|
||||
$return[$currency->id] ??= [
|
||||
'id' => (string)$currency->id,
|
||||
'name' => $currency->name,
|
||||
'symbol' => $currency->symbol,
|
||||
@@ -220,7 +220,7 @@ class BudgetRepository implements BudgetRepositoryInterface
|
||||
foreach ($limits as $limit) {
|
||||
app('log')->debug(sprintf('Budget limit #%d', $limit->id));
|
||||
$currency = $limit->transactionCurrency;
|
||||
$return[$currency->id] = $return[$currency->id] ?? [
|
||||
$return[$currency->id] ??= [
|
||||
'id' => (string)$currency->id,
|
||||
'name' => $currency->name,
|
||||
'symbol' => $currency->symbol,
|
||||
@@ -694,7 +694,7 @@ class BudgetRepository implements BudgetRepositoryInterface
|
||||
|
||||
foreach ($journals as $journal) {
|
||||
$currencyId = (int)$journal['currency_id'];
|
||||
$array[$currencyId] = $array[$currencyId] ?? [
|
||||
$array[$currencyId] ??= [
|
||||
'id' => (string)$currencyId,
|
||||
'name' => $journal['currency_name'],
|
||||
'symbol' => $journal['currency_symbol'],
|
||||
@@ -707,7 +707,7 @@ class BudgetRepository implements BudgetRepositoryInterface
|
||||
// also do foreign amount:
|
||||
$foreignId = (int)$journal['foreign_currency_id'];
|
||||
if (0 !== $foreignId) {
|
||||
$array[$foreignId] = $array[$foreignId] ?? [
|
||||
$array[$foreignId] ??= [
|
||||
'id' => (string)$foreignId,
|
||||
'name' => $journal['foreign_currency_name'],
|
||||
'symbol' => $journal['foreign_currency_symbol'],
|
||||
@@ -757,7 +757,7 @@ class BudgetRepository implements BudgetRepositoryInterface
|
||||
|
||||
foreach ($journals as $journal) {
|
||||
$currencyId = (int)$journal['currency_id'];
|
||||
$array[$currencyId] = $array[$currencyId] ?? [
|
||||
$array[$currencyId] ??= [
|
||||
'id' => (string)$currencyId,
|
||||
'name' => $journal['currency_name'],
|
||||
'symbol' => $journal['currency_symbol'],
|
||||
@@ -770,7 +770,7 @@ class BudgetRepository implements BudgetRepositoryInterface
|
||||
// also do foreign amount:
|
||||
$foreignId = (int)$journal['foreign_currency_id'];
|
||||
if (0 !== $foreignId) {
|
||||
$array[$foreignId] = $array[$foreignId] ?? [
|
||||
$array[$foreignId] ??= [
|
||||
'id' => (string)$foreignId,
|
||||
'name' => $journal['foreign_currency_name'],
|
||||
'symbol' => $journal['foreign_currency_symbol'],
|
||||
|
@@ -64,7 +64,7 @@ class NoBudgetRepository implements NoBudgetRepositoryInterface
|
||||
foreach ($journals as $journal) {
|
||||
$currencyId = (int)$journal['currency_id'];
|
||||
|
||||
$data[$currencyId] = $data[$currencyId] ?? [
|
||||
$data[$currencyId] ??= [
|
||||
'id' => 0,
|
||||
'name' => sprintf('%s (%s)', trans('firefly.no_budget'), $journal['currency_name']),
|
||||
'sum' => '0',
|
||||
@@ -178,7 +178,7 @@ class NoBudgetRepository implements NoBudgetRepositoryInterface
|
||||
|
||||
foreach ($journals as $journal) {
|
||||
$currencyId = (int)$journal['currency_id'];
|
||||
$array[$currencyId] = $array[$currencyId] ?? [
|
||||
$array[$currencyId] ??= [
|
||||
'sum' => '0',
|
||||
'currency_id' => $currencyId,
|
||||
'currency_name' => $journal['currency_name'],
|
||||
|
@@ -105,7 +105,7 @@ class OperationsRepository implements OperationsRepositoryInterface
|
||||
$currencyId = (int)$journal['currency_id'];
|
||||
$key = sprintf('%d-%d', $budgetId, $currencyId);
|
||||
|
||||
$data[$key] = $data[$key] ?? [
|
||||
$data[$key] ??= [
|
||||
'id' => $budgetId,
|
||||
'name' => sprintf('%s (%s)', $budgetName, $journal['currency_name']),
|
||||
'sum' => '0',
|
||||
@@ -164,7 +164,7 @@ class OperationsRepository implements OperationsRepositoryInterface
|
||||
}
|
||||
|
||||
// info about the currency:
|
||||
$array[$currencyId] = $array[$currencyId] ?? [
|
||||
$array[$currencyId] ??= [
|
||||
'budgets' => [],
|
||||
'currency_id' => $currencyId,
|
||||
'currency_name' => $journal['currency_name'],
|
||||
@@ -174,7 +174,7 @@ class OperationsRepository implements OperationsRepositoryInterface
|
||||
];
|
||||
|
||||
// info about the categories:
|
||||
$array[$currencyId]['budgets'][$budgetId] = $array[$currencyId]['budgets'][$budgetId] ?? [
|
||||
$array[$currencyId]['budgets'][$budgetId] ??= [
|
||||
'id' => $budgetId,
|
||||
'name' => $budgetName,
|
||||
'transaction_journals' => [],
|
||||
@@ -298,7 +298,7 @@ class OperationsRepository implements OperationsRepositoryInterface
|
||||
|
||||
foreach ($journals as $journal) {
|
||||
$currencyId = (int)$journal['currency_id'];
|
||||
$array[$currencyId] = $array[$currencyId] ?? [
|
||||
$array[$currencyId] ??= [
|
||||
'sum' => '0',
|
||||
'currency_id' => $currencyId,
|
||||
'currency_name' => $journal['currency_name'],
|
||||
@@ -311,7 +311,7 @@ class OperationsRepository implements OperationsRepositoryInterface
|
||||
// also do foreign amount:
|
||||
$foreignId = (int)$journal['foreign_currency_id'];
|
||||
if (0 !== $foreignId) {
|
||||
$array[$foreignId] = $array[$foreignId] ?? [
|
||||
$array[$foreignId] ??= [
|
||||
'sum' => '0',
|
||||
'currency_id' => $foreignId,
|
||||
'currency_name' => $journal['foreign_currency_name'],
|
||||
|
@@ -62,7 +62,7 @@ class NoCategoryRepository implements NoCategoryRepositoryInterface
|
||||
|
||||
foreach ($journals as $journal) {
|
||||
$currencyId = (int)$journal['currency_id'];
|
||||
$array[$currencyId] = $array[$currencyId] ?? [
|
||||
$array[$currencyId] ??= [
|
||||
'categories' => [],
|
||||
'currency_id' => $currencyId,
|
||||
'currency_name' => $journal['currency_name'],
|
||||
@@ -71,7 +71,7 @@ class NoCategoryRepository implements NoCategoryRepositoryInterface
|
||||
'currency_decimal_places' => $journal['currency_decimal_places'],
|
||||
];
|
||||
// info about the non-existent category:
|
||||
$array[$currencyId]['categories'][0] = $array[$currencyId]['categories'][0] ?? [
|
||||
$array[$currencyId]['categories'][0] ??= [
|
||||
'id' => 0,
|
||||
'name' => (string)trans('firefly.noCategory'),
|
||||
'transaction_journals' => [],
|
||||
@@ -124,7 +124,7 @@ class NoCategoryRepository implements NoCategoryRepositoryInterface
|
||||
|
||||
foreach ($journals as $journal) {
|
||||
$currencyId = (int)$journal['currency_id'];
|
||||
$array[$currencyId] = $array[$currencyId] ?? [
|
||||
$array[$currencyId] ??= [
|
||||
'categories' => [],
|
||||
'currency_id' => $currencyId,
|
||||
'currency_name' => $journal['currency_name'],
|
||||
@@ -134,7 +134,7 @@ class NoCategoryRepository implements NoCategoryRepositoryInterface
|
||||
];
|
||||
|
||||
// info about the non-existent category:
|
||||
$array[$currencyId]['categories'][0] = $array[$currencyId]['categories'][0] ?? [
|
||||
$array[$currencyId]['categories'][0] ??= [
|
||||
'id' => 0,
|
||||
'name' => (string)trans('firefly.noCategory'),
|
||||
'transaction_journals' => [],
|
||||
@@ -175,7 +175,7 @@ class NoCategoryRepository implements NoCategoryRepositoryInterface
|
||||
|
||||
foreach ($journals as $journal) {
|
||||
$currencyId = (int)$journal['currency_id'];
|
||||
$array[$currencyId] = $array[$currencyId] ?? [
|
||||
$array[$currencyId] ??= [
|
||||
'sum' => '0',
|
||||
'currency_id' => $currencyId,
|
||||
'currency_name' => $journal['currency_name'],
|
||||
@@ -212,7 +212,7 @@ class NoCategoryRepository implements NoCategoryRepositoryInterface
|
||||
|
||||
foreach ($journals as $journal) {
|
||||
$currencyId = (int)$journal['currency_id'];
|
||||
$array[$currencyId] = $array[$currencyId] ?? [
|
||||
$array[$currencyId] ??= [
|
||||
'sum' => '0',
|
||||
'currency_id' => $currencyId,
|
||||
'currency_name' => $journal['currency_name'],
|
||||
@@ -243,7 +243,7 @@ class NoCategoryRepository implements NoCategoryRepositoryInterface
|
||||
|
||||
foreach ($journals as $journal) {
|
||||
$currencyId = (int)$journal['currency_id'];
|
||||
$array[$currencyId] = $array[$currencyId] ?? [
|
||||
$array[$currencyId] ??= [
|
||||
'sum' => '0',
|
||||
'currency_id' => $currencyId,
|
||||
'currency_name' => $journal['currency_name'],
|
||||
|
@@ -81,7 +81,7 @@ class OperationsRepository implements OperationsRepositoryInterface
|
||||
}
|
||||
|
||||
// info about the currency:
|
||||
$array[$currencyId] = $array[$currencyId] ?? [
|
||||
$array[$currencyId] ??= [
|
||||
'categories' => [],
|
||||
'currency_id' => (string)$currencyId,
|
||||
'currency_name' => $journal['currency_name'],
|
||||
@@ -91,7 +91,7 @@ class OperationsRepository implements OperationsRepositoryInterface
|
||||
];
|
||||
|
||||
// info about the categories:
|
||||
$array[$currencyId]['categories'][$categoryId] = $array[$currencyId]['categories'][$categoryId] ?? [
|
||||
$array[$currencyId]['categories'][$categoryId] ??= [
|
||||
'id' => (string)$categoryId,
|
||||
'name' => $categoryName,
|
||||
'transaction_journals' => [],
|
||||
@@ -177,7 +177,7 @@ class OperationsRepository implements OperationsRepositoryInterface
|
||||
}
|
||||
|
||||
// info about the currency:
|
||||
$array[$currencyId] = $array[$currencyId] ?? [
|
||||
$array[$currencyId] ??= [
|
||||
'categories' => [],
|
||||
'currency_id' => (string)$currencyId,
|
||||
'currency_name' => $journal['currency_name'],
|
||||
@@ -187,7 +187,7 @@ class OperationsRepository implements OperationsRepositoryInterface
|
||||
];
|
||||
|
||||
// info about the categories:
|
||||
$array[$currencyId]['categories'][$categoryId] = $array[$currencyId]['categories'][$categoryId] ?? [
|
||||
$array[$currencyId]['categories'][$categoryId] ??= [
|
||||
'id' => (string)$categoryId,
|
||||
'name' => $categoryName,
|
||||
'transaction_journals' => [],
|
||||
@@ -241,7 +241,7 @@ class OperationsRepository implements OperationsRepositoryInterface
|
||||
}
|
||||
|
||||
// info about the currency:
|
||||
$array[$currencyId] = $array[$currencyId] ?? [
|
||||
$array[$currencyId] ??= [
|
||||
'categories' => [],
|
||||
'currency_id' => (string)$currencyId,
|
||||
'currency_name' => $journal['currency_name'],
|
||||
@@ -251,7 +251,7 @@ class OperationsRepository implements OperationsRepositoryInterface
|
||||
];
|
||||
|
||||
// info about the categories:
|
||||
$array[$currencyId]['categories'][$categoryId] = $array[$currencyId]['categories'][$categoryId] ?? [
|
||||
$array[$currencyId]['categories'][$categoryId] ??= [
|
||||
'id' => (string)$categoryId,
|
||||
'name' => $categoryName,
|
||||
'transaction_journals' => [],
|
||||
@@ -306,7 +306,7 @@ class OperationsRepository implements OperationsRepositoryInterface
|
||||
}
|
||||
|
||||
// info about the currency:
|
||||
$array[$currencyId] = $array[$currencyId] ?? [
|
||||
$array[$currencyId] ??= [
|
||||
'categories' => [],
|
||||
'currency_id' => (string)$currencyId,
|
||||
'currency_name' => $journal['currency_name'],
|
||||
@@ -316,7 +316,7 @@ class OperationsRepository implements OperationsRepositoryInterface
|
||||
];
|
||||
|
||||
// info about the categories:
|
||||
$array[$currencyId]['categories'][$categoryId] = $array[$currencyId]['categories'][$categoryId] ?? [
|
||||
$array[$currencyId]['categories'][$categoryId] ??= [
|
||||
'id' => (string)$categoryId,
|
||||
'name' => $categoryName,
|
||||
'transaction_journals' => [],
|
||||
@@ -371,7 +371,7 @@ class OperationsRepository implements OperationsRepositoryInterface
|
||||
|
||||
foreach ($journals as $journal) {
|
||||
$currencyId = (int)$journal['currency_id'];
|
||||
$array[$currencyId] = $array[$currencyId] ?? [
|
||||
$array[$currencyId] ??= [
|
||||
'sum' => '0',
|
||||
'currency_id' => (string)$currencyId,
|
||||
'currency_name' => $journal['currency_name'],
|
||||
@@ -414,7 +414,7 @@ class OperationsRepository implements OperationsRepositoryInterface
|
||||
|
||||
foreach ($journals as $journal) {
|
||||
$currencyId = (int)$journal['currency_id'];
|
||||
$array[$currencyId] = $array[$currencyId] ?? [
|
||||
$array[$currencyId] ??= [
|
||||
'sum' => '0',
|
||||
'currency_id' => (string)$currencyId,
|
||||
'currency_name' => $journal['currency_name'],
|
||||
@@ -457,7 +457,7 @@ class OperationsRepository implements OperationsRepositoryInterface
|
||||
|
||||
foreach ($journals as $journal) {
|
||||
$currencyId = (int)$journal['currency_id'];
|
||||
$array[$currencyId] = $array[$currencyId] ?? [
|
||||
$array[$currencyId] ??= [
|
||||
'sum' => '0',
|
||||
'currency_id' => (string)$currencyId,
|
||||
'currency_name' => $journal['currency_name'],
|
||||
|
@@ -76,7 +76,7 @@ class OperationsRepository implements OperationsRepositoryInterface
|
||||
$listedJournals = [];
|
||||
foreach ($journals as $journal) {
|
||||
$currencyId = (int)$journal['currency_id'];
|
||||
$array[$currencyId] = $array[$currencyId] ?? [
|
||||
$array[$currencyId] ??= [
|
||||
'tags' => [],
|
||||
'currency_id' => $currencyId,
|
||||
'currency_name' => $journal['currency_name'],
|
||||
@@ -95,7 +95,7 @@ class OperationsRepository implements OperationsRepositoryInterface
|
||||
continue;
|
||||
}
|
||||
$listedJournals[] = $journalId;
|
||||
$array[$currencyId]['tags'][$tagId] = $array[$currencyId]['tags'][$tagId] ?? [
|
||||
$array[$currencyId]['tags'][$tagId] ??= [
|
||||
'id' => $tagId,
|
||||
'name' => $tagName,
|
||||
'transaction_journals' => [],
|
||||
@@ -176,7 +176,7 @@ class OperationsRepository implements OperationsRepositoryInterface
|
||||
|
||||
foreach ($journals as $journal) {
|
||||
$currencyId = (int)$journal['currency_id'];
|
||||
$array[$currencyId] = $array[$currencyId] ?? [
|
||||
$array[$currencyId] ??= [
|
||||
'tags' => [],
|
||||
'currency_id' => $currencyId,
|
||||
'currency_name' => $journal['currency_name'],
|
||||
@@ -196,7 +196,7 @@ class OperationsRepository implements OperationsRepositoryInterface
|
||||
}
|
||||
$listedJournals[] = $journalId;
|
||||
|
||||
$array[$currencyId]['tags'][$tagId] = $array[$currencyId]['tags'][$tagId] ?? [
|
||||
$array[$currencyId]['tags'][$tagId] ??= [
|
||||
'id' => $tagId,
|
||||
'name' => $tagName,
|
||||
'transaction_journals' => [],
|
||||
|
@@ -329,7 +329,7 @@ class TagRepository implements TagRepositoryInterface
|
||||
/** @var array $journal */
|
||||
foreach ($journals as $journal) {
|
||||
$currencyId = (int)$journal['currency_id'];
|
||||
$sums[$currencyId] = $sums[$currencyId] ?? [
|
||||
$sums[$currencyId] ??= [
|
||||
'currency_id' => $currencyId,
|
||||
'currency_name' => $journal['currency_name'],
|
||||
'currency_symbol' => $journal['currency_symbol'],
|
||||
@@ -351,7 +351,7 @@ class TagRepository implements TagRepositoryInterface
|
||||
|
||||
$foreignCurrencyId = $journal['foreign_currency_id'];
|
||||
if (null !== $foreignCurrencyId && 0 !== $foreignCurrencyId) {
|
||||
$sums[$foreignCurrencyId] = $sums[$foreignCurrencyId] ?? [
|
||||
$sums[$foreignCurrencyId] ??= [
|
||||
'currency_id' => $foreignCurrencyId,
|
||||
'currency_name' => $journal['foreign_currency_name'],
|
||||
'currency_symbol' => $journal['foreign_currency_symbol'],
|
||||
|
@@ -176,7 +176,7 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface
|
||||
/** @var Attachment $attachment */
|
||||
foreach ($set as $attachment) {
|
||||
$journalId = $attachment->attachable_id;
|
||||
$result[$journalId] = $result[$journalId] ?? [];
|
||||
$result[$journalId] ??= [];
|
||||
$current = $attachment->toArray();
|
||||
$current['file_exists'] = true;
|
||||
$current['notes'] = $repository->getNoteText($attachment);
|
||||
@@ -241,7 +241,7 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface
|
||||
/** @var TransactionJournalLink $entry */
|
||||
foreach ($set as $entry) {
|
||||
$journalId = in_array($entry->source_id, $journals, true) ? $entry->source_id : $entry->destination_id;
|
||||
$return[$journalId] = $return[$journalId] ?? [];
|
||||
$return[$journalId] ??= [];
|
||||
|
||||
// phpstan: the editable field is provided by the query.
|
||||
|
||||
@@ -418,7 +418,7 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface
|
||||
$currency = TransactionCurrency::where('id', $currencyPreference->data)->first();
|
||||
}
|
||||
$journalId = $row->transaction_journal_id;
|
||||
$return[$journalId] = $return[$journalId] ?? [];
|
||||
$return[$journalId] ??= [];
|
||||
|
||||
$return[$journalId][] = [
|
||||
'piggy' => $row->piggyBank->name,
|
||||
|
@@ -45,7 +45,7 @@ class TransactionTypeRepository implements TransactionTypeRepositoryInterface
|
||||
|
||||
return $type;
|
||||
}
|
||||
$typeString = $typeString ?? TransactionType::WITHDRAWAL;
|
||||
$typeString ??= TransactionType::WITHDRAWAL;
|
||||
$search = $this->findByType($typeString);
|
||||
if (null === $search) {
|
||||
$search = $this->findByType(TransactionType::WITHDRAWAL);
|
||||
|
@@ -83,7 +83,7 @@ class BillRepository implements BillRepositoryInterface
|
||||
$currency = $bill->transactionCurrency;
|
||||
$currencyId = $bill->transaction_currency_id;
|
||||
|
||||
$return[$currencyId] = $return[$currencyId] ?? [
|
||||
$return[$currencyId] ??= [
|
||||
'currency_id' => (string)$currency->id,
|
||||
'currency_name' => $currency->name,
|
||||
'currency_symbol' => $currency->symbol,
|
||||
@@ -157,7 +157,7 @@ class BillRepository implements BillRepositoryInterface
|
||||
$currencyId = $bill->transaction_currency_id;
|
||||
$average = bcdiv(bcadd($bill->amount_max, $bill->amount_min), '2');
|
||||
$nativeAverage = $converter->convert($currency, $default, $start, $average);
|
||||
$return[$currencyId] = $return[$currencyId] ?? [
|
||||
$return[$currencyId] ??= [
|
||||
'currency_id' => (string)$currency->id,
|
||||
'currency_name' => $currency->name,
|
||||
'currency_symbol' => $currency->symbol,
|
||||
|
@@ -54,7 +54,7 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface
|
||||
/** @var AvailableBudget $availableBudget */
|
||||
foreach ($availableBudgets as $availableBudget) {
|
||||
$currencyId = $availableBudget->transaction_currency_id;
|
||||
$return[$currencyId] = $return[$currencyId] ?? [
|
||||
$return[$currencyId] ??= [
|
||||
'currency_id' => $currencyId,
|
||||
'currency_code' => $availableBudget->transactionCurrency->code,
|
||||
'currency_symbol' => $availableBudget->transactionCurrency->symbol,
|
||||
|
@@ -72,7 +72,7 @@ class OperationsRepository implements OperationsRepositoryInterface
|
||||
}
|
||||
|
||||
// info about the currency:
|
||||
$array[$currencyId] = $array[$currencyId] ?? [
|
||||
$array[$currencyId] ??= [
|
||||
'budgets' => [],
|
||||
'currency_id' => $currencyId,
|
||||
'currency_name' => $journal['currency_name'],
|
||||
@@ -82,7 +82,7 @@ class OperationsRepository implements OperationsRepositoryInterface
|
||||
];
|
||||
|
||||
// info about the budgets:
|
||||
$array[$currencyId]['budgets'][$budgetId] = $array[$currencyId]['budgets'][$budgetId] ?? [
|
||||
$array[$currencyId]['budgets'][$budgetId] ??= [
|
||||
'id' => $budgetId,
|
||||
'name' => $budgetName,
|
||||
'transaction_journals' => [],
|
||||
|
@@ -164,7 +164,7 @@ trait JournalServiceTrait
|
||||
// find by preferred type.
|
||||
$source = $this->accountRepository->findByIbanNull($data['iban'], [$types[0]]);
|
||||
// or any expected type.
|
||||
$source = $source ?? $this->accountRepository->findByIbanNull($data['iban'], $types);
|
||||
$source ??= $this->accountRepository->findByIbanNull($data['iban'], $types);
|
||||
|
||||
if (null !== $source) {
|
||||
app('log')->debug(sprintf('Found "account_iban" object: #%d, %s', $source->id, $source->name));
|
||||
@@ -196,7 +196,7 @@ trait JournalServiceTrait
|
||||
$source = $this->accountRepository->findByAccountNumber((string)$data['number'], [$types[0]]);
|
||||
|
||||
// or any expected type.
|
||||
$source = $source ?? $this->accountRepository->findByAccountNumber((string)$data['number'], $types);
|
||||
$source ??= $this->accountRepository->findByAccountNumber((string)$data['number'], $types);
|
||||
|
||||
if (null !== $source) {
|
||||
app('log')->debug(sprintf('Found account: #%d, %s', $source->id, $source->name));
|
||||
@@ -230,7 +230,7 @@ trait JournalServiceTrait
|
||||
$source = $this->accountRepository->findByName($data['name'], [$types[0]]);
|
||||
|
||||
// or any expected type.
|
||||
$source = $source ?? $this->accountRepository->findByName($data['name'], $types);
|
||||
$source ??= $this->accountRepository->findByName($data['name'], $types);
|
||||
|
||||
if (null !== $source) {
|
||||
app('log')->debug(sprintf('Found "account_name" object: #%d, %s', $source->id, $source->name));
|
||||
|
@@ -40,7 +40,7 @@ trait LocationServiceTrait
|
||||
*/
|
||||
protected function storeNewLocation(Model $model, array $data): ?Location
|
||||
{
|
||||
$data['store_location'] = $data['store_location'] ?? false;
|
||||
$data['store_location'] ??= false;
|
||||
if ($data['store_location']) {
|
||||
$location = new Location();
|
||||
$location->latitude = $data['latitude'] ?? config('firefly.default_location.latitude');
|
||||
|
@@ -71,7 +71,7 @@ class Amount
|
||||
{
|
||||
$locale = app('steam')->getLocale();
|
||||
$rounded = app('steam')->bcround($amount, $decimalPlaces);
|
||||
$coloured = $coloured ?? true;
|
||||
$coloured ??= true;
|
||||
|
||||
$fmt = new NumberFormatter($locale, NumberFormatter::CURRENCY);
|
||||
$fmt->setSymbol(NumberFormatter::CURRENCY_SYMBOL, $symbol);
|
||||
|
@@ -71,7 +71,7 @@ class Date implements BinderInterface
|
||||
|
||||
try {
|
||||
$result = new Carbon($value);
|
||||
} catch (InvalidDateException $e) { /** @phpstan-ignore-line */
|
||||
} catch (InvalidDateException $e) { // @phpstan-ignore-line
|
||||
$message = sprintf('Could not parse date "%s" for user #%d: %s', $value, auth()->user()->id, $e->getMessage());
|
||||
app('log')->error($message);
|
||||
throw new NotFoundHttpException($message, $e);
|
||||
|
@@ -128,7 +128,7 @@ class FrontpageChartGenerator
|
||||
{
|
||||
$currencyId = (int)$currency['currency_id'];
|
||||
|
||||
$this->currencies[$currencyId] = $this->currencies[$currencyId] ?? [
|
||||
$this->currencies[$currencyId] ??= [
|
||||
'currency_id' => $currencyId,
|
||||
'currency_name' => $currency['currency_name'],
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
|
@@ -152,7 +152,7 @@ class WholePeriodChartGenerator
|
||||
$return = [];
|
||||
foreach ($array as $block) {
|
||||
foreach ($block as $currencyId => $currencyRow) {
|
||||
$return[$currencyId] = $return[$currencyId] ?? [
|
||||
$return[$currencyId] ??= [
|
||||
'currency_id' => $currencyId,
|
||||
'currency_name' => $currencyRow['currency_name'],
|
||||
'currency_symbol' => $currencyRow['currency_symbol'],
|
||||
|
@@ -49,7 +49,7 @@ class ExpandedForm
|
||||
*/
|
||||
public function amountNoCurrency(string $name, $value = null, array $options = null): string
|
||||
{
|
||||
$options = $options ?? [];
|
||||
$options ??= [];
|
||||
$label = $this->label($name, $options);
|
||||
$options = $this->expandOptionArray($name, $label, $options);
|
||||
$classes = $this->getHolderClasses($name);
|
||||
@@ -83,8 +83,8 @@ class ExpandedForm
|
||||
*/
|
||||
public function checkbox(string $name, int $value = null, $checked = null, array $options = null): string
|
||||
{
|
||||
$options = $options ?? [];
|
||||
$value = $value ?? 1;
|
||||
$options ??= [];
|
||||
$value ??= 1;
|
||||
$options['checked'] = true === $checked;
|
||||
|
||||
if (app('session')->has('preFilled')) {
|
||||
@@ -144,7 +144,7 @@ class ExpandedForm
|
||||
*/
|
||||
public function file(string $name, array $options = null): string
|
||||
{
|
||||
$options = $options ?? [];
|
||||
$options ??= [];
|
||||
$label = $this->label($name, $options);
|
||||
$options = $this->expandOptionArray($name, $label, $options);
|
||||
$classes = $this->getHolderClasses($name);
|
||||
@@ -169,12 +169,12 @@ class ExpandedForm
|
||||
*/
|
||||
public function integer(string $name, $value = null, array $options = null): string
|
||||
{
|
||||
$options = $options ?? [];
|
||||
$options ??= [];
|
||||
$label = $this->label($name, $options);
|
||||
$options = $this->expandOptionArray($name, $label, $options);
|
||||
$classes = $this->getHolderClasses($name);
|
||||
$value = $this->fillFieldValue($name, $value);
|
||||
$options['step'] = $options['step'] ?? '1';
|
||||
$options['step'] ??= '1';
|
||||
try {
|
||||
$html = view('form.integer', compact('classes', 'name', 'label', 'value', 'options'))->render();
|
||||
} catch (Throwable $e) {
|
||||
@@ -196,7 +196,7 @@ class ExpandedForm
|
||||
*/
|
||||
public function location(string $name, $value = null, array $options = null): string
|
||||
{
|
||||
$options = $options ?? [];
|
||||
$options ??= [];
|
||||
$label = $this->label($name, $options);
|
||||
$options = $this->expandOptionArray($name, $label, $options);
|
||||
$classes = $this->getHolderClasses($name);
|
||||
|
@@ -132,7 +132,7 @@ class AccountForm
|
||||
*/
|
||||
public function assetAccountCheckList(string $name, array $options = null): string
|
||||
{
|
||||
$options = $options ?? [];
|
||||
$options ??= [];
|
||||
$label = $this->label($name, $options);
|
||||
$options = $this->expandOptionArray($name, $label, $options);
|
||||
$classes = $this->getHolderClasses($name);
|
||||
|
@@ -44,7 +44,7 @@ trait FormSupport
|
||||
*/
|
||||
public function select(string $name, array $list = null, $selected = null, array $options = null): string
|
||||
{
|
||||
$list = $list ?? [];
|
||||
$list ??= [];
|
||||
$label = $this->label($name, $options);
|
||||
$options = $this->expandOptionArray($name, $label, $options);
|
||||
$classes = $this->getHolderClasses($name);
|
||||
@@ -68,7 +68,7 @@ trait FormSupport
|
||||
*/
|
||||
protected function label(string $name, array $options = null): string
|
||||
{
|
||||
$options = $options ?? [];
|
||||
$options ??= [];
|
||||
if (array_key_exists('label', $options)) {
|
||||
return $options['label'];
|
||||
}
|
||||
@@ -86,7 +86,7 @@ trait FormSupport
|
||||
*/
|
||||
protected function expandOptionArray(string $name, $label, array $options = null): array
|
||||
{
|
||||
$options = $options ?? [];
|
||||
$options ??= [];
|
||||
$name = str_replace('[]', '', $name);
|
||||
$options['class'] = 'form-control';
|
||||
$options['id'] = 'ffInput_' . $name;
|
||||
@@ -156,7 +156,7 @@ trait FormSupport
|
||||
$date = null;
|
||||
try {
|
||||
$date = today(config('app.timezone'));
|
||||
} catch (InvalidDateException $e) {
|
||||
} catch (InvalidDateException $e) { // @phpstan-ignore-line
|
||||
app('log')->error($e->getMessage());
|
||||
}
|
||||
|
||||
|
@@ -71,7 +71,7 @@ class PiggyBankForm
|
||||
$groupTitle = $group->title;
|
||||
$groupOrder = $group->order;
|
||||
}
|
||||
$subList[$groupOrder] = $subList[$groupOrder] ?? [
|
||||
$subList[$groupOrder] ??= [
|
||||
'group' => [
|
||||
'title' => $groupTitle,
|
||||
],
|
||||
|
@@ -67,7 +67,7 @@ class RuleForm
|
||||
*/
|
||||
public function ruleGroupListWithEmpty(string $name, $value = null, array $options = null): string
|
||||
{
|
||||
$options = $options ?? [];
|
||||
$options ??= [];
|
||||
$options['class'] = 'form-control';
|
||||
/** @var RuleGroupRepositoryInterface $groupRepos */
|
||||
$groupRepos = app(RuleGroupRepositoryInterface::class);
|
||||
|
@@ -171,7 +171,7 @@ trait ConvertsExchangeRates
|
||||
private function convertAmount(string $amount, TransactionCurrency $from, TransactionCurrency $to, ?Carbon $date = null): string
|
||||
{
|
||||
app('log')->debug(sprintf('Converting %s from %s to %s', $amount, $from->code, $to->code));
|
||||
$date = $date ?? today(config('app.timezone'));
|
||||
$date ??= today(config('app.timezone'));
|
||||
$rate = $this->getRate($from, $to, $date);
|
||||
|
||||
return bcmul($amount, $rate);
|
||||
|
@@ -263,7 +263,7 @@ trait AugumentData
|
||||
$name = $journal['source_account_name'];
|
||||
}
|
||||
|
||||
$grouped[$name] = $grouped[$name] ?? '0';
|
||||
$grouped[$name] ??= '0';
|
||||
$grouped[$name] = bcadd($journal['amount'], $grouped[$name]);
|
||||
}
|
||||
|
||||
|
@@ -168,7 +168,7 @@ trait RequestInformation
|
||||
*/
|
||||
final protected function parseAttributes(array $attributes): array // parse input + return result
|
||||
{
|
||||
$attributes['location'] = $attributes['location'] ?? '';
|
||||
$attributes['location'] ??= '';
|
||||
$attributes['accounts'] = AccountList::routeBinder($attributes['accounts'] ?? '', new Route('get', '', []));
|
||||
$date = Carbon::createFromFormat('Ymd', $attributes['startDate']);
|
||||
if (false === $date) {
|
||||
|
@@ -705,7 +705,7 @@ class Navigation
|
||||
*/
|
||||
public function subtractPeriod(Carbon $theDate, string $repeatFreq, int $subtract = null): Carbon
|
||||
{
|
||||
$subtract = $subtract ?? 1;
|
||||
$subtract ??= 1;
|
||||
$date = clone $theDate;
|
||||
// 1D 1W 1M 3M 6M 1Y
|
||||
$functionMap = [
|
||||
|
@@ -156,7 +156,7 @@ class ParseDateString
|
||||
$result = false;
|
||||
try {
|
||||
$result = Carbon::createFromFormat('Y-m-d', $date);
|
||||
} catch (InvalidFormatException $e) {
|
||||
} catch (InvalidFormatException $e) { // @phpstan-ignore-line
|
||||
Log::error(sprintf('parseDefaultDate("%s") ran into an error, but dont mind: %s', $date, $e->getMessage()));
|
||||
}
|
||||
if (false === $result) {
|
||||
|
@@ -77,7 +77,7 @@ class BudgetReportGenerator
|
||||
/** @var Account $account */
|
||||
foreach ($this->accounts as $account) {
|
||||
$accountId = $account->id;
|
||||
$this->report[$accountId] = $this->report[$accountId] ?? [
|
||||
$this->report[$accountId] ??= [
|
||||
'name' => $account->name,
|
||||
'id' => $account->id,
|
||||
'iban' => $account->iban,
|
||||
@@ -117,7 +117,7 @@ class BudgetReportGenerator
|
||||
$sourceAccountId = $journal['source_account_id'];
|
||||
|
||||
$this->report[$sourceAccountId]['currencies'][$currencyId]
|
||||
= $this->report[$sourceAccountId]['currencies'][$currencyId] ?? [
|
||||
??= [
|
||||
'currency_id' => $expenses['currency_id'],
|
||||
'currency_symbol' => $expenses['currency_symbol'],
|
||||
'currency_name' => $expenses['currency_name'],
|
||||
@@ -126,7 +126,7 @@ class BudgetReportGenerator
|
||||
];
|
||||
|
||||
$this->report[$sourceAccountId]['currencies'][$currencyId]['budgets'][$budgetId]
|
||||
= $this->report[$sourceAccountId]['currencies'][$currencyId]['budgets'][$budgetId] ?? '0';
|
||||
??= '0';
|
||||
|
||||
$this->report[$sourceAccountId]['currencies'][$currencyId]['budgets'][$budgetId]
|
||||
= bcadd($this->report[$sourceAccountId]['currencies'][$currencyId]['budgets'][$budgetId], $journal['amount']);
|
||||
@@ -169,7 +169,7 @@ class BudgetReportGenerator
|
||||
private function processBudget(Budget $budget): void
|
||||
{
|
||||
$budgetId = $budget->id;
|
||||
$this->report['budgets'][$budgetId] = $this->report['budgets'][$budgetId] ?? [
|
||||
$this->report['budgets'][$budgetId] ??= [
|
||||
'budget_id' => $budgetId,
|
||||
'budget_name' => $budget->name,
|
||||
'no_budget' => false,
|
||||
@@ -201,7 +201,7 @@ class BudgetReportGenerator
|
||||
$left = -1 === bccomp(bcadd($limit->amount, $spent), '0') ? '0' : bcadd($limit->amount, $spent);
|
||||
$overspent = 1 === bccomp(bcmul($spent, '-1'), $limit->amount) ? bcadd($spent, $limit->amount) : '0';
|
||||
|
||||
$this->report['budgets'][$budgetId]['budget_limits'][$limitId] = $this->report['budgets'][$budgetId]['budget_limits'][$limitId] ?? [
|
||||
$this->report['budgets'][$budgetId]['budget_limits'][$limitId] ??= [
|
||||
'budget_limit_id' => $limitId,
|
||||
'start_date' => $limit->start_date,
|
||||
'end_date' => $limit->end_date,
|
||||
@@ -220,7 +220,7 @@ class BudgetReportGenerator
|
||||
|
||||
// make sum information:
|
||||
$this->report['sums'][$currencyId]
|
||||
= $this->report['sums'][$currencyId] ?? [
|
||||
??= [
|
||||
'budgeted' => '0',
|
||||
'spent' => '0',
|
||||
'left' => '0',
|
||||
@@ -284,9 +284,9 @@ class BudgetReportGenerator
|
||||
$this->report['sums'][$nbCurrencyId]['currency_decimal_places'] = $nbCurrencyDp;
|
||||
|
||||
// append other sums because they might be missing:
|
||||
$this->report['sums'][$nbCurrencyId]['overspent'] = $this->report['sums'][$nbCurrencyId]['overspent'] ?? '0';
|
||||
$this->report['sums'][$nbCurrencyId]['left'] = $this->report['sums'][$nbCurrencyId]['left'] ?? '0';
|
||||
$this->report['sums'][$nbCurrencyId]['budgeted'] = $this->report['sums'][$nbCurrencyId]['budgeted'] ?? '0';
|
||||
$this->report['sums'][$nbCurrencyId]['overspent'] ??= '0';
|
||||
$this->report['sums'][$nbCurrencyId]['left'] ??= '0';
|
||||
$this->report['sums'][$nbCurrencyId]['budgeted'] ??= '0';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -314,7 +314,7 @@ class BudgetReportGenerator
|
||||
if (0 !== bccomp($budgeted, '0') && 0 !== bccomp($totalBudgeted, '0')) {
|
||||
$budgetedPct = round((float)bcmul(bcdiv($budgeted, $totalBudgeted), '100'));
|
||||
}
|
||||
$this->report['sums'][$currencyId]['budgeted'] = $this->report['sums'][$currencyId]['budgeted'] ?? '0';
|
||||
$this->report['sums'][$currencyId]['budgeted'] ??= '0';
|
||||
$this->report['budgets'][$budgetId]['budget_limits'][$limitId]['spent_pct'] = $spentPct;
|
||||
$this->report['budgets'][$budgetId]['budget_limits'][$limitId]['budgeted_pct'] = $budgetedPct;
|
||||
}
|
||||
|
@@ -107,7 +107,7 @@ class CategoryReportGenerator
|
||||
*/
|
||||
private function processCurrencyArray(int $currencyId, array $currencyRow): void
|
||||
{
|
||||
$this->report['sums'][$currencyId] = $this->report['sums'][$currencyId] ?? [
|
||||
$this->report['sums'][$currencyId] ??= [
|
||||
'spent' => '0',
|
||||
'earned' => '0',
|
||||
'sum' => '0',
|
||||
@@ -136,7 +136,7 @@ class CategoryReportGenerator
|
||||
private function processCategoryRow(int $currencyId, array $currencyRow, int $categoryId, array $categoryRow): void
|
||||
{
|
||||
$key = sprintf('%s-%s', $currencyId, $categoryId);
|
||||
$this->report['categories'][$key] = $this->report['categories'][$key] ?? [
|
||||
$this->report['categories'][$key] ??= [
|
||||
'id' => $categoryId,
|
||||
'title' => $categoryRow['name'],
|
||||
'currency_id' => $currencyRow['currency_id'],
|
||||
|
@@ -101,7 +101,7 @@ class AmountFormat extends AbstractExtension
|
||||
return new TwigFunction(
|
||||
'formatAmountByAccount',
|
||||
static function (AccountModel $account, string $amount, bool $coloured = null): string {
|
||||
$coloured = $coloured ?? true;
|
||||
$coloured ??= true;
|
||||
/** @var AccountRepositoryInterface $accountRepos */
|
||||
$accountRepos = app(AccountRepositoryInterface::class);
|
||||
$currency = $accountRepos->getAccountCurrency($account) ?? app('amount')->getDefaultCurrency();
|
||||
@@ -122,8 +122,8 @@ 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;
|
||||
$decimalPlaces ??= 2;
|
||||
$coloured ??= true;
|
||||
$currency = new TransactionCurrency();
|
||||
$currency->symbol = $symbol;
|
||||
$currency->decimal_places = $decimalPlaces;
|
||||
@@ -144,7 +144,7 @@ class AmountFormat extends AbstractExtension
|
||||
return new TwigFunction(
|
||||
'formatAmountByCurrency',
|
||||
static function (TransactionCurrency $currency, string $amount, bool $coloured = null): string {
|
||||
$coloured = $coloured ?? true;
|
||||
$coloured ??= true;
|
||||
|
||||
return app('amount')->formatAnything($currency, $amount, $coloured);
|
||||
},
|
||||
|
@@ -45,7 +45,7 @@ class UserTransformer extends AbstractTransformer
|
||||
*/
|
||||
public function transform(User $user): array
|
||||
{
|
||||
$this->repository = $this->repository ?? app(UserRepositoryInterface::class);
|
||||
$this->repository ??= app(UserRepositoryInterface::class);
|
||||
|
||||
return [
|
||||
'id' => (int)$user->id,
|
||||
|
@@ -64,7 +64,7 @@ class BillTransformer extends AbstractTransformer
|
||||
foreach ($objects as $object) {
|
||||
$id = $object->transaction_currency_id;
|
||||
$bills[] = $object->id;
|
||||
$currencies[$id] = $currencies[$id] ?? TransactionCurrency::find($id);
|
||||
$currencies[$id] ??= TransactionCurrency::find($id);
|
||||
}
|
||||
$this->currencies = $currencies;
|
||||
|
||||
@@ -120,7 +120,7 @@ class BillTransformer extends AbstractTransformer
|
||||
$transaction = $transactions[$journal->id] ?? [];
|
||||
$billId = (int)$journal->bill_id;
|
||||
$currencyId = (int)($transaction['transaction_currency_id'] ?? 0);
|
||||
$currencies[$currencyId] = $currencies[$currencyId] ?? TransactionCurrency::find($currencyId);
|
||||
$currencies[$currencyId] ??= TransactionCurrency::find($currencyId);
|
||||
|
||||
// foreign currency
|
||||
$foreignCurrencyId = null;
|
||||
@@ -132,7 +132,7 @@ class BillTransformer extends AbstractTransformer
|
||||
if (null !== $transaction['foreign_currency_id']) {
|
||||
app('log')->debug(sprintf('Foreign currency is #%d', $transaction['foreign_currency_id']));
|
||||
$foreignCurrencyId = (int)$transaction['foreign_currency_id'];
|
||||
$currencies[$foreignCurrencyId] = $currencies[$foreignCurrencyId] ?? TransactionCurrency::find($foreignCurrencyId);
|
||||
$currencies[$foreignCurrencyId] ??= TransactionCurrency::find($foreignCurrencyId);
|
||||
$foreignCurrencyCode = $currencies[$foreignCurrencyId]->code;
|
||||
$foreignCurrencyName = $currencies[$foreignCurrencyId]->name;
|
||||
$foreignCurrencySymbol = $currencies[$foreignCurrencyId]->symbol;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user