Commit Graph

26820 Commits

Author SHA1 Message Date
Geert Janssens
9efbdc15cf CsvImp - use std::optional instead of boost::optional 2023-02-15 18:30:17 +01:00
Geert Janssens
c5109c67e5 MacOS - try with non-const key for map 2023-02-15 11:57:49 +01:00
Geert Janssens
1a09665333 Add proper include 2023-02-15 11:23:02 +01:00
Geert Janssens
4c5cc9f4a9 Attempt to fix build on MacOS 2023-02-15 11:00:40 +01:00
Geert Janssens
a982b60f17 Merge branch 'CsvTransImpExp' 2023-02-14 18:21:24 +01:00
Geert Janssens
6993fed229 CsvTransExp - fix info message to match state of simple format button 2023-02-14 17:58:05 +01:00
Geert Janssens
dae07fba99 CsvTransExp - treat single account as list of accounts with one element
That allows to remove another tracking variable.
2023-02-14 17:32:52 +01:00
Geert Janssens
1d971c1578 CsvTransExp - remove redundant counter num_accounts
Simply use length of account list instead
2023-02-14 17:24:11 +01:00
Geert Janssens
545f27c550 CsvTransExp - limit scope of variable to actual use 2023-02-14 16:52:13 +01:00
Geert Janssens
aa0a68fd1c CsvTransExp - repeat transaction details on every line in multi-line mode
The GnuCash Csv Importer can deal with both cases,
but there has been user feedback that the format
with only the first line displaying transaction
details is confusing and/or not readily usable
in external tools.
2023-02-14 16:47:23 +01:00
Geert Janssens
be0579dc0c CsvTransExport - more generic code cleanup
- declare variables on use
- more concise tests and loops
- drop unused includes
- gboolean->bool
2023-02-14 16:40:51 +01:00
Geert Janssens
9df059e9a5 CsvTransExport - omit trading splits unless exporting from a trading account 2023-02-14 14:52:59 +01:00
Geert Janssens
c6a93903b3 CsvTransExport - generic code cleanup
- declare variables on use
- more concise tests and loops
2023-02-14 13:10:32 +01:00
Geert Janssens
003f379d88 Bug 798600 - CSV import of multi-split security transactions fails to load capital gain - part 2
Update csv transaction export format to include split values.
In the csv importer the 'GnuCash Export Format' option will
now include values. For compatibility with filex exported
from older gnucash versions the previous preset is still
available under the name 'GnuCash Export Format (4.x and older)'.
2023-02-14 11:57:28 +01:00
Geert Janssens
9e1268d934 Bug 798600 - CSV import of multi-split security transactions fails to load capital gain - part 1
Transactions with capital gains processing can have
splits in transaction currency with a zero amount
and a non-zero value. To properly import those,
prefer the value column even if transaction
currency equals account commodity.
Previous (wrong) assumption was that in case
of a same-currency split, the amount would
always be the value.
2023-02-14 10:41:28 +01:00
Frank H. Ellenberger
232dd76562 Merge branch 'maint' 2023-02-13 19:15:12 +01:00
Christopher Lam
4d977a947a [business-core] remove gnc:split->owner 2023-02-13 23:29:00 +08:00
Christopher Lam
d53f3e68d1 Merge branch 'maint' 2023-02-13 23:28:44 +08:00
mocsa
10b73de133
Translation update by mocsa <csaba@feltoltve.hu> using Weblate
po/hu.po: 60.8% (3285 of 5401 strings; 1196 fuzzy)
553 failing checks (10.2%)
Translation: GnuCash/Program (Hungarian)
Translate-URL: https://hosted.weblate.org/projects/gnucash/gnucash/hu/

Translation update  by mocsa <csaba@feltoltve.hu> using Weblate

po/hu.po: 60.7% (3280 of 5401 strings; 1203 fuzzy)
556 failing checks (10.2%)
Translation: GnuCash/Program (Hungarian)
Translate-URL: https://hosted.weblate.org/projects/gnucash/gnucash/hu/

Translation update  by mocsa <csaba@feltoltve.hu> using Weblate

po/hu.po: 61.9% (3345 of 5401 strings; 1212 fuzzy)
562 failing checks (10.4%)
Translation: GnuCash/Program (Hungarian)
Translate-URL: https://hosted.weblate.org/projects/gnucash/gnucash/hu/

