From c1b25fcf8629eca326fe6dd586e4896eeb5f2d45 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Fri, 20 Feb 2009 02:53:54 -0400 Subject: Rewrote the equity command, which is working again The old implementation used an account formatter, and was very specialized. The new is done as a transaction filter, and works along with everything else, eliminating bugs special to the equity report. --- src/global.cc | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/global.cc') diff --git a/src/global.cc b/src/global.cc index 0ecd1fb8..f967d3e9 100644 --- a/src/global.cc +++ b/src/global.cc @@ -339,7 +339,7 @@ void global_scope_t::normalize_session_options() function_t global_scope_t::look_for_precommand(scope_t& scope, const string& verb) { - if (expr_t::ptr_op_t def = scope.lookup(string("precmd_") + verb)) + if (expr_t::ptr_op_t def = scope.lookup(string(PRECMD_PREFIX) + verb)) return def->as_function(); else return function_t(); @@ -348,7 +348,7 @@ function_t global_scope_t::look_for_precommand(scope_t& scope, function_t global_scope_t::look_for_command(scope_t& scope, const string& verb) { - if (expr_t::ptr_op_t def = scope.lookup(string("cmd_") + verb)) + if (expr_t::ptr_op_t def = scope.lookup(string(CMD_PREFIX) + verb)) return def->as_function(); else return function_t(); @@ -361,7 +361,7 @@ void global_scope_t::normalize_report_options(const string& verb) report_t& rep(report()); - // jww (2009-02-09): These global are a hack, but hard to avoid + // jww (2009-02-09): These global are a hack, but hard to avoid. item_t::use_effective_date = rep.HANDLED(effective); if (rep.HANDLED(date_format_)) { @@ -369,14 +369,15 @@ void global_scope_t::normalize_report_options(const string& verb) output_date_format = rep.HANDLER(date_format_).str(); } - // jww (2008-08-14): This code really needs to be rationalized away - // for 3.0. + // jww (2008-08-14): This code really needs to be rationalized away for 3.0. + // I might be able to do it with command objects, like register_t, which + // each know how to adjust the report based on its current option settings. if (verb == "print" || verb == "entry" || verb == "dump") { rep.HANDLER(related).on_only(); rep.HANDLER(related_all).on_only(); } else if (verb == "equity") { - rep.HANDLER(subtotal).on_only(); + rep.HANDLER(equity).on_only(); } else if (rep.HANDLED(related)) { if (verb[0] == 'r') { -- cgit v1.2.3