[Gnucash-changes] Fix handling of debit notes.

Christian Stimming cstim at cvs.gnucash.org
Mon May 23 17:06:24 EDT 2005


Log Message:
-----------
Fix handling of debit notes.

2005-05-23  Christian Stimming  <stimming at tuhh.de>

	* src/import-export/hbci/dialog-hbcitrans.c: Fix handling of debit
	notes -- they were broken at all times since the aqbanking
	transition, oops.

Modified Files:
--------------
    gnucash:
        ChangeLog
    gnucash/src/import-export/hbci:
        dialog-hbcitrans.c
        gnc-hbci-transfer.c

Revision Data
-------------
Index: ChangeLog
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/ChangeLog,v
retrieving revision 1.1907
retrieving revision 1.1908
diff -LChangeLog -LChangeLog -u -r1.1907 -r1.1908
--- ChangeLog
+++ ChangeLog
@@ -1,5 +1,9 @@
 2005-05-23  Christian Stimming  <stimming at tuhh.de>
 
+	* src/import-export/hbci/dialog-hbcitrans.c: Fix handling of debit
+	notes -- they were broken at all times since the aqbanking
+	transition, oops.
+
 	* src/import-export/hbci/dialog-hbcitrans.c: Add sanity checks and
 	ask user when there are no purpose lines.
 
Index: gnc-hbci-transfer.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/import-export/hbci/gnc-hbci-transfer.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -Lsrc/import-export/hbci/gnc-hbci-transfer.c -Lsrc/import-export/hbci/gnc-hbci-transfer.c -u -r1.21 -r1.22
--- src/import-export/hbci/gnc-hbci-transfer.c
+++ src/import-export/hbci/gnc-hbci-transfer.c
@@ -77,7 +77,7 @@
       ( gnc_hbci_get_book_template_list
 	( xaccAccountGetBook(gnc_acc)));
     int result;
-    gboolean successful;
+    gboolean successful = FALSE;
     HBCITransDialog *td;
 
     /* Now open the HBCI_trans_dialog, which also calls
@@ -110,6 +110,28 @@
 	AB_JOB *job = 
 	  gnc_hbci_trans_dialog_enqueue(td, api,
 					(AB_ACCOUNT *)h_acc, trans_type);
+
+	/* Check whether we really got a job */
+	if (!job) {
+	  /* Oops, no job, probably not supported by bank. */
+	  if (gnc_verify_dialog
+	      (parent, 
+	       FALSE,
+	       "%s",
+	       _("The backend found an error during the preparation \n"
+		 "of the job. It is not possible to execute this job. \n"
+		 "\n"
+		 "Most probable the bank does not support your chosen \n"
+		 "job or your HBCI account does not have the permission \n"
+		 "to execute this job. More error messages might be \n"
+		 "visible on your console log.\n"
+		 "\n"
+		 "Do you want to enter the job again?")))
+	    continue;
+	  else
+	    /* job is NULL anyway, so it doesn't have to be cleaned up */
+	    break;
+	}
       
 	/* HBCI Transaction has been created and enqueued, so now open
 	 * the gnucash transaction dialog and fill in all values. */
Index: dialog-hbcitrans.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/import-export/hbci/dialog-hbcitrans.c,v
retrieving revision 1.43
retrieving revision 1.44
diff -Lsrc/import-export/hbci/dialog-hbcitrans.c -Lsrc/import-export/hbci/dialog-hbcitrans.c -u -r1.43 -r1.44
--- src/import-export/hbci/dialog-hbcitrans.c
+++ src/import-export/hbci/dialog-hbcitrans.c
@@ -506,7 +506,6 @@
 
     {
       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
@@ -694,10 +693,15 @@
     printf("gnc_hbci_trans_dialog_enqueue: Oops, job not available. Aborting.\n");
     return NULL;
   }
-  AB_JobSingleTransfer_SetTransaction(job, td->hbci_trans);
 
-  /* Make really sure there is no other job in the queue */
-/*   HBCI_Outbox_removeByStatus (outbox, HBCI_JOB_STATUS_NONE); */
+  switch (trans_type) {
+  case SINGLE_DEBITNOTE:
+    AB_JobSingleDebitNote_SetTransaction(job, td->hbci_trans);
+    break;
+  default:
+  case SINGLE_TRANSFER:
+    AB_JobSingleTransfer_SetTransaction(job, td->hbci_trans);
+  };
 
   /* Add job to queue */
   AB_Banking_EnqueueJob(api, job);


More information about the gnucash-changes mailing list