mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Can now import and handle external ID field.
This commit is contained in:
parent
71b63bd33b
commit
49138eb03a
@ -91,7 +91,7 @@ class TransactionJournalFactory
|
||||
|
||||
// store date meta fields (if present):
|
||||
$fields = ['sepa-cc', 'sepa-ct-op', 'sepa-ct-id', 'sepa-db', 'sepa-country', 'sepa-ep', 'sepa-ci', 'interest_date', 'book_date', 'process_date',
|
||||
'due_date', 'payment_date', 'invoice_date', 'internal_reference', 'bunq_payment_id','importHash'];
|
||||
'due_date', 'payment_date', 'invoice_date', 'internal_reference', 'bunq_payment_id', 'importHash', 'external_id'];
|
||||
|
||||
foreach ($fields as $field) {
|
||||
$this->storeMeta($journal, $data, $field);
|
||||
|
@ -158,6 +158,14 @@ class ImportJournal
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getExternalId(): string
|
||||
{
|
||||
return $this->externalId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
@ -231,7 +239,6 @@ class ImportJournal
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $hash
|
||||
*/
|
||||
|
@ -199,11 +199,16 @@ class ImportStorage
|
||||
|
||||
throw new FireflyException($message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Search for journals with the same external ID.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
unset($parameters);
|
||||
$this->addStep();
|
||||
|
||||
|
||||
try {
|
||||
$budget = $importJournal->budget->getBudget();
|
||||
$category = $importJournal->category->getCategory();
|
||||
$bill = $importJournal->bill->getBill();
|
||||
@ -222,6 +227,7 @@ class ImportStorage
|
||||
Log::debug(
|
||||
sprintf('Will make #%s (%s) the source and #%s (%s) the destination.', $source->id, $source->name, $destination->id, $destination->name)
|
||||
);
|
||||
|
||||
$data = [
|
||||
'user' => $this->job->user_id,
|
||||
'type' => $transactionType,
|
||||
@ -240,6 +246,7 @@ class ImportStorage
|
||||
'invoice_date' => $importJournal->getMetaDate('invoice_date'),
|
||||
'internal_reference' => $importJournal->metaFields['internal_reference'] ?? null,
|
||||
'notes' => $importJournal->notes,
|
||||
'external_id' => $importJournal->getExternalId(),
|
||||
'sepa-cc' => $importJournal->getMetaString('sepa-cc'),
|
||||
'sepa-ct-op' => $importJournal->getMetaString('sepa-ct-op'),
|
||||
'sepa-ct-id' => $importJournal->getMetaString('sepa-ct-id'),
|
||||
@ -271,6 +278,8 @@ class ImportStorage
|
||||
],
|
||||
],
|
||||
];
|
||||
$factoryJournal = null;
|
||||
try {
|
||||
$factoryJournal = $this->factory->create($data);
|
||||
$this->journals->push($factoryJournal);
|
||||
} catch (FireflyException $e) {
|
||||
@ -278,11 +287,12 @@ class ImportStorage
|
||||
Log::error($e->getTraceAsString());
|
||||
}
|
||||
|
||||
// double add step because "match bills" no longer happens.
|
||||
$this->addStep();
|
||||
$this->addStep();
|
||||
|
||||
// run rules if config calls for it:
|
||||
if (true === $this->applyRules) {
|
||||
if (true === $this->applyRules && null !== $factoryJournal) {
|
||||
Log::info('Will apply rules to this journal.');
|
||||
$this->applyRules($factoryJournal);
|
||||
}
|
||||
@ -291,6 +301,8 @@ class ImportStorage
|
||||
if (!(true === $this->applyRules)) {
|
||||
Log::info('Will NOT apply rules to this journal.');
|
||||
}
|
||||
|
||||
// double add step because some other extra thing was removed here.
|
||||
$this->addStep();
|
||||
$this->addStep();
|
||||
|
||||
|
@ -111,6 +111,7 @@ return [
|
||||
'sepa-cc' => 'SEPA Clearing Code',
|
||||
'sepa-ep' => 'SEPA External Purpose',
|
||||
'sepa-ci' => 'SEPA Creditor Identifier',
|
||||
'external_id' => 'External ID',
|
||||
'account_at_bunq' => 'Account with bunq',
|
||||
'file_name' => 'File name',
|
||||
'file_size' => 'File size',
|
||||
|
@ -210,7 +210,7 @@
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{# all other meta values #}
|
||||
{% for metaField in ['internal_reference','sepa-ct-id','sepa-ct-op','sepa-db','sepa-country','sepa-cc','sepa-ep','sepa-ci'] %}
|
||||
{% for metaField in ['external_id','internal_reference','sepa-ct-id','sepa-ct-op','sepa-db','sepa-country','sepa-cc','sepa-ep','sepa-ci'] %}
|
||||
{% if journalHasMeta(journal, metaField) %}
|
||||
<tr>
|
||||
<td>{{ trans('list.'~metaField) }}</td>
|
||||
|
Loading…
Reference in New Issue
Block a user