mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-18 18:44:16 +00:00
Fix various phpstan issues.
This commit is contained in:
@@ -1,6 +1,4 @@
|
||||
parameters:
|
||||
scanFiles:
|
||||
- ../_ide_helper.php
|
||||
paths:
|
||||
- ../app
|
||||
- ../database
|
||||
|
@@ -55,7 +55,6 @@ class BudgetController extends Controller
|
||||
protected OperationsRepositoryInterface $opsRepository;
|
||||
private BudgetLimitRepositoryInterface $blRepository;
|
||||
private array $currencies = [];
|
||||
private TransactionCurrency $currency;
|
||||
private BudgetRepositoryInterface $repository;
|
||||
|
||||
public function __construct()
|
||||
@@ -201,18 +200,18 @@ class BudgetController extends Controller
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* When no budget limits are present, the expenses of the whole period are collected and grouped.
|
||||
* This is grouped per currency. Because there is no limit set, "left to spend" and "overspent" are empty.
|
||||
*
|
||||
* @throws FireflyException
|
||||
*/
|
||||
private function noBudgetLimits(Budget $budget, Carbon $start, Carbon $end): array
|
||||
{
|
||||
$spent = $this->opsRepository->listExpenses($start, $end, null, new Collection([$budget]));
|
||||
|
||||
return $this->processExpenses($budget->id, $spent, $start, $end);
|
||||
}
|
||||
// /**
|
||||
// * When no budget limits are present, the expenses of the whole period are collected and grouped.
|
||||
// * This is grouped per currency. Because there is no limit set, "left to spend" and "overspent" are empty.
|
||||
// *
|
||||
// * @throws FireflyException
|
||||
// */
|
||||
// private function noBudgetLimits(Budget $budget, Carbon $start, Carbon $end): array
|
||||
// {
|
||||
// $spent = $this->opsRepository->listExpenses($start, $end, null, new Collection([$budget]));
|
||||
//
|
||||
// return $this->processExpenses($budget->id, $spent, $start, $end);
|
||||
// }
|
||||
|
||||
/**
|
||||
* Shared between the "noBudgetLimits" function and "processLimit". Will take a single set of expenses and return
|
||||
@@ -258,59 +257,59 @@ class BudgetController extends Controller
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function that processes each budget limit (per budget).
|
||||
*
|
||||
* If you have a budget limit in EUR, only transactions in EUR will be considered.
|
||||
* If you have a budget limit in GBP, only transactions in GBP will be considered.
|
||||
*
|
||||
* If you have a budget limit in EUR, and a transaction in GBP, it will not be considered for the EUR budget limit.
|
||||
*
|
||||
* @throws FireflyException
|
||||
*/
|
||||
private function budgetLimits(Budget $budget, Collection $limits): array
|
||||
{
|
||||
Log::debug(sprintf('Now in budgetLimits(#%d)', $budget->id));
|
||||
$data = [];
|
||||
// /**
|
||||
// * Function that processes each budget limit (per budget).
|
||||
// *
|
||||
// * If you have a budget limit in EUR, only transactions in EUR will be considered.
|
||||
// * If you have a budget limit in GBP, only transactions in GBP will be considered.
|
||||
// *
|
||||
// * If you have a budget limit in EUR, and a transaction in GBP, it will not be considered for the EUR budget limit.
|
||||
// *
|
||||
// * @throws FireflyException
|
||||
// */
|
||||
// private function budgetLimits(Budget $budget, Collection $limits): array
|
||||
// {
|
||||
// Log::debug(sprintf('Now in budgetLimits(#%d)', $budget->id));
|
||||
// $data = [];
|
||||
//
|
||||
// /** @var BudgetLimit $limit */
|
||||
// foreach ($limits as $limit) {
|
||||
// $data = array_merge($data, $this->processLimit($budget, $limit));
|
||||
// }
|
||||
//
|
||||
// return $data;
|
||||
// }
|
||||
|
||||
/** @var BudgetLimit $limit */
|
||||
foreach ($limits as $limit) {
|
||||
$data = array_merge($data, $this->processLimit($budget, $limit));
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws FireflyException
|
||||
*/
|
||||
private function processLimit(Budget $budget, BudgetLimit $limit): array
|
||||
{
|
||||
Log::debug(sprintf('Created new ExchangeRateConverter in %s', __METHOD__));
|
||||
$end = clone $limit->end_date;
|
||||
$end->endOfDay();
|
||||
$spent = $this->opsRepository->listExpenses($limit->start_date, $end, null, new Collection([$budget]));
|
||||
$limitCurrencyId = $limit->transaction_currency_id;
|
||||
|
||||
/** @var array $entry */
|
||||
// only spent the entry where the entry's currency matches the budget limit's currency
|
||||
// so $filtered will only have 1 or 0 entries
|
||||
$filtered = array_filter($spent, fn ($entry) => $entry['currency_id'] === $limitCurrencyId);
|
||||
$result = $this->processExpenses($budget->id, $filtered, $limit->start_date, $end);
|
||||
if (1 === count($result)) {
|
||||
$compare = bccomp($limit->amount, (string)app('steam')->positive($result[$limitCurrencyId]['spent']));
|
||||
$result[$limitCurrencyId]['budgeted'] = $limit->amount;
|
||||
if (1 === $compare) {
|
||||
// convert this amount into the primary currency:
|
||||
$result[$limitCurrencyId]['left'] = bcadd($limit->amount, (string)$result[$limitCurrencyId]['spent']);
|
||||
}
|
||||
if ($compare <= 0) {
|
||||
$result[$limitCurrencyId]['overspent'] = app('steam')->positive(bcadd($limit->amount, (string)$result[$limitCurrencyId]['spent']));
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
// /**
|
||||
// * @throws FireflyException
|
||||
// */
|
||||
// private function processLimit(Budget $budget, BudgetLimit $limit): array
|
||||
// {
|
||||
// Log::debug(sprintf('Created new ExchangeRateConverter in %s', __METHOD__));
|
||||
// $end = clone $limit->end_date;
|
||||
// $end->endOfDay();
|
||||
// $spent = $this->opsRepository->listExpenses($limit->start_date, $end, null, new Collection([$budget]));
|
||||
// $limitCurrencyId = $limit->transaction_currency_id;
|
||||
//
|
||||
// /** @var array $entry */
|
||||
// // only spent the entry where the entry's currency matches the budget limit's currency
|
||||
// // so $filtered will only have 1 or 0 entries
|
||||
// $filtered = array_filter($spent, fn ($entry) => $entry['currency_id'] === $limitCurrencyId);
|
||||
// $result = $this->processExpenses($budget->id, $filtered, $limit->start_date, $end);
|
||||
// if (1 === count($result)) {
|
||||
// $compare = bccomp($limit->amount, (string)app('steam')->positive($result[$limitCurrencyId]['spent']));
|
||||
// $result[$limitCurrencyId]['budgeted'] = $limit->amount;
|
||||
// if (1 === $compare) {
|
||||
// // convert this amount into the primary currency:
|
||||
// $result[$limitCurrencyId]['left'] = bcadd($limit->amount, (string)$result[$limitCurrencyId]['spent']);
|
||||
// }
|
||||
// if ($compare <= 0) {
|
||||
// $result[$limitCurrencyId]['overspent'] = app('steam')->positive(bcadd($limit->amount, (string)$result[$limitCurrencyId]['spent']));
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return $result;
|
||||
// }
|
||||
|
||||
private function filterLimit(int $currencyId, Collection $limits): ?BudgetLimit
|
||||
{
|
||||
|
@@ -66,7 +66,6 @@ abstract class Controller extends BaseController
|
||||
protected const string JSON_CONTENT_TYPE = 'application/json';
|
||||
protected array $accepts = ['application/json', 'application/vnd.api+json'];
|
||||
|
||||
/** @var array<int, string> */
|
||||
protected bool $convertToPrimary = false;
|
||||
protected TransactionCurrency $primaryCurrency;
|
||||
protected ParameterBag $parameters;
|
||||
|
@@ -29,6 +29,7 @@ use FireflyIII\Api\V1\Requests\Insight\GenericRequest;
|
||||
use FireflyIII\Enums\TransactionTypeEnum;
|
||||
use FireflyIII\Helpers\Collector\GroupCollectorInterface;
|
||||
use FireflyIII\Support\Facades\Amount;
|
||||
use FireflyIII\Support\Facades\Steam;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
|
||||
/**
|
||||
@@ -71,7 +72,7 @@ class PeriodController extends Controller
|
||||
'currency_id' => (string) $currencyId,
|
||||
'currency_code' => $currencyCode,
|
||||
];
|
||||
$response[$currencyId]['difference'] = bcadd($response[$currencyId]['difference'], (string) app('steam')->positive($journal[$field]));
|
||||
$response[$currencyId]['difference'] = bcadd($response[$currencyId]['difference'], Steam::positive($journal[$field]));
|
||||
$response[$currencyId]['difference_float'] = (float) $response[$currencyId]['difference']; // float but on purpose.
|
||||
}
|
||||
|
||||
|
@@ -30,12 +30,13 @@ use FireflyIII\Enums\TransactionTypeEnum;
|
||||
use FireflyIII\Helpers\Collector\GroupCollectorInterface;
|
||||
use FireflyIII\Repositories\Tag\TagRepositoryInterface;
|
||||
use FireflyIII\Support\Facades\Amount;
|
||||
use FireflyIII\Support\Facades\Steam;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
|
||||
/**
|
||||
* Class TagController
|
||||
*/
|
||||
class TagController extends Controller
|
||||
class TagController extends Controller
|
||||
{
|
||||
private TagRepositoryInterface $repository;
|
||||
|
||||
@@ -97,7 +98,7 @@ class TagController extends Controller
|
||||
'currency_id' => (string) $currencyId,
|
||||
'currency_code' => $currencyCode,
|
||||
];
|
||||
$response[$currencyId]['difference'] = bcadd($response[$currencyId]['difference'], (string) app('steam')->positive($journal[$field]));
|
||||
$response[$currencyId]['difference'] = bcadd($response[$currencyId]['difference'], Steam::positive($journal[$field]));
|
||||
$response[$currencyId]['difference_float'] = (float) $response[$currencyId]['difference'];
|
||||
|
||||
}
|
||||
@@ -148,7 +149,7 @@ class TagController extends Controller
|
||||
'currency_id' => (string) $currencyId,
|
||||
'currency_code' => $journal['currency_code'],
|
||||
];
|
||||
$response[$key]['difference'] = bcadd((string) $response[$key]['difference'], (string) app('steam')->positive($journal['amount']));
|
||||
$response[$key]['difference'] = bcadd((string) $response[$key]['difference'], Steam::positive($journal['amount']));
|
||||
$response[$key]['difference_float'] = (float) $response[$key]['difference'];
|
||||
}
|
||||
|
||||
@@ -160,10 +161,7 @@ class TagController extends Controller
|
||||
'currency_id' => (string) $foreignCurrencyId,
|
||||
'currency_code' => $journal['foreign_currency_code'],
|
||||
];
|
||||
$response[$foreignKey]['difference'] = bcadd(
|
||||
(string) $response[$foreignKey]['difference'],
|
||||
(string) app('steam')->positive($journal['foreign_amount'])
|
||||
);
|
||||
$response[$foreignKey]['difference'] = bcadd((string) $response[$foreignKey]['difference'], Steam::positive($journal['foreign_amount']));
|
||||
$response[$foreignKey]['difference_float'] = (float) $response[$foreignKey]['difference'];
|
||||
}
|
||||
}
|
||||
|
@@ -29,6 +29,7 @@ use FireflyIII\Api\V1\Requests\Insight\GenericRequest;
|
||||
use FireflyIII\Enums\TransactionTypeEnum;
|
||||
use FireflyIII\Helpers\Collector\GroupCollectorInterface;
|
||||
use FireflyIII\Support\Facades\Amount;
|
||||
use FireflyIII\Support\Facades\Steam;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
|
||||
/**
|
||||
@@ -71,7 +72,7 @@ class PeriodController extends Controller
|
||||
'currency_id' => (string) $currencyId,
|
||||
'currency_code' => $currencyCode,
|
||||
];
|
||||
$response[$currencyId]['difference'] = bcadd($response[$currencyId]['difference'], (string) app('steam')->positive($journal[$field]));
|
||||
$response[$currencyId]['difference'] = bcadd($response[$currencyId]['difference'], Steam::positive($journal[$field]));
|
||||
$response[$currencyId]['difference_float'] = (float) $response[$currencyId]['difference'];
|
||||
|
||||
}
|
||||
|
@@ -30,6 +30,7 @@ use FireflyIII\Enums\TransactionTypeEnum;
|
||||
use FireflyIII\Helpers\Collector\GroupCollectorInterface;
|
||||
use FireflyIII\Repositories\Tag\TagRepositoryInterface;
|
||||
use FireflyIII\Support\Facades\Amount;
|
||||
use FireflyIII\Support\Facades\Steam;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
|
||||
/**
|
||||
@@ -95,7 +96,7 @@ class TagController extends Controller
|
||||
'currency_id' => (string) $currencyId,
|
||||
'currency_code' => $currencyCode,
|
||||
];
|
||||
$response[$currencyId]['difference'] = bcadd($response[$currencyId]['difference'], (string) app('steam')->positive($journal[$field]));
|
||||
$response[$currencyId]['difference'] = bcadd($response[$currencyId]['difference'], Steam::positive($journal[$field]));
|
||||
$response[$currencyId]['difference_float'] = (float) $response[$currencyId]['difference'];
|
||||
|
||||
}
|
||||
@@ -146,7 +147,7 @@ class TagController extends Controller
|
||||
'currency_id' => (string) $currencyId,
|
||||
'currency_code' => $journal['currency_code'],
|
||||
];
|
||||
$response[$key]['difference'] = bcadd((string) $response[$key]['difference'], (string) app('steam')->positive($journal['amount']));
|
||||
$response[$key]['difference'] = bcadd((string) $response[$key]['difference'], Steam::positive($journal['amount']));
|
||||
$response[$key]['difference_float'] = (float) $response[$key]['difference'];
|
||||
}
|
||||
|
||||
@@ -160,7 +161,7 @@ class TagController extends Controller
|
||||
];
|
||||
$response[$foreignKey]['difference'] = bcadd(
|
||||
(string) $response[$foreignKey]['difference'],
|
||||
(string) app('steam')->positive($journal['foreign_amount'])
|
||||
Steam::positive($journal['foreign_amount'])
|
||||
);
|
||||
$response[$foreignKey]['difference_float'] = (float) $response[$foreignKey]['difference']; // intentional float
|
||||
}
|
||||
|
@@ -114,8 +114,8 @@ class ShowController extends Controller
|
||||
public function show(AvailableBudget $availableBudget): JsonResponse
|
||||
{
|
||||
$manager = $this->getManager();
|
||||
$start = $this->parameters->get('start');
|
||||
$end = $this->parameters->get('end');
|
||||
// $start = $this->parameters->get('start');
|
||||
// $end = $this->parameters->get('end');
|
||||
|
||||
/** @var AvailableBudgetTransformer $transformer */
|
||||
$transformer = app(AvailableBudgetTransformer::class);
|
||||
@@ -126,8 +126,8 @@ class ShowController extends Controller
|
||||
$admin = auth()->user();
|
||||
$enrichment = new AvailableBudgetEnrichment();
|
||||
$enrichment->setUser($admin);
|
||||
$enrichment->setStart($start);
|
||||
$enrichment->setEnd($end);
|
||||
// $enrichment->setStart($start);
|
||||
// $enrichment->setEnd($end);
|
||||
$availableBudget = $enrichment->enrichSingle($availableBudget);
|
||||
|
||||
|
||||
|
@@ -84,6 +84,7 @@ class ShowController extends Controller
|
||||
$enrichment->setUser($admin);
|
||||
$enrichment->setStart($this->parameters->get('start'));
|
||||
$enrichment->setEnd($this->parameters->get('end'));
|
||||
/** @var Budget $budget */
|
||||
$budget = $enrichment->enrichSingle($budget);
|
||||
|
||||
|
||||
|
@@ -192,7 +192,7 @@ class ListController extends Controller
|
||||
$enrichment->setUser($admin);
|
||||
$enrichment->setStart($this->parameters->get('start'));
|
||||
$enrichment->setEnd($this->parameters->get('end'));
|
||||
$bills = $enrichment->enrichSingle($bills);
|
||||
$bills = $enrichment->enrich($bills);
|
||||
|
||||
// make paginator:
|
||||
$paginator = new LengthAwarePaginator($bills, $count, $pageSize, $this->parameters->get('page'));
|
||||
@@ -268,7 +268,6 @@ class ListController extends Controller
|
||||
// filter selection
|
||||
$collection = $unfiltered->filter(
|
||||
static function (Recurrence $recurrence) use ($currency) { // @phpstan-ignore-line
|
||||
/** @var RecurrenceTransaction $transaction */
|
||||
if (array_any($recurrence->recurrenceTransactions, fn ($transaction) => $transaction->transaction_currency_id === $currency->id || $transaction->foreign_currency_id === $currency->id)) {
|
||||
return $recurrence;
|
||||
}
|
||||
@@ -320,7 +319,6 @@ class ListController extends Controller
|
||||
|
||||
$collection = $unfiltered->filter(
|
||||
static function (Rule $rule) use ($currency) { // @phpstan-ignore-line
|
||||
/** @var RuleTrigger $trigger */
|
||||
if (array_any($rule->ruleTriggers, fn ($trigger) => 'currency_is' === $trigger->trigger_type && $currency->name === $trigger->trigger_value)) {
|
||||
return $rule;
|
||||
}
|
||||
|
@@ -481,7 +481,7 @@ class BasicController extends Controller
|
||||
$currencies = [];
|
||||
|
||||
// first, create an entry for each entry in the "available" array.
|
||||
/** @var array $availableBudget */
|
||||
/** @var string $availableBudget */
|
||||
foreach ($available as $currencyId => $availableBudget) {
|
||||
$currencies[$currencyId] ??= $this->currencyRepos->find($currencyId);
|
||||
$return[$currencyId] = [
|
||||
|
@@ -156,13 +156,11 @@ class ConfigurationController extends Controller
|
||||
}
|
||||
|
||||
// fallback
|
||||
if (!str_starts_with($configKey, 'configuration.')) {
|
||||
$data = [
|
||||
'title' => $configKey,
|
||||
'value' => config($configKey),
|
||||
'editable' => false,
|
||||
];
|
||||
}
|
||||
$data = [
|
||||
'title' => $configKey,
|
||||
'value' => config($shortKey),
|
||||
'editable' => false,
|
||||
];
|
||||
|
||||
return response()->api(['data' => $data])->header('Content-Type', self::JSON_CONTENT_TYPE);
|
||||
}
|
||||
@@ -178,7 +176,7 @@ class ConfigurationController extends Controller
|
||||
*/
|
||||
public function update(UpdateRequest $request, string $name): JsonResponse
|
||||
{
|
||||
$rules = ['value' => 'required'];
|
||||
$rules = ['value' => 'required'];
|
||||
if (!$this->repository->hasRole(auth()->user(), 'owner')) {
|
||||
$messages = ['value' => '200005: You need the "owner" role to do this.'];
|
||||
Validator::make([], $rules, $messages)->validate();
|
||||
|
@@ -77,6 +77,7 @@ class UpdateController extends Controller
|
||||
$admin = auth()->user();
|
||||
$enrichment = new WebhookEnrichment();
|
||||
$enrichment->setUser($admin);
|
||||
/** @var Webhook $webhook */
|
||||
$webhook = $enrichment->enrichSingle($webhook);
|
||||
|
||||
Log::channel('audit')->info(sprintf('User updates webhook #%d', $webhook->id), $data);
|
||||
|
@@ -24,7 +24,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Api\V1\Requests\Chart;
|
||||
|
||||
use Illuminate\Contracts\Validation\Validator;
|
||||
use Illuminate\Validation\Validator;
|
||||
use FireflyIII\Enums\UserRoleEnum;
|
||||
use FireflyIII\Support\Http\Api\ValidatesUserGroupTrait;
|
||||
use FireflyIII\Support\Request\ChecksLogin;
|
||||
|
@@ -24,7 +24,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Api\V1\Requests\Data\Bulk;
|
||||
|
||||
use Illuminate\Contracts\Validation\Validator;
|
||||
use Illuminate\Validation\Validator;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
use FireflyIII\Support\Request\ChecksLogin;
|
||||
use FireflyIII\Support\Request\ConvertsDataTypes;
|
||||
|
@@ -24,7 +24,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Api\V1\Requests\Data\Bulk;
|
||||
|
||||
use Illuminate\Contracts\Validation\Validator;
|
||||
use Illuminate\Validation\Validator;
|
||||
use JsonException;
|
||||
use FireflyIII\Enums\ClauseType;
|
||||
use FireflyIII\Rules\IsValidBulkClause;
|
||||
|
@@ -31,7 +31,7 @@ use FireflyIII\Support\Facades\Preferences;
|
||||
use FireflyIII\Support\Http\Api\AccountFilter;
|
||||
use FireflyIII\Support\Request\ConvertsDataTypes;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Contracts\Validation\Validator;
|
||||
use Illuminate\Validation\Validator;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class ShowRequest extends FormRequest
|
||||
@@ -46,8 +46,6 @@ class ShowRequest extends FormRequest
|
||||
// get default for user:
|
||||
/** @var User $user */
|
||||
$user = auth()->user();
|
||||
|
||||
/** @var Preference $pageSize */
|
||||
$limit = (int)Preferences::getForUser($user, 'listPageSize', 50)->data;
|
||||
}
|
||||
|
||||
@@ -81,7 +79,7 @@ class ShowRequest extends FormRequest
|
||||
{
|
||||
$validator->after(
|
||||
function (Validator $validator): void {
|
||||
if ($validator->failed()) {
|
||||
if (count($validator->failed()) > 0) {
|
||||
return;
|
||||
}
|
||||
$data = $validator->getData();
|
||||
|
@@ -24,7 +24,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Api\V1\Requests\Models\Account;
|
||||
|
||||
use Illuminate\Contracts\Validation\Validator;
|
||||
use Illuminate\Validation\Validator;
|
||||
use FireflyIII\Models\Account;
|
||||
use FireflyIII\Models\Location;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
|
@@ -24,7 +24,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Api\V1\Requests\Models\AvailableBudget;
|
||||
|
||||
use Illuminate\Contracts\Validation\Validator;
|
||||
use Illuminate\Validation\Validator;
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Rules\IsValidPositiveAmount;
|
||||
use FireflyIII\Support\Request\ChecksLogin;
|
||||
|
@@ -24,7 +24,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Api\V1\Requests\Models\Bill;
|
||||
|
||||
use Illuminate\Contracts\Validation\Validator;
|
||||
use Illuminate\Validation\Validator;
|
||||
use ValueError;
|
||||
use TypeError;
|
||||
use FireflyIII\Rules\IsBoolean;
|
||||
|
@@ -24,7 +24,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Api\V1\Requests\Models\Bill;
|
||||
|
||||
use Illuminate\Contracts\Validation\Validator;
|
||||
use Illuminate\Validation\Validator;
|
||||
use FireflyIII\Models\Bill;
|
||||
use FireflyIII\Rules\IsBoolean;
|
||||
use FireflyIII\Rules\IsValidPositiveAmount;
|
||||
|
@@ -24,7 +24,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Api\V1\Requests\Models\Budget;
|
||||
|
||||
use Illuminate\Contracts\Validation\Validator;
|
||||
use Illuminate\Validation\Validator;
|
||||
use FireflyIII\Rules\IsBoolean;
|
||||
use FireflyIII\Rules\IsValidPositiveAmount;
|
||||
use FireflyIII\Support\Request\ChecksLogin;
|
||||
|
@@ -24,7 +24,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Api\V1\Requests\Models\Budget;
|
||||
|
||||
use Illuminate\Contracts\Validation\Validator;
|
||||
use Illuminate\Validation\Validator;
|
||||
use FireflyIII\Models\Budget;
|
||||
use FireflyIII\Rules\IsBoolean;
|
||||
use FireflyIII\Rules\IsValidPositiveAmount;
|
||||
|
@@ -24,7 +24,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Api\V1\Requests\Models\BudgetLimit;
|
||||
|
||||
use Illuminate\Contracts\Validation\Validator;
|
||||
use Illuminate\Validation\Validator;
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Rules\IsValidPositiveAmount;
|
||||
use FireflyIII\Support\Request\ChecksLogin;
|
||||
|
@@ -28,7 +28,7 @@ use Carbon\Carbon;
|
||||
use Carbon\Exceptions\InvalidFormatException;
|
||||
use FireflyIII\Support\Request\ChecksLogin;
|
||||
use FireflyIII\Support\Request\ConvertsDataTypes;
|
||||
use Illuminate\Contracts\Validation\Validator;
|
||||
use Illuminate\Validation\Validator;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class StoreByCurrenciesRequest extends FormRequest
|
||||
@@ -55,7 +55,7 @@ class StoreByCurrenciesRequest extends FormRequest
|
||||
{
|
||||
$validator->after(
|
||||
static function (Validator $validator): void {
|
||||
$data = $validator->getData() ?? [];
|
||||
$data = $validator->getData();
|
||||
foreach ($data as $date => $rate) {
|
||||
try {
|
||||
$date = Carbon::createFromFormat('Y-m-d', $date);
|
||||
|
@@ -27,7 +27,7 @@ namespace FireflyIII\Api\V1\Requests\Models\CurrencyExchangeRate;
|
||||
use FireflyIII\Models\TransactionCurrency;
|
||||
use FireflyIII\Support\Request\ChecksLogin;
|
||||
use FireflyIII\Support\Request\ConvertsDataTypes;
|
||||
use Illuminate\Contracts\Validation\Validator;
|
||||
use Illuminate\Validation\Validator;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class StoreByDateRequest extends FormRequest
|
||||
|
@@ -24,7 +24,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Api\V1\Requests\Models\PiggyBank;
|
||||
|
||||
use Illuminate\Contracts\Validation\Validator;
|
||||
use Illuminate\Validation\Validator;
|
||||
use FireflyIII\Models\TransactionCurrency;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
use FireflyIII\Rules\IsValidZeroOrMoreAmount;
|
||||
|
@@ -24,7 +24,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Api\V1\Requests\Models\Recurrence;
|
||||
|
||||
use Illuminate\Contracts\Validation\Validator;
|
||||
use Illuminate\Validation\Validator;
|
||||
use FireflyIII\Rules\BelongsUser;
|
||||
use FireflyIII\Rules\IsBoolean;
|
||||
use FireflyIII\Rules\IsValidPositiveAmount;
|
||||
|
@@ -24,7 +24,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Api\V1\Requests\Models\Recurrence;
|
||||
|
||||
use Illuminate\Contracts\Validation\Validator;
|
||||
use Illuminate\Validation\Validator;
|
||||
use FireflyIII\Models\Recurrence;
|
||||
use FireflyIII\Rules\BelongsUser;
|
||||
use FireflyIII\Rules\IsBoolean;
|
||||
|
@@ -24,7 +24,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Api\V1\Requests\Models\Rule;
|
||||
|
||||
use Illuminate\Contracts\Validation\Validator;
|
||||
use Illuminate\Validation\Validator;
|
||||
use FireflyIII\Rules\IsBoolean;
|
||||
use FireflyIII\Rules\IsValidActionExpression;
|
||||
use FireflyIII\Support\Request\ChecksLogin;
|
||||
|
@@ -24,7 +24,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Api\V1\Requests\Models\Rule;
|
||||
|
||||
use Illuminate\Contracts\Validation\Validator;
|
||||
use Illuminate\Validation\Validator;
|
||||
use FireflyIII\Models\Rule;
|
||||
use FireflyIII\Rules\IsBoolean;
|
||||
use FireflyIII\Rules\IsValidActionExpression;
|
||||
|
@@ -24,7 +24,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Api\V1\Requests\Models\Transaction;
|
||||
|
||||
use Illuminate\Contracts\Validation\Validator;
|
||||
use Illuminate\Validation\Validator;
|
||||
use FireflyIII\Models\Location;
|
||||
use FireflyIII\Rules\BelongsUser;
|
||||
use FireflyIII\Rules\IsBoolean;
|
||||
|
@@ -24,7 +24,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Api\V1\Requests\Models\Transaction;
|
||||
|
||||
use Illuminate\Contracts\Validation\Validator;
|
||||
use Illuminate\Validation\Validator;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Models\TransactionGroup;
|
||||
use FireflyIII\Rules\BelongsUser;
|
||||
|
@@ -24,7 +24,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Api\V1\Requests\Models\TransactionLink;
|
||||
|
||||
use Illuminate\Contracts\Validation\Validator;
|
||||
use Illuminate\Validation\Validator;
|
||||
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
|
||||
use FireflyIII\Repositories\LinkType\LinkTypeRepositoryInterface;
|
||||
use FireflyIII\Support\Request\ChecksLogin;
|
||||
|
@@ -24,7 +24,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Api\V1\Requests\Models\TransactionLink;
|
||||
|
||||
use Illuminate\Contracts\Validation\Validator;
|
||||
use Illuminate\Validation\Validator;
|
||||
use FireflyIII\Models\TransactionJournalLink;
|
||||
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
|
||||
use FireflyIII\Repositories\LinkType\LinkTypeRepositoryInterface;
|
||||
|
@@ -24,7 +24,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Api\V1\Requests\System;
|
||||
|
||||
use Illuminate\Contracts\Validation\Validator;
|
||||
use Illuminate\Validation\Validator;
|
||||
use FireflyIII\Rules\IsBoolean;
|
||||
use FireflyIII\Support\Request\ChecksLogin;
|
||||
use FireflyIII\Support\Request\ConvertsDataTypes;
|
||||
|
@@ -45,9 +45,7 @@ class CorrectsGroupAccounts extends Command
|
||||
public function handle(): int
|
||||
{
|
||||
$groups = [];
|
||||
$res = TransactionJournal::groupBy('transaction_group_id')
|
||||
->get(['transaction_group_id', DB::raw('COUNT(transaction_group_id) as the_count')])// @phpstan-ignore-line
|
||||
;
|
||||
$res = TransactionJournal::groupBy('transaction_group_id')->get(['transaction_group_id', DB::raw('COUNT(transaction_group_id) as the_count')]);
|
||||
|
||||
/** @var TransactionJournal $journal */
|
||||
foreach ($res as $journal) {
|
||||
|
@@ -263,9 +263,9 @@ class CorrectsUnevenAmount extends Command
|
||||
// Log::debug(sprintf('[c] %s', var_export($source->transaction_currency_id === $destination->foreign_currency_id,true)));
|
||||
// Log::debug(sprintf('[d] %s', var_export((int) $destination->transaction_currency_id ===(int) $source->foreign_currency_id, true)));
|
||||
|
||||
if (0 === bccomp((string) app('steam')->positive($source->amount), (string) app('steam')->positive($destination->foreign_amount))
|
||||
if (0 === bccomp(Steam::positive($source->amount), Steam::positive($destination->foreign_amount))
|
||||
&& $source->transaction_currency_id === $destination->foreign_currency_id
|
||||
&& 0 === bccomp((string) app('steam')->positive($destination->amount), (string) app('steam')->positive($source->foreign_amount))
|
||||
&& 0 === bccomp(Steam::positive($destination->amount), Steam::positive($source->foreign_amount))
|
||||
&& (int) $destination->transaction_currency_id === (int) $source->foreign_currency_id
|
||||
) {
|
||||
return true;
|
||||
@@ -302,10 +302,10 @@ class CorrectsUnevenAmount extends Command
|
||||
|
||||
private function isBetweenAssetAndLiability(TransactionJournal $journal): bool
|
||||
{
|
||||
/** @var Transaction $sourceTransaction */
|
||||
/** @var Transaction|null $sourceTransaction */
|
||||
$sourceTransaction = $journal->transactions()->where('amount', '<', 0)->first();
|
||||
|
||||
/** @var Transaction $destinationTransaction */
|
||||
/** @var Transaction|null $destinationTransaction */
|
||||
$destinationTransaction = $journal->transactions()->where('amount', '>', 0)->first();
|
||||
if (null === $sourceTransaction || null === $destinationTransaction) {
|
||||
Log::warning('Either transaction is false, stop.');
|
||||
|
@@ -55,10 +55,7 @@ class RemovesEmptyJournals extends Command
|
||||
*/
|
||||
private function deleteUnevenJournals(): void
|
||||
{
|
||||
$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
|
||||
;
|
||||
$set = Transaction::whereNull('deleted_at')->groupBy('transactions.transaction_journal_id')->get([DB::raw('COUNT(transactions.transaction_journal_id) as the_count'), 'transaction_journal_id']);
|
||||
$total = 0;
|
||||
|
||||
/** @var Transaction $row */
|
||||
|
@@ -32,18 +32,7 @@ class ValidatesEnvironmentVariables extends Command
|
||||
{
|
||||
use ShowsFriendlyMessages;
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var null|string
|
||||
*/
|
||||
protected $description = 'Makes sure you use the correct variables.';
|
||||
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'integrity:validates-environment-variables';
|
||||
|
||||
/**
|
||||
|
@@ -50,7 +50,7 @@ class RecalculatesRunningBalance extends Command
|
||||
/**
|
||||
* Execute the console command.
|
||||
*/
|
||||
public function handle()
|
||||
public function handle(): int
|
||||
{
|
||||
if (true === config('firefly.feature_flags.running_balance_column')) {
|
||||
$this->friendlyInfo('Will recalculate account balances. This may take a LONG time. Please be patient.');
|
||||
@@ -60,6 +60,7 @@ class RecalculatesRunningBalance extends Command
|
||||
return 0;
|
||||
}
|
||||
$this->friendlyWarning('This command has been disabled.');
|
||||
return 0;
|
||||
}
|
||||
|
||||
private function correctBalanceAmounts(bool $forced): void
|
||||
|
@@ -35,6 +35,7 @@ use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
|
||||
use FireflyIII\Support\CacheProperties;
|
||||
use FireflyIII\Support\Facades\Amount;
|
||||
use FireflyIII\Support\Facades\Steam;
|
||||
use FireflyIII\Support\Http\Controllers\DateCalculation;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
|
||||
@@ -92,9 +93,9 @@ class BoxController extends Controller
|
||||
$currencyId = $this->convertToPrimary && $this->primaryCurrency->id !== (int) $journal['currency_id'] ? $this->primaryCurrency->id : (int) $journal['currency_id'];
|
||||
$amount = Amount::getAmountFromJournal($journal);
|
||||
$incomes[$currencyId] ??= '0';
|
||||
$incomes[$currencyId] = bcadd($incomes[$currencyId], (string) app('steam')->positive($amount));
|
||||
$incomes[$currencyId] = bcadd($incomes[$currencyId], Steam::positive($amount));
|
||||
$sums[$currencyId] ??= '0';
|
||||
$sums[$currencyId] = bcadd($sums[$currencyId], (string) app('steam')->positive($amount));
|
||||
$sums[$currencyId] = bcadd($sums[$currencyId], Steam::positive($amount));
|
||||
}
|
||||
|
||||
// collect expenses
|
||||
|
@@ -28,6 +28,7 @@ use Carbon\Carbon;
|
||||
use FireflyIII\Enums\TransactionTypeEnum;
|
||||
use FireflyIII\Helpers\Collector\GroupCollectorInterface;
|
||||
use FireflyIII\Models\TransactionCurrency;
|
||||
use FireflyIII\Support\Facades\Steam;
|
||||
use FireflyIII\Support\Report\Summarizer\TransactionSummarizer;
|
||||
use FireflyIII\Support\Repositories\UserGroup\UserGroupInterface;
|
||||
use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait;
|
||||
@@ -361,7 +362,7 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn
|
||||
];
|
||||
|
||||
// source account? money goes out!
|
||||
$return[$sourceKey]['out'] = bcadd((string) $return[$sourceKey]['out'], (string) app('steam')->negative($amount));
|
||||
$return[$sourceKey]['out'] = bcadd((string) $return[$sourceKey]['out'], Steam::negative($amount));
|
||||
$return[$sourceKey]['difference'] = bcadd($return[$sourceKey]['out'], (string) $return[$sourceKey]['in']);
|
||||
|
||||
// destination account? money comes in:
|
||||
@@ -404,7 +405,7 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn
|
||||
'currency_code' => $journal['foreign_currency_code'],
|
||||
];
|
||||
// source account? money goes out! (same as above)
|
||||
$return[$sourceKey]['out'] = bcadd((string) $return[$sourceKey]['out'], (string) app('steam')->negative($amount));
|
||||
$return[$sourceKey]['out'] = bcadd((string) $return[$sourceKey]['out'], Steam::negative($amount));
|
||||
$return[$sourceKey]['difference'] = bcadd($return[$sourceKey]['out'], (string) $return[$sourceKey]['in']);
|
||||
|
||||
// destination account? money comes in:
|
||||
|
@@ -40,6 +40,7 @@ use FireflyIII\Models\RuleTrigger;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
|
||||
use FireflyIII\Services\Internal\Destroy\BudgetDestroyService;
|
||||
use FireflyIII\Support\Facades\Steam;
|
||||
use FireflyIII\Support\Http\Api\ExchangeRateConverter;
|
||||
use FireflyIII\Support\Repositories\UserGroup\UserGroupInterface;
|
||||
use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait;
|
||||
@@ -632,7 +633,7 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface
|
||||
'decimal_places' => $journal['currency_decimal_places'],
|
||||
'sum' => '0',
|
||||
];
|
||||
$array[$currencyId]['sum'] = bcadd($array[$currencyId]['sum'], (string) app('steam')->negative($journal['amount']));
|
||||
$array[$currencyId]['sum'] = bcadd($array[$currencyId]['sum'], Steam::negative($journal['amount']));
|
||||
|
||||
// also do foreign amount:
|
||||
$foreignId = (int) $journal['foreign_currency_id'];
|
||||
@@ -645,7 +646,7 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface
|
||||
'decimal_places' => $journal['foreign_currency_decimal_places'],
|
||||
'sum' => '0',
|
||||
];
|
||||
$array[$foreignId]['sum'] = bcadd($array[$foreignId]['sum'], (string) app('steam')->negative($journal['foreign_amount']));
|
||||
$array[$foreignId]['sum'] = bcadd($array[$foreignId]['sum'], Steam::negative($journal['foreign_amount']));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -694,7 +695,7 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface
|
||||
'decimal_places' => $journal['currency_decimal_places'],
|
||||
'sum' => '0',
|
||||
];
|
||||
$array[$currencyId]['sum'] = bcadd($array[$currencyId]['sum'], (string) app('steam')->negative($journal['amount']));
|
||||
$array[$currencyId]['sum'] = bcadd($array[$currencyId]['sum'], Steam::negative($journal['amount']));
|
||||
|
||||
// also do foreign amount:
|
||||
$foreignId = (int) $journal['foreign_currency_id'];
|
||||
@@ -707,7 +708,7 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface
|
||||
'decimal_places' => $journal['foreign_currency_decimal_places'],
|
||||
'sum' => '0',
|
||||
];
|
||||
$array[$foreignId]['sum'] = bcadd($array[$foreignId]['sum'], (string) app('steam')->negative($journal['foreign_amount']));
|
||||
$array[$foreignId]['sum'] = bcadd($array[$foreignId]['sum'], Steam::negative($journal['foreign_amount']));
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -27,6 +27,7 @@ namespace FireflyIII\Repositories\Category;
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Enums\TransactionTypeEnum;
|
||||
use FireflyIII\Helpers\Collector\GroupCollectorInterface;
|
||||
use FireflyIII\Support\Facades\Steam;
|
||||
use FireflyIII\Support\Report\Summarizer\TransactionSummarizer;
|
||||
use FireflyIII\Support\Repositories\UserGroup\UserGroupInterface;
|
||||
use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait;
|
||||
@@ -174,7 +175,7 @@ class NoCategoryRepository implements NoCategoryRepositoryInterface, UserGroupIn
|
||||
'currency_code' => $journal['currency_code'],
|
||||
'currency_decimal_places' => $journal['currency_decimal_places'],
|
||||
];
|
||||
$array[$currencyId]['sum'] = bcadd($array[$currencyId]['sum'], (string) app('steam')->positive($journal['amount']));
|
||||
$array[$currencyId]['sum'] = bcadd($array[$currencyId]['sum'], Steam::positive($journal['amount']));
|
||||
}
|
||||
|
||||
return $array;
|
||||
@@ -202,7 +203,7 @@ class NoCategoryRepository implements NoCategoryRepositoryInterface, UserGroupIn
|
||||
'currency_code' => $journal['currency_code'],
|
||||
'currency_decimal_places' => $journal['currency_decimal_places'],
|
||||
];
|
||||
$array[$currencyId]['sum'] = bcadd($array[$currencyId]['sum'], (string) app('steam')->positive($journal['amount']));
|
||||
$array[$currencyId]['sum'] = bcadd($array[$currencyId]['sum'], Steam::positive($journal['amount']));
|
||||
}
|
||||
|
||||
return $array;
|
||||
|
@@ -29,6 +29,7 @@ use FireflyIII\Enums\TransactionTypeEnum;
|
||||
use FireflyIII\Helpers\Collector\GroupCollectorInterface;
|
||||
use FireflyIII\Models\Category;
|
||||
use FireflyIII\Support\Facades\Amount;
|
||||
use FireflyIII\Support\Facades\Steam;
|
||||
use FireflyIII\Support\Report\Summarizer\TransactionSummarizer;
|
||||
use FireflyIII\Support\Repositories\UserGroup\UserGroupInterface;
|
||||
use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait;
|
||||
@@ -403,7 +404,7 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn
|
||||
'currency_code' => $currencyCode,
|
||||
'currency_decimal_places' => $currencyDecimalPlaces,
|
||||
];
|
||||
$array[$currencyId]['sum'] = bcadd($array[$currencyId]['sum'], (string) app('steam')->positive($amount));
|
||||
$array[$currencyId]['sum'] = bcadd($array[$currencyId]['sum'], Steam::positive($amount));
|
||||
}
|
||||
|
||||
return $array;
|
||||
@@ -440,7 +441,7 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn
|
||||
'currency_code' => $journal['currency_code'],
|
||||
'currency_decimal_places' => $journal['currency_decimal_places'],
|
||||
];
|
||||
$array[$currencyId]['sum'] = bcadd($array[$currencyId]['sum'], (string) app('steam')->positive($journal['amount']));
|
||||
$array[$currencyId]['sum'] = bcadd($array[$currencyId]['sum'], Steam::positive($journal['amount']));
|
||||
}
|
||||
|
||||
return $array;
|
||||
|
@@ -26,6 +26,7 @@ namespace FireflyIII\Support\Report\Summarizer;
|
||||
|
||||
use FireflyIII\Models\TransactionCurrency;
|
||||
use FireflyIII\Support\Facades\Amount;
|
||||
use FireflyIII\Support\Facades\Steam;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
@@ -119,10 +120,10 @@ class TransactionSummarizer
|
||||
];
|
||||
|
||||
if ('positive' === $method) {
|
||||
$array[$currencyId]['sum'] = bcadd($array[$currencyId]['sum'], (string) app('steam')->positive($amount));
|
||||
$array[$currencyId]['sum'] = bcadd($array[$currencyId]['sum'], Steam::positive($amount));
|
||||
}
|
||||
if ('negative' === $method) {
|
||||
$array[$currencyId]['sum'] = bcadd($array[$currencyId]['sum'], (string) app('steam')->negative($amount));
|
||||
$array[$currencyId]['sum'] = bcadd($array[$currencyId]['sum'], Steam::negative($amount));
|
||||
}
|
||||
|
||||
// then process foreign amount, if it exists.
|
||||
@@ -138,10 +139,10 @@ class TransactionSummarizer
|
||||
];
|
||||
|
||||
if ('positive' === $method) {
|
||||
$array[$foreignCurrencyId]['sum'] = bcadd($array[$foreignCurrencyId]['sum'], (string) app('steam')->positive($amount));
|
||||
$array[$foreignCurrencyId]['sum'] = bcadd($array[$foreignCurrencyId]['sum'], Steam::positive($amount));
|
||||
}
|
||||
if ('negative' === $method) {
|
||||
$array[$foreignCurrencyId]['sum'] = bcadd($array[$foreignCurrencyId]['sum'], (string) app('steam')->negative($amount));
|
||||
$array[$foreignCurrencyId]['sum'] = bcadd($array[$foreignCurrencyId]['sum'], Steam::negative($amount));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -199,7 +200,7 @@ class TransactionSummarizer
|
||||
];
|
||||
|
||||
// add the data from the $field to the array.
|
||||
$array[$key]['sum'] = bcadd($array[$key]['sum'], (string) app('steam')->{$method}((string) ($journal[$field] ?? '0'))); // @phpstan-ignore-line
|
||||
$array[$key]['sum'] = bcadd($array[$key]['sum'], Steam::{$method}((string) ($journal[$field] ?? '0'))); // @phpstan-ignore-line
|
||||
Log::debug(sprintf('Field for transaction #%d is "%s" (%s). Sum: %s', $journal['transaction_group_id'], $currencyCode, $field, $array[$key]['sum']));
|
||||
|
||||
// also do foreign amount, but only when convertToPrimary is false (otherwise we have it already)
|
||||
@@ -217,7 +218,7 @@ class TransactionSummarizer
|
||||
'currency_code' => $journal['foreign_currency_code'],
|
||||
'currency_decimal_places' => $journal['foreign_currency_decimal_places'],
|
||||
];
|
||||
$array[$key]['sum'] = bcadd($array[$key]['sum'], (string) app('steam')->{$method}((string) $journal['foreign_amount'])); // @phpstan-ignore-line
|
||||
$array[$key]['sum'] = bcadd($array[$key]['sum'], Steam::{$method}((string) $journal['foreign_amount'])); // @phpstan-ignore-line
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user