gnucash master: Multiple changes pushed

John Ralls jralls at code.gnucash.org
Mon Nov 4 17:32:34 EST 2019


Updated	 via  https://github.com/Gnucash/gnucash/commit/ba5bd6b4 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/085aa769 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/491088b2 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/535632b0 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/32a34035 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/be4e4524 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/977b1fcf (commit)
	 via  https://github.com/Gnucash/gnucash/commit/0abc09cc (commit)
	 via  https://github.com/Gnucash/gnucash/commit/3f6c8478 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/d56a47f1 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/47030c76 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/5870887f (commit)
	 via  https://github.com/Gnucash/gnucash/commit/99dbb788 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/b04c494f (commit)
	 via  https://github.com/Gnucash/gnucash/commit/928f6145 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/e27338b0 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/b5ae8416 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/158b5caf (commit)
	 via  https://github.com/Gnucash/gnucash/commit/2df672bd (commit)
	 via  https://github.com/Gnucash/gnucash/commit/b1e32c8a (commit)
	 via  https://github.com/Gnucash/gnucash/commit/5f6413c6 (commit)
	from  https://github.com/Gnucash/gnucash/commit/f89691f7 (commit)



commit ba5bd6b4d708fcc63604fc385b293a3ab6105a1a
Merge: f89691f73 085aa7693
Author: John Ralls <jralls at ceridwen.us>
Date:   Mon Nov 4 14:09:46 2019 -0800

    Merge branch 'maint'

diff --cc gnucash/report/reports/standard/budget-barchart.scm
index 5f33e4046,aca3eac4c..f1a9721c6
--- a/gnucash/report/reports/standard/budget-barchart.scm
+++ b/gnucash/report/reports/standard/budget-barchart.scm
@@@ -31,7 -31,7 +31,8 @@@
  (use-modules (gnucash gnc-module))
  (use-modules (gnucash gettext))
  
 -(gnc:module-load "gnucash/report/report-system" 0)
 +(gnc:module-load "gnucash/report" 0)
++(use-modules (gnucash reports))
  
  (define reportname
    (N_ "Budget Chart"))

commit 085aa76932afe6c68c9b99f0f6c65b889274196c
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Mon Nov 4 10:10:30 2019 +0000

    Bug 796945 - Search dialog update
    
    Change the search dialog so that when adding search criteria, a max
    number of 5 rows are presented before scrolling is required in the
    search criteria scroll window so reducing the height required for the
    this area and when the search is executed the scroll window is hidden
    and the results window has the maximum space available.

diff --git a/gnucash/gnome-search/dialog-search.c b/gnucash/gnome-search/dialog-search.c
index 1d90e74f6..39efe30d1 100644
--- a/gnucash/gnome-search/dialog-search.c
+++ b/gnucash/gnome-search/dialog-search.c
@@ -991,6 +991,16 @@ gnc_search_dialog_add_criterion (GNCSearchWindow *sw)
 static void
 add_criterion (GtkWidget *button, GNCSearchWindow *sw)
 {
+    gint number_of_buttons = g_list_length (sw->crit_list) + 1;
+    gint button_height = gtk_widget_get_allocated_height (button);
+    gint min_height = MIN (number_of_buttons * button_height, 5 * button_height);
+
+    // this sets the minimum content height for the criteria scroll
+    // window, it is set to a max of 5 buttons visible without scrolling
+    gtk_scrolled_window_set_min_content_height (GTK_SCROLLED_WINDOW(
+                                                sw->criteria_scroll_window),
+                                                min_height + (button_height/2));
+
     gnc_search_dialog_add_criterion (sw);
 }
 
diff --git a/gnucash/gtkbuilder/dialog-search.glade b/gnucash/gtkbuilder/dialog-search.glade
index 2f46d8cfd..37631aee4 100644
--- a/gnucash/gtkbuilder/dialog-search.glade
+++ b/gnucash/gtkbuilder/dialog-search.glade
@@ -302,7 +302,7 @@
                 </child>
               </object>
               <packing>
-                <property name="expand">True</property>
+                <property name="expand">False</property>
                 <property name="fill">True</property>
                 <property name="position">1</property>
               </packing>

commit 491088b2f6831be752fc0327282e9bf75eb00f18
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Sun Nov 3 22:29:30 2019 +0800

    Revert "Bug 797468 - Receivable Aging report - phantom company with negative total"
    
    This reverts commit 32a340350d2239c2e71408f69a2d4a4b11bf2cfb.

diff --git a/gnucash/gnome/dialog-payment.c b/gnucash/gnome/dialog-payment.c
index 6f8657e82..b1f96523a 100644
--- a/gnucash/gnome/dialog-payment.c
+++ b/gnucash/gnome/dialog-payment.c
@@ -937,14 +937,6 @@ gnc_payment_ok_cb (G_GNUC_UNUSED GtkWidget *widget, gpointer data)
         selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(pw->docs_list_tree_view));
         gtk_tree_selection_selected_foreach (selection, get_selected_lots, &selected_lots);
 
-        if ((gtk_tree_selection_count_selected_rows (selection) == 0) &&
-            !(gnc_verify_dialog ( GTK_WINDOW(pw->dialog), FALSE,
-                                  _("No documents were selected to assign this payment to. This may create an unattached payment. Do you wish to continue?"))))
-        {
-            gnc_resume_gui_refresh ();
-            return;
-        }
-
         /* When the payment amount is 0, the selected documents cancel each other out
          * so no money is actually transferred.
          * For non-zero payments money will be transferred between the post account

commit 535632b02515d0bbca3ba01ef2f2bfb7f0edf442
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Sun Nov 3 18:41:54 2019 +0800

    Bug 787295 - Allow UI jump from Business accounts to their relevant invoice/bill/voucher
    
    This enables UI jump via Transaction or Right-click menu to open the
    invoice for editing.

diff --git a/gnucash/gnome/gnc-plugin-page-register.c b/gnucash/gnome/gnc-plugin-page-register.c
index 42aead836..308c40916 100644
--- a/gnucash/gnome/gnc-plugin-page-register.c
+++ b/gnucash/gnome/gnc-plugin-page-register.c
@@ -54,6 +54,7 @@
 #include "dialog-find-account.h"
 #include "dialog-find-transactions.h"
 #include "dialog-print-check.h"
+#include "dialog-invoice.h"
 #include "dialog-transfer.h"
 #include "dialog-utils.h"
 #include "assistant-stock-split.h"
@@ -184,6 +185,7 @@ static void gnc_plugin_page_register_cmd_transaction_report (GtkAction *action,
 static void gnc_plugin_page_register_cmd_associate_file_transaction (GtkAction *action, GncPluginPageRegister *plugin_page);
 static void gnc_plugin_page_register_cmd_associate_location_transaction (GtkAction *action, GncPluginPageRegister *plugin_page);
 static void gnc_plugin_page_register_cmd_execassociated_transaction (GtkAction *action, GncPluginPageRegister *plugin_page);
+static void gnc_plugin_page_register_cmd_jump_associated_invoice (GtkAction *action, GncPluginPageRegister *plugin_page);
 
 static void gnc_plugin_page_help_changed_cb( GNCSplitReg *gsr, GncPluginPageRegister *register_page );
 static void gnc_plugin_page_popup_menu_cb( GNCSplitReg *gsr, GncPluginPageRegister *register_page );
@@ -197,6 +199,8 @@ static void gnc_plugin_page_register_event_handler (QofInstance *entity,
         GncPluginPageRegister *page,
         GncEventData *ed);
 
+static GncInvoice * invoice_from_trans (Transaction *trans);
+
 /************************************************************/
 /*                          Actions                         */
 /************************************************************/
