mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-17 09:51:40 +00:00
Make sure each source of transactions stores where it's from.
This commit is contained in:
@@ -73,6 +73,7 @@ class TransactionRequest extends Request
|
|||||||
'invoice_date' => $this->date('invoice_date'),
|
'invoice_date' => $this->date('invoice_date'),
|
||||||
'internal_reference' => $this->string('internal_reference'),
|
'internal_reference' => $this->string('internal_reference'),
|
||||||
'notes' => $this->string('notes'),
|
'notes' => $this->string('notes'),
|
||||||
|
'original-source' => sprintf('api-v%s', config('firefly.api_version')),
|
||||||
'transactions' => $this->getTransactionData(),
|
'transactions' => $this->getTransactionData(),
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@@ -104,7 +104,7 @@ class TransactionJournalFactory
|
|||||||
// store date meta fields (if present):
|
// 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',
|
$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', 'recurrence_id', 'payment_date', 'invoice_date', 'internal_reference', 'bunq_payment_id', 'importHash', 'importHashV2',
|
'due_date', 'recurrence_id', 'payment_date', 'invoice_date', 'internal_reference', 'bunq_payment_id', 'importHash', 'importHashV2',
|
||||||
'external_id', 'sepa-batch-id'];
|
'external_id', 'sepa-batch-id','original-source'];
|
||||||
|
|
||||||
foreach ($fields as $field) {
|
foreach ($fields as $field) {
|
||||||
$this->storeMeta($journal, $data, $field);
|
$this->storeMeta($journal, $data, $field);
|
||||||
|
@@ -75,6 +75,7 @@ class JournalFormRequest extends Request
|
|||||||
'piggy_bank_name' => null,
|
'piggy_bank_name' => null,
|
||||||
'bill_id' => null,
|
'bill_id' => null,
|
||||||
'bill_name' => null,
|
'bill_name' => null,
|
||||||
|
'original-source' => sprintf('gui-v%s', config('firefly.version')),
|
||||||
|
|
||||||
// transaction data:
|
// transaction data:
|
||||||
'transactions' => [
|
'transactions' => [
|
||||||
|
@@ -182,10 +182,10 @@ class ImportTransaction
|
|||||||
}
|
}
|
||||||
|
|
||||||
$meta = ['sepa-ct-id', 'sepa-ct-op', 'sepa-db', 'sepa-cc', 'sepa-country', 'sepa-batch-id', 'sepa-ep', 'sepa-ci', 'internal-reference', 'date-interest',
|
$meta = ['sepa-ct-id', 'sepa-ct-op', 'sepa-db', 'sepa-cc', 'sepa-country', 'sepa-batch-id', 'sepa-ep', 'sepa-ci', 'internal-reference', 'date-interest',
|
||||||
'date-invoice', 'date-book', 'date-payment', 'date-process', 'date-due',];
|
'date-invoice', 'date-book', 'date-payment', 'date-process', 'date-due','original-source'];
|
||||||
Log::debug(sprintf('Now going to check role "%s".', $role));
|
Log::debug(sprintf('Now going to check role "%s".', $role));
|
||||||
if (\in_array($role, $meta, true)) {
|
if (\in_array($role, $meta, true)) {
|
||||||
Log::debug(sprintf('Role "%s" is in allowed meta roles, so store its value %s.', $role, $columnValue->getValue()));
|
Log::debug(sprintf('Role "%s" is in allowed meta roles, so store its value "%s".', $role, $columnValue->getValue()));
|
||||||
$this->meta[$role] = $columnValue->getValue();
|
$this->meta[$role] = $columnValue->getValue();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@@ -173,6 +173,7 @@ class StageImportDataHandler
|
|||||||
'external_id' => $paymentId,
|
'external_id' => $paymentId,
|
||||||
'notes' => null,
|
'notes' => null,
|
||||||
'bunq_payment_id' => $paymentId,
|
'bunq_payment_id' => $paymentId,
|
||||||
|
'original-source' => sprintf('bunq-v%s', config('firefly.version')),
|
||||||
'transactions' => [
|
'transactions' => [
|
||||||
// single transaction:
|
// single transaction:
|
||||||
[
|
[
|
||||||
|
@@ -61,6 +61,7 @@ class StageFinalHandler
|
|||||||
'piggy_bank_name' => null,
|
'piggy_bank_name' => null,
|
||||||
'bill_id' => null,
|
'bill_id' => null,
|
||||||
'bill_name' => null,
|
'bill_name' => null,
|
||||||
|
'original-source' => sprintf('fake-import-v%s', config('firefly.version')),
|
||||||
|
|
||||||
// transaction data:
|
// transaction data:
|
||||||
'transactions' => [
|
'transactions' => [
|
||||||
|
@@ -235,7 +235,7 @@ class ImportableConverter
|
|||||||
'payment_date' => $this->convertDateValue($importable->meta['date-payment'] ?? null),
|
'payment_date' => $this->convertDateValue($importable->meta['date-payment'] ?? null),
|
||||||
'invoice_date' => $this->convertDateValue($importable->meta['date-invoice'] ?? null),
|
'invoice_date' => $this->convertDateValue($importable->meta['date-invoice'] ?? null),
|
||||||
'external_id' => $importable->externalId,
|
'external_id' => $importable->externalId,
|
||||||
|
'original-source' => $importable->meta['original-source'] ?? null,
|
||||||
// journal data:
|
// journal data:
|
||||||
'description' => $importable->description,
|
'description' => $importable->description,
|
||||||
'piggy_bank_id' => null,
|
'piggy_bank_id' => null,
|
||||||
|
@@ -201,6 +201,12 @@ class MappingConverger
|
|||||||
Log::debug('Column skipped because value is empty.');
|
Log::debug('Column skipped because value is empty.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// add a special column value for the "source"
|
||||||
|
$columnValue = new ColumnValue;
|
||||||
|
$columnValue->setValue(sprintf('csv-import-v%s', config('firefly.version')));
|
||||||
|
$columnValue->setMappedValue(0);
|
||||||
|
$columnValue->setRole('original-source');
|
||||||
|
$return[] = $columnValue;
|
||||||
|
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
@@ -189,6 +189,7 @@ class StageImportDataHandler
|
|||||||
'piggy_bank_name' => null,
|
'piggy_bank_name' => null,
|
||||||
'bill_id' => null,
|
'bill_id' => null,
|
||||||
'bill_name' => null,
|
'bill_name' => null,
|
||||||
|
'original-source' => sprintf('spectre-v%s', config('firefly.version')),
|
||||||
|
|
||||||
// transaction data:
|
// transaction data:
|
||||||
'transactions' => [
|
'transactions' => [
|
||||||
|
@@ -173,6 +173,7 @@ class ImportDataHandler
|
|||||||
'piggy_bank_name' => null,
|
'piggy_bank_name' => null,
|
||||||
'bill_id' => null,
|
'bill_id' => null,
|
||||||
'bill_name' => null,
|
'bill_name' => null,
|
||||||
|
'original-source' => sprintf('ynab-v%s', config('firefly.version')),
|
||||||
|
|
||||||
// transaction data:
|
// transaction data:
|
||||||
'transactions' => [
|
'transactions' => [
|
||||||
|
Reference in New Issue
Block a user