gnucash maint: Bug 754192 - Since Last Run Dialog asks for security price even if not needed

John Ralls jralls at code.gnucash.org
Thu Dec 31 16:56:24 EST 2015


Updated	 via  https://github.com/Gnucash/gnucash/commit/c6987290 (commit)
	from  https://github.com/Gnucash/gnucash/commit/383960b3 (commit)



commit c69872900b40241bc61540feb13df7c5a2a586c4
Author: John Ralls <jralls at ceridwen.us>
Date:   Thu Dec 31 13:55:31 2015 -0800

    Bug 754192 - Since Last Run Dialog asks for security price even if not needed
    
    Ignore different-commodity splits even if they have a credit or debit formula
    as long as it has no variables and evaluates to zero.

diff --git a/src/app-utils/gnc-sx-instance-model.c b/src/app-utils/gnc-sx-instance-model.c
index b509068..5ef62da 100644
--- a/src/app-utils/gnc-sx-instance-model.c
+++ b/src/app-utils/gnc-sx-instance-model.c
@@ -214,8 +214,12 @@ _get_vars_helper(Transaction *txn, void *var_hash_data)
             str = kvp_value_get_string(kvp_val);
             if (str && strlen(str) != 0)
             {
-                gnc_sx_parse_vars_from_formula(str, var_hash, NULL);
-                split_is_marker = FALSE;
+		gnc_numeric val = gnc_numeric_zero();
+                int result = gnc_sx_parse_vars_from_formula(str, var_hash,
+							    &val);
+		if (result == 0 && (!gnc_numeric_zero_p(val) ||
+				    g_hash_table_size(var_hash) != 0))
+		    split_is_marker = FALSE;
             }
         }
 
@@ -228,8 +232,12 @@ _get_vars_helper(Transaction *txn, void *var_hash_data)
             str = kvp_value_get_string(kvp_val);
             if (str && strlen(str) != 0)
             {
-                gnc_sx_parse_vars_from_formula(str, var_hash, NULL);
-                split_is_marker = FALSE;
+		gnc_numeric val = gnc_numeric_zero();
+                int result = gnc_sx_parse_vars_from_formula(str, var_hash,
+							    &val);
+		if (result == 0 && (!gnc_numeric_zero_p(val) ||
+				    g_hash_table_size(var_hash) != 0))
+		    split_is_marker = FALSE;
             }
         }
         if (!split_is_marker && first_cmdty == NULL)



Summary of changes:
 src/app-utils/gnc-sx-instance-model.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)



More information about the gnucash-changes mailing list