@@ -209,6 +213,7 @@ static void gnc_plugin_page_register_event_handler (QofInstance *entity,
 #define ASSOCIATE_TRANSACTION_FILE_LABEL      N_("_Associate File with Transaction")
 #define ASSOCIATE_TRANSACTION_LOCATION_LABEL  N_("_Associate Location with Transaction")
 #define EXECASSOCIATED_TRANSACTION_LABEL N_("_Open Associated File/Location")
+#define JUMP_ASSOCIATED_INVOICE_LABEL     N_("Open Associated Invoice")
 #define CUT_SPLIT_LABEL                  N_("Cu_t Split")
 #define COPY_SPLIT_LABEL                 N_("_Copy Split")
 #define PASTE_SPLIT_LABEL                N_("_Paste Split")
@@ -222,6 +227,7 @@ static void gnc_plugin_page_register_event_handler (QofInstance *entity,
 #define ASSOCIATE_TRANSACTION_FILE_TIP   N_("Associate a file with the current transaction")
 #define ASSOCIATE_TRANSACTION_LOCATION_TIP    N_("Associate a location with the current transaction")
 #define EXECASSOCIATED_TRANSACTION_TIP   N_("Open the associated file or location with the current transaction")
+#define JUMP_ASSOCIATED_INVOICE_TIP      N_("Open the associated invoice")
 #define CUT_SPLIT_TIP                    N_("Cut the selected split into clipboard")
 #define COPY_SPLIT_TIP                   N_("Copy the selected split into clipboard")
 #define PASTE_SPLIT_TIP                  N_("Paste the split from the clipboard")
@@ -339,6 +345,11 @@ static GtkActionEntry gnc_plugin_page_register_actions [] =
         EXECASSOCIATED_TRANSACTION_TIP,
         G_CALLBACK (gnc_plugin_page_register_cmd_execassociated_transaction)
     },
+    {
+        "JumpAssociatedInvoiceAction", NULL, JUMP_ASSOCIATED_INVOICE_LABEL, NULL,
+        JUMP_ASSOCIATED_INVOICE_TIP,
+        G_CALLBACK (gnc_plugin_page_register_cmd_jump_associated_invoice)
+    },
 
     /* View menu */
 
@@ -513,6 +524,7 @@ static action_toolbar_labels toolbar_labels[] =
     { "AssociateTransactionFileAction",     N_("Associate File") },
     { "AssociateTransactionLocationAction", N_("Associate Location") },
     { "ExecAssociatedTransactionAction",    N_("Open File/Location") },
+    { "JumpAssociatedInvoiceAction",        N_("Open Invoice") },
     { NULL, NULL },
 };
 
@@ -890,6 +902,7 @@ static const char* tran_action_labels[] =
     ASSOCIATE_TRANSACTION_FILE_LABEL,
     ASSOCIATE_TRANSACTION_LOCATION_LABEL,
     EXECASSOCIATED_TRANSACTION_LABEL,
+    JUMP_ASSOCIATED_INVOICE_LABEL,
     NULL
 };
 
@@ -904,6 +917,7 @@ static const char* tran_action_tips[] =
     ASSOCIATE_TRANSACTION_FILE_TIP,
     ASSOCIATE_TRANSACTION_LOCATION_TIP,
     EXECASSOCIATED_TRANSACTION_TIP,
+    JUMP_ASSOCIATED_INVOICE_TIP,
     NULL
 };
 
@@ -937,6 +951,7 @@ gnc_plugin_page_register_ui_update (gpointer various, GncPluginPageRegister *pag
     GtkAction *action;
     gboolean expanded, voided, read_only = FALSE;
     Transaction *trans;
+    GncInvoice *inv;
     CursorClass cursor_class;
     const char *uri;
 
@@ -1009,6 +1024,12 @@ gnc_plugin_page_register_ui_update (gpointer various, GncPluginPageRegister *pag
                                          "ExecAssociatedTransactionAction");
     gtk_action_set_sensitive (GTK_ACTION(action), (uri && *uri));
 
+    /* Set 'ExecAssociatedInvoice' */
+    inv = invoice_from_trans(trans);
+    action = gnc_plugin_page_get_action (GNC_PLUGIN_PAGE(page),
+                                         "JumpAssociatedInvoiceAction");
+    gtk_action_set_sensitive (GTK_ACTION(action), (!(!inv)));
+
     gnc_plugin_business_split_reg_ui_update (GNC_PLUGIN_PAGE(page));
 
     /* If we are in a readonly book, make any modifying action inactive */
@@ -4307,6 +4328,60 @@ gnc_plugin_page_register_cmd_execassociated_transaction (GtkAction *action,
 
 }
 
+static GncInvoice * invoice_from_trans (Transaction *trans)
+{
+    GncInvoice *invoice;
+    SplitList *splits;
+
+    g_return_if_fail (GNC_IS_TRANSACTION(trans));
+    invoice = gncInvoiceGetInvoiceFromTxn(trans);
+
+    if (invoice)
+        return invoice;
+
+    for (splits = xaccTransGetSplitList (trans); splits; splits = splits->next)
+    {
+        Split *split = splits->data;
+        GNCLot *lot;
+
+        if (!split)
+            continue;
+
+        lot = xaccSplitGetLot (split);
+        if (!lot)
+            continue;
+
+        invoice = gncInvoiceGetInvoiceFromLot (lot);
+        if (!invoice)
+            continue;
+
+        return invoice;
+    }
+
+    return NULL;
+}
+
+static void
+gnc_plugin_page_register_cmd_jump_associated_invoice (GtkAction *action,
+        GncPluginPageRegister *plugin_page)
+{
+    GncPluginPageRegisterPrivate *priv;
+    SplitRegister *reg;
+    GncInvoice *invoice;
+
+    ENTER("(action %p, plugin_page %p)", action, plugin_page);
+
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page));
+    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
+    reg = gnc_ledger_display_get_split_register (priv->gsr->ledger);
+    invoice = invoice_from_trans (xaccSplitGetParent
+                                  (gnc_split_register_get_current_split (reg)));
+    if (invoice)
+        gnc_ui_invoice_edit (NULL, invoice);
+
+    LEAVE(" ");
+}
+
 static void
 gnc_plugin_page_register_cmd_blank_transaction (GtkAction *action,
         GncPluginPageRegister *plugin_page)
diff --git a/gnucash/ui/gnc-plugin-page-register-ui.xml b/gnucash/ui/gnc-plugin-page-register-ui.xml
index 23d64d558..517afcbca 100644
--- a/gnucash/ui/gnc-plugin-page-register-ui.xml
+++ b/gnucash/ui/gnc-plugin-page-register-ui.xml
@@ -25,6 +25,8 @@
       <menuitem name="AssociateTransactionFile" action="AssociateTransactionFileAction"/>
       <menuitem name="AssociateTransactionLocation" action="AssociateTransactionLocationAction"/>
       <menuitem name="ExecAssociateTransaction" action="ExecAssociatedTransactionAction"/>
+      <separator name="TransactionSep4"/>
+      <menuitem name="JumpAssociateInvoice" action="JumpAssociatedInvoiceAction"/>
     </menu>
 
     <menu name="View" action="ViewAction">