Translation update  by mocsa <csaba@feltoltve.hu> using Weblate

po/hu.po: 61.9% (3344 of 5401 strings; 1213 fuzzy)
548 failing checks (10.1%)
Translation: GnuCash/Program (Hungarian)
Translate-URL: https://hosted.weblate.org/projects/gnucash/gnucash/hu/

Translation update  by mocsa <csaba@feltoltve.hu> using Weblate

po/hu.po: 61.9% (3344 of 5401 strings; 1213 fuzzy)
534 failing checks (9.8%)
Translation: GnuCash/Program (Hungarian)
Translate-URL: https://hosted.weblate.org/projects/gnucash/gnucash/hu/

Translation update  by mocsa <csaba@feltoltve.hu> using Weblate

po/hu.po: 61.9% (3344 of 5401 strings; 1213 fuzzy)
516 failing checks (9.5%)
Translation: GnuCash/Program (Hungarian)
Translate-URL: https://hosted.weblate.org/projects/gnucash/gnucash/hu/

Translation update  by mocsa <csaba@feltoltve.hu> using Weblate

po/hu.po: 61.9% (3344 of 5401 strings; 1213 fuzzy)
507 failing checks (9.3%)
Translation: GnuCash/Program (Hungarian)
Translate-URL: https://hosted.weblate.org/projects/gnucash/gnucash/hu/

Translation update  by mocsa <csaba@feltoltve.hu> using Weblate

po/hu.po: 61.9% (3344 of 5401 strings; 1213 fuzzy)
496 failing checks (9.1%)
Translation: GnuCash/Program (Hungarian)
Translate-URL: https://hosted.weblate.org/projects/gnucash/gnucash/hu/

Co-authored-by: mocsa <csaba@feltoltve.hu>
2023-02-13 16:28:25 +01:00
Christopher Lam
851b51d547 [new-owner-report] use let* to access split->owner
oops
2023-02-13 23:27:38 +08:00
Christopher Lam
4953cf94fa [reports] use gnc:make-split->owner with guardian
Instead of a gnc:split->owner, use gnc:make-split->owner instead which
generates a split->owner function with its own hashtable. This
function (and its hash table) will be garbage collected in due course,
triggering the gncOwnerFreeing of all owners.

This is a better approach than gnc:split->owner which maintains a
single hash table. It could be buggy: a report calls gnc:split->owner
to query a split, fails to reset its hashtable via #f; the split's
owner is assigned or modified, and the next call to gnc:split->owner
will return the incorrect cached owner.
2023-02-13 23:17:02 +08:00
Geert Janssens
3f3460fec9 Bug 782141 - Import CSV - Multi-currency support can cause rounding errors
This commit introduces new column types 'Value' and 'Value (Negated)'
which can be used to indicate what the value of a split's amount
is in the transaction currency. These will only be used if the
transaction currency is different from the account commodity
of the given split. Otherwise the amount will simply be
used as value.
2023-02-13 13:08:08 +01:00
Geert Janssens
6ada3822f2 CsvTransImp - drop obsolete sanity check
Incomplete transfer split data will now be used by
the generic import matcher to create the balancing split.
2023-02-13 13:08:08 +01:00
Geert Janssens
625978cc33 CsvTransImp - rework verification code to prevent new cases of invalid transactions
With the added multi-currency support it would be possible
to create imbalanced splits. A new check is added to detect
this beforehand and prevent users from continuing.
This required much of the verification logic to be revisited.
2023-02-13 13:08:08 +01:00
Geert Janssens
57c525fb19 Remove unused function 2023-02-13 13:08:08 +01:00
Geert Janssens
4737665289 Don't use boost::optional for gnc_commodity pointers
These pointers can simply be checked for null to determine
whether they are set or not.
2023-02-13 13:08:08 +01:00
Geert Janssens
9384308b05 Remove unneeded forward declaration 2023-02-13 13:08:08 +01:00
Geert Janssens
dd83042904 CsvTxImp - make PreTrans a member of PreSplits
Before it was tracked in a separate column in the parse table.
However future checks on multi-currency inconsistencies
will be easier to implement if it's a member in each PreSplit.
2023-02-13 13:08:08 +01:00
Geert Janssens
807340bcd7 CsvTxImpProps - simplify exception handling
- catch multiple exception types in one block
  the exception handling code was the same anyway
- stop rethrowing the exception. The calling code
  doesn't need this and just ignores it.
