AUDIT: r17507 - gnucash/trunk/src/register/ledger-core - Bug #340041, #436342: Make the register keep track of whether the exchange rate has been reset. This prevents a zero exchange rate from being ambiguous: previously the register could not tell the difference between "the user has not specified an exchange rate" and "the user has specified a rate of zero".

Charles Day cedayiv at cvs.gnucash.org
Sun Sep 14 12:52:35 EDT 2008


Author: cedayiv
Date: 2008-09-14 12:52:34 -0400 (Sun, 14 Sep 2008)
New Revision: 17507
Trac: http://svn.gnucash.org/trac/changeset/17507

Modified:
   gnucash/trunk/src/register/ledger-core/split-register-control.c
   gnucash/trunk/src/register/ledger-core/split-register-p.h
   gnucash/trunk/src/register/ledger-core/split-register.c
Log:
Bug #340041, #436342: Make the register keep track of whether the exchange rate has been reset. This prevents a zero exchange rate from being ambiguous: previously the register could not tell the difference between "the user has not specified an exchange rate" and "the user has specified a rate of zero".

Much of this patch consists of new ENTER(), DEBUG() and LEAVE() calls for debugging. Nearly all of the rest is refactoring. The code that detected and acted on changes to the account cell has been placed into its own function, gnc_split_register_check_account(). The several calls needed to checking a cell for changes have been combined in gnc_split_register_check_cell().

About 15 lines represent actual changes in functionality. Specifically, the code does a better job of recognizing when an exchange rate needs to be requested from the user, and when it does not. When an account cell is changed in the register, and the new account is denominated in the same commodity as the original, the original exchange rate is used. On the other hand, if the commodity differs, the rate is reset to zero. The register remembers that the zero exchange rate is due to the reset (i.e. was not user-entered) so that the the exchange rate dialog can be presented. Finally, the cell contents are checked before doing a save; previously the checks were missed in certain cases, e.g. if the user pressed "Enter" or clicked the close button.
BP




More information about the gnucash-patches mailing list