mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-12-12 01:42:32 +00:00
Code cleanup
This commit is contained in:
@@ -127,7 +127,7 @@ trait RecurringTransactionTrait
|
||||
if (!$validator->validateDestination(['id' => $destination->id])) {
|
||||
throw new FireflyException(sprintf('Destination invalid: %s', $validator->destError));
|
||||
}
|
||||
if (array_key_exists('foreign_amount', $array) && '' === (string)$array['foreign_amount']) {
|
||||
if (array_key_exists('foreign_amount', $array) && '' === (string) $array['foreign_amount']) {
|
||||
unset($array['foreign_amount']);
|
||||
}
|
||||
// TODO typeOverrule. The account validator may have a different opinion on the type of the transaction.
|
||||
@@ -139,25 +139,25 @@ trait RecurringTransactionTrait
|
||||
'source_id' => $source->id,
|
||||
'destination_id' => $destination->id,
|
||||
'amount' => $array['amount'],
|
||||
'foreign_amount' => array_key_exists('foreign_amount', $array) ? (string)$array['foreign_amount'] : null,
|
||||
'foreign_amount' => array_key_exists('foreign_amount', $array) ? (string) $array['foreign_amount'] : null,
|
||||
'description' => $array['description'],
|
||||
]
|
||||
);
|
||||
$transaction->save();
|
||||
|
||||
if (array_key_exists('budget_id', $array)) {
|
||||
$this->setBudget($transaction, (int)$array['budget_id']);
|
||||
$this->setBudget($transaction, (int) $array['budget_id']);
|
||||
}
|
||||
if (array_key_exists('bill_id', $array)) {
|
||||
$this->setBill($transaction, (int)$array['bill_id']);
|
||||
$this->setBill($transaction, (int) $array['bill_id']);
|
||||
}
|
||||
if (array_key_exists('category_id', $array)) {
|
||||
$this->setCategory($transaction, (int)$array['category_id']);
|
||||
$this->setCategory($transaction, (int) $array['category_id']);
|
||||
}
|
||||
|
||||
// same for piggy bank
|
||||
if (array_key_exists('piggy_bank_id', $array)) {
|
||||
$this->updatePiggyBank($transaction, (int)$array['piggy_bank_id']);
|
||||
$this->updatePiggyBank($transaction, (int) $array['piggy_bank_id']);
|
||||
}
|
||||
|
||||
if (array_key_exists('tags', $array) && is_array($array['tags'])) {
|
||||
@@ -169,8 +169,8 @@ trait RecurringTransactionTrait
|
||||
protected function findAccount(array $expectedTypes, ?int $accountId, ?string $accountName): Account
|
||||
{
|
||||
$result = null;
|
||||
$accountId = (int)$accountId;
|
||||
$accountName = (string)$accountName;
|
||||
$accountId = (int) $accountId;
|
||||
$accountName = (string) $accountName;
|
||||
|
||||
/** @var AccountRepositoryInterface $repository */
|
||||
$repository = app(AccountRepositoryInterface::class);
|
||||
|
||||
Reference in New Issue
Block a user