r17923 - gnucash/branches/2.2/src/register/ledger-core - [17920] Bug #435642: Correct r17853 about editing results of a find.

Andreas Köhler andi5 at cvs.gnucash.org
Sun Feb 15 12:28:21 EST 2009


Author: andi5
Date: 2009-02-15 12:28:20 -0500 (Sun, 15 Feb 2009)
New Revision: 17923
Trac: http://svn.gnucash.org/trac/changeset/17923

Modified:
   gnucash/branches/2.2/src/register/ledger-core/split-register-util.c
Log:
[17920] Bug #435642: Correct r17853 about editing results of a find.

1. create a transaction that has two or more splits in the same account
2. open a register on that account that is in either "Basic Ledger" or
   "Auto-Split Ledger" mode
3. change some transaction other than the one with multiple splits in this
   register
4. click on the second or succeeding occurrence of the transaction with
   multiple splits in this register

This will put the cursor on the first occurrence of the transaction instead of
the one you clicked on.

Patch by Mike Alexander.

Modified: gnucash/branches/2.2/src/register/ledger-core/split-register-util.c
===================================================================
--- gnucash/branches/2.2/src/register/ledger-core/split-register-util.c	2009-02-15 17:28:13 UTC (rev 17922)
+++ gnucash/branches/2.2/src/register/ledger-core/split-register-util.c	2009-02-15 17:28:20 UTC (rev 17923)
@@ -222,22 +222,41 @@
 
       if (t == trans)
       {
+        /* A register entry for the correct transaction. */
         found_trans = TRUE;
-        
+
         if (cursor_class == CURSOR_CLASS_TRANS)
         {
-          found_trans_split = TRUE;
-          if (find_class == CURSOR_CLASS_TRANS)
+          /* This row is the transaction split for this transaction. */
+          if (s == trans_split)
+            /* It's the copy of the transaction that we want. */
+            found_trans_split = TRUE;
+          else
+            found_trans_split = FALSE;
+
+          if (find_class == CURSOR_CLASS_TRANS &&
+              (s == split || reg->style == REG_STYLE_JOURNAL))
           {
+            /* We're looking for a transaction split and this is the split we're looking for
+               or there is only one entry for this transaction in this register (since it's
+               a journal style register) so we must return the only transaction split there is. */
             if (vcell_loc != NULL)
               *vcell_loc = vc_loc;
             return TRUE;
           }
         }
       }
+      else
+      {
+        /* Not the correct transaction.  We shouldn't get here if this is true, but just
+           to be safe reset it. */
+        found_trans = FALSE;
+      }
 
       if (found_trans && (s == split) && s)
       {
+        /* We're on the right transaction, but perhaps not the copy of it we want, and
+           this is the correct split, return it if we don't find anything better. */
         if (vcell_loc != NULL)
           *vcell_loc = vc_loc;
 
@@ -246,6 +265,9 @@
 
       if (found_trans_split && (s == split))
       {
+        /* We're on the right copy of the right transaction, and this is the split we
+           want, return it (it should be the right class since if we wanted a transaction
+           split we would have returned it above. */
         if (vcell_loc != NULL)
           *vcell_loc = vc_loc;
 



More information about the gnucash-changes mailing list