r14691 - gnucash/trunk/src/import-export/hbci - Some code refactoring in preparation for extended importing and HBCI features.

Christian Stimming cstim at cvs.gnucash.org
Fri Aug 18 16:51:58 EDT 2006


Author: cstim
Date: 2006-08-18 16:51:56 -0400 (Fri, 18 Aug 2006)
New Revision: 14691
Trac: http://svn.gnucash.org/trac/changeset/14691

Modified:
   gnucash/trunk/src/import-export/hbci/dialog-hbcitrans.c
   gnucash/trunk/src/import-export/hbci/dialog-hbcitrans.h
   gnucash/trunk/src/import-export/hbci/gnc-hbci-transfer.c
   gnucash/trunk/src/import-export/hbci/gnc-hbci-utils.c
   gnucash/trunk/src/import-export/hbci/gnc-hbci-utils.h
Log:
Some code refactoring in preparation for extended importing and HBCI features.

Modified: gnucash/trunk/src/import-export/hbci/dialog-hbcitrans.c
===================================================================
--- gnucash/trunk/src/import-export/hbci/dialog-hbcitrans.c	2006-08-18 04:48:18 UTC (rev 14690)
+++ gnucash/trunk/src/import-export/hbci/dialog-hbcitrans.c	2006-08-18 20:51:56 UTC (rev 14691)
@@ -730,7 +730,7 @@
 }
 
 AB_JOB *
-gnc_hbci_trans_dialog_enqueue(HBCITransDialog *td, AB_BANKING *api,
+gnc_hbci_trans_dialog_enqueue(const AB_TRANSACTION *hbci_trans, AB_BANKING *api,
 			      AB_ACCOUNT *h_acc, 
 			      GNC_HBCI_Transtype trans_type) 
 {
@@ -762,7 +762,7 @@
 
   switch (trans_type) {
   case SINGLE_DEBITNOTE:
-    AB_JobSingleDebitNote_SetTransaction(job, td->hbci_trans);
+    AB_JobSingleDebitNote_SetTransaction(job, hbci_trans);
     break;
   case SINGLE_INTERNAL_TRANSFER:
 #if ((AQBANKING_VERSION_MAJOR > 1) || \
@@ -771,12 +771,12 @@
        ((AQBANKING_VERSION_MINOR == 6) && \
         ((AQBANKING_VERSION_PATCHLEVEL > 0) || \
 	 (AQBANKING_VERSION_BUILD > 2))))))
-    AB_JobInternalTransfer_SetTransaction(job, td->hbci_trans);
+    AB_JobInternalTransfer_SetTransaction(job, hbci_trans);
     break;
 #endif
   default:
   case SINGLE_TRANSFER:
-    AB_JobSingleTransfer_SetTransaction(job, td->hbci_trans);
+    AB_JobSingleTransfer_SetTransaction(job, hbci_trans);
   };
 
   /* Add job to queue */

Modified: gnucash/trunk/src/import-export/hbci/dialog-hbcitrans.h
===================================================================
--- gnucash/trunk/src/import-export/hbci/dialog-hbcitrans.h	2006-08-18 04:48:18 UTC (rev 14690)
+++ gnucash/trunk/src/import-export/hbci/dialog-hbcitrans.h	2006-08-18 20:51:56 UTC (rev 14691)
@@ -86,7 +86,7 @@
 int gnc_hbci_dialog_run_until_ok(HBCITransDialog *td, 
 				 const AB_ACCOUNT *h_acc);
 AB_JOB *