2023-02-13 13:08:08 +01:00
Geert Janssens
81e17531b9 Csv Tx Imp Props - don't reset multi column property errors by default
This would mask errors encountered in previous columns.
2023-02-13 13:08:08 +01:00
Geert Janssens
88fd034f89 Csv Trans Imp - remove redundant test
Remainder of the code ensures a GncPreSplit account is always
set to either the base account value or a value of an account
column. It's useless to try once more to set a base account
right before creating the preliminary transactions.
2023-02-13 13:08:08 +01:00
Geert Janssens
3af9374126 GncTransPropType - use consistent naming
A few freshly added values had a superfluous _ in the name
2023-02-13 13:08:08 +01:00
Geert Janssens
e5de32fd73 Csv Trans Import - rework error propagation
Use maps and vectors to move error messages around.
Only merge them into a string right before they
need to be passed to Gtk for presentation to the user.
2023-02-13 13:08:08 +01:00
Geert Janssens
8156f42c2b Fix setting and resetting of split properties that can be set more than once
Define them as a separate group and add a function
to test for this trait. Use that function
 consistently instead of testing individual values
everywhere.
2023-02-13 13:07:52 +01:00
Geert Janssens
a31ffd1b70 Bug 797383 - Import transaction via CSV selects the commodity as a currency
..., results in an invalid transaction that is uneditable, and a corrupted price database

This commit will change the transaction currency
to the from or base account's parent account currency if
the from or base account is not denominated in a currency.
This allows to import stock transactions directly into the stock
account.
2023-02-13 12:58:14 +01:00
John Ralls
3686ad4174 Update POTFILE.in for sample-report.scm. 2023-02-12 15:19:32 -08:00
John Ralls
f292ebee47 Merge Flywire's 'Hello5' into master. 2023-02-12 14:16:18 -08:00
Szia Tomi
2b32382c78
Translation update by Szia Tomi <sziatomi01@gmail.com> using Weblate
po/hu.po: 61.9% (3344 of 5401 strings; 1213 fuzzy)
492 failing checks (9.1%)
Translation: GnuCash/Program (Hungarian)
Translate-URL: https://hosted.weblate.org/projects/gnucash/gnucash/hu/

Translation update  by Szia Tomi <sziatomi01@gmail.com> using Weblate

po/glossary/hu.po: 100.0% (216 of 216 strings; 0 fuzzy)
0 failing checks (0.0%)
Translation: GnuCash/Glossary (Hungarian)
Translate-URL: https://hosted.weblate.org/projects/gnucash/glossary/hu/

Translation update  by Szia Tomi <sziatomi01@gmail.com> using Weblate

po/hu.po: 61.8% (3343 of 5401 strings; 1214 fuzzy)
492 failing checks (9.1%)
Translation: GnuCash/Program (Hungarian)
Translate-URL: https://hosted.weblate.org/projects/gnucash/gnucash/hu/

Translation update  by Szia Tomi <sziatomi01@gmail.com> using Weblate

po/hu.po: 61.8% (3343 of 5401 strings; 1214 fuzzy)
492 failing checks (9.1%)
Translation: GnuCash/Program (Hungarian)
Translate-URL: https://hosted.weblate.org/projects/gnucash/gnucash/hu/

Co-authored-by: Szia Tomi <sziatomi01@gmail.com>
2023-02-12 16:35:52 +01:00
Kárász Attila
dd972d9d21
Translation update by Kárász Attila <cult.edie@gmail.com> using Weblate
po/hu.po: 61.8% (3343 of 5401 strings; 1214 fuzzy)
493 failing checks (9.1%)
Translation: GnuCash/Program (Hungarian)
Translate-URL: https://hosted.weblate.org/projects/gnucash/gnucash/hu/

Translation update  by Kárász Attila <cult.edie@gmail.com> using Weblate

po/hu.po: 61.8% (3342 of 5401 strings; 1214 fuzzy)
492 failing checks (9.1%)
Translation: GnuCash/Program (Hungarian)
Translate-URL: https://hosted.weblate.org/projects/gnucash/gnucash/hu/

Translation update  by Kárász Attila <cult.edie@gmail.com> using Weblate

po/hu.po: 61.8% (3341 of 5401 strings; 1214 fuzzy)
492 failing checks (9.1%)
Translation: GnuCash/Program (Hungarian)
Translate-URL: https://hosted.weblate.org/projects/gnucash/gnucash/hu/

