Summary: | MS Money import: Ignore (/import?) Classifications | ||
---|---|---|---|
Product: | [Applications] skrooge | Reporter: | A D <kdebugs5828> |
Component: | general | Assignee: | Stephane MANKOWSKI <stephane> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | NOR | ||
Version First Reported In: | 25.1.0 | ||
Target Milestone: | 25.1.0 | ||
Platform: | Ubuntu | ||
OS: | Linux | ||
Latest Commit: | https://invent.kde.org/office/skrooge/-/commit/96028dee6b2b6857e8f295a50efd1ead00aca0b0 | Version Fixed In: | |
Sentry Crash Report: | |||
Attachments: |
Screenshots of classifications in MS Money and Skrooge
zip file containing MS Money file transactions.json with class1 and class2 fields |
Created attachment 185413 [details]
zip file containing MS Money file
MS Money file contains
Classification 1: Holidays
- Ibiza 2024
- Russia 2023
- - Moscow
- - St Petersburg
Classification 2: UserDefined
- UserDefined-Sub-1
- - Sub-sub-1
- - Sub-sub-2
- UserDefined-Sub-2
One account with 3 transactions, with different Classifications on them.
Git commit 031b8599ac804bfe9a1966b2026e284de191a66e by Stéphane MANKOWSKI. Committed on 01/10/2025 at 19:40. Pushed by smankowski into branch 'master'. 510115: MS Money import: Ignore (/import?) Classifications M +3 -2 CHANGELOG M +18 -15 plugins/import/skrooge_import_mny/skgimportpluginmny.cpp A +- -- tests/input/skgtestimportmny3/510115.mny M +22 -0 tests/skgbankmodelertest/skgtestimportmny3.cpp https://invent.kde.org/office/skrooge/-/commit/031b8599ac804bfe9a1966b2026e284de191a66e I did a fix but only for the minimum. Indeed, I don't have the relevant information in json files and I can not modify sunriize. Created attachment 185458 [details] transactions.json with class1 and class2 fields (In reply to Stephane MANKOWSKI from comment #3) > I did a fix but only for the minimum. > Indeed, I don't have the relevant information in json files and I can not > modify sunriize. I've modified the sunriise jar to include "class1" and "class2" elements in the transaction json - see attached, produced from the .mny file in this bug. (I tried to attach the modified jar itself, but it's 18MB and there's a 4000KB limit on attachments in here. ) With a modified sunriise jar, might it then be possible to convert MS Money Classifications into Skrooge Trackers? (I've only been using classifications in MS Money for a few years, so I don't have _too_ many of them. I'm sure I can get Money to report all transactions in the various sub-classifications I have and then I can manually enter them as Trackers in Skrooge, but you know, it's manual, tedious and error prone and nowhere near as much fun as writing code to do it! Plus, it makes the Skrooge MS Money importer that bit better for anyone else coming this way in the future.) At this stage, this is more asking "can it be done?". If the answer is "yes", then there's probably still a bit more work to be done in sunriise to export the top level of the classifications (effectively decoding classificationID in categories.json - either adding something into categories.json, alongside classificationID, or in a separate classifications.json file). It would also be right/necessary to post the modified sunriise source code somewhere too. Could you send me by email (you can find it in the About of Skrooge) the new version of sunriize ? Git commit 54959d105b60c76d32952950a11917fc0e42d905 by Stéphane MANKOWSKI. Committed on 03/10/2025 at 16:36. Pushed by smankowski into branch 'master'. 510115: MS Money import: Ignore (/import?) Classifications M +24 -0 plugins/import/skrooge_import_mny/skgimportpluginmny.cpp M +2 -0 plugins/import/skrooge_import_mny/skgimportpluginmny.h M +2 -0 tests/skgbankmodelertest/skgtestimportmny3.cpp https://invent.kde.org/office/skrooge/-/commit/54959d105b60c76d32952950a11917fc0e42d905 (In reply to Stephane MANKOWSKI from comment #6) > Git commit 54959d105b60c76d32952950a11917fc0e42d905 by Stéphane MANKOWSKI. > Committed on 03/10/2025 at 16:36. > Pushed by smankowski into branch 'master'. > > 510115: MS Money import: Ignore (/import?) Classifications Thanks, that looked easier than I thought it might be! :-) It's a step in the right direction, but (unfortunately) not quite the full solution needed. This only handles Classification 1 and ignores Classification 2 (I use "Holidays" as Classification 1 and "Projects" as Classification 2, with various items in two levels in both of those). 1) When creating the trackers (at line 208), it needs to be (classificationId == 1 || classificationId == 2) (or even just else ...) 2) In Money, Classifications are trees (like Categories), but the Trackers in Skrooge are just a list, so the Tracker name (line 214) needs to include the path through the tree, not just the leaf name from the category list. (Some of my "Projects" have the same "sub-sub-classifications", so without the "path", there would be several Trackers with the same name.) Something like... If category["parentId"] is null, then the Tacker name needs to be category["classTypeName"] + " : " + category["name"] else (when "parentId" is not null) the Tracker name needs to be m_mapIdTracker[parentId].name + " : " + category["name"] 3) Adding trackers to the transactions needs to consider operation["class2"], as well as "class1". If they're both not empty, then just use one of them (probably "class1") but either emit a warning (similar to the "split repaired" warning) or maybe add the name of the missing Tracker ("class2") to the end of the transaction comment? If class1 is empty and class2 is not empty, use class2 as the tracker. The test file should result in 8 trackers. The third transaction has both class1 and class2 set. I'm sorry that's extra work. If you've had enough of Money importer changes, I'm quite happy to code this and provide a patch - just let me know (but I suspect as you know the code, it will be quicker for you to do it). Thank you! Also, as this needs the modified sunriise.jar, does the jar name (at lines 127 and 131) need to change (sunriise_v2.jar maybe?), so that existing installations "upgrade" to the modified jar? Git commit 96028dee6b2b6857e8f295a50efd1ead00aca0b0 by Stéphane MANKOWSKI. Committed on 05/10/2025 at 17:13. Pushed by smankowski into branch 'master'. 510115: MS Money import: Ignore (/import?) Classifications M +23 -7 plugins/import/skrooge_import_mny/skgimportpluginmny.cpp M +12 -0 tests/skgbankmodelertest/skgtestimportmny3.cpp https://invent.kde.org/office/skrooge/-/commit/96028dee6b2b6857e8f295a50efd1ead00aca0b0 |
Created attachment 185412 [details] Screenshots of classifications in MS Money and Skrooge SUMMARY Alongside Payees and Categories, MS Money can also have up to 2 "Classifications" per transaction - these are very similar to Trackers in Skrooge. See the "Add Classification" screenshot for the MS Money introduction Each of the classifications can be set to one of 6 pre-defined types (Family members, Properties, Projects, Hobbies, Holidays and Job expenses) or a user defined type. Each Classification is then a tree of user defined sub-classifications. Each can sub-classification can have a further level of sub-sub-classifications. (Each tree can only be up to two levels deep.) Each Transaction can have zero, one or two classifications (up to one of each) set for it - see the Transaction screenshot. The classifications are held in the CAT table in MS Money and appear in the categories.json file from sunriise - regular categories have classificationId == 0, while classifications are 1 or 2. Skrooge currently imports the classifications, but places them in the Categories, at the top level, alongside EXPENSE and INCOME - see Skrooge screenshot. Unfortunately, the classifications set for a transaction don't (currently?) appear in transactions.json, if they did, maybe they could then be imported as trackers in Skrooge? (The classifications on transactions are columns IHcls1 and IHcls2 in the MS Money TRN table. The Classifications are in the CT table e.g. 0:Categories, 1:Holidays 2:UserDefined.) STEPS TO REPRODUCE 1. Start with a New document. Remove unused categories (i.e. all of them) 2. Import a MS Money file containing transactions with classifications (I'll attach) 3. Look at the categories list OBSERVED RESULT Classifications are imported alongside the categories (see screenshot) EXPECTED RESULT Minimum: The Skrooge import should ignore the classifications (classificationId != 0) and not add them to the Categories tree. Maybe: Skrooge could import classifications as trackers, but this would require a change to sunriise to export them for transactions first. As Skrooge trackers are a one dimensional list, each leaf in the classification trees would become a tracker, named something like "Holidays: Russia 2023: Moscow" to reflect the path to the leaf. (The user would then either have to manually consolidate the sub-sub-classifications or create reports etc that include all "Russia 2023: x" trackers to obtain all transactions relating to "Russia 2023".) The importer would probably just have to report an error if a transaction has two classifications (assuming that a Skrooge transaction can only have one tracker associated with it?) - I don't think it's very common for a transaction to have two classifications anyway?