mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Add sanity checks and ask user when there are no purpose lines.
2005-05-23 Christian Stimming <stimming@tuhh.de> * src/import-export/hbci/dialog-hbcitrans.c: Add sanity checks and ask user when there are no purpose lines. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@11051 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
19ae070338
commit
a056e3e87b
@ -1,3 +1,8 @@
|
||||
2005-05-23 Christian Stimming <stimming@tuhh.de>
|
||||
|
||||
* src/import-export/hbci/dialog-hbcitrans.c: Add sanity checks and
|
||||
ask user when there are no purpose lines.
|
||||
|
||||
2005-05-06 Christian Stimming <stimming@tuhh.de>
|
||||
|
||||
* src/import-export/hbci/druid-hbci-initial.c (on_aqhbci_button):
|
||||
|
@ -504,6 +504,27 @@ int gnc_hbci_dialog_run_until_ok(HBCITransDialog *td,
|
||||
continue;
|
||||
} /* check Transaction_value */
|
||||
|
||||
{
|
||||
char *purpose = gnc_hbci_getpurpose (td->hbci_trans);
|
||||
printf ("%d: %s\n", strlen(purpose), purpose);
|
||||
if (strlen(purpose) == 0) {
|
||||
gtk_widget_show_all (td->dialog);
|
||||
values_ok = !gnc_verify_dialog
|
||||
(GTK_WIDGET (td->dialog),
|
||||
TRUE,
|
||||
"%s",
|
||||
_("You did not enter any transaction purpose. A purpose is \n"
|
||||
"required for an online transfer.\n"
|
||||
"\n"
|
||||
"Do you want to enter the job again?"));
|
||||
if (values_ok) {
|
||||
AB_Transaction_free (td->hbci_trans);
|
||||
return -1;
|
||||
}
|
||||
continue;
|
||||
} /* check Transaction_purpose */
|
||||
}
|
||||
|
||||
/* FIXME: If this is a direct debit, set the textkey/ "Textschluessel"/
|
||||
transactionCode according to some GUI selection here!! */
|
||||
/*if (td->trans_type == SINGLE_DEBITNOTE)
|
||||
|
@ -533,10 +533,9 @@ static void *gnc_list_string_cb (const char *string, void *user_data)
|
||||
char *gnc_hbci_descr_tognc (const AB_TRANSACTION *h_trans)
|
||||
{
|
||||
/* Description */
|
||||
char *h_descr = NULL;
|
||||
char *h_descr = gnc_hbci_getpurpose (h_trans);
|
||||
char *othername = NULL;
|
||||
char *g_descr;
|
||||
const GWEN_STRINGLIST *h_purpose = AB_Transaction_GetPurpose (h_trans);
|
||||
const GWEN_STRINGLIST *h_remotename = AB_Transaction_GetRemoteName (h_trans);
|
||||
struct cb_struct cb_object;
|
||||
|
||||
@ -544,16 +543,7 @@ char *gnc_hbci_descr_tognc (const AB_TRANSACTION *h_trans)
|
||||
iconv_open(gnc_hbci_book_encoding(), gnc_hbci_AQBANKING_encoding());
|
||||
g_assert(cb_object.gnc_iconv_handler != (iconv_t)(-1));
|
||||
|
||||
/* Don't use list_string_concat_delim here since we need to
|
||||
g_strstrip every single element of the string list, which is
|
||||
only done in our callback gnc_list_string_cb. The separator is
|
||||
also set there. */
|
||||
cb_object.result = &h_descr;
|
||||
if (h_purpose)
|
||||
GWEN_StringList_ForEach (h_purpose,
|
||||
&gnc_list_string_cb,
|
||||
&cb_object);
|
||||
|
||||
/* Get othername */
|
||||
cb_object.result = &othername;
|
||||
if (h_remotename)
|
||||
GWEN_StringList_ForEach (h_remotename,
|
||||
@ -563,14 +553,14 @@ char *gnc_hbci_descr_tognc (const AB_TRANSACTION *h_trans)
|
||||
|
||||
if (othername && (strlen (othername) > 0))
|
||||
g_descr =
|
||||
((h_descr && (strlen (h_descr) > 0)) ?
|
||||
((strlen (h_descr) > 0) ?
|
||||
g_strdup_printf ("%s; %s",
|
||||
h_descr,
|
||||
othername) :
|
||||
g_strdup (othername));
|
||||
else
|
||||
g_descr =
|
||||
((h_descr && (strlen (h_descr) > 0)) ?
|
||||
((strlen (h_descr) > 0) ?
|
||||
g_strdup (h_descr) :
|
||||
g_strdup (_("Unspecified")));
|
||||
|
||||
@ -580,6 +570,31 @@ char *gnc_hbci_descr_tognc (const AB_TRANSACTION *h_trans)
|
||||
return g_descr;
|
||||
}
|
||||
|
||||
char *gnc_hbci_getpurpose (const AB_TRANSACTION *h_trans)
|
||||
{
|
||||
/* Description */
|
||||
char *h_descr = NULL;
|
||||
char *g_descr;
|
||||
const GWEN_STRINGLIST *h_purpose = AB_Transaction_GetPurpose (h_trans);
|
||||
struct cb_struct cb_object;
|
||||
|
||||
cb_object.gnc_iconv_handler =
|
||||
iconv_open(gnc_hbci_book_encoding(), gnc_hbci_AQBANKING_encoding());
|
||||
g_assert(cb_object.gnc_iconv_handler != (iconv_t)(-1));
|
||||
|
||||
cb_object.result = &h_descr;
|
||||
if (h_purpose)
|
||||
GWEN_StringList_ForEach (h_purpose,
|
||||
&gnc_list_string_cb,
|
||||
&cb_object);
|
||||
|
||||
g_descr = g_strdup (h_descr ? h_descr : "");
|
||||
|
||||
iconv_close(cb_object.gnc_iconv_handler);
|
||||
free (h_descr);
|
||||
return g_descr;
|
||||
}
|
||||
|
||||
char *gnc_hbci_memo_tognc (const AB_TRANSACTION *h_trans)
|
||||
{
|
||||
/* Memo in the Split. HBCI's transactionText contains strings like
|
||||
|
@ -109,6 +109,10 @@ char *gnc_hbci_descr_tognc (const AB_TRANSACTION *h_trans);
|
||||
* string must be g_free'd by the caller. */
|
||||
char *gnc_hbci_memo_tognc (const AB_TRANSACTION *h_trans);
|
||||
|
||||
/* Retrieve the merged purpose fields from the transaction. The
|
||||
* returned string must be g_free'd by the caller. If there was no
|
||||
* purpose, an empty (but allocated) string is returned. */
|
||||
char *gnc_hbci_getpurpose (const AB_TRANSACTION *h_trans);
|
||||
/** Return the first customer that can act on the specified account,
|
||||
or NULL if none was found (and an error message is printed on
|
||||
stdout). */
|
||||
|
Loading…
Reference in New Issue
Block a user