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. */ }
void multijob_cb (gpointer element, gpointer user_data) { AB_JOB *job = element; GtkWidget *parent = user_data; if ((AB_Job_GetStatus (job) == AB_Job_StatusPending) || (AB_Job_GetStatus (job) == AB_Job_StatusError)) { /* There was some error in this job. */ if (AB_Job_GetType (job) == AB_Job_TypeDebitNote) { const AB_TRANSACTION *h_trans = AB_JobSingleDebitNote_GetTransaction (job); gchar *descr_name = gnc_hbci_descr_tognc (h_trans); gchar *value = gnc_AB_VALUE_toReadableString (AB_Transaction_GetValue (h_trans)); gchar *errortext; errortext = g_strdup_printf(_("A debit note has been refused by the bank. The refused debit note has the following data:\n" "Remote bank code: \"%s\"\n" "Remote account number: \"%s\"\n" "Description and remote name: \"%s\"\n" "Value: \"%s\"\n"), AB_Transaction_GetRemoteBankCode (h_trans), AB_Transaction_GetRemoteAccountNumber (h_trans), descr_name, value); g_warning ("%s", errortext); gnc_error_dialog (parent, "%s", errortext); g_free (errortext); g_free (descr_name); } else { gnc_error_dialog (parent, "%s", _("One of the jobs 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" "The job has been removed from the queue.")); /* FIXME: Might make more useful user feedback here. */ } } }
void delpending_cb (gpointer element, gpointer user_data) { AB_JOB *job = element; AB_BANKING *ab = user_data; if (AB_Job_GetStatus (job) == AB_Job_StatusPending) AB_Banking_DelPendingJob(ab, job); }
int EBC_Provider_ExecContext_IZV(AB_PROVIDER *pro, AB_IMEXPORTER_CONTEXT *ctx, AB_USER *u, AB_ACCOUNT *a, GWEN_HTTP_SESSION *sess, EBC_CONTEXT *ectx){ EBC_PROVIDER *dp; AB_JOB_LIST2_ITERATOR *jit; int rv; assert(pro); dp=GWEN_INHERIT_GETDATA(AB_PROVIDER, EBC_PROVIDER, pro); assert(dp); DBG_INFO(AQEBICS_LOGDOMAIN, "Executing IZV request"); rv=EBC_Provider_ExecContext__IZV(pro, ctx, u, a, sess, ectx); jit=AB_Job_List2_First(EBC_Context_GetJobs(ectx)); if (jit) { AB_JOB *uj; uj=AB_Job_List2Iterator_Data(jit); assert(uj); while(uj) { const AB_TRANSACTION *ot; switch(EBC_Context_GetJobType(ectx)) { case AB_Job_TypeTransfer: case AB_Job_TypeDebitNote: ot=AB_Job_GetTransaction(uj); break; default: ot=NULL; } assert(ot); if (ot) { AB_TRANSACTION *t; AB_TRANSACTION_STATUS tStatus; switch(AB_Job_GetStatus(uj)) { case AB_Job_StatusFinished: tStatus=AB_Transaction_StatusAccepted; break; case AB_Job_StatusPending: tStatus=AB_Transaction_StatusPending; break; default: tStatus=AB_Transaction_StatusRejected; break; } t=AB_Transaction_dup(ot); AB_Transaction_SetStatus(t, tStatus); AB_ImExporterContext_AddTransfer(ctx, t); } uj=AB_Job_List2Iterator_Next(jit); } /* while */ AB_Job_List2Iterator_free(jit); } return rv; }
int EBC_Provider_CountDoneJobs(AB_JOB_LIST2 *jl){ AB_JOB_LIST2_ITERATOR *jit; int cnt=0; jit=AB_Job_List2_First(jl); if (jit) { AB_JOB *uj; uj=AB_Job_List2Iterator_Data(jit); assert(uj); while(uj) { AB_JOB_STATUS js; js=AB_Job_GetStatus(uj); if (js==AB_Job_StatusFinished || js==AB_Job_StatusError) cnt++; uj=AB_Job_List2Iterator_Next(jit); } /* while */ AB_Job_List2Iterator_free(jit); } return cnt; }
int EBC_Provider_Execute(AB_PROVIDER *pro, AB_IMEXPORTER_CONTEXT *ctx) { EBC_PROVIDER *dp; int oks=0; int errors=0; AB_JOB_LIST2_ITERATOR *jit; int rv; assert(pro); dp=GWEN_INHERIT_GETDATA(AB_PROVIDER, EBC_PROVIDER, pro); assert(dp); rv=EBC_Provider_ExecQueue(pro, ctx); if (!rv) oks++; else { errors++; if (rv==GWEN_ERROR_USER_ABORTED) { EBC_Queue_Clear(dp->queue); AB_Job_List2_Clear(dp->bankingJobs); return rv; } } /* set results in referencing jobs, too */ jit=AB_Job_List2_First(dp->bankingJobs); if (jit) { AB_JOB *uj; uj=AB_Job_List2Iterator_Data(jit); assert(uj); while(uj) { if (AB_Job_GetStatus(uj)==AB_Job_StatusSent) { AB_JOB *rj; uint32_t rjid; rj=uj; /* find referenced job (if any) */ do { GWEN_DB_NODE *dbT; dbT=AB_Job_GetProviderData(rj, pro); assert(dbT); rjid=GWEN_DB_GetIntValue(dbT, "refJob", 0, 0); if (rjid) { rj=EBC_Provider_FindJobById(dp->bankingJobs, rjid); } } while(rjid && rj); if (rj && rj!=uj) { /* found referenced job, copy status and result text */ DBG_INFO(AQEBICS_LOGDOMAIN, "Copying status from referenced job"); AB_Job_SetStatus(uj, AB_Job_GetStatus(rj)); AB_Job_SetResultText(uj, AB_Job_GetResultText(rj)); } if (AB_Job_GetStatus(uj)==AB_Job_StatusSent) AB_Job_SetStatus(uj, AB_Job_StatusFinished); } uj=AB_Job_List2Iterator_Next(jit); } /* while */ AB_Job_List2Iterator_free(jit); } rv=AB_Banking_ExecutionProgress(AB_Provider_GetBanking(pro)); if (rv==GWEN_ERROR_USER_ABORTED) { DBG_INFO(AQEBICS_LOGDOMAIN, "User aborted"); return rv; } EBC_Queue_Clear(dp->queue); AB_Job_List2_Clear(dp->bankingJobs); if (!oks && errors) { DBG_INFO(AQEBICS_LOGDOMAIN, "Not a single job succeeded"); return GWEN_ERROR_GENERIC; } return 0; }
void gnc_ab_gettrans(GtkWidget *parent, Account *gnc_acc) { AB_BANKING *api; gboolean online = FALSE; AB_ACCOUNT *ab_acc; GWEN_TIME *from_date = NULL, *to_date = NULL; Timespec until_timespec; AB_JOB *job = NULL; AB_JOB_LIST2 *job_list = NULL; GncGWENGui *gui = NULL; AB_IMEXPORTER_CONTEXT *context = NULL; GncABImExContextImport *ieci = NULL; AB_JOB_STATUS job_status; g_return_if_fail(parent && gnc_acc); /* Get the API */ api = gnc_AB_BANKING_new(); if (!api) { g_warning("gnc_ab_gettrans: Couldn't get AqBanking API"); return; } if (AB_Banking_OnlineInit(api #ifdef AQBANKING_VERSION_4_EXACTLY , 0 #endif ) != 0) { g_warning("gnc_ab_gettrans: Couldn't initialize AqBanking API"); goto cleanup; } online = TRUE; /* Get the AqBanking Account */ ab_acc = gnc_ab_get_ab_account(api, gnc_acc); if (!ab_acc) { g_warning("gnc_ab_gettrans: No AqBanking account found"); gnc_error_dialog(parent, _("No valid online banking account assigned.")); goto cleanup; } /* Get the start and end dates for the GetTransactions job. */ if (!gettrans_dates(parent, gnc_acc, &from_date, &to_date)) { g_debug("gnc_ab_gettrans: gettrans_dates aborted"); goto cleanup; } /* Use this as a local storage for the until_time below. */ timespecFromTime_t(&until_timespec, GWEN_Time_toTime_t(to_date)); /* Get a GetTransactions job and enqueue it */ job = AB_JobGetTransactions_new(ab_acc); if (!job || AB_Job_CheckAvailability(job #ifndef AQBANKING_VERSION_5_PLUS , 0 #endif )) { g_warning("gnc_ab_gettrans: JobGetTransactions not available for this " "account"); gnc_error_dialog(parent, _("Online action \"Get Transactions\" not available for this account.")); goto cleanup; } AB_JobGetTransactions_SetFromTime(job, from_date); AB_JobGetTransactions_SetToTime(job, to_date); job_list = AB_Job_List2_new(); AB_Job_List2_PushBack(job_list, job); /* Get a GUI object */ gui = gnc_GWEN_Gui_get(parent); if (!gui) { g_warning("gnc_ab_gettrans: Couldn't initialize Gwenhywfar GUI"); goto cleanup; } /* Create a context to store the results */ context = AB_ImExporterContext_new(); /* Execute the job */ AB_Banking_ExecuteJobs(api, job_list, context #ifndef AQBANKING_VERSION_5_PLUS , 0 #endif ); /* 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) { g_warning("gnc_ab_gettrans: Error on executing job"); gnc_error_dialog(parent, _("Error on executing job.\n\nStatus: %s - %s") , AB_Job_Status2Char(job_status) , AB_Job_GetResultText(job)); goto cleanup; } /* Import the results */ ieci = gnc_ab_import_context(context, AWAIT_TRANSACTIONS, FALSE, NULL, parent); if (!(gnc_ab_ieci_get_found(ieci) & FOUND_TRANSACTIONS)) { /* No transaction found */ GtkWidget *dialog = gtk_message_dialog_new( GTK_WINDOW(parent), GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_INFO, GTK_BUTTONS_OK, "%s", _("The Online Banking import returned no transactions " "for the selected time period.")); gtk_dialog_run(GTK_DIALOG(dialog)); gtk_widget_destroy(dialog); } /* Store the date of this retrieval */ gnc_ab_set_account_trans_retrieval(gnc_acc, until_timespec); cleanup: if (ieci) g_free(ieci); if (context) AB_ImExporterContext_free(context); if (gui) gnc_GWEN_Gui_release(gui); if (job_list) AB_Job_List2_free(job_list); if (job) AB_Job_free(job); if (to_date) GWEN_Time_free(to_date); if (from_date) GWEN_Time_free(from_date); if (online) #ifdef AQBANKING_VERSION_4_EXACTLY AB_Banking_OnlineFini(api, 0); #else AB_Banking_OnlineFini(api); #endif gnc_AB_BANKING_fini(api); }
void gnc_ab_maketrans(GtkWidget *parent, Account *gnc_acc, GncABTransType trans_type) { AB_BANKING *api; gboolean online = FALSE; AB_ACCOUNT *ab_acc; GList *templates = NULL; GncABTransDialog *td = NULL; gboolean successful = FALSE; gboolean aborted = FALSE; g_return_if_fail(parent && gnc_acc); /* Get the API */ api = gnc_AB_BANKING_new(); if (!api) { g_warning("gnc_ab_maketrans: Couldn't get AqBanking API"); return; } if (AB_Banking_OnlineInit(api #ifdef AQBANKING_VERSION_4_EXACTLY , 0 #endif ) != 0) { g_warning("gnc_ab_maketrans: Couldn't initialize AqBanking API"); goto cleanup; } online = TRUE; /* Get the AqBanking Account */ ab_acc = gnc_ab_get_ab_account(api, gnc_acc); if (!ab_acc) { g_warning("gnc_ab_gettrans: No AqBanking account found"); gnc_error_dialog(parent, _("No valid online banking account assigned.")); goto cleanup; } /* Get list of template transactions */ templates = gnc_ab_trans_templ_list_new_from_book( gnc_account_get_book(gnc_acc)); /* Create new ABTransDialog */ td = gnc_ab_trans_dialog_new(parent, ab_acc, xaccAccountGetCommoditySCU(gnc_acc), trans_type, templates); templates = NULL; /* Repeat until AqBanking action was successful or user pressed cancel */ do { GncGWENGui *gui = NULL; gint result; gboolean changed; const AB_TRANSACTION *ab_trans; AB_JOB *job = NULL; AB_JOB_LIST2 *job_list = NULL; XferDialog *xfer_dialog = NULL; gnc_numeric amount; gchar *description; gchar *memo; Transaction *gnc_trans = NULL; AB_IMEXPORTER_CONTEXT *context = NULL; AB_JOB_STATUS job_status; GncABImExContextImport *ieci = NULL; /* Get a GUI object */ gui = gnc_GWEN_Gui_get(parent); if (!gui) { g_warning("gnc_ab_maketrans: Couldn't initialize Gwenhywfar GUI"); aborted = TRUE; goto repeat; } /* Let the user enter the values */ result = gnc_ab_trans_dialog_run_until_ok(td); /* Save the templates */ templates = gnc_ab_trans_dialog_get_templ(td, &changed); if (changed) save_templates(parent, gnc_acc, templates, (result == GNC_RESPONSE_NOW)); g_list_free(templates); templates = NULL; if (result != GNC_RESPONSE_NOW && result != GNC_RESPONSE_LATER) { aborted = TRUE; goto repeat; } /* Get a job and enqueue it */ ab_trans = gnc_ab_trans_dialog_get_ab_trans(td); job = gnc_ab_trans_dialog_get_job(td); if (!job || AB_Job_CheckAvailability(job #ifndef AQBANKING_VERSION_5_PLUS , 0 #endif )) { if (!gnc_verify_dialog( parent, FALSE, "%s", _("The backend found an error during the preparation " "of the job. It is not possible to execute this job. \n" "\n" "Most probable the bank does not support your chosen " "job or your Online Banking account does not have the permission " "to execute this job. More error messages might be " "visible on your console log.\n" "\n" "Do you want to enter the job again?"))) aborted = TRUE; goto repeat; } job_list = AB_Job_List2_new(); AB_Job_List2_PushBack(job_list, job); /* Setup a Transfer Dialog for the GnuCash transaction */ xfer_dialog = gnc_xfer_dialog(gnc_ab_trans_dialog_get_parent(td), gnc_acc); switch (trans_type) { case SINGLE_DEBITNOTE: gnc_xfer_dialog_set_title( xfer_dialog, _("Online Banking Direct Debit Note")); gnc_xfer_dialog_lock_to_account_tree(xfer_dialog); break; case SINGLE_INTERNAL_TRANSFER: gnc_xfer_dialog_set_title( xfer_dialog, _("Online Banking Bank-Internal Transfer")); gnc_xfer_dialog_lock_from_account_tree(xfer_dialog); break; case SEPA_TRANSFER: gnc_xfer_dialog_set_title( xfer_dialog, _("Online Banking European (SEPA) Transfer")); gnc_xfer_dialog_lock_from_account_tree(xfer_dialog); break; case SEPA_DEBITNOTE: gnc_xfer_dialog_set_title( xfer_dialog, _("Online Banking European (SEPA) Debit Note")); gnc_xfer_dialog_lock_to_account_tree(xfer_dialog); break; case SINGLE_TRANSFER: default: gnc_xfer_dialog_set_title( xfer_dialog, _("Online Banking Transaction")); gnc_xfer_dialog_lock_from_account_tree(xfer_dialog); } gnc_xfer_dialog_set_to_show_button_active(xfer_dialog, TRUE); amount = double_to_gnc_numeric( AB_Value_GetValueAsDouble(AB_Transaction_GetValue(ab_trans)), xaccAccountGetCommoditySCU(gnc_acc), GNC_HOW_RND_ROUND_HALF_UP); gnc_xfer_dialog_set_amount(xfer_dialog, amount); gnc_xfer_dialog_set_amount_sensitive(xfer_dialog, FALSE); gnc_xfer_dialog_set_date_sensitive(xfer_dialog, FALSE); description = gnc_ab_description_to_gnc(ab_trans); gnc_xfer_dialog_set_description(xfer_dialog, description); g_free(description); memo = gnc_ab_memo_to_gnc(ab_trans); gnc_xfer_dialog_set_memo(xfer_dialog, memo); g_free(memo); gnc_xfer_dialog_set_txn_cb(xfer_dialog, txn_created_cb, &gnc_trans); /* And run it */ successful = gnc_xfer_dialog_run_until_done(xfer_dialog); /* On cancel, go back to the AB transaction dialog */ if (!successful || !gnc_trans) { successful = FALSE; goto repeat; } if (result == GNC_RESPONSE_NOW) { /* Create a context to store possible results */ context = AB_ImExporterContext_new(); gui = gnc_GWEN_Gui_get(parent); if (!gui) { g_warning("gnc_ab_maketrans: Couldn't initialize Gwenhywfar GUI"); aborted = TRUE; goto repeat; } /* Finally, execute the job */ AB_Banking_ExecuteJobs(api, job_list, context #ifndef AQBANKING_VERSION_5_PLUS , 0 #endif ); /* 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", _("An error occurred while executing the job. Please check " "the log window for the exact error message.\n" "\n" "Do you want to enter the job again?"))) { aborted = TRUE; } } else { successful = TRUE; } if (successful) { /* Import the results, awaiting nothing */ ieci = gnc_ab_import_context(context, 0, FALSE, NULL, parent); } } /* Simply ignore any other case */ repeat: /* Clean up */ if (gnc_trans && !successful) { xaccTransBeginEdit(gnc_trans); xaccTransDestroy(gnc_trans); xaccTransCommitEdit(gnc_trans); gnc_trans = NULL; } if (ieci) g_free(ieci); if (context) AB_ImExporterContext_free(context); if (job_list) { AB_Job_List2_free(job_list); job_list = NULL; } if (job) { AB_Job_free(job); job = NULL; } if (gui) { gnc_GWEN_Gui_release(gui); gui = NULL; } } while (!successful && !aborted); cleanup: if (td) gnc_ab_trans_dialog_free(td); if (online) #ifdef AQBANKING_VERSION_4_EXACTLY AB_Banking_OnlineFini(api, 0); #else AB_Banking_OnlineFini(api); #endif gnc_AB_BANKING_fini(api); }
void gnc_ab_getbalance(GtkWidget *parent, Account *gnc_acc) { AB_BANKING *api; gboolean online = FALSE; AB_ACCOUNT *ab_acc; AB_JOB *job = NULL; AB_JOB_LIST2 *job_list = NULL; GncGWENGui *gui = NULL; AB_IMEXPORTER_CONTEXT *context = NULL; GncABImExContextImport *ieci = NULL; AB_JOB_STATUS job_status; g_return_if_fail(parent && gnc_acc); /* Get the API */ api = gnc_AB_BANKING_new(); if (!api) { g_warning("gnc_ab_gettrans: Couldn't get AqBanking API"); return; } if (AB_Banking_OnlineInit(api #ifdef AQBANKING_VERSION_4_EXACTLY , 0 #endif ) != 0) { g_warning("gnc_ab_gettrans: Couldn't initialize AqBanking API"); goto cleanup; } online = TRUE; /* Get the AqBanking Account */ ab_acc = gnc_ab_get_ab_account(api, gnc_acc); if (!ab_acc) { g_warning("gnc_ab_getbalance: No AqBanking account found"); gnc_error_dialog (GTK_WINDOW (parent), _("No valid online banking account assigned.")); goto cleanup; } /* Get a GetBalance job and enqueue it */ job = AB_JobGetBalance_new(ab_acc); if (!job || AB_Job_CheckAvailability(job #ifndef AQBANKING_VERSION_5_PLUS , 0 #endif )) { g_warning("gnc_ab_getbalance: JobGetBalance not available for this " "account"); gnc_error_dialog (GTK_WINDOW (parent), _("Online action \"Get Balance\" not available for this account.")); goto cleanup; } job_list = AB_Job_List2_new(); AB_Job_List2_PushBack(job_list, job); /* Get a GUI object */ gui = gnc_GWEN_Gui_get(parent); if (!gui) { g_warning("gnc_ab_getbalance: Couldn't initialize Gwenhywfar GUI"); goto cleanup; } /* Create a context to store the results */ context = AB_ImExporterContext_new(); /* Execute the job */ AB_Banking_ExecuteJobs(api, job_list, context #ifndef AQBANKING_VERSION_5_PLUS , 0 #endif ); /* 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) { g_warning("gnc_ab_getbalance: Error on executing job"); gnc_error_dialog (GTK_WINDOW (parent), _("Error on executing job.\n\nStatus: %s - %s"), AB_Job_Status2Char(job_status), AB_Job_GetResultText(job)); goto cleanup; } /* Import the results */ ieci = gnc_ab_import_context(context, AWAIT_BALANCES, FALSE, NULL, parent); cleanup: if (ieci) g_free(ieci); if (context) AB_ImExporterContext_free(context); if (gui) gnc_GWEN_Gui_release(gui); if (job_list) AB_Job_List2_free(job_list); if (job) AB_Job_free(job); if (online) #ifdef AQBANKING_VERSION_4_EXACTLY AB_Banking_OnlineFini(api, 0); #else AB_Banking_OnlineFini(api); #endif gnc_AB_BANKING_fini(api); }
void KBJobListViewItem::_populate() { QString tmp; int i; AB_ACCOUNT *a; const char *p; assert(_job); i = 0; a = AB_Job_GetAccount(_job); assert(a); // job id setText(i++, QString::number(AB_Job_GetJobId(_job))); // job type switch (AB_Job_GetType(_job)) { case AB_Job_TypeGetBalance: tmp = i18n("Get Balance"); break; case AB_Job_TypeGetTransactions: tmp = i18n("Get Transactions"); break; case AB_Job_TypeTransfer: tmp = i18n("Transfer"); break; case AB_Job_TypeDebitNote: tmp = i18n("Debit Note"); break; default: tmp = i18nc("Unknown job type", "(unknown)"); break; } setText(i++, tmp); // bank name tmp = AB_Account_GetBankName(a); if (tmp.isEmpty()) tmp = AB_Account_GetBankCode(a); if (tmp.isEmpty()) tmp = i18nc("Unknown bank code", "(unknown)"); setText(i++, tmp); // account name tmp = AB_Account_GetAccountName(a); if (tmp.isEmpty()) tmp = AB_Account_GetAccountNumber(a); if (tmp.isEmpty()) tmp = i18nc("Unknown account number", "(unknown)"); setText(i++, tmp); // status switch (AB_Job_GetStatus(_job)) { case AB_Job_StatusNew: tmp = i18nc("Status of the job", "new"); break; case AB_Job_StatusUpdated: tmp = i18nc("Status of the job", "updated"); break; case AB_Job_StatusEnqueued: tmp = i18nc("Status of the job", "enqueued"); break; case AB_Job_StatusSent: tmp = i18nc("Status of the job", "sent"); break; case AB_Job_StatusPending: tmp = i18nc("Status of the job", "pending"); break; case AB_Job_StatusFinished: tmp = i18nc("Status of the job", "finished"); break; case AB_Job_StatusError: tmp = i18nc("Status of the job", "error"); break; default: tmp = i18nc("Status of the job", "(unknown)"); break; } setText(i++, tmp); p = AB_Provider_GetName(AB_Account_GetProvider(a)); if (!p) tmp = i18nc("Unknown account provider", "(unknown)"); else tmp = p; setText(i++, tmp); p = AB_Job_GetCreatedBy(_job); if (!p) tmp = i18nc("Unknown creator of the job", "(unknown)"); else tmp = p; setText(i++, tmp); }
/** Return the HBCI return code of the given 'job', or zero if none was * found. If 'verbose' is TRUE, make a lot of debugging messages about * this outboxjob. */ static int gnc_hbci_debug_outboxjob (GNCInteractor *inter, AB_JOB *job, gboolean verbose) { int cause = 0; AB_JOB_STATUS jobstatus; g_assert (job); if (verbose) { g_warning("gnc_hbci_debug_outboxjob: Job status: %s", AB_Job_Status2Char(AB_Job_GetStatus(job))); g_warning(", result: %s", AB_Job_GetResultText(job) ? AB_Job_GetResultText(job) : "(none)"); g_warning("\n"); } jobstatus = AB_Job_GetStatus (job); if (jobstatus == AB_Job_StatusError) { if (AB_Job_GetResultText (job)) { /* Add the "result text" to the log window */ char *logstring = g_strdup_printf("Job %s had an error: %s\n", AB_Job_Type2Char(AB_Job_GetType(job)), AB_Job_GetResultText(job)); GNCInteractor_add_log_text (inter, logstring); g_free (logstring); } if (!verbose) g_warning("gnc_hbci_debug_outboxjob: Job %s had an error: %s\n", AB_Job_Type2Char(AB_Job_GetType(job)), AB_Job_GetResultText(job) ? AB_Job_GetResultText(job) : "(none)"); cause = 9000; } else { cause = 0; } #if 0 /* hbci debugging code; might be adapted to aqbanking at a later point in time */ list = AB_JOB_resultCodes (job); if (list_int_size (list) > 0) { cause = get_resultcode_error (list); if (verbose) { g_warning("OutboxJob resultcodes: "); print_list_int (list); switch (cause) { case 9310: msg = "Schluessel noch nicht hinterlegt"; break; case 9320: msg = "Schluessel noch nicht freigeschaltet"; break; case 9330: msg = "Schluessel gesperrt"; break; case 9340: msg = "Schluessel falsch"; break; default: msg = "Unknown"; } g_warning("Probable cause of error was: code %d, msg: %s\n", cause, msg); } } else { if (verbose) g_warning("OutboxJob's resultCodes list has zero length.\n"); } list_int_delete (list); #endif return cause; }