@@ -101,6 +103,8 @@
       <menuitem name="AssociateTransactionLocation" action="AssociateTransactionLocationAction"/>
       <menuitem name="ExecAssociateTransaction" action="ExecAssociatedTransactionAction"/>
       <separator name="PopupSep4"/>
+      <menuitem name="JumpAssociateInvoice"    action="JumpAssociatedInvoiceAction"/>
+      <separator name="PopupSep5"/>
       <menuitem name="BlankTransaction"        action="BlankTransactionAction"/>
       <menuitem name="SplitTransaction"        action="SplitTransactionAction"/>
       <menuitem name="EditExchangeRate"        action="EditExchangeRateAction"/>

commit 32a340350d2239c2e71408f69a2d4a4b11bf2cfb
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Sun Nov 3 13:41:29 2019 +0800

    Bug 797468 - Receivable Aging report - phantom company with negative total
    
    usability fix - warn if no documents were selected

diff --git a/gnucash/gnome/dialog-payment.c b/gnucash/gnome/dialog-payment.c
index b1f96523a..6f8657e82 100644
--- a/gnucash/gnome/dialog-payment.c
+++ b/gnucash/gnome/dialog-payment.c
@@ -937,6 +937,14 @@ gnc_payment_ok_cb (G_GNUC_UNUSED GtkWidget *widget, gpointer data)
         selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(pw->docs_list_tree_view));
         gtk_tree_selection_selected_foreach (selection, get_selected_lots, &selected_lots);
 
+        if ((gtk_tree_selection_count_selected_rows (selection) == 0) &&
+            !(gnc_verify_dialog ( GTK_WINDOW(pw->dialog), FALSE,
+                                  _("No documents were selected to assign this payment to. This may create an unattached payment. Do you wish to continue?"))))
+        {
+            gnc_resume_gui_refresh ();
+            return;
+        }
+
         /* When the payment amount is 0, the selected documents cancel each other out
          * so no money is actually transferred.
          * For non-zero payments money will be transferred between the post account

commit be4e4524242031b7575178e4a5900a39f5fdfe8a
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Sun Nov 3 11:47:08 2019 +0800

    with-output-to-file -> call-with-output-file

diff --git a/gnucash/report/report-system/test/test-extras.scm b/gnucash/report/report-system/test/test-extras.scm
index 210708381..eeb7b0292 100644
--- a/gnucash/report/report-system/test/test-extras.scm
+++ b/gnucash/report/report-system/test/test-extras.scm
@@ -53,11 +53,11 @@
     (if test-title
         (gnc:html-document-set-title! document test-title))
     (let ((render (gnc:html-document-render document)))
-      (with-output-to-file (format #f "/tmp/~a-~a.html"
+      (call-with-output-file (format #f "/tmp/~a-~a.html"
                                    (string-map sanitize-char prefix)
                                    (string-map sanitize-char test-title))
-        (lambda ()
-          (display render)))
+        (lambda (p)
+          (display render p)))
       render)))
 
 (define (strip-string s1 s2)
diff --git a/gnucash/report/report-system/test/test-report-html.scm b/gnucash/report/report-system/test/test-report-html.scm
index 5c672690c..9a1cd8c52 100644
--- a/gnucash/report/report-system/test/test-report-html.scm
+++ b/gnucash/report/report-system/test/test-report-html.scm
@@ -892,9 +892,9 @@ HTML Document Title</title></head><body></body>\n\
       (gnc:html-document-set-style-sheet! doc (gnc:html-style-sheet-find "Default"))
       (gnc:html-document-add-object! doc table)
       (let ((render (gnc:html-document-render doc)))
-        (with-output-to-file (format #f "/tmp/html-acct-table-~a.html" prefix)
-          (lambda ()
-            (display render)))
+        (call-with-output-file (format #f "/tmp/html-acct-table-~a.html" prefix)
+          (lambda (p)
+            (display render p)))
         (xml->sxml render
                    #:trim-whitespace? #t
                    #:entities '((nbsp . "\xa0")
diff --git a/gnucash/report/report-system/trep-engine.scm b/gnucash/report/report-system/trep-engine.scm
index fbcce9f05..7509a40ad 100644
--- a/gnucash/report/report-system/trep-engine.scm
+++ b/gnucash/report/report-system/trep-engine.scm
@@ -2204,9 +2204,9 @@ be excluded from periodic reporting.")
               (if (list? csvlist)
                   (catch #t
                     (lambda ()
-                      (with-output-to-file filename
-                        (lambda ()
-                          (display (lists->csv (append infolist csvlist))))))
+                      (call-with-output-file filename
+                        (lambda (p)
+                          (display (lists->csv (append infolist csvlist)) p))))
                     (lambda (key . args)
                       ;; Translators: ~a error type, ~a filename, ~s error details
                       (let ((fmt (N_ "error ~a during csv output to ~a: ~s")))

commit 977b1fcf9d38bf7e29b23abfb66690427138b090
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Sun Nov 3 11:38:23 2019 +0800

    [qif-guess-map] with-output-to-file -> call-with-output-file
    
    with-output-to-file will redirect stdout to file.
    call-with-output-file is better because it accepts a port for it. thus
    stdout remains available to log tracefile.

diff --git a/gnucash/import-export/qif-imp/qif-guess-map.scm b/gnucash/import-export/qif-imp/qif-guess-map.scm
index f19ab0c52..067013dee 100644
--- a/gnucash/import-export/qif-imp/qif-guess-map.scm
+++ b/gnucash/import-export/qif-imp/qif-guess-map.scm
@@ -184,13 +184,14 @@
 ;;  of bogus accounts if you have funny stuff in your map.
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
-(define (qif-import:write-map hashtab)
+(define (qif-import:write-map hashtab port)
   (let ((table '()))
-    (hash-fold
-     (lambda (key value p)
-       (set! table (cons (cons key (record-fields->list value)) table))
-       #f) #f hashtab)
-    (write table)))
+    (hash-for-each
+     (lambda (key value)
+       (set! table
+         (cons (cons key (record-fields->list value)) table)))
+     hashtab)
+    (write table port)))
 
 (define (qif-import:read-map tablist tab-sep)
   (let* ((table (make-hash-table 20))
@@ -255,34 +256,29 @@
 ;;  GnuCash commodity namespaces and mnemonics (symbols).
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
-(define (qif-import:write-securities security-hash security-prefs)
+(define (qif-import:write-securities security-hash security-prefs port)
   (let ((table '()))
     ;; For each security that has been paired with an existing
     ;; GnuCash commodity, create a list containing the QIF name
     ;; and the commodity's namespace and mnemonic (symbol).
-    (hash-fold
-      (lambda (key value p)
-        ;;FIXME: we used to type-check the values, like:
-        ;; (gw:wcp-is-of-type? <gnc:commodity*> value)
-        (if (and value #t)
-            (set! table (cons (list key
-                                   (gnc-commodity-get-namespace value)
-                                   (gnc-commodity-get-mnemonic value))
-                              table))
-            (gnc:warn "qif-import:write-securities:"
-                      " something funny in hash table."))
-        #f)
-      #f security-hash)
+    (hash-for-each
+     (lambda (key value)
+       (set! table
+         (cons (list key
+                     (gnc-commodity-get-namespace value)
+                     (gnc-commodity-get-mnemonic value))
+               table)))
+     security-hash)
 
     ;; Add on the rest of the saved security mapping preferences.
     (for-each
-      (lambda (m)
-        (if (not (hash-ref security-hash (car m)))
-            (set! table (cons m table))))
-      security-prefs)
+     (lambda (m)
+       (if (not (hash-ref security-hash (car m)))
+           (set! table (cons m table))))
+     security-prefs)
 
     ;; Write out the mappings.
-    (write table)))
+    (write table port)))
 
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -301,38 +297,38 @@
 
   ;; This procedure does all the work. We'll define it, then call it safely.
   (define (private-save)
-    (with-output-to-file (gnc-build-userdata-path "qif-accounts-map")
-      (lambda ()
-        (display ";;; qif-accounts-map")
-        (newline)
-        (display ";;; Automatically generated by GnuCash. DO NOT EDIT.")
-        (newline)
-        (display ";;; (Unless you really, really want to.)")
-        (newline)
-        (display ";;; Map QIF accounts to GnuCash accounts")
-        (newline)
-        (qif-import:write-map acct-map)
-        (newline)
-
-        (display ";;; Map QIF categories to GnuCash accounts")
-        (newline)
-        (qif-import:write-map cat-map)
-        (newline)
-
-        (display ";;; Map QIF payee/memo to GnuCash accounts")
-        (newline)
-        (qif-import:write-map memo-map)
-        (newline)
-
-        (display ";;; Map QIF security names to GnuCash commodities")
-        (newline)
-        (qif-import:write-securities security-map security-prefs)
-        (newline)
-
-        (display ";;; GnuCash separator used in these mappings")
-        (newline)
-        (write (gnc-get-account-separator-string))
-        (newline)))
+    (call-with-output-file (gnc-build-userdata-path "qif-accounts-map")
+      (lambda (port)
+        (display ";;; qif-accounts-map" port)
+        (newline port)
+        (display ";;; Automatically generated by GnuCash. DO NOT EDIT." port)
+        (newline port)
+        (display ";;; (Unless you really, really want to.)" port)
+        (newline port)
+        (display ";;; Map QIF accounts to GnuCash accounts" port)
+        (newline port)
+        (qif-import:write-map acct-map port)
+        (newline port)
+
+        (display ";;; Map QIF categories to GnuCash accounts" port)
+        (newline port)
+        (qif-import:write-map cat-map port)
+        (newline port)
+
+        (display ";;; Map QIF payee/memo to GnuCash accounts" port)
+        (newline port)
+        (qif-import:write-map memo-map port)
+        (newline port)
+
+        (display ";;; Map QIF security names to GnuCash commodities" port)
+        (newline port)
+        (qif-import:write-securities security-map security-prefs port)
+        (newline port)
+
+        (display ";;; GnuCash separator used in these mappings" port)
+        (newline port)
+        (write (gnc-get-account-separator-string) port)
+        (newline port)))
     #t)
 
   ;; Safely save the file.

commit 0abc09cc4cc2b99708f03202e0a591a69619dd36
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Sun Nov 3 11:27:26 2019 +0000

    Fix for previous commit 2ff91cf
    
    When adding new accounts there is no need to clear cached values.

diff --git a/gnucash/gnome-utils/gnc-tree-model-account.c b/gnucash/gnome-utils/gnc-tree-model-account.c
index a8fe36f1f..79de8f420 100644
--- a/gnucash/gnome-utils/gnc-tree-model-account.c
+++ b/gnucash/gnome-utils/gnc-tree-model-account.c
@@ -1427,7 +1427,8 @@ gnc_tree_model_account_event_handler (QofInstance *entity,
     account = GNC_ACCOUNT(entity);
 
     /* clear the cached model values for account */
