Bug 452024 - Date Format when using CSV Importer --> Make QIF File
Summary: Date Format when using CSV Importer --> Make QIF File
Status: RESOLVED FIXED
Alias: None
Product: kmymoney
Classification: Applications
Component: importer (show other bugs)
Version: unspecified
Platform: unspecified All
: NOR wishlist
Target Milestone: ---
Assignee: KMyMoney Devel Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-03-29 06:42 UTC by mrbee
Modified: 2022-04-07 04:19 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Setting up a QIF profile (74.63 KB, image/png)
2022-04-01 07:19 UTC, Thomas Baumgart
Details

Note You need to log in before you can comment on or make changes to this bug.
Description mrbee 2022-03-29 06:42:59 UTC
SUMMARY
Date Format when using Import --> CSV --> Make QIF File is hard-coded MM/DD/YYYY and not suitable for certain countries.
https://invent.kde.org/office/kmymoney/-/blob/master/kmymoney/plugins/csv/import/bankingwizardpage.cpp#L435

STEPS TO REPRODUCE
File --> Import --> CSV --> Make QIF File at the end of the dialog just before importing CSV

OBSERVED RESULT
The exported QIFs are in the date format MM/DD/YYYY and there's no way to change that to DD/MM/YYYY or a different format.

EXPECTED RESULT
Localized Date Format or one you can choose.
Comment 1 Dawid Wróbel 2022-03-29 09:08:17 UTC
Out of curiosity — what is your use case for converting from CSV to QIF using that dialog? I was hoping on removing this functionality altogether, as it is not within the scope of CSV importer and the KMyMoney itself.
Comment 2 mrbee 2022-03-29 09:29:02 UTC
Some financial institutions don't provide QIF exports unfortunately. Some of them just do CSVs. I mostly create QIFs for archiving purposes and I find it easier to work with and use it with other financial software. Make QIF File is a handy feature as it eliminates the extra step of doing a separate QIF export.
Comment 3 Jack 2022-03-29 14:26:37 UTC
Might there be a way for the csv importer to call the qif exporter for the set of transactions it just imported?
Comment 4 Thomas Baumgart 2022-03-30 06:01:34 UTC
Yes, I have something in the works.
Comment 5 Thomas Baumgart 2022-03-30 07:06:33 UTC
Git commit 2124266bee9cf83077d30d19aa8716cc31994a55 by Thomas Baumgart.
Committed on 30/03/2022 at 07:05.
Pushed by tbaumgart into branch 'master'.

Use selected QifProfile when creating QIF copy of CSV import file

M  +21   -16   kmymoney/plugins/csv/import/bankingwizardpage.cpp
M  +13   -12   kmymoney/plugins/csv/import/bankingwizardpage.h
M  +33   -9    kmymoney/plugins/csv/import/csvwizard.cpp
M  +33   -30   kmymoney/plugins/csv/import/investmentwizardpage.cpp
M  +30   -29   kmymoney/plugins/csv/import/investmentwizardpage.h

https://invent.kde.org/office/kmymoney/commit/2124266bee9cf83077d30d19aa8716cc31994a55
Comment 6 mrbee 2022-04-01 03:01:22 UTC
That was quick, thanks heaps for that Thomas.

Just tried out a clean nightly 1471-windows install and I can see the drop down QIF export profile option in the CSV Importer. Unfortunately it's empty and I cannot select a profile. Tried to create a new one but still cannot see or choose anything.

The exported QIF file is now DD.MM.YYYY and it always seems to be this way no matter what date format I put into the default profile. Therefore I assume that the default profile currently has no effect.

Thanks for looking into this.
Comment 7 Thomas Baumgart 2022-04-01 07:19:36 UTC
Created attachment 147874 [details]
Setting up a QIF profile

Follow these steps to create a new QIF profile:

1) select QIF import plugin (export also works)
2) open its configuration
3) create a new profile
4) provide it a name
5) modify the settings

