From e824070b4ac098010f993dbdbcdff9a4bf1a3ba6 Mon Sep 17 00:00:00 2001 From: Johann Klähn Date: Tue, 23 Oct 2012 12:13:22 +0200 Subject: fix bucket directive (bug 765) This was caused by both 'A' and 'bucket' using default_account_directive. This function was still stripping the 'A' directive, so the first character of the account name used with 'bucket' was cut off. Maybe the code for the other directives should be changed accordingly for consistency (put line + 1 in call instead of function). --- src/textual.cc | 8 ++++---- test/regress/0161EB1E.test | 15 +++++++++++++++ 2 files changed, 19 insertions(+), 4 deletions(-) create mode 100644 test/regress/0161EB1E.test diff --git a/src/textual.cc b/src/textual.cc index 0ead9232..7f2f2a69 100644 --- a/src/textual.cc +++ b/src/textual.cc @@ -148,7 +148,7 @@ namespace { void account_value_directive(account_t * account, string expr_str); void account_default_directive(account_t * account); - void default_account_directive(char * line); + void default_account_directive(char * args); void alias_directive(char * line); void payee_directive(char * line); @@ -397,7 +397,7 @@ void instance_t::read_next_directive(bool& error_flag) #endif // TIMELOG_SUPPORT case 'A': // a default account for unbalanced posts - default_account_directive(line); + default_account_directive(line + 1); break; case 'C': // a set of conversions price_conversion_directive(line); @@ -490,9 +490,9 @@ void instance_t::default_commodity_directive(char * line) amt.commodity().add_flags(COMMODITY_KNOWN); } -void instance_t::default_account_directive(char * line) +void instance_t::default_account_directive(char * args) { - context.journal->bucket = top_account()->find_account(skip_ws(line + 1)); + context.journal->bucket = top_account()->find_account(skip_ws(name)); context.journal->bucket->add_flags(ACCOUNT_KNOWN); } diff --git a/test/regress/0161EB1E.test b/test/regress/0161EB1E.test new file mode 100644 index 00000000..93498ad5 --- /dev/null +++ b/test/regress/0161EB1E.test @@ -0,0 +1,15 @@ +bucket Assets:Checking +2011/04/25 Tom's Used Cars + Auto $ 5,500.00 + ; :nobudget: + +A Assets:Checking +2011/04/27 Book Store + Books $20.00 + +test reg +11-Apr-25 Tom's Used Cars Auto $ 5,500.00 $ 5,500.00 + Assets:Checking $ -5,500.00 0 +11-Apr-27 Book Store Books $ 20.00 $ 20.00 + Assets:Checking $ -20.00 0 +end test -- cgit v1.2.3