Commit Graph

17913 Commits

Author SHA1 Message Date
Geert Janssens
5ba4764a2d Add a reset member function to GncPreTrans and GncPreSplit
These will be used in future commits
2017-02-20 18:04:16 +01:00
Geert Janssens
5b446cd9a1 Make sure all lines are checked for errors, regardless of their skipped status
Which errors get actually reported the user remains filtered based on the
line skipping options the user has set.
2017-02-20 18:04:14 +01:00
Geert Janssens
f8470ffa4c Isolate the gtk callbacks from the assistant class' member variables.
This required some refactoring of a number of callback funtions.
2017-02-20 18:04:11 +01:00
Geert Janssens
f85e52beee Consistently use gnucash dialogs instead of generic gtk ones 2017-02-20 17:56:04 +01:00
Geert Janssens
d2098bfc84 Use std::unique_ptr for the TxImport object for better memory management 2017-02-20 17:56:02 +01:00
Geert Janssens
b629fc97a6 Convert assistant struct into a real c++ class 2017-02-20 17:55:58 +01:00
Geert Janssens
b13718ee0b Handle error skipping on the preview page as well and drop the custom page forwarder
With the preview page blocking as long as there are (unskipped) errors
there is no need any more for the assistant to go back from the documentation
page to the preview page in case of errors - the documentation page
can only be reached if all required data is valid.
This required some additional tweaks to other functions that were
written to be called twice in TxImport and no longer will be.
2017-02-20 17:55:54 +01:00
Geert Janssens
cfeb1f6388 Complete error checking on the preview page
- Not all possible issues were reported to the user.
- Report column conflicts above the table, and line issues in the first column of the line having the issue
2017-02-20 17:55:41 +01:00
Geert Janssens
522b75ee18 Move account searching to GncTxImport as it's responsible for the data
And use c++ containers to do the heavy lifting
2017-02-20 17:55:39 +01:00
Geert Janssens
1a1a3fc951 Remove redundant code 2017-02-20 17:55:35 +01:00
Geert Janssens
e4fc93ffe0 Cleanup round - move functions up and down to group related ones 2017-02-20 17:55:33 +01:00
Geert Janssens
0d721b795c Cleanup round
- m_ prefix all member variables
- delay variable declarations until actually needed
- use auto where possible for variable declarations
- use standard c(++) types and constants where possible
- rename variables and functions to be more consistent
- set gui callbacks as much as possible in the glade file
- drop unused parameters
2017-02-20 17:55:31 +01:00
Geert Janssens
4032b553f4 Revisit csv settings
- Store importer settings in a separate object inside the CsvTxImport
- make CsvTxImport responsible for maintaining a consistent settings state
- reduce the assistant's responsability to passing settings changes to CsvTxImport and
  visual display. It no longer does validation
