Hi Charles, why do you need such a flag?
Can't we prevent the zero setting of the excahnge rate? I.e. instead of setting the rate to zero, pop up the exchange rate dialog (possibly augmented with some explaination about the different currencies in the other acount)? What am I missing? Herbert. Charles Day schrieb: > I've figured out the source of bug 436342 and bug 340041, but I have a > question about how to fix it. I'm hoping someone can point me in the right > direction. > > The problem occurs when you edit an existing transaction in a register. If > you change the account on one of the split lines, and the new account uses a > different currency than the old account, the exchange rate dialog never pops > up to ask you the exchange rate. Instead, the exchange rate is saved as > zero. > > The reason this happens is that when the code figures out that you've > changed the account, it resets the exchange rate to zero. Later on, a > different part of the code sees the zero exchange rate and *assumes* that > the user deliberately approved an exchange rate of zero. So the split gets > saved that way. This is actually appropriate in some situations, such as > when the user wants to enter capital or currency gain/loss splits. However, > in this case it was the register code that set the rate to zero, not the > user. So the assumption is wrong, and that causes the bug. > > Now my question: since the two phases of this problem (1. setting the rate > to zero, 2. saving the transaction) occur in different functions, in > different files, I need a way to store a flag somewhere that indicates > whether the zero exchange rate was set by the user (or not). Where could I > store such a flag? I was thinking of adding it to the register's private > SRInfo data structure (see the definition of sr_info in > ledger-core/split-register-p.h). Would this be an appropriate place? > > Any other hints/suggestions? > > Cheers, > Charles > _______________________________________________ > gnucash-devel mailing list > [email protected] > https://lists.gnucash.org/mailman/listinfo/gnucash-devel > -- !!! Please note new phone and fax numbers !!! Herbert Thoma Head of Video Group Multimedia Realtime Systems Department Fraunhofer IIS Am Wolfsmantel 33, 91058 Erlangen, Germany Phone: +49-9131-776-6130 Fax: +49-9131-776-6099 email: [EMAIL PROTECTED] www: http://www.iis.fhg.de/ _______________________________________________ gnucash-devel mailing list [email protected] https://lists.gnucash.org/mailman/listinfo/gnucash-devel
