AUDIT: r17502 - gnucash/trunk/src/import-export/aqbanking - Treat AB_Job_StatusPending as a good status, do not ask the user to repeat.

Andreas Köhler andi5 at cvs.gnucash.org
Thu Sep 11 02:58:23 EDT 2008


Author: andi5
Date: 2008-09-11 02:58:23 -0400 (Thu, 11 Sep 2008)
New Revision: 17502
Trac: http://svn.gnucash.org/trac/changeset/17502

Modified:
   gnucash/trunk/src/import-export/aqbanking/gnc-ab-transfer.c
Log:
Treat AB_Job_StatusPending as a good status, do not ask the user to repeat.

According to Martin Preuss a lot of banks set the status of a
transaction job to pending, signifying that they accepted the job but
have not yet executed it.  This also means that we cannot detect whether
the account is actually overdrafted.

Instead, ignore the return value of AB_Banking_ExecuteJobs() (it will
almost always be 0) and only check the job's status against
AB_Job_StatusFinished and AB_Job_StatusPending.  If the status is
different, ask the user whether he wants to repeat, as usual.

BP

Modified: gnucash/trunk/src/import-export/aqbanking/gnc-ab-transfer.c
===================================================================
--- gnucash/trunk/src/import-export/aqbanking/gnc-ab-transfer.c	2008-09-10 19:22:19 UTC (rev 17501)
+++ gnucash/trunk/src/import-export/aqbanking/gnc-ab-transfer.c	2008-09-11 06:58:23 UTC (rev 17502)
@@ -134,6 +134,7 @@
         gchar *memo;
         Transaction *gnc_trans = NULL;
         AB_IMEXPORTER_CONTEXT *context = NULL;
+        AB_JOB_STATUS job_status;
         GncABImExContextImport *ieci = NULL;
 
         /* Get a GUI object */
@@ -232,10 +233,16 @@
             context = AB_ImExporterContext_new();
 
             /* Finally, execute the job */
-            successful = AB_Banking_ExecuteJobs(api, job_list, context, 0) == 0;
+            AB_Banking_ExecuteJobs(api, job_list, context, 0);
 
-            if (!successful
-                || AB_Job_GetStatus(job) != AB_Job_StatusFinished) {
+            /* Ignore the return value of AB_Banking_ExecuteJobs(), as the job's
+             * status always describes better whether the job was actually
+             * transferred to and accepted by the bank.  See also
+             * http://lists.gnucash.org/pipermail/gnucash-de/2008-September/006389.html
+             */
+            job_status = AB_Job_GetStatus(job);
+            if (job_status != AB_Job_StatusFinished
+                && job_status != AB_Job_StatusPending) {
                 successful = FALSE;
                 if (!gnc_verify_dialog(
                         parent, FALSE, "%s",
@@ -243,19 +250,16 @@
                           "the log window for the exact error message.\n"
                           "\n"
                           "Do you want to enter the job again?"))) {
-                        /* _("The job was sent to the bank successfully, but the " */
-                        /*   "bank is refusing to execute the job. Please check " */
-                        /*   "the log window for the exact error message of the " */
-                        /*   "bank. The line with the error message contains a " */
-                        /*   "code number that is greater than 9000.\n" */
-                        /*   "\n" */
-                        /*   "Do you want to enter the job again?"))) { */
                     aborted = TRUE;
                 }
+            } else {
+                successful = TRUE;
             }
 
-            /* Import the results, awaiting nothing */
-            ieci = gnc_ab_import_context(context, 0, FALSE, NULL, parent);
+            if (successful) {
+                /* Import the results, awaiting nothing */
+                ieci = gnc_ab_import_context(context, 0, FALSE, NULL, parent);
+            }
         }
         /* Simply ignore any other case */
 



More information about the gnucash-changes mailing list