Skip to content

Commit

Permalink
Disable inclusion of transaction text for OFX transactions in the des…
Browse files Browse the repository at this point in the history
…cription.

OFX puts rather useless information in the transaction text that makes
the description overly long with the important part at the end.
  • Loading branch information
jralls committed Oct 16, 2017
1 parent 25e3b22 commit b6d3c0e
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 11 deletions.
4 changes: 2 additions & 2 deletions gnucash/import-export/aqb/dialog-ab-trans.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion gnucash/import-export/aqb/gnc-ab-transfer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
14 changes: 8 additions & 6 deletions gnucash/import-export/aqb/gnc-ab-utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -363,15 +363,15 @@ 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;
gchar *gnc_description = NULL;

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,
Expand All @@ -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;

Expand Down Expand Up @@ -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);

Expand All @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions gnucash/import-export/aqb/gnc-ab-utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit b6d3c0e

Please sign in to comment.