mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Import routine can handle new SEPA fields and many new date fields. See #1248
This commit is contained in:
@@ -312,9 +312,9 @@ class ImportAccount
|
||||
Log::debug('Finding a mapped account based on', $array);
|
||||
|
||||
$search = intval($array['mapped'] ?? 0);
|
||||
$account = $this->repository->find($search);
|
||||
$account = $this->repository->findNull($search);
|
||||
|
||||
if (null === $account->id) {
|
||||
if (null === $account) {
|
||||
Log::error(sprintf('There is no account with id #%d. Invalid mapping will be ignored!', $search));
|
||||
|
||||
return null;
|
||||
@@ -382,7 +382,7 @@ class ImportAccount
|
||||
|
||||
// 4: if search for an asset account, fall back to given "default account" (mandatory)
|
||||
if (AccountType::ASSET === $this->expectedType) {
|
||||
$this->account = $this->repository->find($this->defaultAccountId);
|
||||
$this->account = $this->repository->findNull($this->defaultAccountId);
|
||||
Log::debug(sprintf('Fall back to default account #%d "%s"', $this->account->id, $this->account->name));
|
||||
|
||||
return true;
|
||||
|
@@ -54,6 +54,8 @@ class ImportJournal
|
||||
public $hash;
|
||||
/** @var array */
|
||||
public $metaDates = [];
|
||||
/** @var array */
|
||||
public $metaFields = [];
|
||||
/** @var string */
|
||||
public $notes = '';
|
||||
/** @var ImportAccount */
|
||||
@@ -192,6 +194,18 @@ class ImportJournal
|
||||
case 'account-id':
|
||||
$this->asset->setAccountId($array);
|
||||
break;
|
||||
case 'sepa-cc':
|
||||
case 'sepa-ct-op':
|
||||
case 'sepa-ct-id':
|
||||
case 'sepa-db':
|
||||
case 'sepa-country':
|
||||
case 'sepa-ep':
|
||||
case 'sepa-ci':
|
||||
$value = trim(strval($array['value']));
|
||||
if (strlen($value) > 0) {
|
||||
$this->metaFields[$array['role']] = $value;
|
||||
}
|
||||
break;
|
||||
case 'amount':
|
||||
$this->amount = $array;
|
||||
break;
|
||||
@@ -252,12 +266,6 @@ class ImportJournal
|
||||
case 'description':
|
||||
$this->description .= $array['value'];
|
||||
break;
|
||||
case 'sepa-ct-op':
|
||||
case 'sepa-ct-id':
|
||||
case 'sepa-db':
|
||||
$this->notes .= ' ' . $array['value'];
|
||||
$this->notes = trim($this->notes);
|
||||
break;
|
||||
case 'note':
|
||||
$this->notes .= ' ' . $array['value'];
|
||||
$this->notes = trim($this->notes);
|
||||
@@ -265,6 +273,9 @@ class ImportJournal
|
||||
case 'external-id':
|
||||
$this->externalId = $array['value'];
|
||||
break;
|
||||
case 'internal-reference':
|
||||
$this->metaFields['internal_reference'] = $array['value'];
|
||||
break;
|
||||
case '_ignore':
|
||||
break;
|
||||
case 'ing-debit-credit':
|
||||
@@ -299,6 +310,15 @@ class ImportJournal
|
||||
case 'date-process':
|
||||
$this->metaDates['process_date'] = $array['value'];
|
||||
break;
|
||||
case 'date-due':
|
||||
$this->metaDates['due_date'] = $array['value'];
|
||||
break;
|
||||
case 'date-payment':
|
||||
$this->metaDates['payment_date'] = $array['value'];
|
||||
break;
|
||||
case 'date-invoice':
|
||||
$this->metaDates['invoice_date'] = $array['value'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user