-    gnc_tree_model_account_clear_cached_values (model, account);
+    if (event_type != QOF_EVENT_ADD)
+        gnc_tree_model_account_clear_cached_values (model, account);
 
     if (gnc_account_get_book (account) != priv->book)
     {

commit 3f6c8478a4839e71811dfd857633f3bc0ff3c30a
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Sun Nov 3 10:42:36 2019 +0800

    [view-column] don't emit raw html, include captured-error

diff --git a/gnucash/report/utility-reports/view-column.scm b/gnucash/report/utility-reports/view-column.scm
index b9ab5848d..df68cf689 100644
--- a/gnucash/report/utility-reports/view-column.scm
+++ b/gnucash/report/utility-reports/view-column.scm
@@ -138,9 +138,9 @@
 	     (gnc:html-table-cell-append-objects!
 	      contents-cell
 	      (gnc:make-html-text
-	       (string-append
-		"<h3>" (_ "Report error") "</h3><p>"
-		(_ "An error occurred while running the report.")))))
+	       (gnc:html-markup-h3 (_ "Report error"))
+               (_ "An error occurred while running the report.")
+               (gnc:html-markup "pre" gnc:last-captured-error))))
 
 	 ;; increment the alloc number for each occupied row
 	 (let loop ((row current-row-num))

commit d56a47f17af1c4345fae2d0b671b6fd4f3414d5b
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Sun Nov 3 10:41:05 2019 +0800

    [c-interface] gnc:backtrace-if-exception returns #f if error
    
    previous would return *unspecified* when error was captured.
    old code seems to expect #f to signal error

diff --git a/libgnucash/app-utils/c-interface.scm b/libgnucash/app-utils/c-interface.scm
index 8c0b74b46..7e16d892b 100644
--- a/libgnucash/app-utils/c-interface.scm
+++ b/libgnucash/app-utils/c-interface.scm
@@ -69,7 +69,8 @@
       (display captured-error (current-error-port))
       (set! gnc:last-captured-error (gnc:html-string-sanitize captured-error))
       (when (defined? 'gnc:warn)
-        (gnc:warn captured-error)))
+        (gnc:warn captured-error))
+      #f)
      (else result))))
 
 (define-public gnc:last-captured-error "")

commit 47030c7654d182a33fdcc317af686f51e9ea6775
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Sat Nov 2 23:48:38 2019 +0800

    [hello-world] fix indenting and incorrect change
    
    928f6145c had changed default list option '(good) to 'good - should be
    a list of symbols

diff --git a/gnucash/report/utility-reports/hello-world.scm b/gnucash/report/utility-reports/hello-world.scm
index 24a93e38f..b947cbddc 100644
--- a/gnucash/report/utility-reports/hello-world.scm
+++ b/gnucash/report/utility-reports/hello-world.scm
@@ -192,16 +192,16 @@
      (gnc:make-list-option
       (N_ "Hello Again") (N_ "A list option")
       "h" (N_ "This is a list option.")
-      'good
+      '(good)
       (list (vector 'good
-                   (N_ "The Good")
-                   (N_ "Good option."))
+                    (N_ "The Good")
+                    (N_ "Good option."))
             (vector 'bad
-                   (N_ "The Bad")
-                   (N_ "Bad option."))
+                    (N_ "The Bad")
+                    (N_ "Bad option."))
             (vector 'ugly
-                   (N_ "The Ugly")
-                   (N_ "Ugly option.")))))
+                    (N_ "The Ugly")
+                    (N_ "Ugly option.")))))
     
     ;; This option is for testing. When true, the report generates
     ;; an exception.

commit 5870887f1291041cca3a1e0805b988cf9992dcfc
Merge: 99dbb7889 b04c494f2
Author: Christian Stimming <christian at cstimming.de>
Date:   Sat Nov 2 23:30:54 2019 +0100

    Merge pull request #597 from ingoha/purpose-encoding
    
    Fix bug 797473, UTF-8 characters were not processed correctly with aqbanking6.


