gnucash maint: Multiple changes pushed

John Ralls jralls at code.gnucash.org
Sun Mar 15 15:49:35 EDT 2020


Updated	 via  https://github.com/Gnucash/gnucash/commit/d825d74c (commit)
	 via  https://github.com/Gnucash/gnucash/commit/b8504b78 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/64874df0 (commit)
	from  https://github.com/Gnucash/gnucash/commit/9865a996 (commit)



commit d825d74c861c25ceee381f4bd5edd1c337ead3ab
Merge: 9865a9966 b8504b782
Author: John Ralls <jralls at ceridwen.us>
Date:   Sun Mar 15 12:41:38 2020 -0700

    Merge Peter Zimmer's 'pkzw_bug797631' into maint.


commit b8504b7829cd44b5a1e84c1bb7fc4159c78c0dec
Author: Dr. Peter Zimmerer <pkzw at web.de>
Date:   Sun Mar 15 18:24:07 2020 +0100

    Bug 797631 - Superfluous account selection dialog on first online retrieval
    
    The online id, which is needed to find a GnuCash account for a transaction
    or the balance retrieved from an online account, is already assigned to each
    matched GnuCash account within the Online Banking Setup tool.
    The online id is removed from the GnuCash account if it is no longer matched
    with an AqBanking account.

diff --git a/gnucash/import-export/aqb/assistant-ab-initial.c b/gnucash/import-export/aqb/assistant-ab-initial.c
index 13425a67c..551073ef1 100644
--- a/gnucash/import-export/aqb/assistant-ab-initial.c
+++ b/gnucash/import-export/aqb/assistant-ab-initial.c
@@ -64,6 +64,7 @@
 #include "gnc-ui-util.h"
 #include "gnc-session.h"
 #include "import-account-matcher.h"
+#include "import-utilities.h"
 #ifndef AQBANKING6
 # include <aqbanking/dlg_setup.h>
 #endif
@@ -682,7 +683,8 @@ static void
 clear_kvp_acc_cb(gpointer gnc_acc, gpointer ab_acc, gpointer user_data)
 {
     g_return_if_fail(gnc_acc);
-    /* Delete complete "hbci..." KVPs for GnuCash account */
+    /* Delete "online-id" and complete "hbci..." KVPs for GnuCash account */
+    gnc_account_delete_map_entry((Account *) gnc_acc, "online_id", NULL, NULL, FALSE);
     gnc_account_delete_map_entry((Account *) gnc_acc, "hbci", NULL, NULL, FALSE);
 }
 
@@ -694,6 +696,10 @@ save_kvp_acc_cb(gpointer key, gpointer value, gpointer user_data)
     guint32 ab_account_uid;
     const gchar *ab_accountid, *gnc_accountid;
     const gchar *ab_bankcode, *gnc_bankcode;
+#ifdef AQBANKING6
+    gchar *ab_online_id;
+    const gchar *gnc_online_id;
+#endif
 
     g_return_if_fail(ab_acc && gnc_acc);
 
@@ -726,6 +732,14 @@ save_kvp_acc_cb(gpointer key, gpointer value, gpointer user_data)
             && (!gnc_bankcode
                 || (strcmp(gnc_bankcode, ab_bankcode) != 0)))
         gnc_ab_set_account_bankcode(gnc_acc, ab_bankcode);
+
+#ifdef AQBANKING6
+    ab_online_id = gnc_ab_create_online_id(ab_bankcode, ab_accountid);
+    gnc_online_id = gnc_import_get_acc_online_id(gnc_acc);
+    if (ab_online_id && (!gnc_online_id || (strcmp(ab_online_id, gnc_online_id) != 0)))
+        gnc_import_set_acc_online_id(gnc_acc, ab_online_id);
+    g_free(ab_online_id);
+#endif
 }
 
 static void

commit 64874df0ff3a08794e2cce0c094e5ef2b26cea41
Author: Dr. Peter Zimmerer <pkzw at web.de>
Date:   Sun Mar 15 18:23:38 2020 +0100

    Rename function create_online_id and make it externally callable
    
    The function is renamed to gnc_ab_create_online_id.
    It shall be callable from the Online Banking Setup tool in order
    to (re-)calculate the online id for changed account matches

