static AB_IMEXPORTER_ACCOUNTINFO * accountinfolist_cb(AB_IMEXPORTER_ACCOUNTINFO *accinfo, void *user_data) { Account *gnc_acc; struct import_data *data = user_data; const char *bank_code = AB_ImExporterAccountInfo_GetBankCode(accinfo); const char *account_number = AB_ImExporterAccountInfo_GetAccountNumber(accinfo); const char *account_name = AB_ImExporterAccountInfo_GetAccountName(accinfo); gchar *online_id = g_strconcat (bank_code, account_number, NULL); gnc_acc = gnc_import_select_account(NULL, online_id, 1, account_name, NULL, ACCT_TYPE_NONE, NULL, NULL); g_free(online_id); if (gnc_acc) { /* Store chosen gnucash account in callback data */ data->gnc_acc = gnc_acc; if (data->execute_transactions) { /* Retrieve the aqbanking account that belongs to this gnucash account */ data->hbci_account = gnc_hbci_get_hbci_acc (data->ab, gnc_acc); if (data->hbci_account == NULL) { gnc_error_dialog (NULL, _("No Online Banking account found for this gnucash account. These transactions will not be executed by Online Banking.")); } } else { data->hbci_account = NULL; } /* Iterate through all transactions. */ AB_ImExporterAccountInfo_TransactionsForEach (accinfo, translist_cb, data); /* all transactions finished. */ } return NULL; }
static AB_IMEXPORTER_ACCOUNTINFO * txn_accountinfo_cb(AB_IMEXPORTER_ACCOUNTINFO *element, gpointer user_data) { GncABImExContextImport *data = user_data; Account *gnc_acc; g_return_val_if_fail(element && data, NULL); if (data->awaiting & IGNORE_TRANSACTIONS) /* Ignore them */ return NULL; if (!AB_ImExporterAccountInfo_GetFirstTransaction(element)) /* No transaction found */ return NULL; else data->awaiting |= FOUND_TRANSACTIONS; if (!(data->awaiting & AWAIT_TRANSACTIONS)) { if (gnc_verify_dialog(data->parent, TRUE, "%s", _("The bank has sent transaction information " "in its response." "\n" "Do you want to import it?"))) { data->awaiting |= AWAIT_TRANSACTIONS; } else { data->awaiting |= IGNORE_TRANSACTIONS; return NULL; } } /* Lookup the corresponding gnucash account */ gnc_acc = gnc_ab_accinfo_to_gnc_acc(element); if (!gnc_acc) return NULL; data->gnc_acc = gnc_acc; if (data->execute_txns) { /* Retrieve the aqbanking account that belongs to this gnucash * account */ data->ab_acc = gnc_ab_get_ab_account(data->api, gnc_acc); if (!data->ab_acc) { gnc_error_dialog(NULL, "%s", _("No Online Banking account found for this " "gnucash account. These transactions will " "not be executed by Online Banking.")); } } else { data->ab_acc = NULL; } if (!data->generic_importer) { data->generic_importer = gnc_gen_trans_list_new(data->parent, NULL, TRUE, 14); if (data->execute_txns) { gnc_gen_trans_list_add_tp_cb(data->generic_importer, gnc_ab_trans_processed_cb, data); } } /* Iterate through all transactions */ AB_ImExporterAccountInfo_TransactionsForEach(element, txn_transaction_cb, data); return NULL; }