This allows us to guarantee that the report periods are well-formed and
don't contain errors (e.g. empty spans, spans not contiguous, spans not
a partition).
Note the underlying representation is now for disjoint spans, whereas
previously the end date of a span was equal to the start date of the
next span, and then was adjusted backwards one day when needed.
We no longer attempt to process timeclock entries in time order - that
was a wrong requirement, probably given by me, that can't work. Now
we just process them in parse order. This plus a little tweaking of
error checking fixes several ordering bugs with overlapping sessions
and also allows same-named overlapping sessions.
More cleanup will follow. More testing might show that --old-timeclock
is no longer needed.
Now we process entries in a more careful order: time, then parse
order, like journal format. This fixes the original issue and another
one mentioned at #2417.
The default timeclock parser (ie when not using --old-timeclock) has
the following changes, related to issues such as
[#2141], [#2365], [#2400], [#2417]:
- semicolon now always starts a comment; timeclock account names can't include semicolons
(though journal account names still can)
- clock-in and clock-out entries now have different syntax
- clock-ins now require an account name
- clock-outs now can have a comment and tags
- the doc has been rewritten, and now mentions the --old-timeclock flag
- lib: accountnamep and modifiedaccountnamep now take a flag to allow semicolons or not
This allows using the special string `%account` in auto posting rules.
When run, this will be substituted with the account name of the matched
posting.
This adds a safer version of spanDefaultsFrom that won't create spans
that end before they start, and updates all reports to use it.
The only related change noticed so far is that close now gives an
error instead of a malformed entry, when there's no data to close.
[#2409]
This upgrades Account to enable it to store a multiperiod balance, with
a separate balance for each date period. This enables it do the hard
work in MultiBalanceReport.
Some new types are created to enable convenient operation of accounts.
- `BalanceData` is a type which stores an exclusive balance, inclusive
balance, and number of postings. This was previously directly stored
in Account, but is now factored into a separate data type.
- `PeriodData` is a container which stores date-indexed data, as well as
pre-period data. In post cases, this represents the report spans,
along with the historical data.
- Account becomes polymorphic, allowing customisation of the type of
data it stores. This will usually be `BalanceData`, but in
`BudgetReport` it can use `These BalanceData BalanceData` to store
both actuals and budgets in the same structure. The data structure
changes to contain a `PeriodData`, allowing multiperiod accounts.
Some minor changes are made to behaviour for consistency:
- --declared treats parent accounts consistently.
- --flat --empty ensures that implied accounts with no postings are not displayed, but
accounts with zero balance and actual postings are.
- Added support for unseparated dates, for convenience in ghci and for parseHledgerVersion
- Noted two user-facing uses: --value's argument, and import's .latest files.
YYYYMMDD dates will now also work there. Left this undocumented.
- Noted this is now more permissive, parsing many integers successfully; not expecting problems.
We now support having multiple sessions clocked in. These are paired by
account name if given on the out entry, and otherwise an out closes the
most recent in entry.
Note that this breaks some backwards compatibility, in that we
previously ignored the description on the clock out entry. To mitigate
this, a new hidden flag --timeclock-old has been added, which reverts to
the old behavior.