Various improvements.

This commit is contained in:
James Cole
2019-03-08 05:47:51 +01:00
parent e6d7c0ddbd
commit 431cf08401
11 changed files with 813 additions and 430 deletions

View File

@@ -25,13 +25,9 @@ namespace FireflyIII\Services\Internal\Support;
use FireflyIII\Factory\AccountFactory;
use FireflyIII\Factory\BudgetFactory;
use FireflyIII\Factory\CategoryFactory;
use FireflyIII\Factory\TransactionCurrencyFactory;
use FireflyIII\Models\Account;
use FireflyIII\Models\AccountType;
use FireflyIII\Models\Budget;
use FireflyIII\Models\Category;
use FireflyIII\Models\Transaction;
use FireflyIII\Models\TransactionCurrency;
use FireflyIII\Models\TransactionJournal;
@@ -86,8 +82,14 @@ trait TransactionServiceTrait
* @throws \FireflyIII\Exceptions\FireflyException
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*/
public function findAccount(?string $expectedType, ?int $accountId, ?string $accountName): ?Account
public function findAccount(?string $expectedType, ?Account $account, ?int $accountId, ?string $accountName): ?Account
{
$result = null;
if (null !== $account && $account->user_id === $this->user->id) {
return $account;
}
$accountId = (int)$accountId;
$accountName = (string)$accountName;
$repository = app(AccountRepositoryInterface::class);