Press OK to save it. Hope that helps. If you still find problems, then please report them here.
Comment 8 mrbee 2022-04-01 07:34:02 UTC
That's exactly what I did. I currently have 3 profiles in the QIF Importer/Exporter, the default one and 2 test profiles. Can't select any of them in the CSV Importer. They simply don't show up. None of the 3 profiles do.
Comment 9 Jack 2022-04-01 22:26:38 UTC
I confirm this behavior.  During the csv import process, I see nowhere to specify or select a QIF profile to use for the export.
Comment 10 Thomas Baumgart 2022-04-02 06:01:53 UTC
Answering the last two entries:
a) since you're using windows it might be an OS related problem why KMyMoney does not populate the combo box. I'll look into that.
b) The CSV settings only allow to select a profile, not to define it. That is covered in the QIF settings.
Comment 11 Thomas Baumgart 2022-04-02 08:59:48 UTC
Git commit 6f3901866aac5185248cc8b99459b9958cc29bc3 by Thomas Baumgart.
Committed on 02/04/2022 at 08:59.
Pushed by tbaumgart into branch 'master'.

Fix initial loading of QIF profiles in the CSV importer settings

The combo box remained empty when used on a fresh install (no settings
on file). This change fixes that and provides a tooltip about what to do
if no profile is available.

M  +11   -0    kmymoney/plugins/csv/import/kcm_csvimporter.cpp

https://invent.kde.org/office/kmymoney/commit/6f3901866aac5185248cc8b99459b9958cc29bc3
Comment 12 mrbee 2022-04-04 02:06:02 UTC
I am now able to select a profile, thanks for that.

Unfortunately the exported QIF file is still always in the format DD.MM.YYYY no matter what I define in the QIF profile.

%d/%m/%yy --> DD.MM.YYYY
%d/%m/%yyyy --> DD.MM.YYYY
%m-%d-%yyyy --> DD.MM.YYYY
%mmm/%d/%yyyy --> DD.MM.YYYY
Comment 13 Thomas Baumgart 2022-04-04 09:19:41 UTC
Git commit fc00d78ae19ce80ec18a1e079148be38d2ff2bf8 by Thomas Baumgart.
Committed on 04/04/2022 at 09:19.
Pushed by tbaumgart into branch 'master'.

Prepend leadin to profile names in defined location

Prepending the "Profile-" leadin was done in too many locations which
caused loading the profile to fail when it was forgotten in the code.
This change makes sure that the leadin is only used within the profile
object but not the outside world.

M  +20   -17   kmymoney/mymoney/mymoneyqifprofile.cpp
M  +1    -1    kmymoney/mymoney/mymoneyqifprofile.h
M  +1    -1    kmymoney/plugins/qif/config/mymoneyqifprofileeditor.cpp
M  +7    -7    kmymoney/plugins/qif/export/kexportdlg.cpp
M  +1    -1    kmymoney/plugins/qif/export/mymoneyqifwriter.cpp
M  +8    -8    kmymoney/plugins/qif/import/kimportdlg.cpp
M  +1    -1    kmymoney/plugins/qif/import/mymoneyqifreader.cpp

https://invent.kde.org/office/kmymoney/commit/fc00d78ae19ce80ec18a1e079148be38d2ff2bf8
Comment 14 mrbee 2022-04-07 04:19:00 UTC
Just did some tests and it works beautifully.

Two things I'd like mentioning:
1. Whenever you change a profile in CSV Exporter you need to restart KMyMoney in order to get the new profile working. Otherwise it will keep using the date format from the previous profile. No big deal really, just need to be aware of that.

2. While testing I came across a possible small bug. Exports in date format %d/%m/%yy result in dd/mm'yy (notice the apostrophe after mm). Haven't tested many other date formats.

This date export format problem has been bugging me for quite a while and I am extremely happy that you have found an awesome solution to that.

Thanks Thomas and everyone else for your relentless support. Really appreciate it.