commit 99dbb7889805f863dd519ad332d1c7fba5777820
Author: Christian Stimming <christian at cstimming.de>
Date:   Sat Nov 2 23:17:29 2019 +0100

    Bug #797405: Fix hiding PIN entry window behind online banking log window
    
    If there is a log window, make the PIN entry transient_for
    that one instead of its parent.

diff --git a/gnucash/import-export/aqb/gnc-gwen-gui.c b/gnucash/import-export/aqb/gnc-gwen-gui.c
index 35988cd30..7f5277a69 100644
--- a/gnucash/import-export/aqb/gnc-gwen-gui.c
+++ b/gnucash/import-export/aqb/gnc-gwen-gui.c
@@ -1045,9 +1045,17 @@ get_input(GncGWENGui *gui, guint32 flags, const gchar *title,
         gtk_widget_set_visible(input_entry, TRUE);
     }
 
-    if (gui->parent)
+    if (gui->dialog)
+    {
         gtk_window_set_transient_for(GTK_WINDOW(dialog),
-                                     GTK_WINDOW(gui->parent));
+                                     GTK_WINDOW(gui->dialog));
+    }
+    else
+    {
+        if (gui->parent)
+            gtk_window_set_transient_for(GTK_WINDOW(dialog),
+                                         GTK_WINDOW(gui->parent));
+    }
     if (title)
         gtk_window_set_title(GTK_WINDOW(dialog), title);
 

commit b04c494f244260a7d67f70b1f554ade1080f8d61
Author: Ingo Haschler <ih at ingohaschler.de>
Date:   Wed Oct 30 20:12:15 2019 +0100

    Bug 797473 - UTF8 characters not processed correctly with aqbanking6

diff --git a/gnucash/import-export/aqb/gnc-ab-utils.c b/gnucash/import-export/aqb/gnc-ab-utils.c
index 0f40e1586..4ba804ad6 100644
--- a/gnucash/import-export/aqb/gnc-ab-utils.c
+++ b/gnucash/import-export/aqb/gnc-ab-utils.c
@@ -331,7 +331,7 @@ join_ab_strings_cb(const gchar *str, gpointer user_data)
  
     tmp = g_strdup(str);
     g_strstrip(tmp);
