gnucash maint: Multiple changes pushed
John Ralls
jralls at code.gnucash.org
Fri Mar 29 12:39:01 EDT 2019
Updated via https://github.com/Gnucash/gnucash/commit/79d72fdc (commit)
via https://github.com/Gnucash/gnucash/commit/62f7aa66 (commit)
via https://github.com/Gnucash/gnucash/commit/d8c6af2d (commit)
from https://github.com/Gnucash/gnucash/commit/6cbb0adf (commit)
commit 79d72fdc335c4d8ef4b97b52965ee41b81611017
Merge: 6cbb0adf3 62f7aa66a
Author: John Ralls <jralls at ceridwen.us>
Date: Fri Mar 29 09:38:42 2019 -0700
Merge branch 'aqb6' into maint
commit 62f7aa66a5b7f7f093f4622071ec128a8198c03a
Author: John Ralls <jralls at ceridwen.us>
Date: Thu Mar 28 18:03:55 2019 -0700
Bug 796956 - Aqbanking 6 will drop DTAUS
More important, the AQBanking API has some naming changes.
This commit is substantially cribbed from Martin Pruess's
adaptation in the AQBanking repository. Thanks, Martin!
diff --git a/README.dependencies b/README.dependencies
index 43237b2c5..db0ea9ec2 100644
--- a/README.dependencies
+++ b/README.dependencies
@@ -85,8 +85,8 @@ Libraries/Deps
optional
--------
- aqbanking 4.0.0 online banking; also requires
- gwehywfar and ktoblzcheck
+ aqbanking 5.3.4 online banking; also requires
+ gwehywfar.
libdbi 0.8.3 SQL backend; also requires at
least one of libdbd-sqlite3,
diff --git a/gnucash/import-export/aqb/assistant-ab-initial.c b/gnucash/import-export/aqb/assistant-ab-initial.c
index 59cb1d88a..121cc0010 100644
--- a/gnucash/import-export/aqb/assistant-ab-initial.c
+++ b/gnucash/import-export/aqb/assistant-ab-initial.c
@@ -36,7 +36,13 @@
#include <windows.h>
#endif
+#include "gnc-ab-utils.h" /* For version macros */
+
#include <aqbanking/banking.h>
+#ifdef AQBANKING6
+#include <aqbanking/types/account_spec.h>
+#include <gwenhywfar/gui.h>
+#endif
#include <glib.h>
#include <glib/gi18n.h>
#include <glib/gstdio.h>
@@ -57,8 +63,9 @@
#include "gnc-ui-util.h"
#include "gnc-session.h"
#include "import-account-matcher.h"
-#include <aqbanking/dlg_setup.h>
-
+#ifndef AQBANKING6
+# include <aqbanking/dlg_setup.h>
+#endif
/* This static indicates the debugging module that this .o belongs to. */
static QofLogModule log_module = GNC_MOD_ASSISTANT;
@@ -87,8 +94,8 @@ void aai_match_page_prepare (GtkAssistant *assistant, gpointer user_data);
static gboolean banking_has_accounts(AB_BANKING *banking);
static void hash_from_kvp_acc_cb(Account *gnc_acc, gpointer user_data);
static ABInitialInfo *single_info = NULL;
-static gchar *ab_account_longname(const AB_ACCOUNT *ab_acc);
-static AB_ACCOUNT *update_account_list_acc_cb(AB_ACCOUNT *ab_acc, gpointer user_data);
+static gchar *ab_account_longname(const GNC_AB_ACCOUNT_SPEC *ab_acc);
+static GNC_AB_ACCOUNT_SPEC *update_account_list_acc_cb(GNC_AB_ACCOUNT_SPEC *ab_acc, gpointer user_data);
static void update_account_list(ABInitialInfo *info);
static gboolean find_gnc_acc_cb(gpointer key, gpointer value, gpointer user_data);
static gboolean clear_line_cb(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer user_data);
@@ -133,7 +140,7 @@ struct _AccCbData
struct _RevLookupData
{
Account *gnc_acc;
- AB_ACCOUNT *ab_acc;
+ GNC_AB_ACCOUNT_SPEC *ab_acc;
};
enum account_list_cols
@@ -187,7 +194,9 @@ aai_destroy_cb(GtkWidget *object, gpointer user_data)
if (info->gnc_hash)
{
+#ifndef AQBANKING6
AB_Banking_OnlineFini(info->api);
+#endif
g_hash_table_destroy(info->gnc_hash);
info->gnc_hash = NULL;
}
@@ -240,14 +249,16 @@ aai_wizard_button_clicked_cb(GtkButton *button, gpointer user_data)
}
{
- GWEN_DIALOG *dlg =
- AB_SetupDialog_new(banking);
+#ifdef AQBANKING6
+ GWEN_DIALOG *dlg = AB_Banking_CreateSetupDialog(banking);
+#else
+ GWEN_DIALOG *dlg = AB_SetupDialog_new(banking);
if (AB_Banking_OnlineInit(banking) != 0)
{
PERR("Got error on AB_Banking_OnlineInit!");
}
-
+#endif
if (!dlg)
{
PERR("Could not lookup Setup Dialog of aqbanking!");
@@ -262,11 +273,12 @@ aai_wizard_button_clicked_cb(GtkButton *button, gpointer user_data)
}
GWEN_Dialog_free(dlg);
}
-
+#ifndef AQBANKING6
if (AB_Banking_OnlineFini(banking) != 0)
{
PERR("Got error on AB_Banking_OnlineFini!");
}
+#endif
}
/* Enable the Assistant Buttons if we accounts */
@@ -293,8 +305,10 @@ aai_match_page_prepare (GtkAssistant *assistant, gpointer user_data)
/* Do not run this twice */
if (!info->match_page_prepared)
{
+#ifndef AQBANKING6
/* Load aqbanking accounts */
AB_Banking_OnlineInit(info->api);
+#endif
/* Determine current mapping */
root = gnc_book_get_root_account(gnc_get_current_book());
info->gnc_hash = g_hash_table_new(&g_direct_hash, &g_direct_equal);
@@ -331,23 +345,29 @@ aai_on_finish (GtkAssistant *assistant, gpointer user_data)
static gboolean
banking_has_accounts(AB_BANKING *banking)
{
- AB_ACCOUNT_LIST2 *accl;
- gboolean result;
+ GNC_AB_ACCOUNT_SPEC_LIST *accl = NULL;
+ gboolean result = FALSE;
g_return_val_if_fail(banking, FALSE);
+#ifdef AQBANKING6
+ if (AB_Banking_GetAccountSpecList (banking, &accl) >= 0 &&
+ accl && AV_AccountSpec_List_GetCount (accl))
+ result = TRUE;
+ if (accl)
+ AB_AccountSpec_List_Free (accl);
+#else
AB_Banking_OnlineInit(banking);
accl = AB_Banking_GetAccounts(banking);
if (accl && (AB_Account_List2_GetSize(accl) > 0))
result = TRUE;
- else
- result = FALSE;
if (accl)
AB_Account_List2_free(accl);
AB_Banking_OnlineFini(banking);
+#endif
return result;
}
@@ -356,7 +376,7 @@ static void
hash_from_kvp_acc_cb(Account *gnc_acc, gpointer user_data)
{
AccCbData *data = user_data;
- AB_ACCOUNT *ab_acc;
+ GNC_AB_ACCOUNT_SPEC *ab_acc;
ab_acc = gnc_ab_get_ab_account(data->api, gnc_acc);
if (ab_acc)
@@ -364,25 +384,29 @@ hash_from_kvp_acc_cb(Account *gnc_acc, gpointer user_data)
}
static gchar *
-ab_account_longname(const AB_ACCOUNT *ab_acc)
+ab_account_longname(const GNC_AB_ACCOUNT_SPEC *ab_acc)
{
- gchar *bankname;
- gchar *result;
- const char *ab_bankname, *bankcode, *subAccountId;
+ gchar *bankname = "";
+ gchar *result = NULL;
+ const char *ab_bankname, *bankcode, *subAccountId, *account_number;
g_return_val_if_fail(ab_acc, NULL);
+#ifdef AQBANKING6
+ bankcode = AB_AccountSpec_GetBankCode(ab_acc);
+ subAccountId = AB_AccountSpec_GetSubAccountId(ab_acc);
+ account_number = AB_AccountSpec_GetAccountNumber (ab_acc);
+#else
ab_bankname = AB_Account_GetBankName(ab_acc);
- bankname = ab_bankname ? gnc_utf8_strip_invalid_strdup(ab_bankname) : NULL;
+ bankname = ab_bankname ? gnc_utf8_strip_invalid_strdup(ab_bankname) : "";
bankcode = AB_Account_GetBankCode(ab_acc);
subAccountId = AB_Account_GetSubAccountId(ab_acc);
-
+ account_number = AB_Account_GetAccountNumber (ab_acc);
+#endif
/* Translators: Strings are 1. Bank code, 2. Bank name,
* 3. Account Number, 4. Subaccount ID */
result = g_strdup_printf(_("Bank code %s (%s), Account %s (%s)"),
- bankcode,
- bankname ? bankname : "",
- AB_Account_GetAccountNumber(ab_acc),
+ bankcode, bankname, account_number,
subAccountId ? subAccountId : "");
g_free(bankname);
@@ -390,8 +414,8 @@ ab_account_longname(const AB_ACCOUNT *ab_acc)
}
-static AB_ACCOUNT *
-update_account_list_acc_cb(AB_ACCOUNT *ab_acc, gpointer user_data)
+static GNC_AB_ACCOUNT_SPEC *
+update_account_list_acc_cb(GNC_AB_ACCOUNT_SPEC *ab_acc, gpointer user_data)
{
ABInitialInfo *info = user_data;
gchar *gnc_name, *ab_name;
@@ -428,7 +452,7 @@ update_account_list_acc_cb(AB_ACCOUNT *ab_acc, gpointer user_data)
static void
update_account_list(ABInitialInfo *info)
{
- AB_ACCOUNT_LIST2 *acclist;
+ GNC_AB_ACCOUNT_SPEC_LIST *acclist = NULL;
g_return_if_fail(info && info->api && info->gnc_hash);
@@ -438,9 +462,14 @@ update_account_list(ABInitialInfo *info)
/* Refill the list */
gtk_list_store_clear(info->account_store);
+#ifdef AQBANKING6
+ if (AB_Banking_GetAccountSpecList(info->api, &acclist) >= 0 && acclist)
+ AB_AccountSpec_List_ForEach(acclist, update_account_list_acc_cb, info);
+#else
acclist = AB_Banking_GetAccounts(info->api);
if (acclist)
AB_Account_List2_ForEach(acclist, update_account_list_acc_cb, info);
+#endif
else
g_warning("update_account_list: Oops, account list from AB_Banking "
"is NULL");
@@ -461,7 +490,7 @@ find_gnc_acc_cb(gpointer key, gpointer value, gpointer user_data)
if (value == data->gnc_acc)
{
- data->ab_acc = (AB_ACCOUNT*) key;
+ data->ab_acc = (GNC_AB_ACCOUNT_SPEC*) key;
return TRUE;
}
return FALSE;
@@ -495,7 +524,7 @@ account_list_clicked_cb (GtkTreeView *view, GtkTreePath *path,
ABInitialInfo *info = user_data;
GtkTreeModel *model;
GtkTreeIter iter;
- AB_ACCOUNT *ab_acc;
+ GNC_AB_ACCOUNT_SPEC *ab_acc;
gchar *longname, *gnc_name;
Account *old_value, *gnc_acc;
const gchar *currency;
@@ -518,7 +547,11 @@ account_list_clicked_cb (GtkTreeView *view, GtkTreePath *path,
old_value = g_hash_table_lookup(info->gnc_hash, ab_acc);
longname = ab_account_longname(ab_acc);
+#ifdef AQBANKING6
+ currency = AB_AccountSpec_GetCurrency(ab_acc);
+#else
currency = AB_Account_GetCurrency(ab_acc);
+#endif
if (currency && *currency)
{
commodity = gnc_commodity_table_lookup(
@@ -588,7 +621,7 @@ clear_kvp_acc_cb(Account *gnc_acc, gpointer user_data)
static void
save_kvp_acc_cb(gpointer key, gpointer value, gpointer user_data)
{
- AB_ACCOUNT *ab_acc = key;
+ GNC_AB_ACCOUNT_SPEC *ab_acc = key;
Account *gnc_acc = value;
guint32 ab_account_uid;
const gchar *ab_accountid, *gnc_accountid;
@@ -596,18 +629,30 @@ save_kvp_acc_cb(gpointer key, gpointer value, gpointer user_data)
g_return_if_fail(ab_acc && gnc_acc);
+#ifdef AQBANKING6
+ ab_account_uid = AB_AccountSpec_GetUniqueId(ab_acc);
+#else
ab_account_uid = AB_Account_GetUniqueId(ab_acc);
+#endif
if (gnc_ab_get_account_uid(gnc_acc) != ab_account_uid)
gnc_ab_set_account_uid(gnc_acc, ab_account_uid);
+#ifdef AQBANKING6
+ ab_accountid = AB_AccountSpec_GetAccountNumber(ab_acc);
+#else
ab_accountid = AB_Account_GetAccountNumber(ab_acc);
+#endif
gnc_accountid = gnc_ab_get_account_accountid(gnc_acc);
if (ab_accountid
&& (!gnc_accountid
|| (strcmp(ab_accountid, gnc_accountid) != 0)))
gnc_ab_set_account_accountid(gnc_acc, ab_accountid);
+#ifdef AQBANKING6
+ ab_bankcode = AB_AccountSpec_GetBankCode(ab_acc);
+#else
ab_bankcode = AB_Account_GetBankCode(ab_acc);
+#endif
gnc_bankcode = gnc_ab_get_account_bankcode(gnc_acc);
if (ab_bankcode
&& (!gnc_bankcode
diff --git a/gnucash/import-export/aqb/dialog-ab-trans.c b/gnucash/import-export/aqb/dialog-ab-trans.c
index bea6abf55..ef12efb3e 100644
--- a/gnucash/import-export/aqb/dialog-ab-trans.c
+++ b/gnucash/import-export/aqb/dialog-ab-trans.c
@@ -37,6 +37,9 @@
#include <aqbanking/jobinternaltransfer.h>
#include <aqbanking/jobsepatransfer.h>
#include <aqbanking/jobsepadebitnote.h>
+#ifdef AQBANKING6
+# include <aqbanking/types/transaction.h>
+#endif
#include <gnc-aqbanking-templates.h>
#include "dialog-ab-trans.h"
@@ -61,7 +64,7 @@ static gboolean gnc_ab_trans_dialog_get_templ_helper(GtkTreeModel *model,
gpointer data);
static AB_TRANSACTION *gnc_ab_trans_dialog_fill_values(GncABTransDialog *td);
-static AB_JOB *gnc_ab_trans_dialog_get_available_empty_job(AB_ACCOUNT *ab_acc,
+static GNC_AB_JOB *gnc_ab_trans_dialog_get_available_empty_job(GNC_AB_ACCOUNT_SPEC *ab_acc,
GncABTransType trans_type);
static void gnc_ab_trans_dialog_check_iban(const GncABTransDialog *td,
@@ -102,7 +105,7 @@ struct _GncABTransDialog
/* The dialog itself */
GtkWidget *dialog;
GtkWidget *parent;
- AB_ACCOUNT *ab_acc;
+ GNC_AB_ACCOUNT_SPEC *ab_acc;
/* Whether this is a transfer or a direct debit */
GncABTransType trans_type;
@@ -182,11 +185,11 @@ gnc_ab_trans_dialog_fill_values(GncABTransDialog *td)
AB_TRANSACTION *trans = AB_Transaction_new();
AB_VALUE *value;
+#ifdef AQBNKING6
+ AB_Banking_FillTransactionFromAccountSpec(trans, td->ab_acc);
+#else
AB_Transaction_FillLocalFromAccount(trans, td->ab_acc);
- //AB_Transaction_SetLocalBankCode(trans, AB_Account_GetBankCode(td->ab_acc));
- //AB_Transaction_SetLocalAccountNumber(
- // trans, AB_Account_GetAccountNumber(td->ab_acc));
- //AB_Transaction_SetLocalCountry(trans, "DE");
+#endif
if (gnc_ab_trans_isSEPA(td->trans_type))
{
@@ -205,6 +208,17 @@ gnc_ab_trans_dialog_fill_values(GncABTransDialog *td)
trans, gtk_entry_get_text(GTK_ENTRY(td->recp_account_entry)));
}
AB_Transaction_SetRemoteCountry(trans, "DE");
+#ifdef AQBANKING6
+ AB_Transaction_SetRemoteName(
+ trans, gtk_entry_get_text(GTK_ENTRY(td->recp_name_entry)));
+
+ AB_Transaction_AddPurposeLine(
+ trans, gtk_entry_get_text(GTK_ENTRY(td->purpose_entry)));
+ AB_Transaction_AddPurposeLine(
+ trans, gtk_entry_get_text(GTK_ENTRY(td->purpose_cont_entry)));
+ AB_Transaction_AddPurposeLine(
+ trans, gtk_entry_get_text(GTK_ENTRY(td->purpose_cont2_entry)));
+#else
AB_Transaction_AddRemoteName(
trans, gtk_entry_get_text(GTK_ENTRY(td->recp_name_entry)), FALSE);
@@ -216,7 +230,7 @@ gnc_ab_trans_dialog_fill_values(GncABTransDialog *td)
trans, gtk_entry_get_text(GTK_ENTRY(td->purpose_cont2_entry)), FALSE);
AB_Transaction_AddPurpose(
trans, gtk_entry_get_text(GTK_ENTRY(td->purpose_cont3_entry)), FALSE);
-
+#endif
value = AB_Value_fromDouble(gnc_amount_edit_get_damount(
GNC_AMOUNT_EDIT(td->amount_edit)));
/* FIXME: Replace "EUR" by account-dependent string here. */
@@ -242,7 +256,7 @@ gnc_ab_trans_dialog_fill_values(GncABTransDialog *td)
}
GncABTransDialog *
-gnc_ab_trans_dialog_new(GtkWidget *parent, AB_ACCOUNT *ab_acc,
+gnc_ab_trans_dialog_new(GtkWidget *parent, GNC_AB_ACCOUNT_SPEC *ab_acc,
gint commodity_scu, GncABTransType trans_type,
GList *templates)
{
@@ -270,6 +284,14 @@ gnc_ab_trans_dialog_new(GtkWidget *parent, AB_ACCOUNT *ab_acc,
g_return_val_if_fail(ab_acc, NULL);
+#ifdef AQBANKING6
+ ab_ownername = AB_AccountSpec_GetOwnerName(ab_acc);
+ if (!ab_ownername)
+ ab_ownername = "";
+ ab_accountnumber = AB_AccountSpec_GetAccountNumber(ab_acc);
+ ab_bankcode = AB_AccountSpec_GetBankCode(ab_acc);
+ ab_bankname = _("(unknown)");
+#else
ab_ownername = AB_Account_GetOwnerName(ab_acc);
if (!ab_ownername)
ab_ownername = "";
@@ -278,6 +300,7 @@ gnc_ab_trans_dialog_new(GtkWidget *parent, AB_ACCOUNT *ab_acc,
ab_bankname = AB_Account_GetBankName(ab_acc);
if (!ab_bankname || !*ab_bankname)
ab_bankname = _("(unknown)");
+#endif
td = g_new0(GncABTransDialog, 1);
td->parent = parent;
@@ -404,8 +427,13 @@ gnc_ab_trans_dialog_new(GtkWidget *parent, AB_ACCOUNT *ab_acc,
if (gnc_ab_trans_isSEPA(trans_type))
{
gtk_widget_set_sensitive(GTK_WIDGET(td->orig_name_entry), TRUE);
+#if AQBANKING6
+ ab_accountnumber = AB_AccountSpec_GetIBAN(ab_acc);
+ ab_bankcode = AB_AccountSpec_GetBIC(ab_acc);
+#else
ab_accountnumber = AB_Account_GetIBAN(ab_acc);
ab_bankcode = AB_Account_GetBIC(ab_acc);
+#endif
gtk_label_set_text(GTK_LABEL(orig_account_label), ab_accountnumber);
gtk_label_set_text (GTK_LABEL (orig_bankcode_label), ab_bankcode);
}
@@ -623,7 +651,7 @@ gint
gnc_ab_trans_dialog_run_until_ok(GncABTransDialog *td)
{
gint result;
- AB_JOB *job;
+ GNC_AB_JOB *job;
const AB_TRANSACTION_LIMITS *joblimits;
guint8 max_purpose_lines;
@@ -636,7 +664,11 @@ gnc_ab_trans_dialog_run_until_ok(GncABTransDialog *td)
}
/* Activate as many purpose entries as available for the job */
+#ifdef AQBANKING6
+ joblimits = AB_AccountSpec_GetTransactionLimitsForCommand(td->ab_acc, AB_Transaction_GetCommand(job));
+#else
joblimits = AB_Job_GetFieldLimits (job);
+#endif
max_purpose_lines = joblimits ?
AB_TransactionLimits_GetMaxLinesPurpose(joblimits) : 2;
gtk_widget_set_sensitive(td->purpose_cont_entry, max_purpose_lines > 1);
@@ -772,11 +804,39 @@ gnc_ab_trans_dialog_get_ab_trans(const GncABTransDialog *td)
return td->ab_trans;
}
-static AB_JOB *
-gnc_ab_trans_dialog_get_available_empty_job(AB_ACCOUNT *ab_acc, GncABTransType trans_type)
+static GNC_AB_JOB *
+gnc_ab_trans_dialog_get_available_empty_job(GNC_AB_ACCOUNT_SPEC *ab_acc, GncABTransType trans_type)
{
- AB_JOB *job;
-
+ GNC_AB_JOB *job;
+#ifdef AQBANKING6
+ AB_TRANSACTION_COMMAND cmd = AB_Transaction_CommandUnknown;
+
+ switch (trans_type)
+ {
+ case SINGLE_DEBITNOTE:
+ cmd=AB_Transaction_CommandDebitNote;
+ break;
+ case SINGLE_INTERNAL_TRANSFER:
+ cmd=AB_Transaction_CommandInternalTransfer;
+ break;
+ case SEPA_TRANSFER:
+ cmd=AB_Transaction_CommandSepaTransfer;
+ break;
+ case SEPA_DEBITNOTE:
+ cmd=AB_Transaction_CommandSepaDebitNote;
+ break;
+ case SEPA_TRANSFER:
+ default:
+ cmd=AB_Transaction_CommandTransfer;
+ break;
+ };
+ if (!AB_AccountSpec_GetTransactionLimitsForCommand(ab_acc, cmd))
+ return NULL;
+
+ job = AB_Transaction_new();
+ AB_Transaction_SetCommand(job, cmd);
+ AB_Transaction_SetUniqueAccountId(job, AB_AccountSpec_GetUniqueId(ab_acc));
+#else
switch (trans_type)
{
case SINGLE_DEBITNOTE:
@@ -796,36 +856,56 @@ gnc_ab_trans_dialog_get_available_empty_job(AB_ACCOUNT *ab_acc, GncABTransType t
job = AB_JobSepaTransfer_new(ab_acc);
break;
};
-
if (!job || AB_Job_CheckAvailability(job))
{
if (job) AB_Job_free(job);
return NULL;
}
+#endif
return job;
}
-AB_JOB *
+GNC_AB_JOB *
gnc_ab_trans_dialog_get_job(const GncABTransDialog *td)
{
g_return_val_if_fail(td, NULL);
return gnc_ab_get_trans_job(td->ab_acc, td->ab_trans, td->trans_type);
}
-AB_JOB *
-gnc_ab_get_trans_job(AB_ACCOUNT *ab_acc, const AB_TRANSACTION *ab_trans,
+GNC_AB_JOB *
+gnc_ab_get_trans_job(GNC_AB_ACCOUNT_SPEC *ab_acc,
+ const AB_TRANSACTION *ab_trans,
GncABTransType trans_type)
{
- AB_JOB *job;
+ GNC_AB_JOB *job;
g_return_val_if_fail(ab_acc && ab_trans, NULL);
+#ifdef AQBANKING6
+ job = gnc_ab_trans_dialog_get_available_empty_job(ab_acc, trans_type);
+ if (job)
+ {
+ AB_TRANSACTION *new_job;
+
+ /* merge transactions */
+ new_job=AB_Transaction_dup(ab_trans);
+ AB_Transaction_SetCommand(new_job, AB_Transaction_GetCommand(job));
+ AB_Transaction_SetUniqueAccountId(new_job,
+ AB_Transaction_GetUniqueAccountId(job));
+
+ AB_Transaction_free(job);
+ return new_job;
+ }
+ return NULL;
+
+#else
job = gnc_ab_trans_dialog_get_available_empty_job(ab_acc, trans_type);
if (job)
{
AB_Job_SetTransaction(job, ab_trans);
}
return job;
+#endif
}
void
diff --git a/gnucash/import-export/aqb/dialog-ab-trans.h b/gnucash/import-export/aqb/dialog-ab-trans.h
index 473bfccae..2a630e6e1 100644
--- a/gnucash/import-export/aqb/dialog-ab-trans.h
+++ b/gnucash/import-export/aqb/dialog-ab-trans.h
@@ -35,6 +35,7 @@
#ifndef DIALOG_AB_TRANS_H
#define DIALOG_AB_TRANS_H
+#include "gnc-ab-utils.h"
#include <gtk/gtk.h>
#include <aqbanking/banking.h>
@@ -74,7 +75,7 @@ gboolean gnc_ab_trans_isSEPA(GncABTransType t);
* gnc_ab_trans_dialog_get_templ()
* @return A new GncABTransDialog, free with gnc_ab_trans_dialog_free()
*/
-GncABTransDialog *gnc_ab_trans_dialog_new(GtkWidget *parent, AB_ACCOUNT *ab_acc,
+GncABTransDialog *gnc_ab_trans_dialog_new(GtkWidget *parent, GNC_AB_ACCOUNT_SPEC *ab_acc,
gint commodity_scu,
GncABTransType trans_type,
GList *templates);
@@ -125,25 +126,25 @@ GtkWidget *gnc_ab_trans_dialog_get_parent(const GncABTransDialog *td);
* @param td Transaction dialog
* @return An Aqbanking transaction
*/
-const AB_TRANSACTION *gnc_ab_trans_dialog_get_ab_trans(
- const GncABTransDialog *td);
+const AB_TRANSACTION *gnc_ab_trans_dialog_get_ab_trans(const GncABTransDialog *td);
/**
- * Receive the Aqbanking job associated with the transaction
+ * Receive the Aqbanking job filled by the dialog.
*
* @param td Transaction dialog
* @return An Aqbanking job
*/
-AB_JOB *gnc_ab_trans_dialog_get_job(const GncABTransDialog *td);
+GNC_AB_JOB *gnc_ab_trans_dialog_get_job(const GncABTransDialog *td);
/**
- * FIXME
+ * Return the AqBanking job associated with the transaction.
*
* @param td Transaction dialog
- * @return FIXME
+ * @return An AQBanking job
*/
-AB_JOB *gnc_ab_get_trans_job(AB_ACCOUNT *ab_acc, const AB_TRANSACTION *ab_trans,
- GncABTransType trans_type);
+GNC_AB_JOB *gnc_ab_get_trans_job(GNC_AB_ACCOUNT_SPEC *ab_acc,
+ const AB_TRANSACTION *ab_trans,
+ GncABTransType trans_type);
G_END_DECLS
diff --git a/gnucash/import-export/aqb/gnc-ab-getbalance.c b/gnucash/import-export/aqb/gnc-ab-getbalance.c
index 680357d35..83c7e0b81 100644
--- a/gnucash/import-export/aqb/gnc-ab-getbalance.c
+++ b/gnucash/import-export/aqb/gnc-ab-getbalance.c
@@ -29,13 +29,18 @@
#include <config.h>
+#include "gnc-ab-utils.h"
+
#include <glib/gi18n.h>
#include <aqbanking/banking.h>
+#ifdef AQBANKING6
+# include <aqbanking/types/transaction.h>
+#else
#include <aqbanking/jobgetbalance.h>
+#endif
#include "gnc-ab-getbalance.h"
#include "gnc-ab-kvp.h"
-#include "gnc-ab-utils.h"
#include "gnc-gwen-gui.h"
#include "gnc-ui.h"
@@ -47,13 +52,13 @@ 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;
+ GNC_AB_ACCOUNT_SPEC *ab_acc;
+ GNC_AB_JOB *job = NULL;
+ GNC_AB_JOB_LIST2 *job_list = NULL;
GncGWENGui *gui = NULL;
AB_IMEXPORTER_CONTEXT *context = NULL;
GncABImExContextImport *ieci = NULL;
- AB_JOB_STATUS job_status;
+ GNC_AB_JOB_STATUS job_status;
g_return_if_fail(parent && gnc_acc);
@@ -64,13 +69,15 @@ gnc_ab_getbalance(GtkWidget *parent, Account *gnc_acc)
g_warning("gnc_ab_gettrans: Couldn't get AqBanking API");
return;
}
+
+#ifndef AQBANKING6
if (AB_Banking_OnlineInit(api) != 0)
{
g_warning("gnc_ab_gettrans: Couldn't initialize AqBanking API");
goto cleanup;
}
online = TRUE;
-
+#endif
/* Get the AqBanking Account */
ab_acc = gnc_ab_get_ab_account(api, gnc_acc);
if (!ab_acc)
@@ -81,17 +88,29 @@ gnc_ab_getbalance(GtkWidget *parent, Account *gnc_acc)
}
/* Get a GetBalance job and enqueue it */
+#ifdef AQBANKING6
+ if (!AB_AccountSpec_GetTransactionLimitsForCommand(ab_acc, AB_Transaction_CommandGetBalance))
+#else
job = AB_JobGetBalance_new(ab_acc);
if (!job || AB_Job_CheckAvailability(job))
+#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;
}
+#ifdef AQBANKING6
+ job = AB_Transaction_new();
+ AB_Transaction_SetCommand(job, AB_Transaction_CommandGetBalance);
+ AB_Transaction_SetUniqueAccountId(job, AB_AccountSpec_GetUniqueId(ab_acc));
+
+ job_list = AB_Transaction_List2_new();
+ AB_Transaction_List2_PushBack(job_list, job);
+#else
job_list = AB_Job_List2_new();
AB_Job_List2_PushBack(job_list, job);
-
+#endif
/* Get a GUI object */
gui = gnc_GWEN_Gui_get(parent);
if (!gui)
@@ -104,20 +123,34 @@ gnc_ab_getbalance(GtkWidget *parent, Account *gnc_acc)
context = AB_ImExporterContext_new();
/* Execute the job */
+#ifdef AQBANKING6
+ AB_Banking_SendCommands(api, job_list, context);
+#else
AB_Banking_ExecuteJobs(api, job_list, context);
+#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
*/
+#ifdef AQBANKING6
+#else
job_status = AB_Job_GetStatus(job);
if (job_status != AB_Job_StatusFinished
&& job_status != AB_Job_StatusPending)
+#endif
{
g_warning("gnc_ab_getbalance: Error on executing job");
- gnc_error_dialog (GTK_WINDOW (parent), _("Error on executing job.\n\nStatus: %s - %s"),
+#ifdef AQBANKING6
+ gnc_error_dialog (GTK_WINDOW (parent),
+ _("Error on executing job.\n\nStatus: %s"),
+ AB_Transaction_Status_toString(job_status));
+#else
+ gnc_error_dialog (GTK_WINDOW (parent),
+ _("Error on executing job.\n\nStatus: %s - %s"),
AB_Job_Status2Char(job_status),
AB_Job_GetResultText(job));
+#endif
goto cleanup;
}
@@ -131,11 +164,18 @@ cleanup:
AB_ImExporterContext_free(context);
if (gui)
gnc_GWEN_Gui_release(gui);
+#ifdef AQBANKING6
+ if (job_list)
+ AB_Transaction_List2_free(job_list);
+ if (job)
+ AB_Transaction_free(job);
+#else
if (job_list)
AB_Job_List2_free(job_list);
if (job)
AB_Job_free(job);
if (online)
AB_Banking_OnlineFini(api);
+#endif
gnc_AB_BANKING_fini(api);
}
diff --git a/gnucash/import-export/aqb/gnc-ab-gettrans.c b/gnucash/import-export/aqb/gnc-ab-gettrans.c
index 5bccb9521..411a5ba9a 100644
--- a/gnucash/import-export/aqb/gnc-ab-gettrans.c
+++ b/gnucash/import-export/aqb/gnc-ab-gettrans.c
@@ -29,15 +29,19 @@
#include <config.h>
+#include "gnc-ab-utils.h"
+
#include <glib/gi18n.h>
#include <aqbanking/banking.h>
-#include <aqbanking/jobgettransactions.h>
-
+#ifdef AQBANKING6
+# include <aqbanking/types/transaction.h>
+#else
+# include <aqbanking/jobgettransactions.h>
+#endif
#include "Account.h"
#include "dialog-ab-daterange.h"
#include "gnc-ab-gettrans.h"
#include "gnc-ab-kvp.h"
-#include "gnc-ab-utils.h"
#include "gnc-gwen-gui.h"
#include "gnc-ui.h"
@@ -98,15 +102,15 @@ gnc_ab_gettrans(GtkWidget *parent, Account *gnc_acc)
{
AB_BANKING *api;
gboolean online = FALSE;
- AB_ACCOUNT *ab_acc;
+ GNC_AB_ACCOUNT_SPEC *ab_acc;
GWEN_TIME *from_date = NULL, *to_date = NULL;
time64 until;
- AB_JOB *job = NULL;
- AB_JOB_LIST2 *job_list = NULL;
+ GNC_AB_JOB *job = NULL;
+ GNC_AB_JOB_LIST2 *job_list = NULL;
GncGWENGui *gui = NULL;
AB_IMEXPORTER_CONTEXT *context = NULL;
GncABImExContextImport *ieci = NULL;
- AB_JOB_STATUS job_status;
+ GNC_AB_JOB_STATUS job_status;
g_return_if_fail(parent && gnc_acc);
@@ -117,13 +121,14 @@ gnc_ab_gettrans(GtkWidget *parent, Account *gnc_acc)
g_warning("gnc_ab_gettrans: Couldn't get AqBanking API");
return;
}
+#ifndef AQBANKING6
if (AB_Banking_OnlineInit(api) != 0)
{
g_warning("gnc_ab_gettrans: Couldn't initialize AqBanking API");
goto cleanup;
}
online = TRUE;
-
+#endif
/* Get the AqBanking Account */
ab_acc = gnc_ab_get_ab_account(api, gnc_acc);
if (!ab_acc)
@@ -143,19 +148,49 @@ gnc_ab_gettrans(GtkWidget *parent, Account *gnc_acc)
until = GWEN_Time_toTime_t(to_date);
/* Get a GetTransactions job and enqueue it */
+#ifdef AQBANKING6
+ if (!AB_AccountSpec_GetTransactionLimitsForCommand(ab_acc, AB_Transaction_CommandGetTransactions))
+#else
job = AB_JobGetTransactions_new(ab_acc);
if (!job || AB_Job_CheckAvailability(job))
+#endif
{
g_warning("gnc_ab_gettrans: JobGetTransactions not available for this "
"account");
gnc_error_dialog (GTK_WINDOW (parent), _("Online action \"Get Transactions\" not available for this account."));
goto cleanup;
}
+#ifdef AQBANKING6
+ job = AB_Transaction_new();
+ AB_Transaction_SetCommand(job, AB_Transaction_CommandGetTransactions);
+ AB_Transaction_SetUniqueAccountId(job, AB_AccountSpec_GetUniqueId(ab_acc));
+
+ if (from_date) /* TODO: this should be simplified */
+ {
+ GWEN_DATE *dt;
+
+ dt=GWEN_Date_fromLocalTime(GWEN_Time_toTime_t(from_date));
+ AB_Transaction_SetFirstDate(job, dt);
+ GWEN_Date_free(dt);
+ }
+
+ if (to_date)
+ {
+ GWEN_DATE *dt;
+
+ dt=GWEN_Date_fromLocalTime(GWEN_Time_toTime_t(to_date));
+ AB_Transaction_SetLastDate(job, dt);
+ GWEN_Date_free(dt);
+ }
+
+ job_list = AB_Transaction_List2_new();
+ AB_Transaction_List2_PushBack(job_list, job);
+#else
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);
-
+#endif
/* Get a GUI object */
gui = gnc_GWEN_Gui_get(parent);
if (!gui)
@@ -168,20 +203,38 @@ gnc_ab_gettrans(GtkWidget *parent, Account *gnc_acc)
context = AB_ImExporterContext_new();
/* Execute the job */
+#ifdef AQBANKING6
+ AB_Banking_SendCommands(api, job_list, context);
+#else
AB_Banking_ExecuteJobs(api, job_list, context);
+#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
*/
+#ifdef AQBANKING6
+ job_status = AB_Transaction_GetStatus(job);
+ if (job_status != AB_Transaction_StatusAccepted
+ && job_status != AB_Transaction_StatusPending)
+#else
job_status = AB_Job_GetStatus(job);
if (job_status != AB_Job_StatusFinished
&& job_status != AB_Job_StatusPending)
+#endif
{
g_warning("gnc_ab_gettrans: Error on executing job");
- gnc_error_dialog (GTK_WINDOW (parent), _("Error on executing job.\n\nStatus: %s - %s"),
+#ifdef AQBANKING6
+ gnc_error_dialog (GTK_WINDOW (parent),
+ _("Error on executing job.\n\nStatus: %s (%d)"),
+ AB_Transaction_Status_toString(job_status),
+ job_status);
+#else
+ gnc_error_dialog (GTK_WINDOW (parent),
+ _("Error on executing job.\n\nStatus: %s - %s"),
AB_Job_Status2Char(job_status),
AB_Job_GetResultText(job));
+#endif
goto cleanup;
}
@@ -214,14 +267,24 @@ cleanup:
if (gui)
gnc_GWEN_Gui_release(gui);
if (job_list)
+#ifdef AQBANKING6
+ AB_Transaction_List2_free(job_list);
+#else
AB_Job_List2_free(job_list);
+#endif
if (job)
+#ifdef AQBANKING6
+ AB_Transaction_free(job);
+#else
AB_Job_free(job);
+#endif
if (to_date)
GWEN_Time_free(to_date);
if (from_date)
GWEN_Time_free(from_date);
+#ifndef AQBANKING6
if (online)
AB_Banking_OnlineFini(api);
+#endif
gnc_AB_BANKING_fini(api);
}
diff --git a/gnucash/import-export/aqb/gnc-ab-transfer.c b/gnucash/import-export/aqb/gnc-ab-transfer.c
index 5f08fa92b..421916e5c 100644
--- a/gnucash/import-export/aqb/gnc-ab-transfer.c
+++ b/gnucash/import-export/aqb/gnc-ab-transfer.c
@@ -82,7 +82,7 @@ gnc_ab_maketrans(GtkWidget *parent, Account *gnc_acc,
{
AB_BANKING *api;
gboolean online = FALSE;
- AB_ACCOUNT *ab_acc;
+ GNC_AB_ACCOUNT_SPEC *ab_acc;
GList *templates = NULL;
GncABTransDialog *td = NULL;
gboolean successful = FALSE;
@@ -97,13 +97,14 @@ gnc_ab_maketrans(GtkWidget *parent, Account *gnc_acc,
g_warning("gnc_ab_maketrans: Couldn't get AqBanking API");
return;
}
+#ifndef AQBANKING6
if (AB_Banking_OnlineInit(api) != 0)
{
g_warning("gnc_ab_maketrans: Couldn't initialize AqBanking API");
goto cleanup;
}
online = TRUE;
-
+#endif
/* Get the AqBanking Account */
ab_acc = gnc_ab_get_ab_account(api, gnc_acc);
if (!ab_acc)
@@ -130,15 +131,15 @@ gnc_ab_maketrans(GtkWidget *parent, Account *gnc_acc,
gint result;
gboolean changed;
const AB_TRANSACTION *ab_trans;
- AB_JOB *job = NULL;
- AB_JOB_LIST2 *job_list = NULL;
+ GNC_AB_JOB *job = NULL;
+ GNC_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;
+ GNC_AB_JOB_STATUS job_status;
GncABImExContextImport *ieci = NULL;
/* Get a GUI object */
@@ -170,7 +171,11 @@ gnc_ab_maketrans(GtkWidget *parent, Account *gnc_acc,
/* Get a job and enqueue it */
ab_trans = gnc_ab_trans_dialog_get_ab_trans(td);
job = gnc_ab_trans_dialog_get_job(td);
+#ifdef AQBANKING6
+ if (!job || AB_AccountSpec_GetTransactionLimitsForCommand(ab_acc, AB_Transaction_GetCommand(job))==NULL)
+#else
if (!job || AB_Job_CheckAvailability(job))
+#endif
{
if (!gnc_verify_dialog (
GTK_WINDOW (parent), FALSE, "%s",
@@ -186,9 +191,13 @@ gnc_ab_maketrans(GtkWidget *parent, Account *gnc_acc,
aborted = TRUE;
goto repeat;
}
+#ifdef AQBANKING6
+ job_list = AB_Transaction_List2_new();
+ AB_Transaction_List2_PushBack(job_list, job);
+#else
job_list = AB_Job_List2_new();
AB_Job_List2_PushBack(job_list, job);
-
+#endif
/* Setup a Transfer Dialog for the GnuCash transaction */
xfer_dialog = gnc_xfer_dialog(gnc_ab_trans_dialog_get_parent(td),
gnc_acc);
@@ -265,16 +274,25 @@ gnc_ab_maketrans(GtkWidget *parent, Account *gnc_acc,
}
/* Finally, execute the job */
+#ifdef AQBANKING6
+ AB_Banking_SendCommands(api, job_list, context);
+#else
AB_Banking_ExecuteJobs(api, job_list, context);
-
+#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
*/
+#ifdef AQBANKING6
+ job_status = AB_Transaction_GetStatus(job);
+ if (job_status != AB_Transaction_StatusAccepted
+ && job_status != AB_Transaction_StatusPending)
+#else
job_status = AB_Job_GetStatus(job);
if (job_status != AB_Job_StatusFinished
&& job_status != AB_Job_StatusPending)
+#endif
{
successful = FALSE;
if (!gnc_verify_dialog (
@@ -315,12 +333,20 @@ repeat:
AB_ImExporterContext_free(context);
if (job_list)
{
+#ifdef AQBANKING6
+ AB_Transaction_List2_free(job_list);
+#else
AB_Job_List2_free(job_list);
+#endif
job_list = NULL;
}
if (job)
{
+#ifdef AQBANKING6
+ AB_Transaction_free(job);
+#else
AB_Job_free(job);
+#endif
job = NULL;
}
if (gui)
@@ -335,7 +361,9 @@ repeat:
cleanup:
if (td)
gnc_ab_trans_dialog_free(td);
+#ifndef AQBANKING6
if (online)
AB_Banking_OnlineFini(api);
+#endif
gnc_AB_BANKING_fini(api);
}
diff --git a/gnucash/import-export/aqb/gnc-ab-utils.c b/gnucash/import-export/aqb/gnc-ab-utils.c
index 9f249f1df..08ea23130 100644
--- a/gnucash/import-export/aqb/gnc-ab-utils.c
+++ b/gnucash/import-export/aqb/gnc-ab-utils.c
@@ -29,15 +29,18 @@
#include <config.h>
+#include "gnc-ab-utils.h"
+
#include <glib/gi18n.h>
#include <gwenhywfar/gwenhywfar.h>
#include <aqbanking/banking.h>
-
+#ifdef AQBANKING6
+# include <aqbanking/types/balance.h>
+#endif
#include "window-reconcile.h"
#include "Transaction.h"
#include "dialog-ab-trans.h"
#include "gnc-ab-kvp.h"
-#include "gnc-ab-utils.h"
#include "gnc-glib-utils.h"
#include "gnc-gwen-gui.h"
#include "gnc-prefs.h"
@@ -73,11 +76,11 @@ struct _GncABImExContextImport
guint awaiting;
gboolean txn_found;
Account *gnc_acc;
- AB_ACCOUNT *ab_acc;
+ GNC_AB_ACCOUNT_SPEC *ab_acc;
gboolean execute_txns;
AB_BANKING *api;
GtkWidget *parent;
- AB_JOB_LIST2 *job_list;
+ GNC_AB_JOB_LIST2 *job_list;
GNCImportMainMatcher *generic_importer;
GData *tmp_job_list;
};
@@ -230,10 +233,10 @@ gnc_AB_BANKING_fini(AB_BANKING *api)
return 0;
}
-AB_ACCOUNT *
+GNC_AB_ACCOUNT_SPEC *
gnc_ab_get_ab_account(const AB_BANKING *api, Account *gnc_acc)
{
- AB_ACCOUNT *ab_account = NULL;
+ GNC_AB_ACCOUNT_SPEC *ab_account = NULL;
const gchar *bankcode = NULL;
const gchar *accountid = NULL;
guint32 account_uid = 0;
@@ -244,6 +247,23 @@ gnc_ab_get_ab_account(const AB_BANKING *api, Account *gnc_acc)
if (account_uid > 0)
{
+#ifdef AQBANKING6
+ gint rv;
+
+ rv = AB_Banking_GetAccountSpecByUniqueId(api, account_uid, &ab_account);
+
+ if ( (rv<0 || !ab_account) && bankcode && *bankcode &&
+ accountid && *accountid)
+ {
+/* Finding the account by code and number is suspended in AQBANKING 6 pending
+ * implementation of a replacement for AB_Banking_GetAccountByCodeAndNumber.
+ */
+ g_message("gnc_ab_get_ab_account: No AB_ACCOUNT found for UID %d, "
+ "trying bank code\n", account_uid);
+ return NULL;
+ }
+ return ab_account;
+#else
ab_account = AB_Banking_GetAccount(api, account_uid);
if (!ab_account && bankcode && *bankcode && accountid && *accountid)
@@ -251,7 +271,7 @@ gnc_ab_get_ab_account(const AB_BANKING *api, Account *gnc_acc)
g_message("gnc_ab_get_ab_account: No AB_ACCOUNT found for UID %d, "
"trying bank code\n", account_uid);
ab_account = AB_Banking_GetAccountByCodeAndNumber(api, bankcode,
- accountid);
+ accountid);
}
return ab_account;
@@ -261,6 +281,7 @@ gnc_ab_get_ab_account(const AB_BANKING *api, Account *gnc_acc)
ab_account = AB_Banking_GetAccountByCodeAndNumber(api, bankcode,
accountid);
return ab_account;
+#endif
}
return NULL;
@@ -311,16 +332,30 @@ join_ab_strings_cb(const gchar *str, gpointer user_data)
gchar *
gnc_ab_get_remote_name(const AB_TRANSACTION *ab_trans)
{
+#ifndef AQBANKING6
const GWEN_STRINGLIST *ab_remote_name;
+#endif
gchar *gnc_other_name = NULL;
g_return_val_if_fail(ab_trans, NULL);
ab_remote_name = AB_Transaction_GetRemoteName(ab_trans);
if (ab_remote_name)
+#ifdef AQBANKING6
+ ab_transactionText = AB_Transaction_GetPurpose(ab_trans);
+ if (ab_transactionText)
+ {
+ gchar *tmp;
+
+ tmp = g_strdup(ab_transactionText);
+ g_strstrip(tmp);
+ gnc_utf8_strip_invalid(tmp);
+ gnc_description=tmp;
+ }
+#else
GWEN_StringList_ForEach(ab_remote_name, join_ab_strings_cb,
&gnc_other_name);
-
+#endif
if (!gnc_other_name || !*gnc_other_name)
{
g_free(gnc_other_name);
@@ -460,7 +495,7 @@ gnc_ab_trans_to_gnc(const AB_TRANSACTION *ab_trans, Account *gnc_acc)
QofBook *book;
Transaction *gnc_trans;
const gchar *fitid;
- const GWEN_TIME *valuta_date;
+ const GNC_GWEN_DATE *valuta_date;
time64 current_time;
const char *custref;
gchar *description;
@@ -478,15 +513,23 @@ gnc_ab_trans_to_gnc(const AB_TRANSACTION *ab_trans, Account *gnc_acc)
valuta_date = AB_Transaction_GetValutaDate(ab_trans);
if (!valuta_date)
{
- const GWEN_TIME *normal_date = AB_Transaction_GetDate(ab_trans);
+ const GNC_GWEN_DATE *normal_date = AB_Transaction_GetDate(ab_trans);
if (normal_date)
valuta_date = normal_date;
}
if (valuta_date)
- xaccTransSetDatePostedSecsNormalized(gnc_trans, GWEN_Time_toTime_t(valuta_date));
+ {
+#ifdef AQBANKING6
+ time64 secs = GWEN_Date_toLocalTime(valuta_date);
+#else
+ time64 secs = GWEN_Time_toTime_t(valuta_date);
+#endif
+ xaccTransSetDatePostedSecsNormalized(gnc_trans, secs);
+ }
else
+ {
g_warning("transaction_cb: Oops, date 'valuta_date' was NULL");
-
+ }
xaccTransSetDateEnteredSecs(gnc_trans, gnc_time (NULL));
/* Currency. We take simply the default currency of the gnucash account */
@@ -647,14 +690,21 @@ txn_transaction_cb(const AB_TRANSACTION *element, gpointer user_data)
if (data->execute_txns && data->ab_acc)
{
AB_TRANSACTION *ab_trans = AB_Transaction_dup(element);
- AB_JOB *job;
+ GNC_AB_JOB *job;
/* NEW: The imported transaction has been imported into gnucash.
* Now also add it as a job to aqbanking */
+#ifdef AQBANKING6
+ AB_Transaction_SetLocalBankCode(
+ ab_trans, AB_AccountSpec_GetBankCode(data->ab_acc));
+ AB_Transaction_SetLocalAccountNumber(
+ ab_trans, AB_AccountSpec_GetAccountNumber(data->ab_acc));
+#else
AB_Transaction_SetLocalBankCode(
ab_trans, AB_Account_GetBankCode(data->ab_acc));
AB_Transaction_SetLocalAccountNumber(
ab_trans, AB_Account_GetAccountNumber(data->ab_acc));
+#endif
AB_Transaction_SetLocalCountry(ab_trans, "DE");
@@ -676,7 +726,11 @@ txn_transaction_cb(const AB_TRANSACTION *element, gpointer user_data)
job = gnc_ab_get_trans_job(data->ab_acc, ab_trans, trans_type);
/* Check whether we really got a job */
+#ifdef AQBANKING6
+ if (!job || AB_AccountSpec_GetTransactionLimitsForCommand(data->ab_acc, AB_Transaction_GetCommand(job))==NULL)
+#else
if (!job || AB_Job_CheckAvailability(job))
+#endif
{
/* Oops, no job, probably not supported by bank */
if (gnc_verify_dialog(
@@ -697,8 +751,13 @@ txn_transaction_cb(const AB_TRANSACTION *element, gpointer user_data)
}
else
{
- gnc_gen_trans_list_add_trans_with_ref_id(data->generic_importer, gnc_trans, AB_Job_GetJobId(job));
-
+ gnc_gen_trans_list_add_trans_with_ref_id(data->generic_importer,
+ gnc_trans,
+#ifdef AQBANKING6
+ AB_Transaction_GetUniqueId));
+#else
+ AB_Job_GetJobId(job));
+#endif
/* AB_Job_List2_PushBack(data->job_list, job); -> delayed until trans is successfully imported */
g_datalist_set_data(&data->tmp_job_list, gnc_AB_JOB_to_readable_string(job), job);
}
@@ -719,26 +778,38 @@ static void gnc_ab_trans_processed_cb(GNCImportTransInfo *trans_info,
{
GncABImExContextImport *data = user_data;
gchar *jobname = gnc_AB_JOB_ID_to_string(gnc_import_TransInfo_get_ref_id(trans_info));
- AB_JOB *job = g_datalist_get_data(&data->tmp_job_list, jobname);
+ GNC_AB_JOB *job = g_datalist_get_data(&data->tmp_job_list, jobname);
if (imported)
{
+#ifdef AQBANKING6
+ AB_Transaction_List2_PushBack(data->job_list, job);
+#else
AB_Job_List2_PushBack(data->job_list, job);
+#endif
}
else
{
+#ifdef AQBANKING6
+ AB_Transaction_free(job);
+#else
AB_Job_free(job);
+#endif
}
g_datalist_remove_data(&data->tmp_job_list, jobname);
}
gchar *
-gnc_AB_JOB_to_readable_string(const AB_JOB *job)
+gnc_AB_JOB_to_readable_string(const GNC_AB_JOB *job)
{
if (job)
{
+#ifdef AQBANKING6
+ return gnc_AB_JOB_ID_to_string(AB_Transaction_GetUniqueId(job));
+#else
return gnc_AB_JOB_ID_to_string(AB_Job_GetJobId(job));
+#endif
}
else
{
@@ -765,8 +836,12 @@ txn_accountinfo_cb(AB_IMEXPORTER_ACCOUNTINFO *element, gpointer user_data)
/* Ignore them */
return NULL;
+#ifdef AQBANKING6
+ if (!AB_ImExporterAccountInfo_GetFirstTransaction(element, AB_Transaction_TypeStatement, 0))
+#else
if (!AB_ImExporterAccountInfo_GetFirstTransaction(element))
- /* No transaction found */
+#endif
+/* No transaction found */
return NULL;
else
data->awaiting |= FOUND_TRANSACTIONS;
@@ -823,9 +898,16 @@ txn_accountinfo_cb(AB_IMEXPORTER_ACCOUNTINFO *element, gpointer user_data)
}
/* Iterate through all transactions */
+#ifdef AQBANKING6
+ ab_trans_list = AB_ImExporterAccountInfo_GetTransactionList(element);
+ if (ab_trans_list)
+ AB_Transaction_List_ForEachByType(ab_trans_list,
+ txn_transaction_cb, data,
+ AB_Transaction_TypeStatement, 0);
+#else
AB_ImExporterAccountInfo_TransactionsForEach(element, txn_transaction_cb,
- data);
-
+ data);
+#endif
return NULL;
}
@@ -850,12 +932,21 @@ bal_accountinfo_cb(AB_IMEXPORTER_ACCOUNTINFO *element, gpointer user_data)
/* Ignore them */
return NULL;
+#ifdef AQBANKING6
+ if (!AB_ImExporterAccountInfo_GetFirstBalance(element))
+#else
if (!AB_ImExporterAccountInfo_GetFirstAccountStatus(element))
+#endif
/* No balance found */
return NULL;
else
data->awaiting |= FOUND_BALANCES;
+#ifdef AQBANKING6
+ /* Lookup the most recent BALANCE available */
+ booked_bal=AB_Balance_List_GetLatestByType(AB_ImExporterAccountInfo_GetBalanceList(element),
+ AB_Balance_TypeBooked);
+#else
/* Lookup the most recent ACCOUNT_STATUS available */
item = AB_ImExporterAccountInfo_GetFirstAccountStatus(element);
while (item)
@@ -870,6 +961,8 @@ bal_accountinfo_cb(AB_IMEXPORTER_ACCOUNTINFO *element, gpointer user_data)
}
booked_bal = AB_AccountStatus_GetBookedBalance(best);
+#endif
+
if (!(data->awaiting & AWAIT_BALANCES))
{
/* Ignore zero balances if we don't await a balance */
@@ -900,10 +993,15 @@ bal_accountinfo_cb(AB_IMEXPORTER_ACCOUNTINFO *element, gpointer user_data)
/* Lookup booked balance and time */
if (booked_bal)
{
- const GWEN_TIME *ti = AB_Balance_GetTime(booked_bal);
+ const GNC_GWEN_DATE *ti = AB_Balance_GetTime(booked_bal);
if (ti)
{
- booked_tt = gnc_time64_get_day_neutral(GWEN_Time_toTime_t(ti));
+#ifdef AQBANKING6
+ time64 secs = GWEN_Date_toLocalTime_t(dt);
+#else
+ time64 secs = GWEN_Time_toTime_t(ti);
+#endif
+ booked_tt = gnc_time64_get_day_neutral(secs);
}
else
{
@@ -930,7 +1028,12 @@ bal_accountinfo_cb(AB_IMEXPORTER_ACCOUNTINFO *element, gpointer user_data)
}
/* Lookup noted balance */
+#ifdef AQBANKING6
+ noted_bal = AB_Balance_List_GetLatestByType(AB_ImExporterAccountInfo_GetBalanceList(element),
+ AB_Balance_TypeNoted);
+#else
noted_bal = AB_AccountStatus_GetNotedBalance(best);
+#endif
if (noted_bal)
{
noted_val = AB_Balance_GetValue(noted_bal);
@@ -1034,7 +1137,9 @@ gnc_ab_import_context(AB_IMEXPORTER_CONTEXT *context,
AB_BANKING *api, GtkWidget *parent)
{
GncABImExContextImport *data = g_new(GncABImExContextImport, 1);
-
+#ifdef AQBANKING6
+ AB_IMEXPORTER_ACCOUNTINFO_LIST *ab_ail;
+#endif
g_return_val_if_fail(context, NULL);
/* Do not await and ignore at the same time */
g_return_val_if_fail(!(awaiting & AWAIT_BALANCES)
@@ -1053,13 +1158,31 @@ gnc_ab_import_context(AB_IMEXPORTER_CONTEXT *context,
data->execute_txns = execute_txns;
data->api = api;
data->parent = parent;
+#ifdef AQBANKING6
+ data->job_list = AB_Transaction_List2_new();
+#else
data->job_list = AB_Job_List2_new();
+#endif
data->tmp_job_list = NULL;
data->generic_importer = NULL;
g_datalist_init(&data->tmp_job_list);
/* Import transactions */
+#ifdef AQBANKING6
+ ab_ail = AB_ImExporterContext_GetAccountInfoList(context);
+ if (ab_ail && AB_ImExporterAccountInfo_List_GetCount(ab_ail))
+ {
+ if (!(awaiting & IGNORE_TRANSACTIONS))
+ AB_ImExporterAccountInfo_List_ForEach(ab_ail, txn_accountinfo_cb,
+ data);
+
+ /* Check balances */
+ if (!(awaiting & IGNORE_BALANCES))
+ AB_ImExporterAccountInfo_List_ForEach(ab_ail, bal_accountinfo_cb,
+ data);
+ }
+#else
if (!(awaiting & IGNORE_TRANSACTIONS))
AB_ImExporterContext_AccountInfoForEach(context, txn_accountinfo_cb,
data);
@@ -1068,6 +1191,7 @@ gnc_ab_import_context(AB_IMEXPORTER_CONTEXT *context,
if (!(awaiting & IGNORE_BALANCES))
AB_ImExporterContext_AccountInfoForEach(context, bal_accountinfo_cb,
data);
+#endif
/* Check bank-messages */
{
@@ -1082,7 +1206,11 @@ gnc_ab_import_context(AB_IMEXPORTER_CONTEXT *context,
subject,
text);
+#ifdef AQBANKING6
+ bankmsg = AB_Message_List_Next(bankmsg);
+#else
bankmsg = AB_ImExporterContext_GetNextMessage(context); // The interator is incremented within aqbanking
+#endif
}
}
@@ -1097,7 +1225,7 @@ gnc_ab_ieci_get_found(GncABImExContextImport *ieci)
return ieci->awaiting;
}
-AB_JOB_LIST2 *
+GNC_AB_JOB_LIST2 *
gnc_ab_ieci_get_job_list(GncABImExContextImport *ieci)
{
g_return_val_if_fail(ieci, NULL);
diff --git a/gnucash/import-export/aqb/gnc-ab-utils.h b/gnucash/import-export/aqb/gnc-ab-utils.h
index decf28057..0cfb4db1c 100644
--- a/gnucash/import-export/aqb/gnc-ab-utils.h
+++ b/gnucash/import-export/aqb/gnc-ab-utils.h
@@ -52,6 +52,28 @@ G_BEGIN_DECLS
* in the interval [0..99]. */
#define GWENHYWFAR_VERSION_INT (10000 * GWENHYWFAR_VERSION_MAJOR + 100 * GWENHYWFAR_VERSION_MINOR + GWENHYWFAR_VERSION_PATCHLEVEL)
+#if AQBANKING_VERSION_INT >= 59900
+# define AQBANKING6 1
+# define GNC_AB_ACCOUNT_SPEC AB_ACCOUNT_SPEC
+# define GNC_AB_ACCOUNT_SPEC_LIST AB_ACCOUNT_SPEC_LIST
+# define GNC_AB_JOB AB_TRANSACTION
+# define GNC_AB_JOB_LIST2 AB_TRANSACTION_LIST2
+# define GNC_AB_JOB_LIST2_ITERATOR AB_TRANSACTION_LIST2_ITERATOR
+# define GNC_AB_JOB_STATUS AB_TRANSACTION_STATUS
+# define GNC_GWEN_DATE GWEN_DATE
+#else
+# define GNC_AB_ACCOUNT_SPEC AB_ACCOUNT
+# define GNC_AB_ACCOUNT_SPEC_LIST AB_ACCOUNT_LIST2
+# define GNC_AB_JOB AB_JOB
+# define GNC_AB_JOB_LIST2 AB_JOB_LIST2
+# define GNC_AB_JOB_LIST2_ITERATOR AB_JOB_LIST2_ITERATOR
+# define GNC_AB_JOB_STATUS AB_JOB_STATUS
+# define GNC_GWEN_DATE GWEN_TIME
+#endif
+#if GWENHYWFAR_VERSION_INT >= 49900
+# define GWENHYWFAR5
+#endif
+
#define GNC_PREFS_GROUP_AQBANKING "dialogs.import.hbci"
#define GNC_PREF_FORMAT_SWIFT940 "format-swift-mt940"
#define GNC_PREF_FORMAT_SWIFT942 "format-swift-mt942"
@@ -112,11 +134,11 @@ gint gnc_AB_BANKING_fini(AB_BANKING *api);
* Of course this only works after the GnuCash account has been set up for
* AqBanking use, i.e. the account's hbci data have been set up and populated.
*
- * @param api The AB_BANKING to get the AB_ACCOUNT from
- * @param gnc_acc The GnuCash account to query for AB_ACCOUNT reference data
- * @return The AB_ACCOUNT found or NULL otherwise
+ * @param api The AB_BANKING to get the GNC_AB_ACCOUNT_SPEC from
+ * @param gnc_acc The GnuCash account to query for GNC_AB_ACCOUNT_SPEC reference data
+ * @return The GNC_AB_ACCOUNT_SPEC found or NULL otherwise
*/
-AB_ACCOUNT *gnc_ab_get_ab_account(const AB_BANKING *api, Account *gnc_acc);
+GNC_AB_ACCOUNT_SPEC *gnc_ab_get_ab_account(const AB_BANKING *api, Account *gnc_acc);
/**
* Print the value of @a value with two decimal places and @a value's
@@ -130,10 +152,10 @@ gchar *gnc_AB_VALUE_to_readable_string(const AB_VALUE *value);
/**
* Return the job as string.
*
- * @param value AB_JOB or NULL
+ * @param value GNC_AB_JOB or NULL
* @return A newly allocated string
*/
-gchar *gnc_AB_JOB_to_readable_string(const AB_JOB *job);
+gchar *gnc_AB_JOB_to_readable_string(const GNC_AB_JOB *job);
/**
* Return the job_id as string.
@@ -208,7 +230,7 @@ Transaction *gnc_ab_trans_to_gnc(const AB_TRANSACTION *ab_trans, Account *gnc_ac
* create an aqbanking job for each of the transactions found
*
* @param api If @a execute_txns is TRUE, the AB_BANKING to get
- * AB_ACCOUNTs from
+ * GNC_AB_ACCOUNT_SPECs from
*
* @param parent Widget to set new dialogs transient for, may be NULL
*
@@ -236,7 +258,7 @@ guint gnc_ab_ieci_get_found(GncABImExContextImport *ieci);
* @param ieci The return value of gnc_ab_import_context()
* @return The list of jobs, freeable with AB_Job_List2_FreeAll()
*/
-AB_JOB_LIST2 *gnc_ab_ieci_get_job_list(GncABImExContextImport *ieci);
+GNC_AB_JOB_LIST2 *gnc_ab_ieci_get_job_list(GncABImExContextImport *ieci);
/**
* Run the generic transaction matcher dialog.
diff --git a/gnucash/import-export/aqb/gnc-file-aqb-import.c b/gnucash/import-export/aqb/gnc-file-aqb-import.c
index 9a43a497d..1d8ff43a5 100644
--- a/gnucash/import-export/aqb/gnc-file-aqb-import.c
+++ b/gnucash/import-export/aqb/gnc-file-aqb-import.c
@@ -79,10 +79,10 @@ gnc_file_aqbanking_import(GtkWindow *parent,
AB_IMEXPORTER_CONTEXT *context = NULL;
GWEN_IO_LAYER *io = NULL;
GncABImExContextImport *ieci = NULL;
- AB_JOB_LIST2 *job_list = NULL;
- AB_JOB_LIST2_ITERATOR *jit;
- AB_JOB *job;
- AB_JOB_STATUS job_status;
+ GNC_AB_JOB_LIST2 *job_list = NULL;
+ GNC_AB_JOB_LIST2_ITERATOR *jit;
+ GNC_AB_JOB *job;
+ GNC_AB_JOB_STATUS job_status;
gboolean successful = TRUE;
int num_jobs = 0;
int num_jobs_failed = 0;
@@ -105,13 +105,14 @@ gnc_file_aqbanking_import(GtkWindow *parent,
gnc_set_default_directory(GNC_PREFS_GROUP_AQBANKING, default_dir);
g_free(default_dir);
+#ifndef AQBANKING6
dtaus_fd = g_open(selected_filename, O_RDONLY, 0);
if (dtaus_fd == -1)
{
DEBUG("Could not open file %s", selected_filename);
goto cleanup;
}
-
+#endif
/* Get the API */
api = gnc_AB_BANKING_new();
if (!api)
@@ -119,6 +120,7 @@ gnc_file_aqbanking_import(GtkWindow *parent,
g_warning("gnc_file_aqbanking_import: Couldn't get AqBanking API");
goto cleanup;
}
+#ifndef AQBANKING6
if (AB_Banking_OnlineInit(api) != 0)
{
g_warning("gnc_file_aqbanking_import: "
@@ -166,10 +168,20 @@ gnc_file_aqbanking_import(GtkWindow *parent,
}
goto cleanup;
}
+#endif
/* Create a context to store the results */
context = AB_ImExporterContext_new();
+#ifdef AQBANKING6
+ if (AB_Banking_ImportFromFileLoadProfile(api, aqbanking_importername,
+ context, aqbanking_profilename,
+ NULL, selected_filename) < 0)
+ {
+ g_warning("gnc_file_aqbanking_import: Error on import");
+ goto cleanup;
+ }
+#else
/* Wrap file in buffered gwen io */
close(dtaus_fd);
io = GWEN_SyncIo_File_new(selected_filename, GWEN_SyncIo_File_CreationMode_OpenExisting);
@@ -198,6 +210,7 @@ gnc_file_aqbanking_import(GtkWindow *parent,
/* Close the file */
GWEN_SyncIo_free(io);
io = NULL;
+#endif
/* Before importing the results, if this is a new book, let user specify
* book options, since they affect how transactions are created */
@@ -231,8 +244,11 @@ gnc_file_aqbanking_import(GtkWindow *parent,
}
/* And execute the jobs */
+#ifdef AQBANKING6
+ AB_Banking_SendCommands(api, job_list, execution_context);
+#else
AB_Banking_ExecuteJobs(api, job_list, execution_context);
-
+#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
@@ -243,33 +259,50 @@ gnc_file_aqbanking_import(GtkWindow *parent,
* to give the appropriate feedback if any of the jobs didn't
* work. */
+#ifdef AQBANKING6
+ jit = AB_Transaction_List2_First(job_list);
+#else
jit = AB_Job_List2_First(job_list);
+#endif
if (jit)
{
-
job = AB_Job_List2Iterator_Data(jit);
while (job)
{
num_jobs += 1;
+#ifdef AQBANKING6
+ job_status = AB_Transaction_GetStatus(job);
+ if (job_status != AB_Transaction_StatusFinished &&
+ job_status != AB_Transaction_StatusPending)
+#else
job_status = AB_Job_GetStatus(job);
- if (job_status != AB_Job_StatusFinished
- && job_status != AB_Job_StatusPending)
+ if (job_status != AB_Job_StatusFinished &&
+ job_status != AB_Job_StatusPending)
+#endif
{
successful = FALSE;
num_jobs_failed += 1;
if (num_jobs_failed <= max_failures)
{
+#ifdef AQBANKING6
+ gchar *fmt_str =_("Job %d status %d - %s\n");
+#else
+ gchar *fmt_str =_("Job %d status %d - %s: %s\n");
+#endif
if (num_jobs_failed == 1)
{
errstr = g_string_new("Failed jobs:\n");
}
- g_string_append_printf(errstr, _("Job %d status %d - %s: %s \n")
- , num_jobs
- , job_status
- , AB_Job_Status2Char(job_status)
- , AB_Job_GetResultText(job));
- }
+ g_string_append_printf(errstr, fmt_str, num_jobs,
+ job_status,
+#ifdef AQBANKING6
+ AB_Transaction_Status_toString(job_status));
+#else
+ AB_Job_Status2Char(job_status),
+ AB_Job_GetResultText(job));
+#endif
+ }
else
{
if (num_jobs_failed == (max_failures + 1) )
@@ -279,10 +312,17 @@ gnc_file_aqbanking_import(GtkWindow *parent,
}
}
}
+#ifdef AQBANKING6
+ job = AB_Transaction_List2Iterator_Next(jit);
+#else
job = AB_Job_List2Iterator_Next(jit);
+#endif
} /* while */
-
+#ifdef AQBANKING6
+ AB_Job_List2Iterator_free(jit);
+#else
AB_Job_List2Iterator_free(jit);
+#endif
}
if (!successful)
@@ -317,30 +357,30 @@ gnc_file_aqbanking_import(GtkWindow *parent,
}
cleanup:
- if (io)
- {
- GWEN_SyncIo_free(io);
- }
-
if (job_list)
+#ifdef AQBANKING6
+ AB_Transaction_List2_FreeAll(job_list);
+#else
AB_Job_List2_FreeAll(job_list);
+ if (io)
+ GWEN_SyncIo_free(io);
+ if (db_profiles)
+ GWEN_DB_Group_free(db_profiles);
+ if (online)
+ AB_Banking_OnlineFini(api);
+ if (dtaus_fd != -1)
+ close(dtaus_fd);
+#endif
if (ieci)
g_free(ieci);
if (context)
AB_ImExporterContext_free(context);
- if (db_profiles)
- GWEN_DB_Group_free(db_profiles);
if (gui)
gnc_GWEN_Gui_release(gui);
- if (online)
- AB_Banking_OnlineFini(api);
if (api)
gnc_AB_BANKING_fini(api);
- if (dtaus_fd != -1)
- close(dtaus_fd);
if (selected_filename)
g_free(selected_filename);
if (errstr)
g_string_free(errstr, TRUE);
-
}
diff --git a/gnucash/import-export/aqb/gnc-gwen-gui.c b/gnucash/import-export/aqb/gnc-gwen-gui.c
index 91b0592e5..94ef52b05 100644
--- a/gnucash/import-export/aqb/gnc-gwen-gui.c
+++ b/gnucash/import-export/aqb/gnc-gwen-gui.c
@@ -190,7 +190,7 @@ static gint progress_advance_cb(GWEN_GUI *gwen_gui, uint32_t id,
static gint progress_log_cb(GWEN_GUI *gwen_gui, guint32 id,
GWEN_LOGGER_LEVEL level, const gchar *text);
static gint progress_end_cb(GWEN_GUI *gwen_gui, guint32 id);
-#if GWENHYWFAR_VERSION_INT < 49900
+#ifndef GWENHYWFAR5
static gint GNC_GWENHYWFAR_CB getpassword_cb(GWEN_GUI *gwen_gui, guint32 flags,
const gchar *token,
const gchar *title,
@@ -1409,7 +1409,7 @@ progress_end_cb(GWEN_GUI *gwen_gui, guint32 id)
}
static gint GNC_GWENHYWFAR_CB
-#if GWENHYWFAR_VERSION_INT < 49900
+#ifndef GWENHYWFAR5
getpassword_cb(GWEN_GUI *gwen_gui, guint32 flags, const gchar *token,
const gchar *title, const gchar *text, gchar *buffer,
gint min_len, gint max_len, guint32 guiid)
commit d8c6af2d651bb846c6de1b3844bfcf785cc9b99d
Author: John Ralls <jralls at ceridwen.us>
Date: Thu Mar 28 12:41:08 2019 -0700
Remove support for ancient versions of AQBanking.
Requires Gwenhywfar >= 4.9.99 and AQBanking >= 5.3.4, the versions
just before the ones provided by Ubuntu 14.04LTS
Removes all definitions and ifdeffed code for earlier versions.
Removes the never-completed SEPA character checking that was if-zeroed.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4ab2891ec..f385764b5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -357,8 +357,8 @@ endif ()
# ############################################################
if (WITH_AQBANKING)
- gnc_pkg_check_modules (GWENHYWFAR REQUIRED gwenhywfar)
- gnc_pkg_check_modules (AQBANKING REQUIRED aqbanking)
+ gnc_pkg_check_modules (GWENHYWFAR REQUIRED gwenhywfar>=4.9.99)
+ gnc_pkg_check_modules (AQBANKING REQUIRED aqbanking>=5.3.4)
if(WITH_GNUCASH)
gnc_pkg_check_modules (GWEN_GTK3 gwengui-gtk3)
if(GWEN_GTK3_FOUND AND GWEN_GTK3_VERSION VERSION_GREATER "4.20.0")
diff --git a/gnucash/import-export/aqb/assistant-ab-initial.c b/gnucash/import-export/aqb/assistant-ab-initial.c
index 0f6bbd654..59cb1d88a 100644
--- a/gnucash/import-export/aqb/assistant-ab-initial.c
+++ b/gnucash/import-export/aqb/assistant-ab-initial.c
@@ -57,11 +57,7 @@
#include "gnc-ui-util.h"
#include "gnc-session.h"
#include "import-account-matcher.h"
-
-#if AQBANKING_VERSION_INT > 49908
-/* For aqbanking > 4.99.8. See below. */
-# include <aqbanking/dlg_setup.h>
-#endif
+#include <aqbanking/dlg_setup.h>
/* This static indicates the debugging module that this .o belongs to. */
static QofLogModule log_module = GNC_MOD_ASSISTANT;
@@ -91,10 +87,6 @@ void aai_match_page_prepare (GtkAssistant *assistant, gpointer user_data);
static gboolean banking_has_accounts(AB_BANKING *banking);
static void hash_from_kvp_acc_cb(Account *gnc_acc, gpointer user_data);
static ABInitialInfo *single_info = NULL;
-
-#if AQBANKING_VERSION_INT <= 49908
-static void child_exit_cb(GPid pid, gint status, gpointer data);
-#endif
static gchar *ab_account_longname(const AB_ACCOUNT *ab_acc);
static AB_ACCOUNT *update_account_list_acc_cb(AB_ACCOUNT *ab_acc, gpointer user_data);
static void update_account_list(ABInitialInfo *info);
@@ -195,11 +187,7 @@ aai_destroy_cb(GtkWidget *object, gpointer user_data)
if (info->gnc_hash)
{
-#ifdef AQBANKING_VERSION_4_EXACTLY
- AB_Banking_OnlineFini(info->api, 0);
-#else
AB_Banking_OnlineFini(info->api);
-#endif
g_hash_table_destroy(info->gnc_hash);
info->gnc_hash = NULL;
}
@@ -241,12 +229,6 @@ aai_wizard_button_clicked_cb(GtkButton *button, gpointer user_data)
GtkWidget *page = gtk_assistant_get_nth_page (GTK_ASSISTANT(info->window), num);
AB_BANKING *banking = info->api;
-#if AQBANKING_VERSION_INT <= 49908
- GWEN_BUFFER *buf;
- gboolean wizard_exists;
- const gchar *wizard_path;
- gboolean qt_probably_unavailable = FALSE;
-#endif /* AQBANKING_VERSION_INT */
g_return_if_fail(banking);
ENTER("user_data: %p", user_data);
@@ -257,8 +239,6 @@ aai_wizard_button_clicked_cb(GtkButton *button, gpointer user_data)
return;
}
-#if AQBANKING_VERSION_INT > 49908
- /* For aqbanking5 > 4.99.8: Use AB_Banking_GetNewUserDialog(). */
{
GWEN_DIALOG *dlg =
AB_SetupDialog_new(banking);
@@ -288,107 +268,6 @@ aai_wizard_button_clicked_cb(GtkButton *button, gpointer user_data)
PERR("Got error on AB_Banking_OnlineFini!");
}
}
-#else
- /* Previous implementation for aqbanking <= 4.99.8: Use the
- * external application. */
-
-
- /* This is the point where we look for and start an external
- * application shipped with aqbanking that contains the setup assistant
- * for AqBanking related stuff. It requires qt (but not kde). This
- * application contains the very verbose step-by-step setup wizard
- * for the AqBanking account, and the application is shared with
- * other AqBanking-based financial managers that offer the AqBanking
- * features (e.g. KMyMoney). See gnucash-devel discussion here
- * https://lists.gnucash.org/pipermail/gnucash-devel/2004-December/012351.html
- */
- buf = GWEN_Buffer_new(NULL, 300, 0, 0);
- AB_Banking_FindWizard(banking, "", NULL, buf);
- wizard_exists = *GWEN_Buffer_GetStart(buf) != 0;
- wizard_path = GWEN_Buffer_GetStart(buf);
-
- if (wizard_exists)
- {
- /* Really check whether the file exists */
- gint fd = g_open(wizard_path, O_RDONLY, 0);
- if (fd == -1)
- wizard_exists = FALSE;
- else
- close(fd);
- }
-
-#ifdef G_OS_WIN32
- {
- const char *check_file = "qtdemo.exe";
- gchar *found_program = g_find_program_in_path(check_file);
- if (found_program)
- {
- g_debug("Yes, we found the Qt demo program in %s\n", found_program);
- g_free(found_program);
- }
- else
- {
- g_warning("Ouch, no Qt demo program was found. Qt not installed?\n");
- qt_probably_unavailable = TRUE;
- }
- }
-#endif
-
- if (wizard_exists)
- {
- /* Call the qt wizard. See the note above about why this
- * approach is chosen. */
-
- GPid pid;
- GError *error = NULL;
- gchar *argv[2];
- gboolean spawned;
-
- argv[0] = g_strdup (wizard_path);
- argv[1] = NULL;
- spawned = g_spawn_async (NULL, argv, NULL, G_SPAWN_DO_NOT_REAP_CHILD,
- NULL, NULL, &pid, &error);
- g_free (argv[0]);
-
- if (error)
- g_critical(
- "Error on starting AqBanking setup wizard: Code %d: %s",
- error->code, error->message ? error->message : "(null)");
-
- if (!spawned)
- {
- g_critical("Could not start AqBanking setup wizard: %s",
- error->message ? error->message : "(null)");
- g_error_free (error);
- }
- else
- {
- /* Keep a reference to info that can survive info */
- info->deferred_info = g_new0(DeferredInfo, 1);
- info->deferred_info->initial_info = info;
- info->deferred_info->wizard_path = g_strdup(wizard_path);
- info->deferred_info->qt_probably_unavailable =
- qt_probably_unavailable;
-
- g_child_watch_add (pid, child_exit_cb, info->deferred_info);
- }
- }
- else
- {
- g_warning("on_aqhbci_button: Oops, no aqhbci setup wizard found.");
- gnc_error_dialog
- (GTK_WINDOW (info->window),
- _("The external program \"AqBanking Setup Wizard\" has not "
- "been found. \n\n"
- "The %s package should include the "
- "program \"qt3-wizard\". Please check your installation to "
- "ensure this program is present. On some distributions this "
- "may require installing additional packages."),
- QT3_WIZARD_PACKAGE);
- }
-
- GWEN_Buffer_free(buf);
-#endif
/* Enable the Assistant Buttons if we accounts */
if (banking_has_accounts(info->api))
@@ -415,11 +294,7 @@ aai_match_page_prepare (GtkAssistant *assistant, gpointer user_data)
if (!info->match_page_prepared)
{
/* Load aqbanking accounts */
-#ifdef AQBANKING_VERSION_4_EXACTLY
- AB_Banking_OnlineInit(info->api, 0);
-#else
AB_Banking_OnlineInit(info->api);
-#endif
/* Determine current mapping */
root = gnc_book_get_root_account(gnc_get_current_book());
info->gnc_hash = g_hash_table_new(&g_direct_hash, &g_direct_equal);
@@ -461,11 +336,7 @@ banking_has_accounts(AB_BANKING *banking)
g_return_val_if_fail(banking, FALSE);
-#ifdef AQBANKING_VERSION_4_EXACTLY
- AB_Banking_OnlineInit(banking, 0);
-#else
AB_Banking_OnlineInit(banking);
-#endif
accl = AB_Banking_GetAccounts(banking);
if (accl && (AB_Account_List2_GetSize(accl) > 0))
@@ -476,11 +347,7 @@ banking_has_accounts(AB_BANKING *banking)
if (accl)
AB_Account_List2_free(accl);
-#ifdef AQBANKING_VERSION_4_EXACTLY
- AB_Banking_OnlineFini(banking, 0);
-#else
AB_Banking_OnlineFini(banking);
-#endif
return result;
}
@@ -496,82 +363,6 @@ hash_from_kvp_acc_cb(Account *gnc_acc, gpointer user_data)
g_hash_table_insert(data->hash, ab_acc, gnc_acc);
}
-#if AQBANKING_VERSION_INT <= 49908
-static void
-child_exit_cb(GPid pid, gint status, gpointer data)
-{
- DeferredInfo *deferred_info = data;
- ABInitialInfo *info = deferred_info->initial_info;
- gint num = gtk_assistant_get_current_page (GTK_ASSISTANT(info->window));
- GtkWidget *page = gtk_assistant_get_nth_page (GTK_ASSISTANT(info->window), num);
-
- gint exit_status;
-
-#ifdef G_OS_WIN32
- exit_status = status;
-#else
- exit_status = WEXITSTATUS(status);
-#endif
-
- g_spawn_close_pid(pid);
-
- if (!info)
- {
- g_message("Online Banking wizard exited, but the assistant has been "
- "destroyed already");
- goto cleanup_child_exit_cb;
- }
-
- if (exit_status == 0)
- {
- gtk_assistant_set_page_complete (GTK_ASSISTANT(info->window), page, TRUE);
- }
- else
- {
- if (deferred_info->qt_probably_unavailable)
- {
- g_warning("on_aqhbci_button: Oops, aqhbci wizard return nonzero "
- "value: %d. The called program was \"%s\".\n",
- exit_status, deferred_info->wizard_path);
- gnc_error_dialog
- (GTK_WINDOW (info->window), "%s",
- _("The external program \"AqBanking Setup Wizard\" failed "
- "to run successfully because the "
- "additional software \"Qt\" was not found. "
- "Please install the \"Qt/Windows Open Source Edition\" "
- "from Trolltech by downloading it from www.trolltech.com"
- "\n\n"
- "If you have installed Qt already, you will have to adapt "
- "the PATH variable of your system appropriately. "
- "Contact the GnuCash developers if you need further "
- "assistance on how to install Qt correctly."
- "\n\n"
- "Online Banking cannot be setup without Qt. Press \"Close\" "
- "now, then \"Cancel\" to cancel the Online Banking setup."));
- }
- else
- {
- g_warning("on_aqhbci_button: Oops, aqhbci wizard return nonzero "
- "value: %d. The called program was \"%s\".\n",
- exit_status, deferred_info->wizard_path);
- gnc_error_dialog
- (GTK_WINDOW (info->window), "%s",
- _("The external program \"AqBanking Setup Wizard\" failed "
- "to run successfully. Online Banking can only be setup "
- "if this wizard has run successfully. "
- "Please try running the \"AqBanking Setup Wizard\" again."));
- }
- gtk_assistant_set_page_complete (GTK_ASSISTANT(info->window), page, FALSE);
- }
-
-cleanup_child_exit_cb:
- g_free(deferred_info->wizard_path);
- g_free(deferred_info);
- if (info)
- info->deferred_info = NULL;
-}
-#endif /* AQBANKING_VERSION_INT <= 49908 */
-
static gchar *
ab_account_longname(const AB_ACCOUNT *ab_acc)
{
diff --git a/gnucash/import-export/aqb/dialog-ab-trans.c b/gnucash/import-export/aqb/dialog-ab-trans.c
index 4aa6bf364..bea6abf55 100644
--- a/gnucash/import-export/aqb/dialog-ab-trans.c
+++ b/gnucash/import-export/aqb/dialog-ab-trans.c
@@ -46,11 +46,6 @@
#include "gnc-amount-edit.h"
#include "gnc-ui.h"
-#if AQBANKING_VERSION_INT > 50200 || ((AQBANKING_VERSION_INT == 50200) && (AQBANKING_VERSION_BUILD > 0))
-/** Defined for aqbanking > 5.2.0 */
-# define AQBANKING_VERSION_GREATER_5_2_0
-#endif
-
/* This static indicates the debugging module that this .o belongs to. */
static QofLogModule log_module = G_LOG_DOMAIN;
@@ -620,27 +615,6 @@ gnc_ab_trans_dialog_verify_values(GncABTransDialog *td)
g_free(purpose);
}
-#if 0
-// // AQBANKING_VERSION_INT >= 50307
-// if (gnc_ab_trans_isSEPA(td->trans_type))
-// {
-// AB_USER *u = AH_Job_GetUser(j);
-// uint32_t uflags;
-// (AB_Transaction_CheckForSepaConformity(td->ab_trans, 0) != 0))
- // need to check how to do this for aqbanking >= 5.3.7 when I have time
- {
- gnc_ab_trans_dialog_entry_set (td->recp_name_entry,
- _("The text you entered contained at least one character that is invalid for a SEPA transaction. "
- "In SEPA, unfortunately only exactly the following characters are allowed: "
- "a...z, A...Z, 0...9, and the following punctuations: ' : ? , - ( + . ) / "
- "\n\n"
- "In particular, neither Umlauts nor an ampersand (&) is allowed, "
- "neither in the recipient or sender name nor in any purpose line."),
- "process-stop");
- values_ok = FALSE;
- }
-#endif
-
gtk_widget_set_sensitive(td->exec_button, values_ok);
gnc_ab_trans_dialog_clear_transaction(td);
}
@@ -662,13 +636,7 @@ gnc_ab_trans_dialog_run_until_ok(GncABTransDialog *td)
}
/* Activate as many purpose entries as available for the job */
- joblimits =
-#ifdef AQBANKING_VERSION_GREATER_5_2_0
- AB_Job_GetFieldLimits
-#else
- AB_JobSingleTransfer_GetFieldLimits
-#endif
- (job);
+ joblimits = AB_Job_GetFieldLimits (job);
max_purpose_lines = joblimits ?
AB_TransactionLimits_GetMaxLinesPurpose(joblimits) : 2;
gtk_widget_set_sensitive(td->purpose_cont_entry, max_purpose_lines > 1);
@@ -829,11 +797,7 @@ gnc_ab_trans_dialog_get_available_empty_job(AB_ACCOUNT *ab_acc, GncABTransType t
break;
};
- if (!job || AB_Job_CheckAvailability(job
-#ifndef AQBANKING_VERSION_5_PLUS
- , 0
-#endif
- ))
+ if (!job || AB_Job_CheckAvailability(job))
{
if (job) AB_Job_free(job);
return NULL;
@@ -859,29 +823,7 @@ gnc_ab_get_trans_job(AB_ACCOUNT *ab_acc, const AB_TRANSACTION *ab_trans,
job = gnc_ab_trans_dialog_get_available_empty_job(ab_acc, trans_type);
if (job)
{
-#ifdef AQBANKING_VERSION_GREATER_5_2_0
AB_Job_SetTransaction(job, ab_trans);
-#else
- switch (trans_type)
- {
- case SINGLE_DEBITNOTE:
- AB_JobSingleDebitNote_SetTransaction(job, ab_trans);
- break;
- case SINGLE_INTERNAL_TRANSFER:
- AB_JobInternalTransfer_SetTransaction(job, ab_trans);
- break;
- case SEPA_TRANSFER:
- AB_JobSepaTransfer_SetTransaction(job, ab_trans);
- break;
- case SEPA_DEBITNOTE:
- AB_JobSepaDebitNote_SetTransaction(job, ab_trans);
- break;
- case SINGLE_TRANSFER:
- default:
- AB_JobSingleTransfer_SetTransaction(job, ab_trans);
- break;
- };
-#endif
}
return job;
}
diff --git a/gnucash/import-export/aqb/gnc-ab-getbalance.c b/gnucash/import-export/aqb/gnc-ab-getbalance.c
index 3a2c6cb5f..680357d35 100644
--- a/gnucash/import-export/aqb/gnc-ab-getbalance.c
+++ b/gnucash/import-export/aqb/gnc-ab-getbalance.c
@@ -64,11 +64,7 @@ gnc_ab_getbalance(GtkWidget *parent, Account *gnc_acc)
g_warning("gnc_ab_gettrans: Couldn't get AqBanking API");
return;
}
- if (AB_Banking_OnlineInit(api
-#ifdef AQBANKING_VERSION_4_EXACTLY
- , 0
-#endif
- ) != 0)
+ if (AB_Banking_OnlineInit(api) != 0)
{
g_warning("gnc_ab_gettrans: Couldn't initialize AqBanking API");
goto cleanup;
@@ -86,11 +82,7 @@ gnc_ab_getbalance(GtkWidget *parent, Account *gnc_acc)
/* 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
- ))
+ if (!job || AB_Job_CheckAvailability(job))
{
g_warning("gnc_ab_getbalance: JobGetBalance not available for this "
"account");
@@ -112,11 +104,7 @@ gnc_ab_getbalance(GtkWidget *parent, Account *gnc_acc)
context = AB_ImExporterContext_new();
/* Execute the job */
- AB_Banking_ExecuteJobs(api, job_list, context
-#ifndef AQBANKING_VERSION_5_PLUS
- , 0
-#endif
- );
+ AB_Banking_ExecuteJobs(api, job_list, context);
/* 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
@@ -148,10 +136,6 @@ cleanup:
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);
}
diff --git a/gnucash/import-export/aqb/gnc-ab-gettrans.c b/gnucash/import-export/aqb/gnc-ab-gettrans.c
index 92f02c7d9..5bccb9521 100644
--- a/gnucash/import-export/aqb/gnc-ab-gettrans.c
+++ b/gnucash/import-export/aqb/gnc-ab-gettrans.c
@@ -117,11 +117,7 @@ gnc_ab_gettrans(GtkWidget *parent, Account *gnc_acc)
g_warning("gnc_ab_gettrans: Couldn't get AqBanking API");
return;
}
- if (AB_Banking_OnlineInit(api
-#ifdef AQBANKING_VERSION_4_EXACTLY
- , 0
-#endif
- ) != 0)
+ if (AB_Banking_OnlineInit(api) != 0)
{
g_warning("gnc_ab_gettrans: Couldn't initialize AqBanking API");
goto cleanup;
@@ -148,11 +144,7 @@ gnc_ab_gettrans(GtkWidget *parent, Account *gnc_acc)
/* 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
- ))
+ if (!job || AB_Job_CheckAvailability(job))
{
g_warning("gnc_ab_gettrans: JobGetTransactions not available for this "
"account");
@@ -176,11 +168,7 @@ gnc_ab_gettrans(GtkWidget *parent, Account *gnc_acc)
context = AB_ImExporterContext_new();
/* Execute the job */
- AB_Banking_ExecuteJobs(api, job_list, context
-#ifndef AQBANKING_VERSION_5_PLUS
- , 0
-#endif
- );
+ AB_Banking_ExecuteJobs(api, job_list, context);
/* 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
@@ -234,10 +222,6 @@ cleanup:
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);
}
diff --git a/gnucash/import-export/aqb/gnc-ab-transfer.c b/gnucash/import-export/aqb/gnc-ab-transfer.c
index 128e94bcf..5f08fa92b 100644
--- a/gnucash/import-export/aqb/gnc-ab-transfer.c
+++ b/gnucash/import-export/aqb/gnc-ab-transfer.c
@@ -97,11 +97,7 @@ gnc_ab_maketrans(GtkWidget *parent, Account *gnc_acc,
g_warning("gnc_ab_maketrans: Couldn't get AqBanking API");
return;
}
- if (AB_Banking_OnlineInit(api
-#ifdef AQBANKING_VERSION_4_EXACTLY
- , 0
-#endif
- ) != 0)
+ if (AB_Banking_OnlineInit(api) != 0)
{
g_warning("gnc_ab_maketrans: Couldn't initialize AqBanking API");
goto cleanup;
@@ -174,11 +170,7 @@ gnc_ab_maketrans(GtkWidget *parent, Account *gnc_acc,
/* 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 (!job || AB_Job_CheckAvailability(job))
{
if (!gnc_verify_dialog (
GTK_WINDOW (parent), FALSE, "%s",
@@ -273,11 +265,7 @@ gnc_ab_maketrans(GtkWidget *parent, Account *gnc_acc,
}
/* Finally, execute the job */
- AB_Banking_ExecuteJobs(api, job_list, context
-#ifndef AQBANKING_VERSION_5_PLUS
- , 0
-#endif
- );
+ AB_Banking_ExecuteJobs(api, job_list, context);
/* Ignore the return value of AB_Banking_ExecuteJobs(), as the job's
* status always describes better whether the job was actually
@@ -348,10 +336,6 @@ 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);
}
diff --git a/gnucash/import-export/aqb/gnc-ab-utils.c b/gnucash/import-export/aqb/gnc-ab-utils.c
index 79704a4b7..9f249f1df 100644
--- a/gnucash/import-export/aqb/gnc-ab-utils.c
+++ b/gnucash/import-export/aqb/gnc-ab-utils.c
@@ -47,10 +47,7 @@
#include "import-utilities.h"
#include "qof.h"
#include "engine-helpers.h"
-
-#ifdef AQBANKING_VERSION_5_PLUS
-# include <aqbanking/abgui.h>
-#endif /* AQBANKING_VERSION_5_PLUS */
+#include <aqbanking/abgui.h>
/* This static indicates the debugging module that this .o belongs to. */
G_GNUC_UNUSED static QofLogModule log_module = G_LOG_DOMAIN;
@@ -155,56 +152,31 @@ gnc_AB_BANKING_new(void)
api = AB_Banking_new("gnucash", NULL, 0);
g_return_val_if_fail(api, NULL);
-#ifdef AQBANKING_VERSION_4_PLUS
/* Check for config migration */
- if (AB_Banking_HasConf4(api
-# ifndef AQBANKING_VERSION_5_PLUS
- , 0
-# endif
- ) != 0)
+ if (AB_Banking_HasConf4(api) != 0)
{
- if (AB_Banking_HasConf3(api
-# ifndef AQBANKING_VERSION_5_PLUS
- , 0
-# endif
- ) == 0)
+ if (AB_Banking_HasConf3(api) == 0)
{
g_message("gnc_AB_BANKING_new: importing aqbanking3 configuration\n");
- if (AB_Banking_ImportConf3(api
-# ifndef AQBANKING_VERSION_5_PLUS
- , 0
-# endif
- ) < 0)
+ if (AB_Banking_ImportConf3(api) < 0)
{
g_message("gnc_AB_BANKING_new: unable to import aqbanking3 configuration\n");
}
}
- else if (AB_Banking_HasConf2(api
-# ifndef AQBANKING_VERSION_5_PLUS
- , 0
-# endif
- ) == 0)
+ else if (AB_Banking_HasConf2(api) == 0)
{
g_message("gnc_AB_BANKING_new: importing aqbanking2 configuration\n");
- if (AB_Banking_ImportConf2(api
-# ifndef AQBANKING_VERSION_5_PLUS
- , 0
-# endif
- ) < 0)
+ if (AB_Banking_ImportConf2(api) < 0)
{
g_message("gnc_AB_BANKING_new: unable to import aqbanking2 configuration\n");
}
}
}
-#endif /* AQBANKING_VERSION_4_PLUS */
/* Init the API */
g_return_val_if_fail(AB_Banking_Init(api) == 0, NULL);
-
-#ifdef AQBANKING_VERSION_5_PLUS
gnc_gwengui_extended_by_ABBanking = GWEN_Gui_GetGui();
AB_Gui_Extend(gnc_gwengui_extended_by_ABBanking, api);
-#endif /* AQBANKING_VERSION_5_PLUS */
/* Cache it */
gnc_AB_BANKING = api;
@@ -242,21 +214,17 @@ gnc_AB_BANKING_fini(AB_BANKING *api)
{
if (--gnc_AB_BANKING_refcount == 0)
{
-#ifdef AQBANKING_VERSION_5_PLUS
if (gnc_gwengui_extended_by_ABBanking)
AB_Gui_Unextend(gnc_gwengui_extended_by_ABBanking);
gnc_gwengui_extended_by_ABBanking = NULL;
-#endif /* AQBANKING_VERSION_5_PLUS */
return AB_Banking_Fini(api);
}
}
else
{
-#ifdef AQBANKING_VERSION_5_PLUS
if (gnc_gwengui_extended_by_ABBanking)
AB_Gui_Unextend(gnc_gwengui_extended_by_ABBanking);
gnc_gwengui_extended_by_ABBanking = NULL;
-#endif /* AQBANKING_VERSION_5_PLUS */
return AB_Banking_Fini(api);
}
return 0;
@@ -708,11 +676,7 @@ txn_transaction_cb(const AB_TRANSACTION *element, gpointer user_data)
job = gnc_ab_get_trans_job(data->ab_acc, ab_trans, trans_type);
/* Check whether we really got a job */
- if (!job || AB_Job_CheckAvailability(job
-#ifndef AQBANKING_VERSION_5_PLUS
- , 0
-#endif
- ))
+ if (!job || AB_Job_CheckAvailability(job))
{
/* Oops, no job, probably not supported by bank */
if (gnc_verify_dialog(
@@ -1157,18 +1121,7 @@ gnc_ab_get_permanent_certs(void)
AB_BANKING *banking = gnc_AB_BANKING_new();
g_return_val_if_fail(banking, NULL);
-#ifdef AQBANKING_VERSION_4_PLUS
- rv = AB_Banking_LoadSharedConfig(banking, "certs", &perm_certs
-# ifndef AQBANKING_VERSION_5_PLUS
- , 0
-# endif
- );
-#else
- /* FIXME: Add code for older AqBanking versions */
- /* See QBankmanager 0.9.50 in src/kbanking/libs/kbanking.cpp lines 323ff
- for a proper example of how to do this */
- rv = 0;
-#endif
+ rv = AB_Banking_LoadSharedConfig(banking, "certs", &perm_certs);
gnc_AB_BANKING_fini(banking);
g_return_val_if_fail(rv >= 0, NULL);
return perm_certs;
diff --git a/gnucash/import-export/aqb/gnc-ab-utils.h b/gnucash/import-export/aqb/gnc-ab-utils.h
index 3f3fc4467..decf28057 100644
--- a/gnucash/import-export/aqb/gnc-ab-utils.h
+++ b/gnucash/import-export/aqb/gnc-ab-utils.h
@@ -52,24 +52,6 @@ G_BEGIN_DECLS
* in the interval [0..99]. */
#define GWENHYWFAR_VERSION_INT (10000 * GWENHYWFAR_VERSION_MAJOR + 100 * GWENHYWFAR_VERSION_MINOR + GWENHYWFAR_VERSION_PATCHLEVEL)
-#if AQBANKING_VERSION_INT >= 39900
-/** Defined if libaqbanking4 as opposed to libaqbanking3 or earlier is
- * being used */
-# define AQBANKING_VERSION_4_PLUS
-#endif
-
-#if AQBANKING_VERSION_INT >= 49900
-/** Defined if libaqbanking5 as opposed to libaqbanking4 or earlier is
- * being used */
-# define AQBANKING_VERSION_5_PLUS
-#endif
-
-#if defined(AQBANKING_VERSION_4_PLUS) && !defined(AQBANKING_VERSION_5_PLUS)
-/** Defined if libaqbanking4 is used and neither a newer nor an older
- * version of libaqbanking. */
-# define AQBANKING_VERSION_4_EXACTLY
-#endif
-
#define GNC_PREFS_GROUP_AQBANKING "dialogs.import.hbci"
#define GNC_PREF_FORMAT_SWIFT940 "format-swift-mt940"
#define GNC_PREF_FORMAT_SWIFT942 "format-swift-mt942"
diff --git a/gnucash/import-export/aqb/gnc-file-aqb-import.c b/gnucash/import-export/aqb/gnc-file-aqb-import.c
index b8af4b799..9a43a497d 100644
--- a/gnucash/import-export/aqb/gnc-file-aqb-import.c
+++ b/gnucash/import-export/aqb/gnc-file-aqb-import.c
@@ -44,15 +44,9 @@
#include "gnc-ab-utils.h"
-#ifdef AQBANKING_VERSION_5_PLUS
# include <gwenhywfar/syncio_file.h>
# include <gwenhywfar/syncio_buffered.h>
typedef GWEN_SYNCIO GWEN_IO_LAYER;
-#else
-# include <gwenhywfar/io_file.h>
-# include <gwenhywfar/io_buffered.h>
-# include <gwenhywfar/iomanager.h>
-#endif
#include "dialog-ab-trans.h"
#include "dialog-utils.h"
@@ -125,11 +119,7 @@ gnc_file_aqbanking_import(GtkWindow *parent,
g_warning("gnc_file_aqbanking_import: Couldn't get AqBanking API");
goto cleanup;
}
- if (AB_Banking_OnlineInit(api
-#ifdef AQBANKING_VERSION_4_EXACTLY
- , 0
-#endif
- ) != 0)
+ if (AB_Banking_OnlineInit(api) != 0)
{
g_warning("gnc_file_aqbanking_import: "
"Couldn't initialize AqBanking API");
@@ -181,7 +171,6 @@ gnc_file_aqbanking_import(GtkWindow *parent,
context = AB_ImExporterContext_new();
/* Wrap file in buffered gwen io */
-#ifdef AQBANKING_VERSION_5_PLUS
close(dtaus_fd);
io = GWEN_SyncIo_File_new(selected_filename, GWEN_SyncIo_File_CreationMode_OpenExisting);
g_assert(io);
@@ -197,34 +186,17 @@ gnc_file_aqbanking_import(GtkWindow *parent,
}
g_assert(GWEN_SyncIo_GetStatus(io) == GWEN_SyncIo_Status_Connected);
}
-#else
- io = GWEN_Io_LayerFile_new(dtaus_fd, -1);
- g_assert(io);
- if (GWEN_Io_Manager_RegisterLayer(io))
- {
- g_warning("gnc_file_aqbanking_import: Failed to wrap file");
- goto cleanup;
- }
-#endif
dtaus_fd = -1;
/* Run the import */
- if (AB_ImExporter_Import(importer, context, io, db_profile
-#ifndef AQBANKING_VERSION_5_PLUS
- , 0
-#endif
- ))
+ if (AB_ImExporter_Import(importer, context, io, db_profile))
{
g_warning("gnc_file_aqbanking_import: Error on import");
goto cleanup;
}
/* Close the file */
-#ifdef AQBANKING_VERSION_5_PLUS
GWEN_SyncIo_free(io);
-#else
- GWEN_Io_Layer_free(io);
-#endif
io = NULL;
/* Before importing the results, if this is a new book, let user specify
@@ -259,11 +231,7 @@ gnc_file_aqbanking_import(GtkWindow *parent,
}
/* And execute the jobs */
- AB_Banking_ExecuteJobs(api, job_list, execution_context
-#ifndef AQBANKING_VERSION_5_PLUS
- , 0
-#endif
- );
+ AB_Banking_ExecuteJobs(api, job_list, execution_context);
/* Ignore the return value of AB_Banking_ExecuteJobs(), as the job's
* status always describes better whether the job was actually
@@ -351,11 +319,7 @@ gnc_file_aqbanking_import(GtkWindow *parent,
cleanup:
if (io)
{
-#ifdef AQBANKING_VERSION_5_PLUS
GWEN_SyncIo_free(io);
-#else
- GWEN_Io_Layer_free(io);
-#endif
}
if (job_list)
@@ -369,11 +333,7 @@ cleanup:
if (gui)
gnc_GWEN_Gui_release(gui);
if (online)
-#ifdef AQBANKING_VERSION_4_EXACTLY
- AB_Banking_OnlineFini(api, 0);
-#else
AB_Banking_OnlineFini(api);
-#endif
if (api)
gnc_AB_BANKING_fini(api);
if (dtaus_fd != -1)
diff --git a/gnucash/import-export/aqb/gnc-gwen-gui.c b/gnucash/import-export/aqb/gnc-gwen-gui.c
index c708339e0..91b0592e5 100644
--- a/gnucash/import-export/aqb/gnc-gwen-gui.c
+++ b/gnucash/import-export/aqb/gnc-gwen-gui.c
@@ -46,14 +46,8 @@
#include "gnc-plugin-aqbanking.h"
#include "qof.h"
-#if GWENHYWFAR_VERSION_INT >= 39921
-/* For sufficiently new gwenhywfar (>=3.99.21) the gtk3 gui object is
- * working fine and it is enabled here here. */
# define USING_GWENHYWFAR_GTK3_GUI
# define GNC_GWENHYWFAR_CB GWENHYWFAR_CB
-#else
-# define GNC_GWENHYWFAR_CB
-#endif
#define GWEN_GUI_CM_CLASS "dialog-hbcilog"
#define GNC_PREFS_GROUP_CONNECTION GNC_PREFS_GROUP_AQBANKING ".connection-dialog"
@@ -218,9 +212,7 @@ static gint GNC_GWENHYWFAR_CB setpasswordstatus_cb(GWEN_GUI *gwen_gui, const gch
GWEN_GUI_PASSWORD_STATUS status, guint32 guiid);
static gint GNC_GWENHYWFAR_CB loghook_cb(GWEN_GUI *gwen_gui, const gchar *log_domain,
GWEN_LOGGER_LEVEL priority, const gchar *text);
-#ifdef AQBANKING_VERSION_5_PLUS
typedef GWEN_SYNCIO GWEN_IO_LAYER;
-#endif
static gint GNC_GWENHYWFAR_CB checkcert_cb(GWEN_GUI *gwen_gui, const GWEN_SSLCERTDESCR *cert,
GWEN_IO_LAYER *io, guint32 guiid);
Summary of changes:
CMakeLists.txt | 4 +-
README.dependencies | 4 +-
gnucash/import-export/aqb/assistant-ab-initial.c | 298 +++++------------------
gnucash/import-export/aqb/dialog-ab-trans.c | 174 +++++++------
gnucash/import-export/aqb/dialog-ab-trans.h | 19 +-
gnucash/import-export/aqb/gnc-ab-getbalance.c | 72 ++++--
gnucash/import-export/aqb/gnc-ab-gettrans.c | 99 ++++++--
gnucash/import-export/aqb/gnc-ab-transfer.c | 58 +++--
gnucash/import-export/aqb/gnc-ab-utils.c | 237 ++++++++++++------
gnucash/import-export/aqb/gnc-ab-utils.h | 50 ++--
gnucash/import-export/aqb/gnc-file-aqb-import.c | 138 +++++------
gnucash/import-export/aqb/gnc-gwen-gui.c | 12 +-
12 files changed, 592 insertions(+), 573 deletions(-)
More information about the gnucash-changes
mailing list