Various code cleanup.

This commit is contained in:
James Cole
2021-09-18 10:20:19 +02:00
parent 481a6bdd5f
commit 3589c9f60f
137 changed files with 369 additions and 282 deletions

View File

@@ -151,7 +151,7 @@ trait RecurringTransactionTrait
[
'recurrence_id' => $recurrence->id,
'transaction_currency_id' => $currency->id,
'foreign_currency_id' => null === $foreignCurrency ? null : $foreignCurrency->id,
'foreign_currency_id' => $foreignCurrency?->id,
'source_id' => $source->id,
'destination_id' => $destination->id,
'amount' => $array['amount'],

View File

@@ -31,6 +31,7 @@ use FireflyIII\Models\Location;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Services\Internal\Support\AccountServiceTrait;
use FireflyIII\User;
use JsonException;
use Log;
/**
@@ -78,7 +79,7 @@ class AccountUpdateService
*
* @return Account
* @throws FireflyException
* @throws \JsonException
* @throws JsonException
*/
public function update(Account $account, array $data): Account
{
@@ -215,7 +216,7 @@ class AccountUpdateService
$newOrder = $data['order'];
Log::debug(sprintf('Order is set to be updated from %s to %s', $oldOrder, $newOrder));
$list = $this->getTypeIds([AccountType::MORTGAGE, AccountType::LOAN, AccountType::DEBT]);
if (in_array($type, [AccountType::ASSET], true)) {
if ($type === AccountType::ASSET) {
$list = $this->getTypeIds([AccountType::ASSET]);
}

View File

@@ -23,6 +23,7 @@ declare(strict_types=1);
namespace FireflyIII\Services\Internal\Update;
use FireflyIII\Exceptions\DuplicateTransactionException;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Factory\TransactionJournalFactory;
use FireflyIII\Models\TransactionGroup;
@@ -168,7 +169,7 @@ class GroupUpdateService
* @param array $data
*
* @throws FireflyException
* @throws \FireflyIII\Exceptions\DuplicateTransactionException
* @throws DuplicateTransactionException
*/
private function createTransactionJournal(TransactionGroup $transactionGroup, array $data): void
{

View File

@@ -475,7 +475,7 @@ class JournalUpdateService
$billId = (int)($this->data['bill_id'] ?? 0);
$billName = (string)($this->data['bill_name'] ?? '');
$bill = $this->billRepository->findBill($billId, $billName);
$this->transactionJournal->bill_id = null === $bill ? null : $bill->id;
$this->transactionJournal->bill_id = $bill?->id;
Log::debug('Updated bill ID');
}
}