gnucash maint: Multiple changes pushed

John Ralls jralls at code.gnucash.org
Thu Mar 10 13:29:11 EST 2016


Updated	 via  https://github.com/Gnucash/gnucash/commit/2b958161 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/5b40df51 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/ec83e3a3 (commit)
	from  https://github.com/Gnucash/gnucash/commit/71574b7d (commit)



commit 2b958161250bcd0191e7815e65065b9507231ea8
Author: John Ralls <jralls at ceridwen.us>
Date:   Thu Mar 10 10:27:55 2016 -0800

    Bug 763111 - commodities prices editor creates hidden db entries
    
    There were two problems: First, if there were multiple prices in the database
    for a particular day only one would be displayed. Second, if one manually
    created a second price on a day in the price editor the first wouldn't
    be removed.

diff --git a/src/engine/gnc-pricedb.c b/src/engine/gnc-pricedb.c
index 123c520..790cf32 100644
--- a/src/engine/gnc-pricedb.c
+++ b/src/engine/gnc-pricedb.c
@@ -1001,18 +1001,6 @@ gnc_pricedb_equal (GNCPriceDB *db1, GNCPriceDB *db2)
     return equal_data.equal;
 }
 
-static gboolean
-insert_or_replace_price(GNCPriceDB *db, GNCPrice *p)
-{
-    GNCPrice *old_price = gnc_pricedb_lookup_day (db, p->commodity,
-                                                  p->currency, p->tmspec);
-    if (old_price == NULL)
-        return TRUE;
-    if (p->source < old_price->source)
-        return TRUE;
-    return FALSE;
-
-}
 /* ==================================================================== */
 /* The add_price() function is a utility that only manages the
  * dual hash table instertion */
@@ -1026,6 +1014,7 @@ add_price(GNCPriceDB *db, GNCPrice *p)
     gnc_commodity *commodity;
     gnc_commodity *currency;
     GHashTable *currency_hash;
+    GNCPrice *old_price;
 
     if (!db || !p) return FALSE;
     ENTER ("db=%p, pr=%p dirty=%d destroying=%d",
@@ -1072,19 +1061,32 @@ add_price(GNCPriceDB *db, GNCPrice *p)
         LEAVE ("gnc_price_list_insert failed");
         return FALSE;
     }
+
     if (!price_list)
     {
         LEAVE (" no price list");
         return FALSE;
     }
 
-    if (!insert_or_replace_price(db, p))
+/* Check for an existing price on the same day. If there is no existing price,
+ * add this one. If this price is of equal or better precedence than the old
+ * one, copy this one over the old one.
+ */
+    old_price = gnc_pricedb_lookup_day (db, p->commodity, p->currency,
+                                        p->tmspec);
+    if (!db->bulk_update && old_price != NULL)
     {
-        LEAVE("A better price already exists");
-        return FALSE;
+        if (p->source > old_price->source)
+        {
+            gnc_price_unref(p);
+            LEAVE ("Better price already in DB.");
+            return FALSE;
+        }
+        gnc_pricedb_remove_price(db, old_price);
     }
     g_hash_table_insert(currency_hash, currency, price_list);
     p->db = db;
+
     qof_event_gen (&p->inst, QOF_EVENT_ADD, NULL);
 
     LEAVE ("db=%p, pr=%p dirty=%d dextroying=%d commodity=%s/%s currency_hash=%p",

commit 5b40df510d9cc97b64e5db7d36526f9e2428bd92
Author: John Ralls <jralls at ceridwen.us>
Date:   Thu Mar 10 09:49:43 2016 -0800

    Bug 763279 - GnuCash has empty reports
    
    On recent builds of gentoo, apparently because the supplied webkit dislikes
    that we output xhtml in a file called foo.html. Make the header say that
    we're using HTML4.

diff --git a/src/report/report-system/html-document.scm b/src/report/report-system/html-document.scm
index 9b63d09..89239bc 100644
--- a/src/report/report-system/html-document.scm
+++ b/src/report/report-system/html-document.scm
@@ -158,9 +158,8 @@
                 ;;./share/gnucash/scm/gnucash/report/taxinvoice.eguile.scm:<html>
                 ;;./share/gnucash/scm/gnucash/report/balsheet-eg.eguile.scm:<html>
 
-                ;; Validate against XHTML 1.0 Transitional
-                (push "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \n\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">")
-                (push "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n")
+                ;; Validate against HTML4 Transitional:
+                (push "<!DOCTYPE!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN\" \n\"http://www.w3.org/TR/html4/loose.dtd\">")
                 (push "<head>\n")
                 (push "<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\" />\n")
 				(if css? 

commit ec83e3a338ba817509b178840d5435ca638965f1
Author: John Ralls <jralls at ceridwen.us>
Date:   Tue Mar 8 15:19:52 2016 -0800

    Bug 722996 - Cannot add stock price on Price Editor
    
    gtk_combo_box_set_active() doesn't work if the model is changed after
    the combo box is constructed.

diff --git a/src/gnome-utils/dialog-commodity.c b/src/gnome-utils/dialog-commodity.c
index 2ebe179..ca3c564 100644
--- a/src/gnome-utils/dialog-commodity.c
+++ b/src/gnome-utils/dialog-commodity.c
@@ -644,9 +644,8 @@ gnc_ui_update_namespace_picker (GtkWidget *cbwe,
 {
     GtkComboBox *combo_box;
     GtkTreeModel *model;
-    GtkTreeIter iter;
+    GtkTreeIter iter, match;
     GList *namespaces, *node;
-    gint current = 0, match = 0;
 
     g_return_if_fail(GTK_IS_COMBO_BOX (cbwe));
 
@@ -654,7 +653,8 @@ gnc_ui_update_namespace_picker (GtkWidget *cbwe,
     combo_box = GTK_COMBO_BOX(cbwe);
     model = gtk_combo_box_get_model(combo_box);
     gtk_list_store_clear(GTK_LIST_STORE(model));
-    gtk_combo_box_set_active(combo_box, -1);
+    gtk_tree_model_get_iter_first(model, &match);
+    gtk_combo_box_set_active_iter(combo_box, &match);
 
     /* fetch a list of the namespaces */
     switch (mode)
@@ -698,11 +698,10 @@ gnc_ui_update_namespace_picker (GtkWidget *cbwe,
         }
 
         if (init_string && (g_utf8_collate(node->data, init_string) == 0))
-            match = current;
-        current++;
+            match = iter;
     }
 
-    gtk_combo_box_set_active(combo_box, match);
+    gtk_combo_box_set_active_iter(combo_box, &match);
     g_list_free(namespaces);
 }
 



Summary of changes:
 src/engine/gnc-pricedb.c                   | 32 ++++++++++++++++--------------
 src/gnome-utils/dialog-commodity.c         | 11 +++++-----
 src/report/report-system/html-document.scm |  5 ++---
 3 files changed, 24 insertions(+), 24 deletions(-)



More information about the gnucash-changes mailing list