gnucash master: Multiple changes pushed

Christopher Lam clam at code.gnucash.org
Thu May 14 07:39:52 EDT 2020


Updated	 via  https://github.com/Gnucash/gnucash/commit/ecf429a4 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/bbde69ff (commit)
	 via  https://github.com/Gnucash/gnucash/commit/dba9ba2f (commit)
	from  https://github.com/Gnucash/gnucash/commit/86dc6dcb (commit)



commit ecf429a49a0a1ff8f9d22e38d8371aa8c6fa919c
Merge: bbde69ffc dba9ba2f8
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Thu May 14 19:38:55 2020 +0800

    Merge branch 'master-796932'


commit bbde69ffcd3be07dac9e9eaa2d4559359d7e6579
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Thu May 14 18:42:12 2020 +0800

    [register] price shown in transaction currency rather than account's parent currency
    
    error in commit 710b559cc4a4a130afcbe0e88c50a972955e0e62
    
    xaccSplitGetSharePrice is priced in the transaction
    currency. gnc-account-get-currency-or-parent would only output the
    correct price currency if the chart of accounts was set up properly.
    
    also: for Dr/Cr display, small modification to ensure a "$0.00" is
    rendered when the split value is neither positive nor negative.

diff --git a/gnucash/report/reports/standard/register.scm b/gnucash/report/reports/standard/register.scm
index 14715714f..ed2c807be 100644
--- a/gnucash/report/reports/standard/register.scm
+++ b/gnucash/report/reports/standard/register.scm
@@ -246,9 +246,7 @@
                  "number-cell"
                  (if split-info?
                      (gnc:default-price-renderer
-                      (gnc-account-get-currency-or-parent
-                       (xaccSplitGetAccount split))
-                      (xaccSplitGetSharePrice split))
+                      trans-currency (xaccSplitGetSharePrice split))
                      " "))))
     (if (amount-single-col column-vector)
         (addto! row-contents
@@ -294,7 +292,7 @@
                     " ")))
     (if (value-credit-col column-vector)
         (addto! row-contents
-                (if (and split-info? (negative? (xaccSplitGetValue split)))
+                (if (and split-info? (not (positive? (xaccSplitGetValue split))))
                     (gnc:make-html-table-cell/markup
                      "number-cell"
                      (gnc:make-gnc-monetary trans-currency

commit dba9ba2f8fca25d4367319b5c772282808efbb6c
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Wed May 13 18:39:41 2020 +0800

    Bug 796932 - Invoices order when assigning payments
    
    sorts documents in dialog-payment.c by date, then by document ID.

diff --git a/gnucash/gnome/dialog-payment.c b/gnucash/gnome/dialog-payment.c
index 0dd03995d..539e47397 100644
--- a/gnucash/gnome/dialog-payment.c
+++ b/gnucash/gnome/dialog-payment.c
@@ -1162,6 +1162,28 @@ static void print_date (G_GNUC_UNUSED GtkTreeViewColumn *tree_column,
     g_free (doc_date_str);
 }
 
+static gint
+doc_sort_func (GtkTreeModel *model,
+               GtkTreeIter  *a,
+               GtkTreeIter  *b,
+               gpointer      user_data)
+{
+    time64 a_date, b_date;
+    gchar *a_id = NULL, *b_id = NULL;
+    int ret;
+
+    gtk_tree_model_get (model, a, 0, &a_date, 1, &a_id, -1);
+    gtk_tree_model_get (model, b, 0, &b_date, 1, &b_id, -1);
+
+    if (a_date < b_date) ret = -1;
+    else if (a_date > b_date) ret = 1;
+    else ret = g_strcmp0 (a_id, b_id);
+
+    g_free (a_id);
+    g_free (b_id);
+    return ret;
+}
+
 static PaymentWindow *
 new_payment_window (GtkWindow *parent, QofBook *book, InitialPaymentInfo *tx_info)
 {
@@ -1318,10 +1340,16 @@ new_payment_window (GtkWindow *parent, QofBook *book, InitialPaymentInfo *tx_inf
     tree_view_column_set_default_width (GTK_TREE_VIEW (pw->docs_list_tree_view),
                                         column, "9,999,999.00");
 
-    gtk_tree_sortable_set_sort_column_id (
-        GTK_TREE_SORTABLE (gtk_tree_view_get_model (GTK_TREE_VIEW (pw->docs_list_tree_view))),
-        0, GTK_SORT_ASCENDING);
+    gtk_tree_sortable_set_default_sort_func
+        (GTK_TREE_SORTABLE (gtk_tree_view_get_model
+                            (GTK_TREE_VIEW (pw->docs_list_tree_view))),
+         doc_sort_func, NULL, NULL);
 
+    gtk_tree_sortable_set_sort_column_id
+        (GTK_TREE_SORTABLE (gtk_tree_view_get_model
+                            (GTK_TREE_VIEW (pw->docs_list_tree_view))),
+         GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID,
+         GTK_SORT_ASCENDING);
 
     box = GTK_WIDGET (gtk_builder_get_object (builder, "acct_window"));
     pw->acct_tree = GTK_WIDGET(gnc_tree_view_account_new (FALSE));



Summary of changes:
 gnucash/gnome/dialog-payment.c               | 34 +++++++++++++++++++++++++---
 gnucash/report/reports/standard/register.scm |  6 ++---
 2 files changed, 33 insertions(+), 7 deletions(-)



More information about the gnucash-changes mailing list