diff --git a/gnucash/import-export/aqb/assistant-ab-initial.c b/gnucash/import-export/aqb/assistant-ab-initial.c index e40832614e..133e3a70de 100644 --- a/gnucash/import-export/aqb/assistant-ab-initial.c +++ b/gnucash/import-export/aqb/assistant-ab-initial.c @@ -352,10 +352,10 @@ banking_has_accounts(AB_BANKING *banking) #ifdef AQBANKING6 if (AB_Banking_GetAccountSpecList (banking, &accl) >= 0 && - accl && AV_AccountSpec_List_GetCount (accl)) + accl && AB_AccountSpec_List_GetCount (accl)) result = TRUE; if (accl) - AB_AccountSpec_List_Free (accl); + AB_AccountSpec_List_free (accl); #else AB_Banking_OnlineInit(banking); @@ -394,7 +394,7 @@ ab_account_longname(const GNC_AB_ACCOUNT_SPEC *ab_acc) #ifdef AQBANKING6 bankcode = AB_AccountSpec_GetBankCode(ab_acc); - subAccountId = AB_AccountSpec_GetSubAccountId(ab_acc); + subAccountId = AB_AccountSpec_GetSubAccountNumber(ab_acc); account_number = AB_AccountSpec_GetAccountNumber (ab_acc); #else ab_bankname = AB_Account_GetBankName(ab_acc); diff --git a/gnucash/import-export/aqb/dialog-ab-trans.c b/gnucash/import-export/aqb/dialog-ab-trans.c index ef12efb3e7..d3c0e54da2 100644 --- a/gnucash/import-export/aqb/dialog-ab-trans.c +++ b/gnucash/import-export/aqb/dialog-ab-trans.c @@ -32,20 +32,21 @@ #include #include -#include -#include -#include -#include -#include +#include "gnc-ab-utils.h" /* for AQBANKING6 */ #ifdef AQBANKING6 # include +#else +# include +# include +# include +# include +# include #endif #include #include "dialog-ab-trans.h" #include "dialog-transfer.h" #include "dialog-utils.h" -#include "gnc-ab-utils.h" #include "gnc-amount-edit.h" #include "gnc-ui.h" @@ -185,7 +186,7 @@ gnc_ab_trans_dialog_fill_values(GncABTransDialog *td) AB_TRANSACTION *trans = AB_Transaction_new(); AB_VALUE *value; -#ifdef AQBNKING6 +#ifdef AQBANKING6 AB_Banking_FillTransactionFromAccountSpec(trans, td->ab_acc); #else AB_Transaction_FillLocalFromAccount(trans, td->ab_acc); @@ -428,8 +429,8 @@ gnc_ab_trans_dialog_new(GtkWidget *parent, GNC_AB_ACCOUNT_SPEC *ab_acc, { 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); + 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); @@ -813,7 +814,7 @@ gnc_ab_trans_dialog_get_available_empty_job(GNC_AB_ACCOUNT_SPEC *ab_acc, GncABTr switch (trans_type) { - case SINGLE_DEBITNOTE: + case SINGLE_DEBITNOTE: /* no longer in use */ cmd=AB_Transaction_CommandDebitNote; break; case SINGLE_INTERNAL_TRANSFER: @@ -825,9 +826,8 @@ gnc_ab_trans_dialog_get_available_empty_job(GNC_AB_ACCOUNT_SPEC *ab_acc, GncABTr case SEPA_DEBITNOTE: cmd=AB_Transaction_CommandSepaDebitNote; break; - case SEPA_TRANSFER: default: - cmd=AB_Transaction_CommandTransfer; + cmd=AB_Transaction_CommandTransfer; /* no longer in use */ break; }; if (!AB_AccountSpec_GetTransactionLimitsForCommand(ab_acc, cmd)) diff --git a/gnucash/import-export/aqb/gnc-ab-getbalance.c b/gnucash/import-export/aqb/gnc-ab-getbalance.c index 03164c57f7..dc0394a2b9 100644 --- a/gnucash/import-export/aqb/gnc-ab-getbalance.c +++ b/gnucash/import-export/aqb/gnc-ab-getbalance.c @@ -134,13 +134,17 @@ gnc_ab_getbalance(GtkWidget *parent, Account *gnc_acc) * https://lists.gnucash.org/pipermail/gnucash-de/2008-September/006389.html */ #ifdef AQBANKING6 + job_status = AB_Transaction_GetStatus(job); + if (job_status != AB_Transaction_StatusEnqueued + && job_status != AB_Transaction_StatusPending + && job_status != AB_Transaction_StatusAccepted) #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"); + g_warning("gnc_ab_getbalance: Error on executing job: %d", job_status); #ifdef AQBANKING6 gnc_error_dialog (GTK_WINDOW (parent), _("Error on executing job.\n\nStatus: %s"), diff --git a/gnucash/import-export/aqb/gnc-ab-utils.c b/gnucash/import-export/aqb/gnc-ab-utils.c index ad6cba2016..cec2a5766b 100644 --- a/gnucash/import-export/aqb/gnc-ab-utils.c +++ b/gnucash/import-export/aqb/gnc-ab-utils.c @@ -50,7 +50,11 @@ #include "import-utilities.h" #include "qof.h" #include "engine-helpers.h" -#include +#ifdef AQBANKING6 +# include +#else +# include +#endif /* This static indicates the debugging module that this .o belongs to. */ G_GNUC_UNUSED static QofLogModule log_module = G_LOG_DOMAIN; @@ -155,6 +159,7 @@ gnc_AB_BANKING_new(void) api = AB_Banking_new("gnucash", NULL, 0); g_return_val_if_fail(api, NULL); +#ifndef AQBANKING6 /* Check for config migration */ if (AB_Banking_HasConf4(api) != 0) { @@ -175,6 +180,7 @@ gnc_AB_BANKING_new(void) } } } +#endif /* Init the API */ g_return_val_if_fail(AB_Banking_Init(api) == 0, NULL); @@ -332,7 +338,10 @@ join_ab_strings_cb(const gchar *str, gpointer user_data) gchar * gnc_ab_get_remote_name(const AB_TRANSACTION *ab_trans) { -#ifndef AQBANKING6 +#ifdef AQBANKING6 + const char* ab_remote_name; + const char* ab_transactionText; +#else const GWEN_STRINGLIST *ab_remote_name; #endif gchar *gnc_other_name = NULL; @@ -368,7 +377,11 @@ gnc_ab_get_remote_name(const AB_TRANSACTION *ab_trans) gchar * gnc_ab_get_purpose(const AB_TRANSACTION *ab_trans, gboolean is_ofx) { +#ifdef AQBANKING6 + const char* ab_purpose; +#else const GWEN_STRINGLIST *ab_purpose; +#endif const char *ab_transactionText = NULL; gchar *gnc_description = NULL; @@ -385,12 +398,16 @@ gnc_ab_get_purpose(const AB_TRANSACTION *ab_trans, gboolean is_ofx) } ab_purpose = AB_Transaction_GetPurpose(ab_trans); +#ifdef AQBANKING6 + gnc_description = g_strdup(ab_purpose ? ab_purpose : ""); +#else if (ab_purpose) GWEN_StringList_ForEach(ab_purpose, join_ab_strings_cb, &gnc_description); if (!gnc_description) gnc_description = g_strdup(""); +#endif return gnc_description; } @@ -717,7 +734,9 @@ txn_transaction_cb(const AB_TRANSACTION *element, gpointer user_data) /* trans_type = SINGLE_INTERNAL_TRANSFER; * break; */ case AB_Transaction_TypeTransfer: +#ifndef AQBANKING6 case AB_Transaction_TypeEuTransfer: +#endif default: trans_type = SEPA_TRANSFER; break; @@ -754,7 +773,7 @@ txn_transaction_cb(const AB_TRANSACTION *element, gpointer user_data) gnc_gen_trans_list_add_trans_with_ref_id(data->generic_importer, gnc_trans, #ifdef AQBANKING6 - AB_Transaction_GetUniqueId)); + AB_Transaction_GetUniqueId(job)); #else AB_Job_GetJobId(job)); #endif @@ -899,11 +918,13 @@ 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); + { + AB_TRANSACTION_LIST *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); @@ -916,8 +937,6 @@ bal_accountinfo_cb(AB_IMEXPORTER_ACCOUNTINFO *element, gpointer user_data) { GncABImExContextImport *data = user_data; Account *gnc_acc; - AB_ACCOUNT_STATUS *item, *best = NULL; - const GWEN_TIME *best_time = NULL; const AB_BALANCE *booked_bal, *noted_bal; const AB_VALUE *booked_val = NULL, *noted_val = NULL; gdouble booked_value, noted_value; @@ -947,6 +966,9 @@ bal_accountinfo_cb(AB_IMEXPORTER_ACCOUNTINFO *element, gpointer user_data) booked_bal=AB_Balance_List_GetLatestByType(AB_ImExporterAccountInfo_GetBalanceList(element), AB_Balance_TypeBooked); #else + { + AB_ACCOUNT_STATUS *item, *best = NULL; + const GWEN_TIME *best_time = NULL; /* Lookup the most recent ACCOUNT_STATUS available */ item = AB_ImExporterAccountInfo_GetFirstAccountStatus(element); while (item) @@ -961,6 +983,7 @@ bal_accountinfo_cb(AB_IMEXPORTER_ACCOUNTINFO *element, gpointer user_data) } booked_bal = AB_AccountStatus_GetBookedBalance(best); + } #endif if (!(data->awaiting & AWAIT_BALANCES)) @@ -993,11 +1016,15 @@ bal_accountinfo_cb(AB_IMEXPORTER_ACCOUNTINFO *element, gpointer user_data) /* Lookup booked balance and time */ if (booked_bal) { +#ifdef AQBANKING6 + const GWEN_DATE *ti = AB_Balance_GetDate(booked_bal); +#else const GNC_GWEN_DATE *ti = AB_Balance_GetTime(booked_bal); +#endif if (ti) { #ifdef AQBANKING6 - time64 secs = GWEN_Date_toLocalTime_t(dt); + time64 secs = GWEN_Date_toLocalTime(ti); #else time64 secs = GWEN_Time_toTime_t(ti); #endif diff --git a/gnucash/import-export/aqb/gnc-file-aqb-import.c b/gnucash/import-export/aqb/gnc-file-aqb-import.c index 2a247bd224..cda6befe3b 100644 --- a/gnucash/import-export/aqb/gnc-file-aqb-import.c +++ b/gnucash/import-export/aqb/gnc-file-aqb-import.c @@ -73,7 +73,9 @@ gnc_file_aqbanking_import(GtkWindow *parent, AB_BANKING *api = NULL; gboolean online = FALSE; GncGWENGui *gui = NULL; +#ifndef AQBANKING6 AB_IMEXPORTER *importer; +#endif GWEN_DB_NODE *db_profiles = NULL; GWEN_DB_NODE *db_profile; AB_IMEXPORTER_CONTEXT *context = NULL; @@ -266,13 +268,17 @@ gnc_file_aqbanking_import(GtkWindow *parent, #endif if (jit) { +#ifdef AQBANKING6 + job = AB_Transaction_List2Iterator_Data(jit); +#else job = AB_Job_List2Iterator_Data(jit); +#endif while (job) { num_jobs += 1; #ifdef AQBANKING6 job_status = AB_Transaction_GetStatus(job); - if (job_status != AB_Transaction_StatusFinished && + if (job_status != AB_Transaction_StatusAccepted && job_status != AB_Transaction_StatusPending) #else job_status = AB_Job_GetStatus(job); @@ -319,7 +325,7 @@ gnc_file_aqbanking_import(GtkWindow *parent, #endif } /* while */ #ifdef AQBANKING6 - AB_Job_List2Iterator_free(jit); + AB_Transaction_List2Iterator_free(jit); #else AB_Job_List2Iterator_free(jit); #endif @@ -359,7 +365,7 @@ gnc_file_aqbanking_import(GtkWindow *parent, cleanup: if (job_list) #ifdef AQBANKING6 - AB_Transaction_List2_FreeAll(job_list); + AB_Transaction_List2_freeAll(job_list); #else AB_Job_List2_FreeAll(job_list); if (io)