- Refine the gui some more
2017-02-20 17:55:27 +01:00
Geert Janssens
26e59c4e21 Revisit error checking on the preview page.
- make the CsvTxImport class responsible for the check
- guide the user with suggestions rather than have the user click through to the next page to find out things weren't set up properly
2017-02-20 17:55:23 +01:00
Geert Janssens
e5a175a2c7 Move the base account selection to the preview page 2017-02-20 17:55:21 +01:00
Geert Janssens
e6e36d648b Add account selector to the preview window 2017-02-20 17:55:16 +01:00
Geert Janssens
550a431cdc Some variable declaration cleanups 2017-02-20 17:55:13 +01:00
Geert Janssens
7a381cd88b Make sure row coloring happens each time the preview is updated 2017-02-20 17:55:11 +01:00
Geert Janssens
91c4202f2a Remove redundant check for valid column types
The CsvTransSettings object guarantees all types in the vector are valid
so there's no need any more to check this again in the assistant.
2017-02-20 17:55:08 +01:00
Geert Janssens
7fdf135a54 Revisit csv trans import settings handling
- move all gtk related stuff to the assistant code
- move all checks to the settings object, the assistant should query that
- handle sensitivity of the save and delete button more intelligently
2017-02-20 17:55:06 +01:00
Geert Janssens
718a755f67 Drop fixed-format csv importer
It's functionality has been completely replicated
in the generic csv importer.
2017-02-20 17:55:03 +01:00
Geert Janssens
a0320d3a21 Allow user to only select column_types that make sense in the current context
The context being either multi-split or two-split. There's no use
in selecting a Transaction ID column in two-split mode for example.
Similarly none of the 'Transfer xzy' types will be used in
multi-split mode.
2017-02-20 17:55:00 +01:00
Geert Janssens
0b345d471e Drop balance column from csv importer
In its current state it will only work for a very restricted context.
However there's no code to validate this context so the importer will
happily produce wrong results in all other contexts.
A query on the mailing list didn't return any interest in this feature
so instead of fixing it I'd rather drop it to keep the code clean.
2017-02-20 17:54:57 +01:00
Geert Janssens
847b140b34 Adapt csv export format to new csv importer capabilities 2017-02-20 17:54:54 +01:00
Geert Janssens
35ba4ec92f Extend csv importer to be able to import multi-currency and stock transactions 2017-02-20 17:54:52 +01:00
Geert Janssens
49bbbca1d5 Extend csv importer to be able to import voided transactions 2017-02-20 17:54:46 +01:00
Geert Janssens
95d7e17c7b Extend csv importer to be able to import reconcile states
A detail worth noting: contrary to most other date fields
an empty value for a reconcile date is allowed if the reconcile
field is not set to 'y' (reconciled).
2017-02-20 17:54:43 +01:00
Geert Janssens
2492931094 Add additional check before creating splits or transactions
This allows the code following the check to make certain assumptions about the state
of the prop objects.
2017-02-20 17:54:40 +01:00
Geert Janssens
d2597ef1e2 Defer testing boost:optionals until really needed
Similarly only lookup book when really needed
2017-02-20 17:54:38 +01:00
Geert Janssens
848c7b8f8e Create trans/split props only when needed and have them keep their own value of date/currency format 2017-02-20 17:54:35 +01:00
Geert Janssens
443237f2b9 Extend csv importer to be able to import split action fields
At the same time drop the exception handling for the num for action setting.
The importer can't possibly get this right automatically in all cases. It's
now up to the user to assign the right columns to the correct properties
based on how he/she wants gnucash to store it internally.
2017-02-20 17:54:33 +01:00
Geert Janssens
5950b902a4 Avoid assigning empty or null char*'s to a std::string
Apparently this can cause segfaults
2017-02-20 17:54:30 +01:00
Geert Janssens
6d304d3c3e csv import prefs - store coltypes as strings
Additionally use g_key_file_[gs]_<type>_list to store and retrieve coltypes and colwidths
instead of storing/retrieving a raw string to parse afterwards
2017-02-20 17:54:26 +01:00
Geert Janssens
1fc4b3cd9b Convert column_widths to a vector 2017-02-20 17:54:24 +01:00
Geert Janssens
9e70166b8e Drop superfluous code that sets the default in case of an error.
The returned values in case of an error from the g_key_file_get* are
the correct defaults in most cases already.
In addition:
- Reduce number of temporary variables
- Fix a memory leak while testing the saved data
2017-02-20 17:54:21 +01:00
Geert Janssens
e8d24e193b Use std::vector to store column types, and a few other data type changes 2017-02-20 17:54:14 +01:00
Geert Janssens
7a69d552bd Convert CsvTransSettings into a c++ class 2017-02-20 17:54:12 +01:00
Geert Janssens
dcce2d79cd Remove final dependencies on GOFFICE
This was still pulled in via the now removed gnc-csv-model.
In order to remove this, the fixed format csv importer
has been tweaked to get the required features from
the c++ csv importer code instead.
2017-02-20 17:54:09 +01:00
Geert Janssens
861bff3f3b Fix error handling in the multi-split case (and probaly in the other case as well)
Dereferencing an iterator and then assigning it to another variable
apparently copies the object the iterator points at, instead
of making a reference to it. C++ beginner mistakes...
Also do the multi-split parent dance before handling errors. Otherwise
child lines would be mistakenly added to the first working parent split
instead of also being skipped until the parent is fixed.
2017-02-20 17:54:06 +01:00
Geert Janssens
8e20c6404e Introduce multi-split imports in the csv importer
This should be the start for round-trip export-import.
Full roundtrip is not supported yet though. Missing
is multi-currency/commodity imports.
2017-02-20 17:54:03 +01:00
Geert Janssens
4f2980ef42 Rework csv import preview with additional cleanups
- The preview part should be less chaotic now. It already has an option for future multi-split
  import functionality, but that's not used yet
- rename a few variables
- change semantics on start/end lines; this is now communicated in number of lines to skip
- avoid a couple of double value storing (once in the assistant object and onece in the import object)
2017-02-20 17:54:00 +01:00
Geert Janssens
056d20c1f7 Fix memory leaks in the draft transactions object 2017-02-20 17:53:57 +01:00
Geert Janssens
854ee31989 Cleanup commit
- improve comments
- improve variable and function names (to be more concise and to the point
- use 'Transfer Account' instead of 'Other Account' as that's the term used in the rest of gnucash
2017-02-20 17:53:55 +01:00
Geert Janssens
90e5e96f8f Rework the intermediate properties storage
The overly complex templated class hierarchy is replaced
with two simple classes. One to keep the discovered transaction
properties and one for the discovered split properties. Make
both classes responsible for verifying it's state and creating
the necessary objects.
2017-02-20 17:53:52 +01:00
Geert Janssens
d642d0804b Refactor parse_to_trans into smaller functions 2017-02-20 17:53:49 +01:00
Geert Janssens
ab6dc0f590 Add property structs for transaction vs split properties 2017-02-20 17:52:17 +01:00
Geert Janssens
91df5edaa5 Refactor pair into a tuple in preparation of extending it 2017-02-20 17:51:51 +01:00
Geert Janssens
ffa68c6b84 Factor out balance calculating function 2017-02-20 17:51:46 +01:00
Geert Janssens
0d4d92fbb4 Drop unused parameter 2017-02-20 17:51:43 +01:00
Geert Janssens
f64d217ed3 Drop remaining GError boilerplate from the c++ importer 2017-02-20 17:51:40 +01:00