diff --git a/src/import-export/qif-import/druid-qif-import.c b/src/import-export/qif-import/druid-qif-import.c
index 2517fa0d05..4ffe94cd62 100644
--- a/src/import-export/qif-import/druid-qif-import.c
+++ b/src/import-export/qif-import/druid-qif-import.c
@@ -56,6 +56,7 @@
#define DRUID_QIF_IMPORT_CM_CLASS "druid-qif-import"
#define GCONF_SECTION "dialogs/import/qif"
#define GCONF_NAME_SHOW_DOC "show_doc"
+#define GCONF_NAME_DEFAULT_TRANSACTION_STATUS "default_status"
#define PREV_ROW "prev_row"
@@ -165,6 +166,7 @@ struct _qifimportwindow
SCM imported_account_tree;
SCM match_transactions;
+ SCM transaction_status;
int selected_transaction;
};
@@ -2637,12 +2639,13 @@ gnc_ui_qif_import_convert_progress_show_cb(GtkWidget *widget,
/* This step will fill 70% of the bar. */
gnc_progress_dialog_push(wind->convert_progress, 0.7);
retval = scm_apply(qif_to_gnc,
- SCM_LIST7(wind->imported_files,
+ SCM_LIST8(wind->imported_files,
wind->acct_map_info,
wind->cat_map_info,
wind->memo_map_info,
wind->security_hash,
scm_makfrom0str(currname),
+ wind->transaction_status,
progress),
SCM_EOL);
gnc_progress_dialog_pop(wind->convert_progress);
@@ -3214,6 +3217,8 @@ static void
get_preferences(QIFImportWindow *wind)
{
GError * err = NULL;
+ gchar *status_pref = NULL;
+ gchar tmp_transaction_status = 'n';
g_return_if_fail(wind);
@@ -3231,6 +3236,27 @@ get_preferences(QIFImportWindow *wind)
g_warning("QIF import: Documentation pages will be shown by default.");
wind->show_doc_pages = TRUE;
}
+
+ /* Clear / Reconcile transaction if not specified in QIF file. */
+ status_pref = gnc_gconf_get_string(
+ GCONF_SECTION, GCONF_NAME_DEFAULT_TRANSACTION_STATUS, &err);
+ if (err != NULL)
+ {
+ g_warning("QIF import: gnc_gconf_get_string error: %s", err->message);
+ g_error_free(err);
+ g_warning("QIF import: Couldn't get %s setting from gconf.",
+ GCONF_NAME_DEFAULT_TRANSACTION_STATUS);
+ } else {
+ if (g_strcmp0(status_pref, "cleared") == 0)
+ {
+ tmp_transaction_status = 'c';
+ } else if (g_strcmp0(status_pref, "reconciled") == 0)
+ {
+ tmp_transaction_status = 'y';
+ }
+ }
+ g_free(status_pref);
+ wind->transaction_status = SCM_MAKE_CHAR(tmp_transaction_status);
}
diff --git a/src/import-export/qif-import/qif-to-gnc.scm b/src/import-export/qif-import/qif-to-gnc.scm
index 8a50e6aa9a..90f0ffffcf 100644
--- a/src/import-export/qif-import/qif-to-gnc.scm
+++ b/src/import-export/qif-import/qif-to-gnc.scm
@@ -215,7 +215,9 @@
(define (qif-import:qif-to-gnc qif-files-list
qif-acct-map qif-cat-map
qif-memo-map stock-map
- default-currency-name progress-dialog)
+ default-currency-name
+ transaction-status-pref
+ progress-dialog)
;; This procedure does all the work. We'll define it, then call it safely.
(define (private-convert)
@@ -392,6 +394,7 @@
qif-acct-map
qif-cat-map
qif-memo-map
+ transaction-status-pref
progress-dialog)
;; rebalance and commit everything
@@ -423,6 +426,7 @@
(define (qif-import:qif-xtn-to-gnc-xtn qif-xtn qif-file gnc-xtn
gnc-acct-hash
qif-acct-map qif-cat-map qif-memo-map
+ transaction-status-pref
progress-dialog)
(let ((splits (qif-xtn:splits qif-xtn))
(gnc-near-split (xaccMallocSplit (gnc-get-current-book)))
@@ -490,10 +494,15 @@
;; the debit/credit lines. See bug 495219 for more information.
(xaccTransSetNotes gnc-xtn qif-memo)))
+ ;; Look for the transaction status (QIF "C" line). When it exists, apply
+ ;; the cleared (c) or reconciled (y) status to the split. Otherwise, apply
+ ;; user preference.
(if (eq? qif-cleared 'cleared)
- (xaccSplitSetReconcile gnc-near-split #\c))
- (if (eq? qif-cleared 'reconciled)
- (xaccSplitSetReconcile gnc-near-split #\y))
+ (xaccSplitSetReconcile gnc-near-split #\c)
+ (if (eq? qif-cleared 'reconciled)
+ (xaccSplitSetReconcile gnc-near-split #\y)
+ ;; Apply user preference by default.
+ (xaccSplitSetReconcile gnc-near-split transaction-status-pref)))
(if (not qif-security)
(begin
diff --git a/src/import-export/qif-import/qif.glade b/src/import-export/qif-import/qif.glade
index 76efdb9284..30f9258807 100644
--- a/src/import-export/qif-import/qif.glade
+++ b/src/import-export/qif-import/qif.glade
@@ -1380,7 +1380,74 @@ Click "Cancel" to abort the QIF import process.
-
+
+ _Reconciled
+ True
+ True
+ False
+ When the status is not specified in a QIF file, the transactions are marked as reconciled.
+ True
+ True
+
+
+ 6
+ 7
+ GTK_FILL
+
+ 12
+
+
+
+
+ _Cleared
+ True
+ True
+ False
+ When the status is not specified in a QIF file, the transactions are marked as cleared.
+ True
+ True
+ gconf/dialogs/import/qif/default_status/reconciled
+
+
+ 5
+ 6
+ GTK_FILL
+
+ 12
+
+
+
+
+ _Not cleared
+ True
+ True
+ True
+ When the status is not specified in a QIF file, the transactions are marked as not cleared.
+ True
+ True
+ gconf/dialogs/import/qif/default_status/reconciled
+
+
+ 4
+ 5
+ GTK_FILL
+
+ 12
+
+
+
+
+ True
+ 0
+ Default transaction status (overridden by the status given by the QIF file):
+
+
+ 4
+ 2
+ 3
+ GTK_FILL
+
+
diff --git a/src/import-export/qif-import/schemas/apps_gnucash_import_qif.schemas.in b/src/import-export/qif-import/schemas/apps_gnucash_import_qif.schemas.in
index 2cef19b19c..fab61fffc9 100644
--- a/src/import-export/qif-import/schemas/apps_gnucash_import_qif.schemas.in
+++ b/src/import-export/qif-import/schemas/apps_gnucash_import_qif.schemas.in
@@ -16,5 +16,19 @@
+
+ /schemas/apps/gnucash/dialogs/import/qif/default_status
+ /apps/gnucash/dialogs/import/qif/default_status
+ gnucash
+ string
+ not_cleared
+
+ Default QIF transaction status
+
+ Default status for QIF transaction when not specified in QIF file.
+
+
+
+