Co-authored-by: Kárász Attila <cult.edie@gmail.com>
2023-02-12 16:35:51 +01:00
Szia Tomi
72dc75b451
Translation update by Szia Tomi <sziatomi01@gmail.com> using Weblate
po/glossary/hu.po: 100.0% (216 of 216 strings; 0 fuzzy)
0 failing checks (0.0%)
Translation: GnuCash/Glossary (Hungarian)
Translate-URL: https://hosted.weblate.org/projects/gnucash/glossary/hu/

Co-authored-by: Szia Tomi <sziatomi01@gmail.com>
2023-02-12 16:35:51 +01:00
Kryštof Černý
7def8a8e87
Translation update by Kryštof Černý <cleverline1mc@gmail.com> using Weblate
po/cs.po: 44.2% (2388 of 5401 strings; 1917 fuzzy)
704 failing checks (13.0%)
Translation: GnuCash/Program (Czech)
Translate-URL: https://hosted.weblate.org/projects/gnucash/gnucash/cs/

Co-authored-by: Kryštof Černý <cleverline1mc@gmail.com>
2023-02-12 16:35:47 +01:00
aleksej0R
3486cc7535
Translation update by aleksej0R <omolice@hotmail.fr> using Weblate
po/glossary/fr.po: 100.0% (216 of 216 strings; 0 fuzzy)
0 failing checks (0.0%)
Translation: GnuCash/Glossary (French)
Translate-URL: https://hosted.weblate.org/projects/gnucash/glossary/fr/

Co-authored-by: aleksej0R <omolice@hotmail.fr>
2023-02-12 16:35:46 +01:00
mocsa
16015110de
Translation update by mocsa <csaba@feltoltve.hu> using Weblate
po/hu.po: 61.8% (3341 of 5401 strings; 1213 fuzzy)
491 failing checks (9.0%)
Translation: GnuCash/Program (Hungarian)
Translate-URL: https://hosted.weblate.org/projects/gnucash/gnucash/hu/

Co-authored-by: mocsa <csaba@feltoltve.hu>
2023-02-12 16:35:46 +01:00
Geert Janssens
76d742c6e3 Fixup csv price import assistant reset
A few lines were missing in my previous commit
2023-02-07 21:16:32 +01:00
Geert Janssens
66660c02fb Only reset csv importer internal state if new file is selected
The changes from
8ed40078b0
and
78c8e8f3af
caused the importers to reset everything in the preview page whenever opening this
page, including when navigating back from a future page. This can be very frustrating
if many settings were adjusted but one went back just to tweak a single one.

With these changes the importer will only be reset whenever the user selects a
different file in the file chooser. So even navigating back to the file chooser,
but not changing files will keep the import state.
2023-02-07 19:36:08 +01:00
Geert Janssens
0c3807414a Generic Importer - allow user to modify exchange rates for unbalanced transactions
With the improved support for multi-currency imports, it
can happen an incomplete transaction needs an exchange
rate (or balancing split amount) before the transaction
can be imported. This commit adds a context menu entry
to set exchange rates on such transactions.
The menu is only enabled for unbalanced transactions
for a destination account has been set.
2023-02-07 17:44:59 +01:00
Geert Janssens
fb8c0ab039 Bug 796955 - Import CSV - Single-line two-currency transactions can't be imported
Calculation using price from csv data was still backwards.
This commit fixes it.
2023-02-07 17:44:59 +01:00
Geert Janssens
27764908e6 Import matcher - remove a few redundant tests with GLists 2023-02-07 17:44:58 +01:00
Geert Janssens
b8a14c172f Import-matcher.c - C99 fun
- introduce bool
- declare variables on first use
2023-02-07 17:44:53 +01:00
Geert Janssens
b862142e82 Bug 793306 - Price is not imported from CSV
This is really a variation of bug 796955, except that in this case
even less data was provided in the csv file, so we needed
extra code to defer second split generation to the generic import
matcher.

The missing details can be either transfer account,
transfer amount and/or price.

The generic import matcher has more options to find this
information: the transfer account can be guessed from
import maps or manually selected by the user.
Only when that one is known, we can consider transfer
amount. In a single currency situation, this is easy.
In the multi-currency case we currently need either
a price or a transfer amount from the csv import data.
2023-02-07 17:41:30 +01:00