Bug 399094

Summary: Plugin for accessing transaction bills
Product: [Applications] kmymoney Reporter: Ralf Habacker <ralf.habacker>
Component: importerAssignee: KMyMoney Devel Mailing List <kmymoney-devel>
Status: REPORTED ---    
Severity: wishlist CC: mahueb55
Priority: NOR    
Version: 4.8.2   
Target Milestone: ---   
Platform: Other   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=378937
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Ralf Habacker 2018-09-26 08:19:11 UTC
Nowadays, many invoices are sent by email or can be accessed via a website, e.g. Amazon, Vodafone, etc.. When managing current accounts, it would be helpful if a transaction could be used to download or view the corresponding invoice in the account book.
With the extension one would have to be able to indicate an email account, over which the appropriate calculation is searched and downloaded.
Comment 1 Ralf Habacker 2018-09-27 07:45:32 UTC
The basic procedure for fetching email attachments from an IMAP server is shown in the php script of https://stackoverflow.com/questions/44801931/how-can-i-download-all-files-attachments-in-php

In the KDE context this would be possible via the IMAP kioslave plugin, which can be called e.g. in the KDE4 environment with kioclient.

1. retrieve a list of emails containing '231549460-0002' in the subject line
    kioclient ls 'imaps://<username>@<host>/INBOX/;?SUBJECT%20231549460-0002'
     INBOX
     45870
     45871
2. downloading the e-mail concerned
    kioclient cat 'imaps://<username>@<host>/INBOX/;UID=45870'

The imap kioslave plugin is currently not available for KF5 (see https://phabricator.kde.org/T9758)
Comment 2 Thomas Baumgart 2018-09-30 16:04:40 UTC
I am not sure if using a (personal) IMAP account as the source is a good idea. This will only work in single user environments. Bug 378937 contains a wishlist item to store arbitrary files and attach them to a transaction/split. Since the source is not only e-mail but could also be a website that allows downloading the invoice, I suggest to create a mechanism that allows to store the invoice files in a defined location (probably per KMyMoney file). The default for such location could be the one returned by  QStandardPaths::writableLocation(AppLocalDataLocation). Anyway, it should be user configurable and supporting network drives. Attaching any file to a transaction would make a copy of that file and store it in the above mentioned location.
Comment 3 mahueb55 2018-10-01 05:10:05 UTC
(In reply to Thomas Baumgart from comment #2)
> [...] Bug 378937 contains a
> wishlist item to store arbitrary files and attach them to a
> transaction/split. [...]

fyi: I've been working on that and have a ~80% solution built for that (although that's currently only storing references to existing files and doesn't create copies - changing that shouldn't be that big of a deal though). Will have to find some time in the next couple of days to clean this up, rebase and submit a review request. Just thought it's worth mentioning before someone else picks this up.