diff options
author | John Wiegley <johnw@newartisans.com> | 2009-11-20 21:33:23 -0500 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2009-11-20 21:33:23 -0500 |
commit | 117dddabd4f883de4f464821f9567d889a6fa449 (patch) | |
tree | 602c8c5e72b81ffc9bcf01bbaed5e2875d0e60a0 /src/xact.cc | |
parent | cc9110a43a1e2d006de8d24a84bbfb2c6918cf33 (diff) | |
parent | 4e6ec09e4d2a69dcb06627e44512980b09561448 (diff) | |
download | fork-ledger-117dddabd4f883de4f464821f9567d889a6fa449.tar.gz fork-ledger-117dddabd4f883de4f464821f9567d889a6fa449.tar.bz2 fork-ledger-117dddabd4f883de4f464821f9567d889a6fa449.zip |
Merge branch 'next'
Diffstat (limited to 'src/xact.cc')
-rw-r--r-- | src/xact.cc | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/xact.cc b/src/xact.cc index f2694976..623c5772 100644 --- a/src/xact.cc +++ b/src/xact.cc @@ -122,7 +122,7 @@ bool xact_base_t::finalize() amount_t& p(post->cost ? *post->cost : post->amount); if (! p.is_null()) { DEBUG("xact.finalize", "post must balance = " << p.reduced()); - if (! post->cost && post->amount.is_annotated() && + if (! post->cost && post->amount.has_annotation() && post->amount.annotation().price) { // If the amount has no cost, but is annotated with a per-unit // price, use the price times the amount as the cost @@ -221,7 +221,7 @@ bool xact_base_t::finalize() foreach (post_t * post, posts) { if (! post->amount.is_null()) { - if (post->amount.is_annotated()) + if (post->amount.has_annotation()) top_post = post; else if (! top_post) top_post = post; @@ -260,7 +260,7 @@ bool xact_base_t::finalize() foreach (post_t * post, posts) { if (post != top_post && post->must_balance() && ! post->amount.is_null() && - post->amount.is_annotated() && + post->amount.has_annotation() && post->amount.annotation().price) { amount_t temp = *post->amount.annotation().price * post->amount; if (total_cost.is_null()) { @@ -309,10 +309,11 @@ bool xact_base_t::finalize() _("A posting's cost must be of a different commodity than its amount")); cost_breakdown_t breakdown = - amount_t::current_pool->exchange(post->amount, *post->cost, false, - datetime_t(date(), time_duration(0, 0, 0, 0))); + commodity_pool_t::current_pool->exchange + (post->amount, *post->cost, false, + datetime_t(date(), time_duration(0, 0, 0, 0))); - if (post->amount.is_annotated() && + if (post->amount.has_annotation() && breakdown.basis_cost.commodity() == breakdown.final_cost.commodity()) { if (amount_t gain_loss = (breakdown.basis_cost - |