2003-02-22 Christian Stimming <stimming@tuhh.de>

* src/import-export/hbci/dialog-hbcitrans.c: Quick fix to avoid
	online transfers being sent twice to the bank.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@8016 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Christian Stimming 2003-02-22 17:01:32 +00:00
parent d154e92e71
commit cad1302d86

View File

@ -46,6 +46,7 @@ gnc_hbci_trans (GtkWidget *parent,
HBCI_Transaction *trans = NULL; HBCI_Transaction *trans = NULL;
gint result; gint result;
const HBCI_Bank *bank; const HBCI_Bank *bank;
gboolean successful;
g_assert (api); g_assert (api);
g_assert (h_acc); g_assert (h_acc);
@ -189,12 +190,18 @@ gnc_hbci_trans (GtkWidget *parent,
from the boxes. */ from the boxes. */
gnome_dialog_close_hides (GNOME_DIALOG (dialog), TRUE); gnome_dialog_close_hides (GNOME_DIALOG (dialog), TRUE);
gtk_widget_show_all (GTK_WIDGET (dialog)); /* Repeat until HBCI action was successful or user pressed cancel */
do {
result = gnome_dialog_run_and_close (GNOME_DIALOG (dialog)); gtk_widget_show_all (dialog);
result = gnome_dialog_run (GNOME_DIALOG (dialog));
gtk_widget_hide_all (dialog);
/*result = gnome_dialog_run_and_close (GNOME_DIALOG (dialog));*/
/* printf("hbci_trans: result button was %d.\n", result); */ /* printf("hbci_trans: result button was %d.\n", result); */
/* Was cancel pressed or dialog closed? */ /* Was cancel pressed or dialog closed? 0 == execute now, 1 ==
scheduled for later execution (currently unimplemented) */
if ((result != 0) && (result != 1)) { if ((result != 0) && (result != 1)) {
gtk_widget_destroy (GTK_WIDGET (dialog)); gtk_widget_destroy (GTK_WIDGET (dialog));
return NULL; return NULL;
@ -263,26 +270,36 @@ gnc_hbci_trans (GtkWidget *parent,
job = HBCI_OutboxJobTransfer_OutboxJob (transfer_job); job = HBCI_OutboxJobTransfer_OutboxJob (transfer_job);
} }
HBCI_API_clearQueueByStatus (api, HBCI_JOB_STATUS_NONE);
g_assert (job); g_assert (job);
HBCI_API_addJob (api, job); HBCI_API_addJob (api, job);
if (result == 0) { if (result == 0) {
/* If the user pressed "execute now", then execute this job now. */ /* If the user pressed "execute now", then execute this job now. */
if (!gnc_hbci_api_execute (parent, api, job, interactor)) { successful = gnc_hbci_api_execute (parent, api, job, interactor);
/*printf("dialog-hbcitrans: Ok, result of api_execute was %d.\n",
successful);*/
if (!successful) {
/* HBCI_API_executeOutbox failed. */ /* HBCI_API_executeOutbox failed. */
gtk_widget_destroy (GTK_WIDGET (dialog));
HBCI_Transaction_delete (trans); HBCI_Transaction_delete (trans);
HBCI_API_clearQueueByStatus (api, HBCI_JOB_STATUS_NONE); HBCI_API_clearQueueByStatus (api, HBCI_JOB_STATUS_NONE);
return NULL;
} }
} /* result == 0 */
else {
/* huh? Only result == 0 should be possible. Simply ignore
this case. */
break;
} /* result == 0 */
} } /* Create a do-transaction (transfer) job */
} } while (!successful);
} } /* GtkWidget declarations/definitions */
HBCI_API_clearQueueByStatus (api, HBCI_JOB_STATUS_NONE); HBCI_API_clearQueueByStatus (api, HBCI_JOB_STATUS_NONE);
gtk_widget_destroy (GTK_WIDGET (dialog)); gtk_widget_destroy (GTK_WIDGET (dialog));