Commit graph

1848 commits

Author SHA1 Message Date
Alexis Hildebrandt
ba35340ca9 Bugfix 1038: empty reg report for this month period
when year was specified with literal Y or year directive, but not
when using apply year.
2014-12-29 11:08:10 +01:00
Alexis Hildebrandt
0462c887ae Improve error handling when parsing year directives
A literal Y directive or ‘year’ directive with an empty or invalid 
argument, e.g. ‘2o14’ (that is a small letter ‘oh’ instead of a zero)
would fail with the following rather unhelpful error message:
Error: bad lexical cast: source type value could not be interpreted as target
2014-12-28 13:42:02 +01:00
Alexis Hildebrandt
e716980c7d Fix plain year directive
Only Y2014 or apply year 2014 would actually set the year for the
following transactions; year 2014 would silently do nothing.
2014-12-28 13:32:22 +01:00
Alexis Hildebrandt
bb2b20b311 Use same license text formatting in source files 2014-12-27 11:38:36 +01:00
Alexis Hildebrandt
1dd9dcaab4 Bump copyright notice to 2015
The following script makes it a no-brainer:
% NEXT_YEAR=2015; ag -l 'Copyright.*Wiegley' \
  | xargs sed -i '' -e "s/\(Copyright.*\)-20[0-9]\{2\}/\1-${NEXT_YEAR}/"
2014-12-27 11:24:55 +01:00
Alexis Hildebrandt
a1a51f69f3 Correct no-python error messages
[ci skip]
2014-12-25 12:28:31 +01:00
Alexis Hildebrandt
f1478851ee Fix crash when using --trace 10 or above
uint8_t is typedef'd to char, thus boost::lexical_cast treats it
as such instead of a number.
2014-12-23 23:45:39 +01:00
Alexis Hildebrandt
0a0f2f0d69 Fix crash when using -M with empty result
ledger -f /dev/null reg -M test causes a segmentation fault,
see bug 730 and duplicates 1080 and 1084 for details.

Kudos to Ikke for helping with debugging.
2014-12-16 19:37:37 +01:00
Adrian Lang
a013a73b26 Fix off by one error in textual.cc
This fixes parsing of transactions with single-character payees and comments.
2014-12-11 21:57:25 +01:00
Christophe Rhodes
3e1f6670fc support date as well as datetime in Balance.value()
cargo-cut'n'paste from py_amount.cc
2014-12-01 21:03:23 +00:00
ELIPTUS
af571c1047 Improve Embedded Python Support
Discussion:
https://groups.google.com/d/msg/ledger-cli/kq9sKoRX9vw/fmyhvPslzokJ
2014-11-12 22:51:56 -08:00
Stefano Zacchiroli
56976a127c make --columns default to terminal width, as returned by ioctl()
If set, the COLUMNS environment variable will take precedence over terminal
width. However, please note that COLUMNS is usually *not* exported by shells to
child processes, so in most cases COLUMNS will be undefined for ledger---hence
the motivation for this change.

Terminal width is queried using ioctl() on stdin. For the sake of portability
the querying is done only on platform where ioctl() is detected as supported at
compile-time.
2014-10-13 17:15:56 -04:00
Martin Michlmayr
96223f9e20 Add ISO 8601 date as recognized date string
Dates specified via --begin and --end are converted to a value expression
using an ISO 8601 (yyyy-mm-dd) date, but this date was not recognized by
ledger.

Bug fix for #1072
2014-10-02 18:33:26 -04:00
Martin Michlmayr
fbcb5e9093 Fix period expression parsing for month to month without year
Bug fix for #1074, a regression introduced by the fix for bug #375
2014-10-02 17:31:26 -04:00
Carlos E. Garcia
5d6655c84f minor spelling fixes 2014-09-15 14:04:19 -04:00
Joseph Mornin
4c86042665 "mispelled" was misspelled 2014-09-08 09:41:21 -07:00
Joe Gallo
d5592ea1e3 #if guards for boost 1.56 compatibility 2014-08-28 11:04:55 -04:00
John Wiegley
948f5fea28 Revert "fix "no viable conversion from ... to 'bool'""
This reverts commit df9ae3ab9b.
2014-08-27 11:56:14 -05:00
John Wiegley
4ed6599579 Revert "fix "type 'char' cannot be used prior to '::'""
This reverts commit 38557ee632.
2014-08-27 11:56:07 -05:00
Joe Gallo
38557ee632 fix "type 'char' cannot be used prior to '::'" 2014-08-26 09:09:06 -04:00
Joe Gallo
df9ae3ab9b fix "no viable conversion from ... to 'bool'" 2014-08-26 09:07:57 -04:00
Craig Earls
fa46f3442d fix rare bug in balance report output if the budgeted amount happens to be zero.
See emails in group from John Rakestraw circa November 2011
2014-08-24 18:40:00 -07:00
Martin Michlmayr
b886342064 Preserve the given cost for print
Patch from John Wiegley
2014-07-14 21:05:54 -04:00
Martin Michlmayr
37b8b5e337 Preserve original cost basis when gain or loss is made
Change the definition of cost: in the past, if you bought 1 AAA for
$10 and then sold it for $12, ledger would take $12 as the cost.  With
the patch, the original cost of $10 is preserved ss the cost basis.
In my opinion, this brings ledger in line with accounting expectations.

This change fixes bugs #712 and #713.

Bug #712 is about Equity:Capital Gains and Equity:Capital Loss
entries ledger automatically generates that are in my opinion
incorrect.

Bug #713 is about strange behaviour with -B after a capital gain or
loss is made.