diff --git a/gnucash/import-export/aqb/gnc-ab-utils.c b/gnucash/import-export/aqb/gnc-ab-utils.c
index 4e965fa35..09e9f1b36 100644
--- a/gnucash/import-export/aqb/gnc-ab-utils.c
+++ b/gnucash/import-export/aqb/gnc-ab-utils.c
@@ -63,7 +63,6 @@ G_GNUC_UNUSED static QofLogModule log_module = G_LOG_DOMAIN;
 static AB_BANKING *gnc_AB_BANKING = NULL;
 static gint gnc_AB_BANKING_refcount = 0;
 
-static gchar* create_online_id(const gchar *bankcode, const gchar *accountnumber);
 static gpointer join_ab_strings_cb(const gchar *str, gpointer user_data);
 static Account *gnc_ab_accinfo_to_gnc_acc(GtkWidget *parent,
     AB_IMEXPORTER_ACCOUNTINFO *account_info);
@@ -318,8 +317,8 @@ gnc_AB_VALUE_to_readable_string(const AB_VALUE *value)
 }
 
 
-static gchar*
-create_online_id(const gchar *bankcode, const gchar *accountnumber)
+gchar*
+gnc_ab_create_online_id(const gchar *bankcode, const gchar *accountnumber)
 {
     gchar *online_id;
 
@@ -669,7 +668,7 @@ gnc_ab_accinfo_to_gnc_acc(GtkWidget *parent, AB_IMEXPORTER_ACCOUNTINFO *acc_info
 
     bankcode = AB_ImExporterAccountInfo_GetBankCode(acc_info);
     accountnumber = AB_ImExporterAccountInfo_GetAccountNumber(acc_info);
-    online_id = create_online_id(bankcode, accountnumber);
+    online_id = gnc_ab_create_online_id(bankcode, accountnumber);
     gnc_acc = gnc_import_select_account(
                   parent, online_id, 1, AB_ImExporterAccountInfo_GetAccountName(acc_info),
                   NULL, ACCT_TYPE_NONE, NULL, NULL);
@@ -708,7 +707,7 @@ gnc_ab_txn_to_gnc_acc(GtkWidget *parent, const AB_TRANSACTION *transaction)
         return NULL;
     }
 
-    online_id = create_online_id(bankcode, accountnumber);
+    online_id = gnc_ab_create_online_id(bankcode, accountnumber);
     gnc_acc = gnc_import_select_account(
                   parent, online_id, 1, AB_Transaction_GetLocalName(transaction),
                   NULL, ACCT_TYPE_NONE, NULL, NULL);
diff --git a/gnucash/import-export/aqb/gnc-ab-utils.h b/gnucash/import-export/aqb/gnc-ab-utils.h
index 0cfb4db1c..3f4846228 100644
--- a/gnucash/import-export/aqb/gnc-ab-utils.h
+++ b/gnucash/import-export/aqb/gnc-ab-utils.h
@@ -276,6 +276,17 @@ gboolean gnc_ab_ieci_run_matcher(GncABImExContextImport *ieci);
  */
 GWEN_DB_NODE *gnc_ab_get_permanent_certs(void);
 
+/**
+ * Creates an online ID from bank code and account number.
+ *
+ * The returned string must be g_free'd by the caller.
+ *
+ * @param bankcode       Bank code
+ * @param accountnumber  Account number
+ * @return an online ID
+ */
+gchar* gnc_ab_create_online_id(const gchar *bankcode, const gchar *accountnumber);
+
 G_END_DECLS
 
 /** @} */



Summary of changes:
 gnucash/import-export/aqb/assistant-ab-initial.c | 16 +++++++++++++++-
 gnucash/import-export/aqb/gnc-ab-utils.c         |  9 ++++-----
 gnucash/import-export/aqb/gnc-ab-utils.h         | 11 +++++++++++
 3 files changed, 30 insertions(+), 6 deletions(-)



More information about the gnucash-changes mailing list