diff options
author | John Wiegley <johnw@newartisans.com> | 2010-06-18 19:44:10 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2010-06-18 19:44:10 -0400 |
commit | 4bbce6dc7b79c4b724264ead327cf990ab553f0f (patch) | |
tree | 821ed85a244db078eb6b5715d75fac25ce8f49b1 /src/filters.cc | |
parent | b7ea365bfc41ce665441749d68004cb761dbfed5 (diff) | |
download | fork-ledger-4bbce6dc7b79c4b724264ead327cf990ab553f0f.tar.gz fork-ledger-4bbce6dc7b79c4b724264ead327cf990ab553f0f.tar.bz2 fork-ledger-4bbce6dc7b79c4b724264ead327cf990ab553f0f.zip |
When --inject is used for a tag, convert to an amount
Diffstat (limited to 'src/filters.cc')
-rw-r--r-- | src/filters.cc | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/src/filters.cc b/src/filters.cc index 04b0eaa9..1a45ee8a 100644 --- a/src/filters.cc +++ b/src/filters.cc @@ -1376,22 +1376,16 @@ void inject_posts::operator()(post_t& post) } if (tag_value) { - if (tag_value->is_amount()) { - xact_t& xact = temps.copy_xact(*post.xact); - xact._date = post.date(); - xact.add_flags(ITEM_GENERATED); - post_t& temp = temps.copy_post(post, xact); + xact_t& xact = temps.copy_xact(*post.xact); + xact._date = post.date(); + xact.add_flags(ITEM_GENERATED); + post_t& temp = temps.copy_post(post, xact); - temp.account = pair.second.first; - temp.amount = tag_value->as_amount(); - temp.add_flags(ITEM_GENERATED); + temp.account = pair.second.first; + temp.amount = tag_value->to_amount(); + temp.add_flags(ITEM_GENERATED); - item_handler<post_t>::operator()(temp); - } else { - throw_(std::logic_error, - _("Attempt to inject a posting with non-amount %1 for tag %2") - << *tag_value << pair.first); - } + item_handler<post_t>::operator()(temp); } } |