To make this work, I had to add the right head and make a change to the CMakeLists file.
The ofx code used to have a static int to count imported transactions, which was a bit hacky.
I replaced it with a structure that's passed to all the callbacks. The structure has
the transaction count, as well as a list of statement balances information.
This list is used after the import of the ofx file to do the reconciliation.
NOTE: I wouldn't need a list since the current code only process one ofx at a time. However
I have another PR for importing several ofx files in one shot, so this PR is ready for that.
The reconciliation code is modeled after what's done in aqbanking.
file(COPY ) will only trigger when the destination file doesn't exist yet.
It won't retrigger on source file changes.
configure_file on the other hand will. To avoid unwanted substitution
attempts this can be invoked with the COPYONLY keyword.
Disadvantage of configure_file is that it will only take one
input file where file(COPY ) can operate on a list of files.
As such the configure_file statement has to be wrapped in a foreach.
A few uses of file(COPY ) can't be replaced as they are setting
file permissions. And the one in make_dist has been kept as that
always operates on an empty directory, hence copying is guaranteed.
The former will monitor the file for updates and copy it again
the latter will only copy the file if it doesn't exist in the destination yet
If the register has subaccounts in different currencies and a
transaction has splits in more than one, the transaction will
incorrectly appear to be unbalanced if we total amounts because
the balancing logic works on split values.
bb986e474 use of (ice-9 match) was technically sound however exposes a
subtle bug; _ in the matching pattern is meant to match anything
however it exposes undefined behaviour when _ is already bound to
gnc:gettext. Solution for now is to omit the second _.
Unfortunately d6de324b had a copy-and-paste bug, and the (if)
conditional has failed to mark internal transfers.
This commit fixes the parens so that splits with matching accounts are
now marked for skipping during import.