mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-17 08:14:25 +08:00
change the type of balance modification transaction to income or expense for imported feidee mymoney transaction data
This commit is contained in:
@@ -49,8 +49,12 @@ type DataTableTransactionDataImporter struct {
|
||||
transactionTypeMapping map[models.TransactionType]string
|
||||
geoLocationSeparator string
|
||||
transactionTagSeparator string
|
||||
postProcessFunc DataTableTransactionDataImporterPostProcessFunc
|
||||
}
|
||||
|
||||
// DataTableTransactionDataImporterPostProcessFunc represents item post process function of DataTableTransactionDataImporter
|
||||
type DataTableTransactionDataImporterPostProcessFunc func(core.Context, *models.ImportTransaction) error
|
||||
|
||||
func (c *DataTableTransactionDataExporter) buildExportedContent(ctx core.Context, dataTableBuilder DataTableBuilder, uid int64, transactions []*models.Transaction, accountMap map[int64]*models.Account, categoryMap map[int64]*models.TransactionCategory, tagMap map[int64]*models.TransactionTag, allTagIndexes map[int64][]int64) error {
|
||||
for i := 0; i < len(transactions); i++ {
|
||||
transaction := transactions[i]
|
||||
@@ -492,6 +496,15 @@ func (c *DataTableTransactionDataImporter) parseImportedData(ctx core.Context, u
|
||||
OriginalTagNames: tagNames,
|
||||
}
|
||||
|
||||
if c.postProcessFunc != nil {
|
||||
err = c.postProcessFunc(ctx, transaction)
|
||||
|
||||
if err != nil {
|
||||
log.Errorf(ctx, "[data_table_transaction_data_converter.parseImportedData] cannot post process data row \"index:%d\" for user \"uid:%d\", because %s", dataRowIndex, user.Uid, err.Error())
|
||||
return nil, nil, nil, nil, err
|
||||
}
|
||||
}
|
||||
|
||||
allNewTransactions = append(allNewTransactions, transaction)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user