-gnc_hbci_trans_dialog_enqueue(HBCITransDialog *td, AB_BANKING *api,
+gnc_hbci_trans_dialog_enqueue(const AB_TRANSACTION *hbci_trans, AB_BANKING *api,
 			      AB_ACCOUNT *h_acc, 
 			      GNC_HBCI_Transtype trans_type);
 /** Callback function for gnc_xfer_dialog_set_txn_cb(). The user_data

Modified: gnucash/trunk/src/import-export/hbci/gnc-hbci-transfer.c
===================================================================
--- gnucash/trunk/src/import-export/hbci/gnc-hbci-transfer.c	2006-08-18 04:48:18 UTC (rev 14690)
+++ gnucash/trunk/src/import-export/hbci/gnc-hbci-transfer.c	2006-08-18 20:51:56 UTC (rev 14691)
@@ -120,7 +120,7 @@
 
       {
 	AB_JOB *job = 
-	  gnc_hbci_trans_dialog_enqueue(td, api,
+	  gnc_hbci_trans_dialog_enqueue(gnc_hbci_dialog_get_htrans(td), api,
 					(AB_ACCOUNT *)h_acc, trans_type);
 
 	/* Check whether we really got a job */

Modified: gnucash/trunk/src/import-export/hbci/gnc-hbci-utils.c
===================================================================
--- gnucash/trunk/src/import-export/hbci/gnc-hbci-utils.c	2006-08-18 04:48:18 UTC (rev 14690)
+++ gnucash/trunk/src/import-export/hbci/gnc-hbci-utils.c	2006-08-18 20:51:56 UTC (rev 14691)
@@ -321,7 +321,7 @@
     return FALSE;
 #endif
   case AB_ERROR_NETWORK:
-    GNCInteractor_hide (inter);
+    if (inter) GNCInteractor_hide (inter);
     gnc_error_dialog 
       (parent,
        _("The server of your bank refused the HBCI connection. "
@@ -403,8 +403,9 @@
 			AB_JOB *job, GNCInteractor *inter)
 {
   int err;
-  int resultcode;
+  int resultcode = 3000; /* This code means: Warnings, but not errors */
   int be_verbose = FALSE;
+  g_assert (api);
 	  
   if (inter)
     GNCInteractor_show (inter);
@@ -434,7 +435,8 @@
     
   } while (gnc_hbci_Error_retry (parent, err, inter));
   
-  resultcode = gnc_hbci_debug_outboxjob (job, be_verbose);
+  if (job)
+    resultcode = gnc_hbci_debug_outboxjob (job, be_verbose);
   if (!hbci_Error_isOk(err)) {
 /*     char *errstr =  */
 /*       g_strdup_printf("gnc_AB_BANKING_execute: Error at executeQueue: %s", */
@@ -443,8 +445,8 @@
 /*     HBCI_Interactor_msgStateResponse (HBCI_Hbci_interactor  */
 /* 				      (AB_BANKING_Hbci (api)), errstr); */
 /*     g_free (errstr); */
-    gnc_hbci_debug_outboxjob (job, TRUE);
-    GNCInteractor_show_nodelete (inter);
+    if (job) gnc_hbci_debug_outboxjob (job, TRUE);
+    if (inter) GNCInteractor_show_nodelete (inter);
     return FALSE;
   }
 

Modified: gnucash/trunk/src/import-export/hbci/gnc-hbci-utils.h
===================================================================
--- gnucash/trunk/src/import-export/hbci/gnc-hbci-utils.h	2006-08-18 04:48:18 UTC (rev 14690)
+++ gnucash/trunk/src/import-export/hbci/gnc-hbci-utils.h	2006-08-18 20:51:56 UTC (rev 14691)
@@ -90,7 +90,9 @@
 /* Calls AB_BANKING_executeQueue with some supplementary stuff around
  * it: set the debugLevel, show the GNCInteractor, and do some error
  * checking. Returns TRUE upon success or FALSE if the calling dialog
- * should abort. */
+ * should abort. parent may be NULL, job may be NULL (although in this
+ * case no HBCI result codes can be checked!), inter may be NULL; api
+ * must not be NULL.  */
 gboolean
 gnc_AB_BANKING_execute (GtkWidget *parent, AB_BANKING *api,
 			AB_JOB *job, GNCInteractor *inter);



More information about the gnucash-changes mailing list