r17732 - gnucash/branches/2.2/src/register/ledger-core - [r17507] 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".

Christian Stimming cstim at cvs.gnucash.org
Thu Nov 27 06:17:14 EST 2008


Author: cstim
Date: 2008-11-27 06:17:13 -0500 (Thu, 27 Nov 2008)
New Revision: 17732
Trac: http://svn.gnucash.org/trac/changeset/17732

Modified:
   gnucash/branches/2.2/src/register/ledger-core/split-register-control.c
   gnucash/branches/2.2/src/register/ledger-core/split-register-p.h
   gnucash/branches/2.2/src/register/ledger-core/split-register.c
Log:
[r17507] 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.

Original commit by cedayiv.



More information about the gnucash-patches mailing list