Skip to content

Firefly III: a personal finances manager

Make sure each source of transactions stores where it's from.

James Coleb1cc17d96e14
diff --git a/app/Api/V1/Requests/TransactionRequest.php b/app/Api/V1/Requests/TransactionRequest.php
index cbb2f74e71..293c43f1c0 100644
--- a/app/Api/V1/Requests/TransactionRequest.php
+++ b/app/Api/V1/Requests/TransactionRequest.php
@@ -73,6 +73,7 @@ class TransactionRequest extends Request
'invoice_date' => $this->date('invoice_date'),
'internal_reference' => $this->string('internal_reference'),
'notes' => $this->string('notes'),
+ 'original-source' => sprintf('api-v%s', config('firefly.api_version')),
'transactions' => $this->getTransactionData(),
];
diff --git a/app/Factory/TransactionJournalFactory.php b/app/Factory/TransactionJournalFactory.php
index 1dbd565934..7cdb758772 100644
--- a/app/Factory/TransactionJournalFactory.php
+++ b/app/Factory/TransactionJournalFactory.php
@@ -104,7 +104,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', '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) {
$this->storeMeta($journal, $data, $field);
diff --git a/app/Http/Requests/JournalFormRequest.php b/app/Http/Requests/JournalFormRequest.php
index ee45cfe6ce..d2881eec9e 100644
--- a/app/Http/Requests/JournalFormRequest.php
+++ b/app/Http/Requests/JournalFormRequest.php
@@ -75,6 +75,7 @@ class JournalFormRequest extends Request
'piggy_bank_name' => null,
'bill_id' => null,
'bill_name' => null,
+ 'original-source' => sprintf('gui-v%s', config('firefly.version')),
// transaction data:
'transactions' => [
diff --git a/app/Support/Import/Placeholder/ImportTransaction.php b/app/Support/Import/Placeholder/ImportTransaction.php
index 0d397561f7..9472e48d5a 100644
--- a/app/Support/Import/Placeholder/ImportTransaction.php
+++ b/app/Support/Import/Placeholder/ImportTransaction.php
@@ -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',
- '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));
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();
return;
diff --git a/app/Support/Import/Routine/Bunq/StageImportDataHandler.php b/app/Support/Import/Routine/Bunq/StageImportDataHandler.php
index 3920d988e4..2f9822b9fe 100644
--- a/app/Support/Import/Routine/Bunq/StageImportDataHandler.php
+++ b/app/Support/Import/Routine/Bunq/StageImportDataHandler.php
@@ -173,6 +173,7 @@ class StageImportDataHandler
'external_id' => $paymentId,
'notes' => null,
'bunq_payment_id' => $paymentId,
+ 'original-source' => sprintf('bunq-v%s', config('firefly.version')),
'transactions' => [
// single transaction:
[
diff --git a/app/Support/Import/Routine/Fake/StageFinalHandler.php b/app/Support/Import/Routine/Fake/StageFinalHandler.php
index bb93636f90..11cf6962f3 100644
--- a/app/Support/Import/Routine/Fake/StageFinalHandler.php
+++ b/app/Support/Import/Routine/Fake/StageFinalHandler.php
@@ -61,6 +61,7 @@ class StageFinalHandler
'piggy_bank_name' => null,
'bill_id' => null,
'bill_name' => null,
+ 'original-source' => sprintf('fake-import-v%s', config('firefly.version')),
// transaction data:
'transactions' => [
diff --git a/app/Support/Import/Routine/File/ImportableConverter.php b/app/Support/Import/Routine/File/ImportableConverter.php
index b12cb52216..1fc0103725 100644
--- a/app/Support/Import/Routine/File/ImportableConverter.php
+++ b/app/Support/Import/Routine/File/ImportableConverter.php
@@ -235,7 +235,7 @@ class ImportableConverter
'payment_date' => $this->convertDateValue($importable->meta['date-payment'] ?? null),
'invoice_date' => $this->convertDateValue($importable->meta['date-invoice'] ?? null),
'external_id' => $importable->externalId,
-
+ 'original-source' => $importable->meta['original-source'] ?? null,
// journal data:
'description' => $importable->description,
'piggy_bank_id' => null,
diff --git a/app/Support/Import/Routine/File/MappingConverger.php b/app/Support/Import/Routine/File/MappingConverger.php
index 50fa6352ad..bf855707dd 100644
--- a/app/Support/Import/Routine/File/MappingConverger.php
+++ b/app/Support/Import/Routine/File/MappingConverger.php
@@ -201,6 +201,12 @@ class MappingConverger
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;
}
diff --git a/app/Support/Import/Routine/Spectre/StageImportDataHandler.php b/app/Support/Import/Routine/Spectre/StageImportDataHandler.php
index bf1c29157c..2d81cbb82b 100644
--- a/app/Support/Import/Routine/Spectre/StageImportDataHandler.php
+++ b/app/Support/Import/Routine/Spectre/StageImportDataHandler.php
@@ -189,6 +189,7 @@ class StageImportDataHandler
'piggy_bank_name' => null,
'bill_id' => null,
'bill_name' => null,
+ 'original-source' => sprintf('spectre-v%s', config('firefly.version')),
// transaction data:
'transactions' => [
diff --git a/app/Support/Import/Routine/Ynab/ImportDataHandler.php b/app/Support/Import/Routine/Ynab/ImportDataHandler.php
index 0e97b2f5ea..01982df142 100644
--- a/app/Support/Import/Routine/Ynab/ImportDataHandler.php
+++ b/app/Support/Import/Routine/Ynab/ImportDataHandler.php
@@ -173,6 +173,7 @@ class ImportDataHandler
'piggy_bank_name' => null,
'bill_id' => null,
'bill_name' => null,
+ 'original-source' => sprintf('ynab-v%s', config('firefly.version')),
// transaction data:
'transactions' => [