diff --git a/ChangeLog b/ChangeLog index 0d113305c0..c4f0995f1c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2001-07-17 Dave Peticolas + + * src/engine/Transaction.c (xaccTransAppendSplit): make sure + split's value conforms to the transaction common currency. + 2001-07-12 Dave Peticolas * src/gnome/window-register.c: same as below diff --git a/src/engine/Transaction.c b/src/engine/Transaction.c index 30ed13c66b..c7aa7145c1 100644 --- a/src/engine/Transaction.c +++ b/src/engine/Transaction.c @@ -1720,6 +1720,18 @@ xaccTransAppendSplit (Transaction *trans, Split *split) /* now, insert the split into the array */ split->parent = trans; trans->splits = g_list_append (trans->splits, split); + + /* convert the split to the new transaction's commodity denominator */ + /* if the denominator can't be exactly converted, it's an error */ + if (trans->common_currency) + { + int fraction = gnc_commodity_get_fraction (trans->common_currency); + gnc_numeric new_value; + + new_value = gnc_numeric_convert(split->value, fraction, GNC_RND_ROUND); + if (gnc_numeric_check (new_value) == GNC_ERROR_OK) + split->value = new_value; + } } /********************************************************************\