-    gnc_utf8_strip_invalid(tmp);
+    gnc_utf8_strip_invalid_and_controls(tmp);
 
     if (*acc)
     {

commit 928f6145c77d6026fb1ffd700817ab785fcd7853
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Sat Nov 2 18:25:26 2019 +0800

    cleanup (list->vector (list ...))
    
    this is not an efficiency change, rather a readability change
    especially for hello-world which aims to introduce new users to reports.

diff --git a/gnucash/report/locale-specific/us/taxtxf-de_DE.scm b/gnucash/report/locale-specific/us/taxtxf-de_DE.scm
index 651785b4f..c9ff0b69f 100644
--- a/gnucash/report/locale-specific/us/taxtxf-de_DE.scm
+++ b/gnucash/report/locale-specific/us/taxtxf-de_DE.scm
@@ -152,33 +152,24 @@
     gnc:pagename-general (N_ "Alternate Period")
     "c" (N_ "Override or modify From: & To:.")
     (if after-tax-day 'from-to 'last-year)
-    (list (list->vector
-           (list 'from-to (N_ "Use From - To") (N_ "Use From - To period.")))
-          (list->vector
-           (list '1st-est (N_ "1st Est Tax Quarter") (N_ "Jan 1 - Mar 31.")))
-          (list->vector
-           (list '2nd-est (N_ "2nd Est Tax Quarter") (N_ "Apr 1 - May 31.")))
-          (list->vector
-	   ;; Translators: The US tax quarters are different from
-	   ;; actual year's quarters! See the definition of
-	   ;; tax-qtr-real-qtr-year variable above.
-           (list '3rd-est (N_ "3rd Est Tax Quarter") (N_ "Jun 1 - Aug 31.")))
-          (list->vector
-           (list '4th-est (N_ "4th Est Tax Quarter") (N_ "Sep 1 - Dec 31.")))
-          (list->vector
-           (list 'last-year (N_ "Last Year") (N_ "Last Year.")))
-          (list->vector
-           (list '1st-last (N_ "Last Yr 1st Est Tax Qtr")
-                 (N_ "Jan 1 - Mar 31, Last year.")))
-          (list->vector
-           (list '2nd-last (N_ "Last Yr 2nd Est Tax Qtr")
-                 (N_ "Apr 1 - May 31, Last year.")))
-          (list->vector
-           (list '3rd-last (N_ "Last Yr 3rd Est Tax Qtr")
-                 (N_ "Jun 1 - Aug 31, Last year.")))
-          (list->vector
-           (list '4th-last (N_ "Last Yr 4th Est Tax Qtr")
-                 (N_ "Sep 1 - Dec 31, Last year."))))))
+    (list (vector 'from-to (N_ "Use From - To") (N_ "Use From - To period."))
+          (vector '1st-est (N_ "1st Est Tax Quarter") (N_ "Jan 1 - Mar 31."))
+          (vector '2nd-est (N_ "2nd Est Tax Quarter") (N_ "Apr 1 - May 31."))
+          (vector '3rd-est (N_ "3rd Est Tax Quarter") (N_ "Jun 1 - Aug 31."))
+          (vector '4th-est (N_ "4th Est Tax Quarter") (N_ "Sep 1 - Dec 31."))
+          (vector 'last-year (N_ "Last Year") (N_ "Last Year."))
+          (vector '1st-last
+                  (N_ "Last Yr 1st Est Tax Qtr")
+                  (N_ "Jan 1 - Mar 31, Last year."))
+          (vector '2nd-last
+                  (N_ "Last Yr 2nd Est Tax Qtr")
+                  (N_ "Apr 1 - May 31, Last year."))
+          (vector '3rd-last
+                  (N_ "Last Yr 3rd Est Tax Qtr")
+                  (N_ "Jun 1 - Aug 31, Last year."))
+          (vector '4th-last
+                  (N_ "Last Yr 4th Est Tax Qtr")
+                  (N_ "Sep 1 - Dec 31, Last year.")))))
 
   (gnc:register-tax-option
    (gnc:make-account-list-option
diff --git a/gnucash/report/locale-specific/us/taxtxf.scm b/gnucash/report/locale-specific/us/taxtxf.scm
index 753e3b131..e09cdf9a6 100644
--- a/gnucash/report/locale-specific/us/taxtxf.scm
+++ b/gnucash/report/locale-specific/us/taxtxf.scm
@@ -180,36 +180,30 @@
     gnc:pagename-general (N_ "Alternate Period")
     "c" (N_ "Override or modify From: & To:.")
     (if after-tax-day 'from-to 'last-year)
-    (list (list->vector
-           (list 'from-to (N_ "Use From - To") (N_ "Use From - To period.")))
-          (list->vector
-           (list '1st-est (N_ "1st Est Tax Quarter") (N_ "Jan 1 - Mar 31.")))
-          (list->vector
-           (list '2nd-est (N_ "2nd Est Tax Quarter") (N_ "Apr 1 - May 31.")))
-          (list->vector
-	   ;; Translators: The US tax quarters are different from
-	   ;; actual year's quarters! See the definition of
-	   ;; tax-qtr-real-qtr-year variable above.
-           (list '3rd-est (N_ "3rd Est Tax Quarter") (N_ "Jun 1 - Aug 31.")))
-          (list->vector
-           (list '4th-est (N_ "4th Est Tax Quarter") (N_ "Sep 1 - Dec 31.")))
-          (list->vector
-           (list 'last-year (N_ "Last Year") (N_ "Last Year.")))
-          (list->vector
-           (list '1st-last (N_ "Last Yr 1st Est Tax Qtr")
-                 (N_ "Jan 1 - Mar 31, Last year.")))
-          (list->vector
-           (list '2nd-last (N_ "Last Yr 2nd Est Tax Qtr")
-                 (N_ "Apr 1 - May 31, Last year.")))
-          (list->vector
-           (list '3rd-last (N_ "Last Yr 3rd Est Tax Qtr")
-		 ;; Translators: The US tax quarters are different from
-		 ;; actual year's quarters! See the definition of
-		 ;; tax-qtr-real-qtr-year variable above.
-                 (N_ "Jun 1 - Aug 31, Last year.")))
-          (list->vector
-           (list '4th-last (N_ "Last Yr 4th Est Tax Qtr")
-                 (N_ "Sep 1 - Dec 31, Last year."))))))
+    (list (vector 'from-to (N_ "Use From - To") (N_ "Use From - To period."))
+          (vector '1st-est (N_ "1st Est Tax Quarter") (N_ "Jan 1 - Mar 31."))
+          (vector '2nd-est (N_ "2nd Est Tax Quarter") (N_ "Apr 1 - May 31."))
+          ;; Translators: The US tax quarters are different from
+          ;; actual year's quarters! See the definition of
+          ;; tax-qtr-real-qtr-year variable above.
+          (vector '3rd-est (N_ "3rd Est Tax Quarter") (N_ "Jun 1 - Aug 31."))
+          (vector '4th-est (N_ "4th Est Tax Quarter") (N_ "Sep 1 - Dec 31."))
+          (vector 'last-year (N_ "Last Year") (N_ "Last Year."))
+          (vector '1st-last
+                  (N_ "Last Yr 1st Est Tax Qtr")
+                  (N_ "Jan 1 - Mar 31, Last year."))
+          (vector '2nd-last
+                  (N_ "Last Yr 2nd Est Tax Qtr")
+                  (N_ "Apr 1 - May 31, Last year."))
+          (vector '3rd-last
+                  (N_ "Last Yr 3rd Est Tax Qtr")
+                  ;; Translators: The US tax quarters are different from
+                  ;; actual year's quarters! See the definition of
+                  ;; tax-qtr-real-qtr-year variable above.
+                  (N_ "Jun 1 - Aug 31, Last year."))
+          (vector '4th-last
+                  (N_ "Last Yr 4th Est Tax Qtr")
+                  (N_ "Sep 1 - Dec 31, Last year.")))))
 
   (gnc:register-tax-option
    (gnc:make-account-list-option
diff --git a/gnucash/report/report-system/options-utilities.scm b/gnucash/report/report-system/options-utilities.scm
index 43d8bbb25..2704a05ef 100644
--- a/gnucash/report/report-system/options-utilities.scm
+++ b/gnucash/report/report-system/options-utilities.scm
@@ -66,24 +66,14 @@
   (gnc:register-option 
    options  
    (gnc:make-multichoice-option
-    pagename name-display-depth
-    sort-tag 
-    help-string
-    default-depth
-    (list (list->vector
-	   (list 'all (N_ "All") (N_ "All accounts")))
-	  (list->vector
-	   (list 1 "1" (N_ "Top-level.")))
-	  (list->vector
-	   (list 2 "2" (N_ "Second-level.")))
-	  (list->vector
-	   (list 3 "3" (N_ "Third-level.")))
-	  (list->vector
-	   (list 4 "4" (N_ "Fourth-level.")))
-	  (list->vector
-	   (list 5 "5" (N_ "Fifth-level.")))
-	  (list->vector
-	   (list 6 "6" (N_ "Sixth-level.")))))))
+    pagename name-display-depth sort-tag help-string default-depth
+    (list (vector 'all (N_ "All") (N_ "All accounts"))
+	  (vector 1 "1" (N_ "Top-level."))
+	  (vector 2 "2" (N_ "Second-level."))
+	  (vector 3 "3" (N_ "Third-level."))
+	  (vector 4 "4" (N_ "Fourth-level."))
+	  (vector 5 "5" (N_ "Fifth-level."))
+	  (vector 6 "6" (N_ "Sixth-level."))))))
 
 ;; These help for selecting a bunch of accounts.
 (define (gnc:options-add-account-selection! 
diff --git a/gnucash/report/standard-reports/budget-barchart.scm b/gnucash/report/standard-reports/budget-barchart.scm
index e9f840929..aca3eac4c 100644
--- a/gnucash/report/standard-reports/budget-barchart.scm
+++ b/gnucash/report/standard-reports/budget-barchart.scm
@@ -102,21 +102,12 @@
         (N_ "This is a multi choice option.") ;; option help text
         'bars                                 ;; default selectioin
         (list
-          (list->vector
-            (list 'bars
+          (vector 'bars
                   (N_ "Barchart")
-                  (N_ "Show the report as a bar chart.")
-            )
-          )
-          (list->vector
-            (list 'lines
+                  (N_ "Show the report as a bar chart."))
+          (vector 'lines
                   (N_ "Linechart")
-                  (N_ "Show the report as a line chart.")
-            )
-          )
-        )
-      )
-    )
+                  (N_ "Show the report as a line chart.")))))
 
     (gnc:options-add-plot-size! 
      options gnc:pagename-display 
diff --git a/gnucash/report/utility-reports/hello-world.scm b/gnucash/report/utility-reports/hello-world.scm
index 182d72ca5..24a93e38f 100644
--- a/gnucash/report/utility-reports/hello-world.scm
+++ b/gnucash/report/utility-reports/hello-world.scm
@@ -65,22 +65,18 @@
      (gnc:make-multichoice-option
       (N_ "Hello, World!") (N_ "Multi Choice Option")
       "b" (N_ "This is a multi choice option.") 'third
-      (list (list->vector
-             (list 'first
-                   (N_ "First Option")
-                   (N_ "Help for first option.")))
-            (list->vector
-             (list 'second
-                   (N_ "Second Option")
-                   (N_ "Help for second option.")))
-            (list->vector
-             (list 'third
-                   (N_ "Third Option")
-                   (N_ "Help for third option.")))
-            (list->vector
-             (list 'fourth
-                   (N_ "Fourth Options")
-                   (N_ "The fourth option rules!"))))))
+      (list (vector 'first
+                    (N_ "First Option")
+                    (N_ "Help for first option."))
+            (vector 'second
+                    (N_ "Second Option")
+                    (N_ "Help for second option."))
+            (vector 'third
+                    (N_ "Third Option")
+                    (N_ "Help for third option."))
+            (vector 'fourth
+                    (N_ "Fourth Options")
+                    (N_ "The fourth option rules!")))))
     
     ;; This is a string option. Users can type anything they want
     ;; as a value. The default value is "Hello, World". This is
@@ -196,19 +192,16 @@
      (gnc:make-list-option
       (N_ "Hello Again") (N_ "A list option")
       "h" (N_ "This is a list option.")
-      (list 'good)
-      (list (list->vector
-             (list 'good
+      'good
+      (list (vector 'good
                    (N_ "The Good")
-                   (N_ "Good option.")))
-            (list->vector
-             (list 'bad
+                   (N_ "Good option."))
+            (vector 'bad
                    (N_ "The Bad")
-                   (N_ "Bad option.")))
-            (list->vector
-             (list 'ugly
+                   (N_ "Bad option."))
+            (vector 'ugly
                    (N_ "The Ugly")
-                   (N_ "Ugly option."))))))
+                   (N_ "Ugly option.")))))
     
     ;; This option is for testing. When true, the report generates
     ;; an exception.

commit e27338b004d9dc4f1cb501bdec6755a1048af37a
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Sat Nov 2 18:25:44 2019 +0800

    [html-utilities] more deprecations
    
    * gnc:html-table-append-ruler/at! was flawed - the empty-cell defined
    as '() would lead to invalid html-table element. it was never used
    because colskip was always 0. inline and deprecate function.

diff --git a/gnucash/report/report-system/html-utilities.scm b/gnucash/report/report-system/html-utilities.scm
index 5f9ab1ebb..805cfeca6 100644
--- a/gnucash/report/report-system/html-utilities.scm
+++ b/gnucash/report/report-system/html-utilities.scm
@@ -132,6 +132,8 @@
 ;; colspan at, optionally, the specified column.
 (define (gnc:html-table-append-ruler/at! table colskip colspan)
   (define empty-cell '())
+  (issue-deprecation-warning
+   "gnc:html-table-append-ruler/at! is deprecated.")
   (gnc:html-table-append-row! 
    table
    (append (make-list colskip empty-cell)
@@ -141,6 +143,8 @@
      
 (define (gnc:html-table-append-ruler/at/markup! table markup colskip colspan)
   (define empty-cell "")
+  (issue-deprecation-warning
+   "gnc:html-table-append-ruler/at/markup! is deprecated.")
   (gnc:html-table-append-row/markup! 
    table
    markup
@@ -150,7 +154,9 @@
       1 colspan (gnc:make-html-text (gnc:html-markup-hr)))))))
 
 (define (gnc:html-table-append-ruler! table colspan)
-  (gnc:html-table-append-ruler/at! table 0 colspan))
+  (gnc:html-table-append-row!
+   table (list (gnc:make-html-table-cell/size
+                1 colspan (gnc:make-html-text (gnc:html-markup-hr))))))
 
 (define (gnc:html-table-append-ruler/markup! table markup colspan)
   (issue-deprecation-warning

commit b5ae8416a0b6b560910015653e764d45c485e53b
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Sat Nov 2 09:27:13 2019 +0800

    [new-owner-report] remove dependency on new-aging
    
    because gnc:owner-splits->aging-list belongs to report-utilities.scm

diff --git a/gnucash/report/business-reports/new-owner-report.scm b/gnucash/report/business-reports/new-owner-report.scm
index 6665c18b0..82cfef200 100644
--- a/gnucash/report/business-reports/new-owner-report.scm
+++ b/gnucash/report/business-reports/new-owner-report.scm
@@ -38,7 +38,6 @@
 (gnc:module-load "gnucash/report/report-system" 0)
 (use-modules (gnucash report standard-reports))
 (use-modules (gnucash report business-reports))
-(use-modules (gnucash report new-aging)) ;for gnc:owner-splits->aging-list
 
 ;; Option names
 (define optname-from-date (N_ "From"))

commit 158b5caf6375348f7334c9e2598090db6b25759d
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Fri Nov 1 18:52:24 2019 +0800

    [new-aging] restore display of owner address

diff --git a/gnucash/report/business-reports/new-aging.scm b/gnucash/report/business-reports/new-aging.scm
index 1ef00c521..0896b66a7 100644
--- a/gnucash/report/business-reports/new-aging.scm
+++ b/gnucash/report/business-reports/new-aging.scm
@@ -45,6 +45,22 @@
 (define optname-show-zeros (N_ "Show zero balance items"))
 (define optname-date-driver (N_ "Due or Post Date"))
 
+;; Display tab options
+(define optname-addr-source (N_ "Address Source"))
+
+(define addr-options-list
+  (list (list (N_ "Address Name") "b"
+              (N_ "Display Address Name. This, and other fields, may be useful if \
+copying this report to a spreadsheet for use in a mail merge."))
+        (list (N_ "Address 1") "c" (N_ "Display Address 1."))
+        (list (N_ "Address 2") "d" (N_ "Display Address 2."))
+        (list (N_ "Address 3") "e" (N_ "Display Address 3."))
+        (list (N_ "Address 4") "f" (N_ "Display Address 4."))
+        (list (N_ "Address Phone") "g" (N_ "Display Phone."))
+        (list (N_ "Address Fax") "h" (N_ "Display Fax."))
+        (list (N_ "Address Email") "i" (N_ "Display Email."))
+        (list (N_ "Active") "j" (N_ "Display Active status."))))
+
 (define no-APAR-account (_ "No valid A/Payable or A/Receivable \
 account found. Please ensure valid AP/AR account exists."))
 
@@ -101,8 +117,41 @@ exist but have no suitable transactions."))
                (N_ "Post date is leading.")))))
 
     (gnc:options-set-default-section options "General")
+
+    (for-each
+     (lambda (opt)
+       (add-option
+        (gnc:make-simple-boolean-option
+         gnc:pagename-display (car opt) (cadr opt) (caddr opt) #f)))
+     addr-options-list)
+
     options))
 
+(define (options->address options receivable? owner)
+  (define (op-value name)
+    (gnc:option-value (gnc:lookup-option options gnc:pagename-display name)))
+  (let* ((address-list-names (map car addr-options-list))
+         (address-list-options (map op-value address-list-names))
+         (addr-source (if receivable? (op-value optname-addr-source) 'billing))
+         (result-list
+          (cond
+           (owner
+            (let ((addr (if (eq? addr-source 'shipping)
+                            (gncCustomerGetShipAddr (gncOwnerGetCustomer owner))
+                            (gncOwnerGetAddr owner))))
+              (list (gncAddressGetName addr)
+                    (gncAddressGetAddr1 addr)
+                    (gncAddressGetAddr2 addr)
+                    (gncAddressGetAddr3 addr)
+                    (gncAddressGetAddr4 addr)
+                    (gncAddressGetPhone addr)
+                    (gncAddressGetFax addr)
+                    (gncAddressGetEmail addr)
+                    (if (gncOwnerGetActive owner) (_ "Y") (_ "N")))))
+           (else address-list-names))))
+    (fold-right (lambda (opt elt prev) (if opt (cons elt prev) prev))
+                '() address-list-options result-list)))
+
 (define (txn-is-invoice? txn)
   (eqv? (xaccTransGetTxnType txn) TXN-TYPE-INVOICE))
 
@@ -138,9 +187,9 @@ exist but have no suitable transactions."))
     owner))
 
 (define (aging-renderer report-obj receivable)
+  (define options (gnc:report-options report-obj))
   (define (op-value section name)
-    (gnc:option-value
-     (gnc:lookup-option (gnc:report-options report-obj) section name)))
+    (gnc:option-value (gnc:lookup-option options section name)))
 
   (define make-heading-list
     (list ""
@@ -201,7 +250,9 @@ exist but have no suitable transactions."))
                             splits)))
           (cond
            ((null? accounts)
-            (gnc:html-table-set-col-headers! table make-heading-list)
+            (gnc:html-table-set-col-headers!
+             table (append make-heading-list
+                           (options->address options receivable #f)))
             (gnc:html-document-add-object!
              document (if (null? (gnc:html-table-data table))
                           (gnc:make-html-text empty-APAR-accounts)
@@ -277,7 +328,8 @@ exist but have no suitable transactions."))
                             (gnc:make-html-text
                              (gnc:html-markup-anchor
                               (gnc:owner-report-text owner account)
-                              (gnc:make-gnc-monetary comm aging-total))))))))
+                              (gnc:make-gnc-monetary comm aging-total)))))
+                          (options->address options receivable owner))))
                       (lp (cdr acc-owners)
                           other-owner-splits
                           (map + acc-totals
@@ -289,7 +341,21 @@ exist but have no suitable transactions."))
   (aging-options-generator (gnc:new-options)))
 
 (define (receivable-options-generator)
-  (aging-options-generator (gnc:new-options)))
+  (let ((options (aging-options-generator (gnc:new-options))))
+    (define (add-option new-option)
+      (gnc:register-option options new-option))
+
+    (add-option
+     (gnc:make-multichoice-option
+      gnc:pagename-display optname-addr-source "a" (N_ "Address source.") 'billing
+      (list
+       (vector 'billing
+               (N_ "Billing")
+               (N_ "Address fields from billing address."))
+       (vector 'shipping
+               (N_ "Shipping")
+               (N_ "Address fields from shipping address.")))))
+    options))
 
 (define (payables-renderer report-obj)
   (aging-renderer report-obj #f))

commit 2df672bdb2ba34dbe59560c05c498d021312b8d8
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Fri Nov 1 19:37:33 2019 +0800

    [gncOwner] i18n gncOwnerGetTypeString types

diff --git a/libgnucash/engine/gncOwner.c b/libgnucash/engine/gncOwner.c
index 93a8211e5..32d5e0de4 100644
--- a/libgnucash/engine/gncOwner.c
+++ b/libgnucash/engine/gncOwner.c
@@ -210,17 +210,17 @@ const char * gncOwnerGetTypeString (const GncOwner *owner)
     switch (type)
     {
     case GNC_OWNER_NONE:
-        return "None";
+        return N_("None");
     case GNC_OWNER_UNDEFINED:
-        return "Undefined";
+        return N_("Undefined");
     case GNC_OWNER_CUSTOMER:
-        return "Customer";
+        return N_("Customer");
     case GNC_OWNER_JOB:
-        return "Job";
+        return N_("Job");
     case GNC_OWNER_VENDOR:
-        return "Vendor";
+        return N_("Vendor");
     case GNC_OWNER_EMPLOYEE:
-        return "Employee";
+        return N_("Employee");
     default:
         PWARN ("Unknown owner type");
         return NULL;

commit b1e32c8a9defbe240bc165b5b8fa7ec8d4a7f1c5
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Fri Nov 1 19:35:58 2019 +0800

    [report-utilities] minor refinements

diff --git a/gnucash/report/report-system/report-utilities.scm b/gnucash/report/report-system/report-utilities.scm
index 2180b3734..825928834 100644
--- a/gnucash/report/report-system/report-utilities.scm
+++ b/gnucash/report/report-system/report-utilities.scm
@@ -1184,7 +1184,9 @@ flawed. see report-utilities.scm. please update reports.")
                 (xaccTransGetCurrency txn)
                 (xaccSplitGetValue spl))))))
   (define (trans->str txn)
-    (format #f "Txn<d:~a>" (qof-print-date (xaccTransGetDate txn))))
+    (format #f "Txn<d:~a,desc:~a>"
+            (qof-print-date (xaccTransGetDate txn))
+            (xaccTransGetDescription txn)))
   (define (account->str acc)
     (format #f "Acc<~a>" (xaccAccountGetName acc)))
   (define (monetary-collector->str coll)
@@ -1213,7 +1215,7 @@ flawed. see report-utilities.scm. please update reports.")
                                (gncInvoiceGetTotal inv)))))
   (define (lot->str lot)
     (format #f "Lot<Acc:~a,Title:~a,Notes:~a,Balance:~a,NSplits:~a>"
-            (gnc:strify (xaccAccountGetName (gnc-lot-get-account lot)))
+            (xaccAccountGetName (gnc-lot-get-account lot))
             (gnc-lot-get-title lot)
             (gnc-lot-get-notes lot)
             (gnc-lot-get-balance lot)

commit 5f6413c6c5bf323d6998ea4fced545429e7c7e02
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Fri Nov 1 19:15:35 2019 +0800

    [report-utilities] tiny reordering to remove unnecessary reference
    
    instead of split->txn->invoice->lot->invoice
    grab split->txn->invoice->lot directly

diff --git a/gnucash/report/report-system/report-utilities.scm b/gnucash/report/report-system/report-utilities.scm
index 2eec572b8..2180b3734 100644
--- a/gnucash/report/report-system/report-utilities.scm
+++ b/gnucash/report/report-system/report-utilities.scm
@@ -1124,10 +1124,9 @@ flawed. see report-utilities.scm. please update reports.")
        ;; reduce the lot balance automatically.
        ((eqv? (xaccTransGetTxnType (xaccSplitGetParent (car splits)))
               TXN-TYPE-INVOICE)
-        (let* ((lot (gncInvoiceGetPostedLot
-                     (gncInvoiceGetInvoiceFromTxn
-                      (xaccSplitGetParent (car splits)))))
-               (invoice (gncInvoiceGetInvoiceFromLot lot))
+        (let* ((invoice (gncInvoiceGetInvoiceFromTxn
+                         (xaccSplitGetParent (car splits))))
+               (lot (gncInvoiceGetPostedLot invoice))
                (bal (gnc-lot-get-balance lot))
                (bal (if receivable? bal (- bal)))
                (date (if (eq? date-type 'postdate)



Summary of changes:
 gnucash/gnome-search/dialog-search.c               |  10 +
 gnucash/gnome-utils/gnc-tree-model-account.c       |   3 +-
 gnucash/gnome/gnc-plugin-page-register.c           |  75 +++
 gnucash/gtkbuilder/dialog-search.glade             |   2 +-
 gnucash/import-export/aqb/gnc-ab-utils.c           |   2 +-
 gnucash/import-export/aqb/gnc-gwen-gui.c           |  12 +-
 gnucash/import-export/qif-imp/qif-guess-map.scm    | 110 ++--
 gnucash/report/html-utilities.scm                  | 634 +++++++++++++++++++--
 gnucash/report/options-utilities.scm               |  26 +-
 gnucash/report/report-utilities.scm                |  13 +-
 gnucash/report/reports/example/hello-world.scm     |  51 +-
 .../reports/locale-specific/de_DE/taxtxf.scm       |  45 +-
 .../report/reports/locale-specific/us/taxtxf.scm   |  54 +-
 .../report/reports/standard/budget-barchart.scm    | 443 +++++++-------
 gnucash/report/reports/standard/new-aging.scm      |  76 ++-
 gnucash/report/reports/standard/view-column.scm    |   6 +-
 gnucash/report/test/test-report-extras.scm         |   6 +-
 gnucash/report/test/test-report-html.scm           |   6 +-
 gnucash/report/trep-engine.scm                     |   6 +-
 gnucash/ui/gnc-plugin-page-register-ui.xml         |   4 +
 libgnucash/app-utils/c-interface.scm               |   3 +-
 libgnucash/engine/gncOwner.c                       |  12 +-
 22 files changed, 1108 insertions(+), 491 deletions(-)



More information about the gnucash-changes mailing list