mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
a fix for an anoying little buig
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@1594 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
2ed0e8f98b
commit
a0f3f5148e
@ -319,7 +319,6 @@ xaccSRSaveRegEntry (SplitRegister *reg)
|
|||||||
{
|
{
|
||||||
Split *split;
|
Split *split;
|
||||||
Transaction *trans, *oldtrans;
|
Transaction *trans, *oldtrans;
|
||||||
Account * acc;
|
|
||||||
unsigned int changed;
|
unsigned int changed;
|
||||||
int style;
|
int style;
|
||||||
|
|
||||||
@ -373,6 +372,7 @@ xaccSRSaveRegEntry (SplitRegister *reg)
|
|||||||
xaccTransAppendSplit (trans, split);
|
xaccTransAppendSplit (trans, split);
|
||||||
|
|
||||||
if (force_double_entry_awareness) {
|
if (force_double_entry_awareness) {
|
||||||
|
Account * acc;
|
||||||
acc = xaccSplitGetAccount (s);
|
acc = xaccSplitGetAccount (s);
|
||||||
xaccAccountInsertSplit (acc, split);
|
xaccAccountInsertSplit (acc, split);
|
||||||
}
|
}
|
||||||
@ -515,7 +515,38 @@ xaccSRSaveRegEntry (SplitRegister *reg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (MOD_PRIC & changed) {
|
if (MOD_PRIC & changed) {
|
||||||
|
Account *acc;
|
||||||
|
int n;
|
||||||
xaccSplitSetSharePrice (split, reg->priceCell->amount);
|
xaccSplitSetSharePrice (split, reg->priceCell->amount);
|
||||||
|
|
||||||
|
/* Here we handle a very special case: the user just created
|
||||||
|
* an account, which now has two splits in it, and the user
|
||||||
|
* is editing the opening balance split. Then copy the price
|
||||||
|
* over to the last split, so that the account balance, when
|
||||||
|
* computed, won't be obviously bad. Strictly speaking, everything
|
||||||
|
* will automatically fix itself once the user closes the window,
|
||||||
|
* or if they start editing the second split, and so we don't
|
||||||
|
* really have to do this. This is more of a feel-good thing,
|
||||||
|
* so that they won't see even breifly what looks like bad values,
|
||||||
|
* and that might give them the willies. We want them to feel good.
|
||||||
|
*/
|
||||||
|
acc = xaccSplitGetAccount (split);
|
||||||
|
n = xaccAccountGetNumSplits (acc);
|
||||||
|
if (2 == n) {
|
||||||
|
Split *s = xaccAccountGetSplit (acc, 0);
|
||||||
|
if (s == split) {
|
||||||
|
Transaction *t;
|
||||||
|
double currprice;
|
||||||
|
s = xaccAccountGetSplit (acc, 1);
|
||||||
|
currprice = xaccSplitGetSharePrice (s);
|
||||||
|
if (DEQ (currprice, 1.0)) {
|
||||||
|
t = xaccSplitGetParent (s);
|
||||||
|
xaccTransBeginEdit (t, 0);
|
||||||
|
xaccSplitSetSharePrice (s, reg->priceCell->amount);
|
||||||
|
xaccTransCommitEdit (t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (MOD_VALU & changed) {
|
if (MOD_VALU & changed) {
|
||||||
|
Loading…
Reference in New Issue
Block a user