mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Allow the mapping of asset accounts for opposing value
This commit is contained in:
parent
9c507f7f62
commit
528da3f08e
@ -55,7 +55,6 @@ class TransactionFactory
|
|||||||
Log::debug('Start of TransactionFactory::create()');
|
Log::debug('Start of TransactionFactory::create()');
|
||||||
$currencyId = $data['currency_id'] ?? null;
|
$currencyId = $data['currency_id'] ?? null;
|
||||||
$currencyId = isset($data['currency']) ? $data['currency']->id : $currencyId;
|
$currencyId = isset($data['currency']) ? $data['currency']->id : $currencyId;
|
||||||
Log::debug('We dont make it here');
|
|
||||||
if ('' === $data['amount']) {
|
if ('' === $data['amount']) {
|
||||||
throw new FireflyException('Amount is an empty string, which Firefly III cannot handle. Apologies.');
|
throw new FireflyException('Amount is an empty string, which Firefly III cannot handle. Apologies.');
|
||||||
}
|
}
|
||||||
|
@ -379,8 +379,8 @@ class ImportArrayStorage
|
|||||||
foreach ($toStore as $index => $store) {
|
foreach ($toStore as $index => $store) {
|
||||||
Log::debug(sprintf('Going to store entry %d of %d', $index + 1, $count));
|
Log::debug(sprintf('Going to store entry %d of %d', $index + 1, $count));
|
||||||
// convert the date to an object:
|
// convert the date to an object:
|
||||||
$store['date'] = Carbon::createFromFormat('Y-m-d', $store['date']);
|
$store['date'] = Carbon::createFromFormat('Y-m-d', $store['date']);
|
||||||
|
$store['description'] = $store['description'] === '' ? '(empty description)' : $store['description'];
|
||||||
// store the journal.
|
// store the journal.
|
||||||
$collection->push($this->journalRepos->store($store));
|
$collection->push($this->journalRepos->store($store));
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,7 @@ class OpposingAccountMapper
|
|||||||
if ((int)$accountId > 0) {
|
if ((int)$accountId > 0) {
|
||||||
// find any account with this ID:
|
// find any account with this ID:
|
||||||
$result = $this->repository->findNull($accountId);
|
$result = $this->repository->findNull($accountId);
|
||||||
if (null !== $result && $result->accountType->type === $expectedType) {
|
if (null !== $result && ($result->accountType->type === $expectedType || $result->accountType->type === AccountType::ASSET)) {
|
||||||
Log::debug(sprintf('Found account "%s" (%s) based on given ID %d. Return it!', $result->name, $result->accountType->type, $accountId));
|
Log::debug(sprintf('Found account "%s" (%s) based on given ID %d. Return it!', $result->name, $result->accountType->type, $accountId));
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
@ -112,7 +112,7 @@ class OpposingAccountMapper
|
|||||||
// not found? Create it!
|
// not found? Create it!
|
||||||
$creation = [
|
$creation = [
|
||||||
'name' => $data['name'] ?? '(no name)',
|
'name' => $data['name'] ?? '(no name)',
|
||||||
'iban' => $data['iban']?? null,
|
'iban' => $data['iban'] ?? null,
|
||||||
'accountNumber' => $data['number'] ?? null,
|
'accountNumber' => $data['number'] ?? null,
|
||||||
'account_type_id' => null,
|
'account_type_id' => null,
|
||||||
'accountType' => $expectedType,
|
'accountType' => $expectedType,
|
||||||
|
Loading…
Reference in New Issue
Block a user