[Gnucash-changes] Improve HBCI code.
Christian Stimming
cstim at cvs.gnucash.org
Sat Jan 29 07:15:01 EST 2005
Log Message:
-----------
Improve HBCI code.
2005-01-29 Christian Stimming <stimming at tuhh.de>
* src/import-export/hbci/dialog-hbcitrans.c: Enable debit notes
again. Various other improvements.
* src/import-export/hbci/druid-hbci-initial.c (on_aqhbci_button),
configure.in: Adapt to latest changes in aqbanking; external
wizard name is no longer hard-coded here but is asked from
aqbanking.
Modified Files:
--------------
gnucash:
ChangeLog
configure.in
gnucash/src/import-export/hbci:
dialog-hbcitrans.c
druid-hbci-initial.c
gnc-hbci-getbalance.c
gnc-hbci-gettrans.c
gnc-hbci-transfer.c
gnc-hbci-utils.c
gnc-hbci-utils.h
Revision Data
-------------
Index: configure.in
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/configure.in,v
retrieving revision 1.399
retrieving revision 1.400
diff -Lconfigure.in -Lconfigure.in -u -r1.399 -r1.400
--- configure.in
+++ configure.in
@@ -601,7 +601,7 @@
if test x${MT940_DIR} = xmt940 ;
then
AC_MSG_ERROR([Sorry, MT940 support is currently broken since it depended on the hbci module with the old openhbci 0.9.x library. But the hbci module has now been ported to a new hbci library called aqbanking. That library contains a MT940 parser, too, so porting shouldnt be too difficult. Nevertheless someone needs to do the porting work before this can be enabled again.])
- AC_AQBANKING(0,9,8)
+ AC_AQBANKING(1,0,0)
# Note: HBCI_LIBS is changed again below in the --enable-hbci
# section. So check for mt940 first and *not* the other way round!
HBCI_LIBS="${OPENHBCI_LIBS}"
@@ -623,7 +623,7 @@
if test x${HBCI_DIR} = xhbci ;
then
# Check for Aqbanking library
- AC_AQBANKING(0,9,8)
+ AC_AQBANKING(1,0,0)
if test x${have_aqbanking} != xyes;
then
AC_MSG_ERROR([Could not find aqbanking. If you use --enable-hbci, you *have* to enable aqbanking.])
Index: ChangeLog
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/ChangeLog,v
retrieving revision 1.1880
retrieving revision 1.1881
diff -LChangeLog -LChangeLog -u -r1.1880 -r1.1881
--- ChangeLog
+++ ChangeLog
@@ -1,3 +1,13 @@
+2005-01-29 Christian Stimming <stimming at tuhh.de>
+
+ * src/import-export/hbci/dialog-hbcitrans.c: Enable debit notes
+ again. Various other improvements.
+
+ * src/import-export/hbci/druid-hbci-initial.c (on_aqhbci_button),
+ configure.in: Adapt to latest changes in aqbanking; external
+ wizard name is no longer hard-coded here but is asked from
+ aqbanking.
+
2005-01-23 Derek Atkins <derek at ihtfp.com>
* src/business/business-core/gncInvoice.c: Properly accumulate
Index: druid-hbci-initial.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/import-export/hbci/druid-hbci-initial.c,v
retrieving revision 1.54
retrieving revision 1.55
diff -Lsrc/import-export/hbci/druid-hbci-initial.c -Lsrc/import-export/hbci/druid-hbci-initial.c -u -r1.54 -r1.55
--- src/import-export/hbci/druid-hbci-initial.c
+++ src/import-export/hbci/druid-hbci-initial.c
@@ -452,46 +452,33 @@
int res;
const char *backend_name = "aqhbci";
- /* NOTE NOTE NOTE: This is the name for the external application
- shipped with aqhbci that contains the setup druid for HBCI
- related stuff. The name is misleading -- it requires qt but not
- kde). This application contains the very verbose step-by-step
- setup wizard for the HBCI account, and the application is shared
- with other AqBanking-based financial managers that offer the HBCI
- features (e.g. KMyMoney). See gnucash-devel discussion here
- https://lists.gnucash.org/pipermail/gnucash-devel/2004-December/012351.html
+ /* This is the point where we look for and start an external
+ application shipped with aqhbci that contains the setup druid for
+ HBCI related stuff. It requires qt (but not kde). This
+ application contains the very verbose step-by-step setup wizard
+ for the HBCI account, and the application is shared with other
+ AqBanking-based financial managers that offer the HBCI features
+ (e.g. KMyMoney). See gnucash-devel discussion here
+ https://lists.gnucash.org/pipermail/gnucash-devel/2004-December/012351.html
*/
- const char *wizard_name = "kde_wizard";
gboolean wizard_exists;
const char *wizard_path;
- int fd;
AB_BANKING *banking = info->api;
g_assert(info->druid);
- buf = GWEN_Buffer_new(NULL, 200, 0, 0);
- AB_Banking_GetWizardPath(banking, backend_name, buf);
+ buf = GWEN_Buffer_new(NULL, 300, 0, 0);
+ AB_Banking_FindWizard(banking, backend_name, NULL, buf);
wizard_exists = (strlen(GWEN_Buffer_GetStart(buf)) > 0);
-
- GWEN_Buffer_AppendString(buf, "/");
- /* {
- GWEN_PLUGIN_DESCRIPTION_LIST2 *l =
- AB_Banking_GetWizardDescrs(banking, backend_name);
- const GWEN_PLUGIN_DESCRIPTION *x = GWEN_PluginDescription_List2_GetFront(l);
- // There needs to be a way to find the file name here. Currently
- // this doesnt work yet.
- wizard_name = GWEN_PluginDescription_GetName(x);
- GWEN_Buffer_AppendString(buf, wizard_name);
- GWEN_PluginDescription_List2_freeAll(l);
- } */
- GWEN_Buffer_AppendString(buf, wizard_name);
wizard_path = GWEN_Buffer_GetStart(buf);
- /* Really check whether the file exists */
- fd = open( wizard_path, O_RDONLY );
- if ( fd == -1)
- wizard_exists = FALSE;
- else
- close( fd );
+ if (wizard_exists) {
+ /* Really check whether the file exists */
+ int fd = open( wizard_path, O_RDONLY );
+ if ( fd == -1)
+ wizard_exists = FALSE;
+ else
+ close( fd );
+ }
druid_disable_next_button(info);
AB_Banking_DeactivateProvider(banking, backend_name);
@@ -499,8 +486,8 @@
int wait_status;
int wait_result = 0;
- /* Call the qt wizard (called kde wizard). See the note above
- about why this approach is chosen. */
+ /* Call the qt wizard. See the note above about why this approach
+ is chosen. */
/* In gtk2, this would be g_spawn_async or similar. */
AB_Banking_Fini (info->api);
@@ -519,6 +506,7 @@
_exit(0);
default: /* parent */
res = 0;
+ /* wait until child is finished */
while (wait_result == 0) {
gtk_main_iteration();
wait_result = waitpid(pid, &wait_status, WNOHANG);
@@ -556,10 +544,8 @@
gnc_error_dialog
(info->window, "%s",
_("The external program \"AqHBCI Setup Wizard\" has not been found. \n\n"
- "Did you install the package \"kde_wizard\" of AqHBCI? \n"
- "If not, please install it now. (The name of that package \n"
- "is misleading, as it does not require the KDE desktop \n"
- "environment but only the Qt toolkit libraries.)"));
+ "Did you install the package \"aqhbci-qt-wizard\" of AqHBCI? \n"
+ "If not, please install it now."));
druid_disable_next_button(info);
}
GWEN_Buffer_free(buf);
Index: gnc-hbci-utils.h
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/import-export/hbci/gnc-hbci-utils.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -Lsrc/import-export/hbci/gnc-hbci-utils.h -Lsrc/import-export/hbci/gnc-hbci-utils.h -u -r1.18 -r1.19
--- src/import-export/hbci/gnc-hbci-utils.h
+++ src/import-export/hbci/gnc-hbci-utils.h
@@ -76,6 +76,11 @@
int
gnc_hbci_debug_outboxjob (AB_JOB *job, gboolean verbose);
+/** Clean up the queue after executing, i.e. delete the job as good as
+ possible. */
+void
+gnc_hbci_cleanup_job(AB_BANKING *api, AB_JOB *job);
+
/* Check int on whether some feedback should be given to the
* user. Returns true if the HBCI action should be tried again; on the
* other hand, returns false if the user can't do anything about this
Index: gnc-hbci-transfer.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/import-export/hbci/gnc-hbci-transfer.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -Lsrc/import-export/hbci/gnc-hbci-transfer.c -Lsrc/import-export/hbci/gnc-hbci-transfer.c -u -r1.20 -r1.21
--- src/import-export/hbci/gnc-hbci-transfer.c
+++ src/import-export/hbci/gnc-hbci-transfer.c
@@ -135,15 +135,9 @@
xaccTransBeginEdit(gtrans);
xaccTransDestroy(gtrans);
xaccTransCommitEdit(gtrans);
-
-/* AB_Banking_DequeueJob(api, job); */
-/* AB_Banking_DelFinishedJob(api, job); */
-/* AB_Banking_DelPendingJob(api, job); */
}
- AB_Banking_DequeueJob(api, job);
- AB_Banking_DelFinishedJob(api, job);
- AB_Banking_DelPendingJob(api, job);
+ gnc_hbci_cleanup_job(api, job);
} /* result == 0 */
else {
/* huh? Only result == 0 should be possible. Simply ignore
Index: gnc-hbci-gettrans.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/import-export/hbci/gnc-hbci-gettrans.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -Lsrc/import-export/hbci/gnc-hbci-gettrans.c -Lsrc/import-export/hbci/gnc-hbci-gettrans.c -u -r1.34 -r1.35
--- src/import-export/hbci/gnc-hbci-gettrans.c
+++ src/import-export/hbci/gnc-hbci-gettrans.c
@@ -109,9 +109,7 @@
/* Execute Outbox. */
if (!gnc_AB_BANKING_execute (parent, api, job, interactor)) {
/* AB_BANKING_executeOutbox failed. */
- AB_Banking_DequeueJob(api, job);
- AB_Banking_DelFinishedJob(api, job);
- AB_Banking_DelPendingJob(api, job);
+ gnc_hbci_cleanup_job(api, job);
return;
}
@@ -122,9 +120,7 @@
gnc_hbci_gettrans_final(parent, gnc_acc, job, FALSE);
/* Clean up behind ourself. */
- AB_Banking_DequeueJob(api, job);
- AB_Banking_DelFinishedJob(api, job);
- AB_Banking_DelPendingJob(api, job);
+ gnc_hbci_cleanup_job(api, job);
gnc_AB_BANKING_fini (api);
GNCInteractor_hide (interactor);
GWEN_Time_free (from_date);
Index: dialog-hbcitrans.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/import-export/hbci/dialog-hbcitrans.c,v
retrieving revision 1.38
retrieving revision 1.39
diff -Lsrc/import-export/hbci/dialog-hbcitrans.c -Lsrc/import-export/hbci/dialog-hbcitrans.c -u -r1.38 -r1.39
--- src/import-export/hbci/dialog-hbcitrans.c
+++ src/import-export/hbci/dialog-hbcitrans.c
@@ -29,6 +29,7 @@
#include <gnome.h>
#include <aqbanking/account.h>
#include <aqbanking/jobsingletransfer.h>
+#include <aqbanking/jobsingledebitnote.h>
#include "dialog-utils.h"
#include "gnc-ui.h"
@@ -624,7 +625,14 @@
AB_JOB *job;
/* Create a Do-Transaction (Transfer) job. */
- job = AB_JobSingleTransfer_new(h_acc);
+ switch (trans_type) {
+ case SINGLE_DEBITNOTE:
+ job = AB_JobSingleDebitNote_new(h_acc);
+ break;
+ default:
+ case SINGLE_TRANSFER:
+ job = AB_JobSingleTransfer_new(h_acc);
+ };
if (AB_Job_CheckAvailability(job)) {
printf("gnc_hbci_trans_dialog_enqueue: Oops, job not available. Aborting.\n");
return NULL;
Index: gnc-hbci-utils.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/import-export/hbci/gnc-hbci-utils.c,v
retrieving revision 1.48
retrieving revision 1.49
diff -Lsrc/import-export/hbci/gnc-hbci-utils.c -Lsrc/import-export/hbci/gnc-hbci-utils.c -u -r1.48 -r1.49
--- src/import-export/hbci/gnc-hbci-utils.c
+++ src/import-export/hbci/gnc-hbci-utils.c
@@ -134,7 +134,7 @@
if (!hbci_acc && bankcode && (strlen(bankcode)>0) &&
accountid && (strlen(accountid) > 0)) {
- printf("gnc_hbci_get_hbci_acc: No AB_ACCOUNT found for UID %d, trying bank code\n", account_uid);
+ /* printf("gnc_hbci_get_hbci_acc: No AB_ACCOUNT found for UID %d, trying bank code\n", account_uid); */
hbci_acc = AB_Banking_GetAccountByCodeAndNumber(api, bankcode, accountid);
}
/*printf("gnc_hbci_get_hbci_acc: return HBCI_Account %p\n", hbci_acc);*/
@@ -239,6 +239,18 @@
return cause;
}
+void
+gnc_hbci_cleanup_job(AB_BANKING *api, AB_JOB *job)
+{
+ if (AB_Job_GetStatus(job) == AB_Job_StatusFinished) {
+ AB_Banking_DelFinishedJob(api, job);
+ } else if (AB_Job_GetStatus(job) == AB_Job_StatusPending) {
+ AB_Banking_DelPendingJob(api, job);
+ }
+ /* Martin assured me that there will be no job in the queue after
+ ExecuteQueue, so we don't need to remove it from the queue. */
+}
+
gboolean
gnc_hbci_Error_retry (GtkWidget *parent, int error,
Index: gnc-hbci-getbalance.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/import-export/hbci/gnc-hbci-getbalance.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -Lsrc/import-export/hbci/gnc-hbci-getbalance.c -Lsrc/import-export/hbci/gnc-hbci-getbalance.c -u -r1.31 -r1.32
--- src/import-export/hbci/gnc-hbci-getbalance.c
+++ src/import-export/hbci/gnc-hbci-getbalance.c
@@ -102,9 +102,7 @@
if (!gnc_AB_BANKING_execute (parent, api, job, interactor)) {
/* AB_BANKING_executeOutbox failed. */
- AB_Banking_DequeueJob(api, job);
- AB_Banking_DelFinishedJob(api, job);
- AB_Banking_DelPendingJob(api, job);
+ gnc_hbci_cleanup_job(api, job);
/* FIXME: free unneeded data */
return;
}
@@ -117,9 +115,7 @@
job);
/* Clean up after ourselves. */
- AB_Banking_DequeueJob(api, job);
- AB_Banking_DelFinishedJob(api, job);
- AB_Banking_DelPendingJob(api, job);
+ gnc_hbci_cleanup_job(api, job);
gnc_AB_BANKING_fini (api);
GNCInteractor_hide (interactor);
}
More information about the gnucash-changes
mailing list