diff --git a/gnucash/import-export/aqb/dialog-ab-trans.c b/gnucash/import-export/aqb/dialog-ab-trans.c index 718e530e03e..1a45cca2e20 100644 --- a/gnucash/import-export/aqb/dialog-ab-trans.c +++ b/gnucash/import-export/aqb/dialog-ab-trans.c @@ -688,8 +688,8 @@ gnc_ab_trans_dialog_verify_values(GncABTransDialog *td) gnc_ab_trans_dialog_entry_set (amount_entry, "", NULL); } - /* Check transaction purpose */ - purpose = gnc_ab_get_purpose(td->ab_trans); + /* Check transaction purpose. OFX doesn't do transfers. */ + purpose = gnc_ab_get_purpose(td->ab_trans, FALSE); if (!purpose || !strlen(purpose)) { gnc_ab_trans_dialog_entry_set (td->purpose_entry, diff --git a/gnucash/import-export/aqb/gnc-ab-transfer.c b/gnucash/import-export/aqb/gnc-ab-transfer.c index ec21267aa5b..74f337c2478 100644 --- a/gnucash/import-export/aqb/gnc-ab-transfer.c +++ b/gnucash/import-export/aqb/gnc-ab-transfer.c @@ -238,7 +238,8 @@ gnc_ab_maketrans(GtkWidget *parent, Account *gnc_acc, gnc_xfer_dialog_set_amount_sensitive(xfer_dialog, FALSE); gnc_xfer_dialog_set_date_sensitive(xfer_dialog, FALSE); - description = gnc_ab_description_to_gnc(ab_trans); + /* OFX doesn't do transfers. */ + description = gnc_ab_description_to_gnc(ab_trans, FALSE); gnc_xfer_dialog_set_description(xfer_dialog, description); g_free(description); diff --git a/gnucash/import-export/aqb/gnc-ab-utils.c b/gnucash/import-export/aqb/gnc-ab-utils.c index 131481cb9e7..bf04ea873b3 100644 --- a/gnucash/import-export/aqb/gnc-ab-utils.c +++ b/gnucash/import-export/aqb/gnc-ab-utils.c @@ -363,7 +363,7 @@ gnc_ab_get_remote_name(const AB_TRANSACTION *ab_trans) } gchar * -gnc_ab_get_purpose(const AB_TRANSACTION *ab_trans) +gnc_ab_get_purpose(const AB_TRANSACTION *ab_trans, gboolean is_ofx) { const GWEN_STRINGLIST *ab_purpose; const char *ab_transactionText = NULL; @@ -371,7 +371,7 @@ gnc_ab_get_purpose(const AB_TRANSACTION *ab_trans) g_return_val_if_fail(ab_trans, g_strdup("")); - if (gnc_prefs_get_bool(GNC_PREFS_GROUP_AQBANKING, GNC_PREF_USE_TRANSACTION_TXT)) + if (!is_ofx && gnc_prefs_get_bool(GNC_PREFS_GROUP_AQBANKING, GNC_PREF_USE_TRANSACTION_TXT)) { /* According to AqBanking, some of the non-swift lines have a special * meaning. Some banks place valuable text into the transaction text, @@ -393,10 +393,10 @@ gnc_ab_get_purpose(const AB_TRANSACTION *ab_trans) } gchar * -gnc_ab_description_to_gnc(const AB_TRANSACTION *ab_trans) +gnc_ab_description_to_gnc(const AB_TRANSACTION *ab_trans, gboolean is_ofx) { /* Description */ - gchar *description = gnc_ab_get_purpose(ab_trans); + gchar *description = gnc_ab_get_purpose(ab_trans, is_ofx); gchar *other_name = gnc_ab_get_remote_name(ab_trans); gchar *retval; @@ -527,8 +527,10 @@ gnc_ab_trans_to_gnc(const AB_TRANSACTION *ab_trans, Account *gnc_acc) /* Trans-Num or Split-Action set with gnc_set_num_action below per book * option */ + fitid = AB_Transaction_GetFiId(ab_trans); + /* Description */ - description = gnc_ab_description_to_gnc(ab_trans); + description = gnc_ab_description_to_gnc(ab_trans, (fitid && *fitid)); xaccTransSetDescription(gnc_trans, description); g_free(description); @@ -549,10 +551,10 @@ gnc_ab_trans_to_gnc(const AB_TRANSACTION *ab_trans, Account *gnc_acc) gnc_set_num_action (gnc_trans, split, custref, NULL); /* Set OFX unique transaction ID */ - fitid = AB_Transaction_GetFiId(ab_trans); if (fitid && *fitid) gnc_import_set_split_online_id(split, fitid); + /* FIXME: Extract function */ { /* Amount into the split */ const AB_VALUE *ab_value = AB_Transaction_GetValue(ab_trans); diff --git a/gnucash/import-export/aqb/gnc-ab-utils.h b/gnucash/import-export/aqb/gnc-ab-utils.h index ca7153dec4c..3f3fc4467f9 100644 --- a/gnucash/import-export/aqb/gnc-ab-utils.h +++ b/gnucash/import-export/aqb/gnc-ab-utils.h @@ -179,7 +179,7 @@ gchar *gnc_ab_get_remote_name(const AB_TRANSACTION *ab_trans); * @param ab_trans AqBanking transaction * @return A newly allocated string, may be "" */ -gchar *gnc_ab_get_purpose(const AB_TRANSACTION *ab_trans); +gchar *gnc_ab_get_purpose(const AB_TRANSACTION *ab_trans, gboolean is_ofx); /** * Create the appropriate description field for a GnuCash Transaction by the @@ -189,7 +189,7 @@ gchar *gnc_ab_get_purpose(const AB_TRANSACTION *ab_trans); * @param ab_trans AqBanking transaction * @return A newly allocated string, may be "" */ -gchar *gnc_ab_description_to_gnc(const AB_TRANSACTION *ab_trans); +gchar *gnc_ab_description_to_gnc(const AB_TRANSACTION *ab_trans, gboolean is_ofx); /** * Create the appropriate memo field for a GnuCash Split by the information