r23699 - gnucash/trunk/src/engine - Bug 555182 - Security Type template hidden

John Ralls jralls at code.gnucash.org
Thu Jan 16 17:52:03 EST 2014


Author: jralls
Date: 2014-01-16 17:52:03 -0500 (Thu, 16 Jan 2014)
New Revision: 23699
Trac: http://svn.gnucash.org/trac/changeset/23699

Modified:
   gnucash/trunk/src/engine/gnc-commodity.c
Log:
Bug 555182 - Security Type template hidden

Part 2: Change commodities in namespace "template" to namespace "User"
unless the mnemonic is also "template". This makes commidities which
have been entered into "template" by mistake visible so that they
can be deleted or edited.

Modified: gnucash/trunk/src/engine/gnc-commodity.c
===================================================================
--- gnucash/trunk/src/engine/gnc-commodity.c	2014-01-15 20:11:29 UTC (rev 23698)
+++ gnucash/trunk/src/engine/gnc-commodity.c	2014-01-16 22:52:03 UTC (rev 23699)
@@ -834,6 +834,14 @@
 
     if ( namespace != NULL )
     {
+	/* Prevent setting anything except template in namespace template. */
+	if (g_strcmp0 (namespace, "template") == 0 &&
+	    g_strcmp0 (mnemonic, "template") != 0)
+	{
+	    PWARN("Converting commodity %s from namespace template to "
+		  "namespace User", mnemonic);
+	    namespace = "User";
+	}
         gnc_commodity_set_namespace(retval, namespace);
         if (gnc_commodity_namespace_is_iso(namespace))
         {
@@ -1855,13 +1863,22 @@
                 }
             }
         }
-
         gnc_commodity_copy (c, comm);
         gnc_commodity_destroy (comm);
         LEAVE("found at %p", c);
         return c;
     }
 
+    /* Prevent setting anything except template in namespace template. */
+    if (g_strcmp0 (ns_name, "template") == 0 &&
+	g_strcmp0 (priv->mnemonic, "template") != 0)
+    {
+	PWARN("Converting commodity %s from namespace template to "
+	      "namespace User", priv->mnemonic);
+	gnc_commodity_set_namespace (comm, "User");
+	ns_name = "User";
+    }
+
     book = qof_instance_get_book (&comm->inst);
     nsp = gnc_commodity_table_add_namespace(table, ns_name, book);
 



More information about the gnucash-changes mailing list