Patch from John Wiegley.
2014-07-14 20:39:04 -04:00
Martin Michlmayr
746ca1fe6d Unify debugging categories
Debugging categories follow the filename, which in this case is singular
(rather than plural) "account" and "amount".
2014-07-01 14:14:23 -04:00
Max Satula
de17ccf1f4 When a status flag (! or *) is explicitly specified for an individual posting, it always has a priority over entire transaction status. 2014-06-30 13:39:22 -04:00
Craig Earls
db73e7af9e Fix Bug 1057: Emacs output does not escape special characters. 2014-06-26 20:52:50 -07:00
Martin Michlmayr
23902686a3 Don't lose commodity when cost is not separated by whitespace
When a cost was specified without a whitespace after the @ symbol,
as in @$5.01, this was incorrectly parsed as 5.01 (losing the
commodity) rather than $5.01.

Bug fix for #1050
2014-06-05 19:46:22 -04:00
Martin Michlmayr
a5ffcc42ff Improve backwards compatibility with ledger2
This brings some single character format strings in line with what
they actually meant in ledger2.

Bug fix for #755
2014-05-30 23:52:36 -04:00
Martin Michlmayr
7eeb2e2e18 Recognize --cleared-format option
Bug fix for #747
2014-05-30 22:14:48 -04:00
Martin Michlmayr
dfcbbd169e Fix query string for select account
A wrong query string was generated by "select account": one ansify_if()
too much was listed and justify() was called with the wrong parameters.

Bug fix for #744
2014-05-30 22:01:08 -04:00
Martin Michlmayr
b2b84f35b4 Move the debug statement to where it makes more sense
It's possible to just say "select account" without a "from", so
put the debug statement at the end of the block where the variable
"formatter" is filled with the query string.
2014-05-30 22:00:16 -04:00
Martin Michlmayr
b534ee80a3 Handle POST_COST_VIRTUAL in print
Bug fix for #1046
2014-05-30 20:23:59 -04:00
Martin Michlmayr
fafd7c1346 Check whether a month is followed by a year
Bug fix for #375
2014-05-30 18:27:22 -04:00
Martin Michlmayr
2cee0fe23f Cosmetic change - format code consistently
Add a space between if and the opening bracket, between a closing
round bracket and the following opening curly bracket, etc.
2014-05-18 09:51:32 -04:00
thdox
8b3f8d1884 Fix bug introduced by commit AA2FF2B
Correction is to not use uninitialized amount
2014-05-17 23:41:07 +02:00
Martin Michlmayr
ab921cca0c Ensure that high-levels directives have arguments if they need one
Ensure that high-levels directives, such as account, alias and
commodity, have arguments if they need one.  Bug fix for #1036
2014-05-14 17:55:07 -04:00
Martin Michlmayr
86fd99c9d0 Ensure that directives have arguments if they need one
Ensure that account, commodity and payee directives have arguments
if they need one.  Bug fix for #785
2014-05-14 17:53:43 -04:00
Martin Michlmayr
60d9c2bc1d Remove trailing whitespace from error messages
Fix for bug #867
2014-05-13 18:08:34 -04:00
John Wiegley
1a2ab0eff7 Merge pull request #289 from csrhodes/payee-uuid-mapping
Payee uuid mapping
2014-05-13 15:35:56 -05:00
Christophe Rhodes
da51f5b510 support payee uuid directive
The semantics of this are a little bit tricky: we want, if we come
across a transaction with exactly the given UUID, to set the
transaction's payee to be the specified one.

We need to set that payee before the first post in the transaction is
parsed, otherwise that post will inherit the wrong payee; however, we
need to do it after the transaction's tags have been parsed.  The
implementation as it is in this commit is potentially a little
wasteful, if there are post-like (non-comment non-assertion) entries
in the transaction that don't successfully parse as posts.
2014-05-13 16:08:10 +01:00
Martin Michlmayr
0c9e188cfb Honour date-format for lot dates
Fixes bug #383
2014-05-13 00:03:39 -04:00
Martin Michlmayr
e367cfd895 Recognize the --no-pager option
Thanks to Johann Klähn.
2014-05-12 22:15:57 -04:00
Christophe Rhodes
bcb28b066f rename payee_mappings to payee_alias_mappings
(and similar renames) in preparation for payee_uuid_mappings
2014-05-12 23:16:07 +01:00
thdox
e422b41600 Library GMP is not yet ready for GCC 4.9, as described at bottom of page
http://gcc.gnu.org/gcc-4.9/porting_to.html

See extract below:

The <cstddef> header was updated for C++11 support and this breaks some
libraries which misuse macros meant for internal use by GCC only. For
instance with GMP versions up to 5.1.3, you may see:

/usr/include/c++/4.9.0/cstddef:51:11: error: ‘::max_align_t’ has not been declared
   using ::max_align_t;
           ^

Another possible error is:

someheader.h:99:13: error: ‘ptrdiff_t’ does not name a type

A workaround until libraries get updated is to include <cstddef> or
<stddef.h> before any headers from that library.
2014-05-11 11:14:49 +02:00
John Wiegley
bd8a1a6756 Use the POST_COST_VIRTUAL flag when exchange commodities
Fixes #999
2014-05-08 14:28:07 -05:00
John Wiegley
1aa0e03a9e Fix build for building with g++ 4.8 2014-05-07 20:49:45 +00:00
Johann Klähn
73caafa2c5 fix debug build for gcc
-ansi ≡ -std=c++98 ;)
2014-05-07 19:08:06 +02:00
John Wiegley
07b206bf6a Add the --no-pager option 2014-04-27 20:30:21 -05:00
John Wiegley
4707122eed Initialize journal_t::no_aliases to false upon costruction
This fixes a bug introduced by ecd5097d51.
2014-04-21 18:01:08 -05:00