gnucash maint: Multiple changes pushed

Geert Janssens gjanssens at code.gnucash.org
Thu Dec 18 08:31:13 EST 2014


Updated	 via  https://github.com/Gnucash/gnucash/commit/e3bef5fd (commit)
	 via  https://github.com/Gnucash/gnucash/commit/9dc06a2f (commit)
	from  https://github.com/Gnucash/gnucash/commit/321278f9 (commit)



commit e3bef5fdc3abddb2cb6c6913e6a2f43375db0ef4
Author: Geert Janssens <janssens-geert at telenet.be>
Date:   Wed Dec 17 18:51:39 2014 +0100

    Fix lot scrubbing for business lots
    
    When adding splits to such a lot the code was supposed to
    reduce splits in the same transaction and the same lot to
    one single split. This is to avoid infinite fragmentation
    over time.
    That reduction wasn't working for business lots and should
    be fixed with this commit.
    This is also a potential fix for bug https://bugzilla.gnome.org/show_bug.cgi?id=741418
    which could very well be a report of such infinite fragmentation.

diff --git a/src/engine/Scrub2.c b/src/engine/Scrub2.c
index 4c9b6a7..10ee3f8 100644
--- a/src/engine/Scrub2.c
+++ b/src/engine/Scrub2.c
@@ -366,18 +366,21 @@ restart:
         if (s == split) continue;
         if (qof_instance_get_destroying(s)) continue;
 
-        /* OK, this split is in the same lot (and thus same account)
-         * as the indicated split.  Make sure it is really a subsplit
-         * of the split we started with.  It's possible to have two
-         * splits in the same lot and transaction that are not subsplits
-         * of each other, the test-period test suite does this, for
-         * example.  Only worry about adjacent sub-splits.  By
-         * repeatedly merging adjacent subsplits, we'll get the non-
-         * adjacent ones too. */
-        guid = qof_instance_get_guid(s);
-        if (gnc_kvp_bag_find_by_guid (split->inst.kvp_data, "lot-split",
-                                      "peer_guid", guid) == NULL)
-            continue;
+        if (strict)
+        {
+            /* OK, this split is in the same lot (and thus same account)
+             * as the indicated split.  Make sure it is really a subsplit
+             * of the split we started with.  It's possible to have two
+             * splits in the same lot and transaction that are not subsplits
+             * of each other, the test-period test suite does this, for
+             * example.  Only worry about adjacent sub-splits.  By
+             * repeatedly merging adjacent subsplits, we'll get the non-
+             * adjacent ones too. */
+            guid = qof_instance_get_guid(s);
+            if (gnc_kvp_bag_find_by_guid (split->inst.kvp_data, "lot-split",
+                                          "peer_guid", guid) == NULL)
+                continue;
+        }
 
         merge_splits (split, s);
         rc = TRUE;

commit 9dc06a2f24051b153d68b0481a3619c331a5dc1e
Author: Geert Janssens <janssens-geert at telenet.be>
Date:   Wed Dec 17 18:46:54 2014 +0100

    Improve comment for gncOwnerAutoApplyPaymentsWithLots
    
    It was no longer accurate

diff --git a/src/engine/gncOwner.c b/src/engine/gncOwner.c
index 7ffb5e1..25fa682 100644
--- a/src/engine/gncOwner.c
+++ b/src/engine/gncOwner.c
@@ -1345,8 +1345,11 @@ void gncOwnerAutoApplyPaymentsWithLots (const GncOwner *owner, GList *lots)
 
 /*
  * Create a payment of "amount" for the owner and match it with
- * the set of lots passed in. If not lots were given all open
- * lots for the owner are considered.
+ * the set of lots passed in.
+ * If
+ * - no lots were given
+ * - auto_pay is true
+ * then all open lots for the owner are considered.
  */
 void
 gncOwnerApplyPayment (const GncOwner *owner, Transaction *txn, GList *lots,



Summary of changes:
 src/engine/Scrub2.c   | 27 +++++++++++++++------------
 src/engine/gncOwner.c |  7 +++++--
 2 files changed, 20 insertions(+), 14 deletions(-)



More information about the gnucash-changes mailing list