diff --git a/kapital_bank/bank_api.py b/kapital_bank/bank_api.py index 9a0dbcc..b0ad19f 100644 --- a/kapital_bank/bank_api.py +++ b/kapital_bank/bank_api.py @@ -1412,6 +1412,14 @@ def get_card_statement_transactions(from_date, to_date, card_account_number, log # Purpose (operationName serves as both purpose and counterparty description) operation_name = (txn.get("operationName") or "").strip() + # Build enriched description from all available remark fields + desc_parts = [operation_name] if operation_name else [] + for field in ("fullRemark", "shortRemark", "description"): + val = (txn.get(field) or "").strip() + if val and val not in desc_parts: + desc_parts.append(val) + full_description = " || ".join(desc_parts) + transactions.append({ "ref_no": txn_id, "date": str(parsed_date), @@ -1421,6 +1429,7 @@ def get_card_statement_transactions(from_date, to_date, card_account_number, log "currency": currency, "drcr": dr_cr, "purpose": operation_name, + "full_description": full_description, "source_type": "card", "source_label": f"Card: {pan}", }) @@ -2202,7 +2211,7 @@ def _import_one_bank_transaction(txn_data, settings, voen_to_party, name_to_part bt.deposit = amount if dr_cr == "C" else 0 bt.withdrawal = amount if dr_cr == "D" else 0 bt.currency = currency - bt.description = purpose + bt.description = txn_data.get("full_description") or purpose bt.reference_number = ref_no bt.transaction_id = ref_no bt.company = settings.default_company diff --git a/kapital_bank/client/bank_transaction.js b/kapital_bank/client/bank_transaction.js index 847fd36..d6ecf41 100644 --- a/kapital_bank/client/bank_transaction.js +++ b/kapital_bank/client/bank_transaction.js @@ -527,7 +527,16 @@ KBBTImport.import = { }, showTransactionSelection: function(txns) { - let txnTable = '
'; + const hasCardTxns = txns.some(t => t.source_type === 'card'); + + let txnTable = ''; + if (hasCardTxns) { + txnTable += '
'; + txnTable += '⚠️ ' + __('Card transactions may already be imported from other accounts. The bank uses different reference numbers for card and account statements, so duplicates cannot be detected automatically.'); + txnTable += '
'; + } + + txnTable += '
'; txnTable += '' + '' + '' + @@ -555,7 +564,7 @@ KBBTImport.import = { '' + '' + '' + - '' + + '' + ''; }); diff --git a/kapital_bank/client/payment_entry.js b/kapital_bank/client/payment_entry.js index ca18199..b40c759 100644 --- a/kapital_bank/client/payment_entry.js +++ b/kapital_bank/client/payment_entry.js @@ -485,7 +485,16 @@ KBImport.import = { }, showTransactionSelection: function(txns) { - let txnTable = '
' + __('Ref No') + '' + (txn.counterparty || '') + '' + amountFmt + ' ' + (txn.currency || '') + '' + drcrLabel + '' + (txn.purpose || '') + '' + (txn.full_description || txn.purpose || '') + '
'; + const hasCardTxns = txns.some(t => t.source_type === 'card'); + + let txnTable = ''; + if (hasCardTxns) { + txnTable += '
'; + txnTable += '⚠️ ' + __('Card transactions may already be imported from other accounts. The bank uses different reference numbers for card and account statements, so duplicates cannot be detected automatically.'); + txnTable += '
'; + } + + txnTable += '
'; txnTable += '' + '' + '' + @@ -513,7 +522,7 @@ KBImport.import = { '' + '' + '' + - '' + + '' + ''; });
' + __('Ref No') + '' + (txn.counterparty || '') + '' + amountFmt + ' ' + (txn.currency || '') + '' + drcrLabel + '' + (txn.purpose || '') + '' + (txn.full_description || txn.purpose || '') + '