diff options
author | John Wiegley <johnw@newartisans.com> | 2009-11-21 02:06:01 -0500 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2009-11-21 02:06:01 -0500 |
commit | 5d4a0a39bee1fd1abd1a04e0614c75755df4485d (patch) | |
tree | 305b6055ed31c109beb3f694ec45c1859b621011 /src/value.cc | |
parent | eab95ad55b601d44af25dd65384e7980cd54a487 (diff) | |
download | fork-ledger-5d4a0a39bee1fd1abd1a04e0614c75755df4485d.tar.gz fork-ledger-5d4a0a39bee1fd1abd1a04e0614c75755df4485d.tar.bz2 fork-ledger-5d4a0a39bee1fd1abd1a04e0614c75755df4485d.zip |
The Python web server now uses jQuery Tablesorter
Diffstat (limited to 'src/value.cc')
-rw-r--r-- | src/value.cc | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/value.cc b/src/value.cc index e2e748f4..cce4c4e8 100644 --- a/src/value.cc +++ b/src/value.cc @@ -1114,18 +1114,18 @@ void value_t::in_place_cast(type_t cast_type) break; } - case BALANCE: + case BALANCE: { + const balance_t& bal(as_balance()); switch (cast_type) { case AMOUNT: { - const balance_t& temp(as_balance()); - if (temp.amounts.size() == 1) { + if (bal.amounts.size() == 1) { // Because we are changing the current balance value to an amount // value, and because set_amount takes a reference (and that memory is // about to be repurposed), we must pass in a copy. - set_amount(amount_t((*temp.amounts.begin()).second)); + set_amount(amount_t((*bal.amounts.begin()).second)); return; } - else if (temp.amounts.size() == 0) { + else if (bal.amounts.size() == 0) { set_amount(0L); return; } @@ -1135,10 +1135,17 @@ void value_t::in_place_cast(type_t cast_type) } break; } + case STRING: + if (bal.is_empty()) + set_string(""); + else + set_string(as_balance().to_string()); + return; default: break; } break; + } case STRING: switch (cast_type) { |