Disable inclusion of transaction text for OFX transactions in the description.

OFX puts rather useless information in the transaction text that makes
the description overly long with the important part at the end.
This commit is contained in:
John Ralls 2017-10-15 15:56:40 -07:00
parent 25e3b22a4a
commit b6d3c0e581
4 changed files with 14 additions and 11 deletions

View File

@ -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,

View File

@ -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);

View File

@ -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);

View File

@ -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