mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
[gnc-ab-utils] concise string accumulator
This commit is contained in:
parent
ecd2cdf425
commit
68aced362c
@ -510,50 +510,16 @@ ab_ultimate_creditor_debtor_to_gnc (const AB_TRANSACTION *ab_trans,
|
||||
gchar *
|
||||
gnc_ab_description_to_gnc (const AB_TRANSACTION *ab_trans, gboolean is_ofx)
|
||||
{
|
||||
/* Description */
|
||||
gchar *description = gnc_ab_get_purpose (ab_trans, is_ofx);
|
||||
gchar *other_name = gnc_ab_get_remote_name (ab_trans);
|
||||
gchar *ultimate = ab_ultimate_creditor_debtor_to_gnc (ab_trans, is_ofx);
|
||||
gchar *retval = NULL;
|
||||
GList *acc = NULL;
|
||||
gchar *retval;
|
||||
|
||||
if (ultimate)
|
||||
retval = ultimate;
|
||||
if (description)
|
||||
{
|
||||
if (retval)
|
||||
{
|
||||
char *tmp = g_strdup_printf ("%s; %s", retval, description);
|
||||
g_free (retval);
|
||||
g_free (description);
|
||||
retval = tmp;
|
||||
}
|
||||
else
|
||||
{
|
||||
retval = description;
|
||||
}
|
||||
}
|
||||
acc = g_list_prepend (acc, gnc_ab_get_remote_name (ab_trans));
|
||||
acc = g_list_prepend (acc, gnc_ab_get_purpose (ab_trans, is_ofx));
|
||||
acc = g_list_prepend (acc, ab_ultimate_creditor_debtor_to_gnc (ab_trans, is_ofx));
|
||||
retval = gnc_g_list_stringjoin (acc, "; ");
|
||||
|
||||
if (other_name)
|
||||
{
|
||||
if (retval)
|
||||
{
|
||||
char *tmp = g_strdup_printf ("%s; %s", retval, other_name);
|
||||
g_free (retval);
|
||||
g_free (other_name);
|
||||
retval = tmp;
|
||||
}
|
||||
else
|
||||
{
|
||||
retval = other_name;
|
||||
}
|
||||
}
|
||||
|
||||
if (!retval)
|
||||
{
|
||||
retval = g_strdup (_("Unspecified"));
|
||||
}
|
||||
|
||||
return retval;
|
||||
g_list_free_full (acc, g_free);
|
||||
return retval ? retval : g_strdup (_("Unspecified"));
|
||||
}
|
||||
|
||||
gchar *
|
||||
|
Loading…
Reference in New Issue
Block a user