Bug 437481 - Wish links to corresponding documents
Summary: Wish links to corresponding documents
Status: RESOLVED FIXED
Alias: None
Product: kmymoney
Classification: Applications
Component: general (show other bugs)
Version: 5.1.1
Platform: Other Linux
: NOR wishlist
Target Milestone: ---
Assignee: KMyMoney Devel Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-05-22 08:30 UTC by Fabiano Caruana
Modified: 2024-10-30 09:06 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.2.0
Sentry Crash Report:


Attachments
Screenshot how to configure payee based links (75.82 KB, image/png)
2022-07-13 08:38 UTC, Ralf Habacker
Details
Screenshot showing payee based links in ledger (25.53 KB, image/png)
2022-07-13 08:39 UTC, Ralf Habacker
Details
My Example with category (31.16 KB, image/png)
2022-07-13 14:02 UTC, Fabiano Caruana
Details
Patch based on branch-4.8 (19.28 KB, patch)
2022-07-14 15:31 UTC, Ralf Habacker
Details
Document Vodafon (17.43 KB, image/png)
2022-10-06 09:38 UTC, Fabiano Caruana
Details
Payee with empty fields (5.84 KB, image/png)
2022-10-06 12:32 UTC, Fabiano Caruana
Details
testcase (30.43 KB, text/xml)
2024-10-30 08:36 UTC, Ralf Habacker
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Fabiano Caruana 2021-05-22 08:30:43 UTC
Hello KMyMoney team,

As I get more and more "lazy" with increasing age, I would like to add a new feature in KMyMoney, namely a link to one (or more) PDF-documents. I can always find my documents, but it would be a huge relief if I could simply call up the corresponding document in the booking with a click (or a key combination).
Could this be feasible?

Thank you.

greetings
Udo
Comment 1 Jack 2021-05-22 14:53:43 UTC
As a temporary workaround, could you just add the link to the memo field?  You  might have to copy/paste into a browser or file manager (URL vs full file path) to get it to open instead of just clicking, but it's a start.
Comment 2 antoine 2021-05-22 19:53:16 UTC
this issue seems to be similar to https://bugs.kde.org/show_bug.cgi?id=274021
Comment 3 Fabiano Caruana 2021-05-25 07:19:51 UTC
To Jack:

That is also my approach at the moment. If only the link address is in the comment field, Ctrl + a can be used to mark it nicely, but if there is more information in the field, I must first mark the part of the with the mouse. Of course, it would be nice if I just "click" and ... voila ... the document is there. :-)

To Antoine:
Sorry, I didn't find that. I searched for "corresponding document".

greetings
Udo
Comment 4 Fabiano Caruana 2022-07-12 11:36:47 UTC
Hi KMyMoney team,

I would like to ask if anything is planned in the meantime.
Since I'm in the process of digitizing my paper receipts at the moment, I could combine the two wonderfully.

My current plan is to create a category named "Beleg" and store the link to the receipt with a split posting.
I have already written a utility with xdotool that I can call up the document with a simple keystroke.
But before I record everything in this way, it would be important for me to know whether something is planned. I just don't want to do everything twice.

The indisputable "Skrooge" can do this and I can import all data from KMyMoney just fine.
But Skrooge is otherwise really "terrible"

Thank you for your information.

Greetings
Udo
Comment 5 Ralf Habacker 2022-07-13 08:38:14 UTC
Created attachment 150578 [details]
Screenshot how to configure payee based links

It would need to be considered what that should look like specifically.

For example, I once implemented a function for my needs that supports payee-based links for transactions (see screenshots)
Comment 6 Ralf Habacker 2022-07-13 08:39:03 UTC
Created attachment 150579 [details]
Screenshot showing payee based links in ledger
Comment 7 Fabiano Caruana 2022-07-13 14:02:09 UTC
Created attachment 150584 [details]
My Example with category
Comment 8 Fabiano Caruana 2022-07-13 14:02:41 UTC
Hi Ralf,

Thank you for your example.
But it looks like the payee always has the same address.
Or can you edit the address in the booking form?
But in this form it would be OK, although I prefer the 1-line display myself, but have always activated the booking form.

I need different addresses (usually PDF) for each process, and in my case the associated invoices.
See my example with the category and split booking.

Greetings
Udo
Comment 9 Thomas Baumgart 2022-07-13 15:28:46 UTC
I envision a feature that allows to attach multiple documents (links, references, ...) per transaction. They should be accessible from any account that references the transaction. I don't support misusing an extra split to store this information.
Comment 10 Fabiano Caruana 2022-07-14 10:42:51 UTC
Hi Thomas,

The idea of misusing split postings is based on the use of "Sales Line" (and many other tables) in "Microsoft Dynamics" (formerly "Navision"). These can be of various types such as [(Text),G/L Account,Item,Resource,Fixed Asset,Charge (Item)].

Please don't be angry with me, but this use for documents is currently the only manageable way to manage and view the documents without great effort.

If KMyMoney offers another solution in the future, it would be no problem for me to remove these split entries again, since I work with an SQLite backend. And because the split bookings are entered with zero values, I see no problems with the database consistency.

Greetings
Udo
Comment 11 Ralf Habacker 2022-07-14 11:29:59 UTC
> Thank you for your example.
> But it looks like the payee always has the same address.

I did set `(\d+\d+\d+)` into the id pattern field and  `https://www.amazon.com/...%1` into the url template field of the my payee for example "amazon".

> Or can you edit the address in the booking form?

In the booking form I enter the order number into the memo field of the related transaction e.g. `xxx-yyyy-zzzz` which x,y,z all numbers and get a link to the related order at the amazon web site.
 
> I need different addresses (usually PDF) for each process, and in my case the associated invoices.
> See my example with the category and split booking.

That would be configured with:
1. add payee `vodafone` if not present
2. set url template to `file:///Common/Documents/Vodafone/Rechnungen/%1'
3. in the id pattern field set `(Rechnung_\d+.pdf)` 
4. assign related transaction to payee `vodafone` and add `Rechnung_3668468554.pdf` to the memo field
6. save transaction

Then you would see the term `Rechnung_3668468554.pdf` be underlined in the related transaction to indicate a matching link.

After selecting this transaction the link can be opened by mouse right click and pressing `open url` or by the associate keyboard shortcut.

Cheers
Ralf
Comment 12 Fabiano Caruana 2022-07-14 12:22:21 UTC
Hi Ralf,

That looks very good and after a few tries I would definitely be able to do it.
Too bad... KMyMoney doesn't offer me this feature.

If this is in "kmymoney-master" (latest AppImage), I cannot start it with error messages.
Not in OpenSUSE 15.4
Not in OpenSuse Tumbleweed
Not in Manjaro 21.3.3

Greetings
Udo
Comment 13 Ralf Habacker 2022-07-14 14:46:07 UTC
> If this is in "kmymoney-master

I added this to a local copy of kmymoney sources, which needs to be adjust to work with kmymoney from master branch.
Comment 14 Fabiano Caruana 2022-07-14 14:59:51 UTC
Hi Ralf,

So no chance for me?
I'm not familiar with Devil or anything like that

Greetings
Udo
Comment 15 Ralf Habacker 2022-07-14 15:31:15 UTC
Created attachment 150622 [details]
Patch based on branch-4.8
Comment 16 Ralf Habacker 2022-07-14 15:38:36 UTC
(In reply to Ralf Habacker from comment #15)
> Created attachment 150622 [details]
> Patch based on branch-4.8

The master branch has undergone major changes, so it will probably have to be rewritten in some points. I think that hints are needed to accomplish this.
Comment 17 Fabiano Caruana 2022-07-14 15:49:36 UTC
Hi Ralf,

Try to convince Thomas for this project.
I would be glad.

Many Thanks.

Greetings
Udo
Comment 18 Ralf Habacker 2022-07-23 15:23:19 UTC
(In reply to Ralf Habacker from comment #6)
> Created attachment 150579 [details]
> Screenshot showing payee based links in ledger

I looked at how this could be implemented in the kmymoney master branch and found that there is no support for underlining text fragments when displaying transactions, as was possible in KDE4 times.

The relevant place is https://invent.kde.org/office/kmymoney/-/blob/master/kmymoney/views/journaldelegate.cpp#L481
Comment 19 Fabiano Caruana 2022-07-27 08:59:47 UTC
Hello Ralf,

I think that a quick solution is probably not possible and, as already described above, I will "misuse" the split posting (even if Thomas disapproves of this).
I would like to scan my paper invoices and reference them in KMyMoney soon.

Many thanks for your effort.

Greetings
Udo
Comment 20 Bug Janitor Service 2022-07-27 16:44:10 UTC
A possibly relevant merge request was started @ https://invent.kde.org/office/kmymoney/-/merge_requests/149
Comment 21 Ralf Habacker 2022-07-27 16:49:22 UTC
(In reply to Ralf Habacker from comment #18)
> I looked at how this could be implemented in the kmymoney master branch

Finally, I rearranged the patch for the master branch for which the mentioned merge request was made. If you can build kmymoney from source code, you get this feature immediately, otherwise you would have to wait until it was reviewed and merged.
Comment 22 Fabiano Caruana 2022-07-28 10:06:46 UTC
Ok Ralf ... I'll wait.

Maybe I'll delve into the marvel of compilation and building as well.
Because the current master app image breaks off for me (OpenSuse 15.4 and Tumbleweed, and Manjaro 21.3.5), but it has been for some time. And the Last Successful Artifacts is also about a week old.

Greetings and have a nice day
Udo
Comment 23 Fabiano Caruana 2022-10-06 09:38:23 UTC
Created attachment 152611 [details]
Document Vodafon
Comment 24 Fabiano Caruana 2022-10-06 09:38:54 UTC
Hello Ralf,

I dared and set up a development test system. After a few attempts, I managed to compile your version "kmymoney-work-437481-payee-link-support" and get it running.
I then set up the Payee "Vodafon" according to your specifications for testing and then entered the receipt in the memo field.
Lo and behold... called "Open URL" in the context menu (and added a shortcut) and have the corresponding document .
Great !!! This is exactly what I wanted (see screenshot "Vodafon")

Thanks alot !!!

Now my questions:
Can I also use your version "kmymoney-work-437481-payee-link-support" for live operation? Or would you still advise me against it and wait until this function is implemented in an official version (5.2?).
I would love to start using it like this.
I will definitely test with several Payees.

Thanks again !!

Greetings from Riegelsberg
Udo
Comment 25 Fabiano Caruana 2022-10-06 11:19:15 UTC
Hello Ralf,

Unfortunately, Payee does not store the "Link Matching" data in a SQLite backend. So for my tests I need to use an xml backend.
Of course, this version is not yet suitable for live operation (I use SQLite with a password).
But I can "play" ...

Greetings from Riegelsberg
Udo
Comment 26 Ralf Habacker 2022-10-06 12:02:57 UTC
(In reply to Fabiano Caruana from comment #25)
> Unfortunately, Payee does not store the "Link Matching" data in a SQLite backend. 

Hmmh, sql write support has been added, see  https://invent.kde.org/office/kmymoney/-/merge_requests/149/diffs#12a772abd18634860550279a5ae897eecdbd0a2c_1029_1029 and related locations, but I have not tested this support yet.
Comment 27 Fabiano Caruana 2022-10-06 12:32:25 UTC
Created attachment 152618 [details]
Payee with empty fields
Comment 28 Fabiano Caruana 2022-10-06 12:34:10 UTC
Hi Ralf,

die fields in Payee after saving in SQLite (without password) are empty ... (see attachement).

greetings
Udo
Comment 29 Ralf Habacker 2022-10-06 14:03:37 UTC
(In reply to Fabiano Caruana from comment #28)
Hi Udo

> die fields in Payee after saving in SQLite (without password) are empty ...

thanks for reporting - should be fixed now.
Comment 30 Fabiano Caruana 2022-10-06 14:52:16 UTC
Hi Ralf,

Not Muhammad Ali, You are the Greatest !!!

Many thanks !!!

grettings from Riegelsberg
Udo
Comment 31 Ralf Habacker 2024-10-30 08:36:50 UTC
Created attachment 175358 [details]
testcase
Comment 32 Ralf Habacker 2024-10-30 09:06:20 UTC
Git commit cff9e730ddc216fd5924e8a9fd24dce6922064cc by Ralf Habacker.
Committed on 30/10/2024 at 08:50.
Pushed by habacker into branch 'master'.

Add doc for payee links

M  +80   -3    doc/details-payees.docbook
A  +-    --    doc/payee_link-matching-ledger.png
A  +-    --    doc/payee_link-matching.png

https://invent.kde.org/office/kmymoney/-/commit/cff9e730ddc216fd5924e8a9fd24dce6922064cc
Comment 33 Ralf Habacker 2024-10-30 09:06:28 UTC
Git commit 4c86b5b1e490f95889d7df04cc19816169d56ea3 by Ralf Habacker.
Committed on 30/10/2024 at 08:49.
Pushed by habacker into branch 'master'.

Adding payee-based links in the memo field of transactions

For this purpose, a new tab entry “Link Matching” has been
added to the processing interface for payees, which contains
two input fields, one for a pattern for identifiers and one
for a url template with a placeholder “%1”.

If these fields are filled for a recipient, a matching
identifier is searched for in the memo field in the general
ledger view for transactions that are assigned to this
recipient and, if found, marked accordingly and inserted
into the url template.

The link created in this way can be opened via the new
“Open URL” entry in the context menu, via a keyboard
shortcut if configured in the settings and in the form
view and editor of a transaction via a displayed link.

Simple examples of a pattern are \d{10} for a 10-digit
number or “\d+-\d+” for two blocks of numbers connected
with a hyphen.
FIXED-IN:5.2.0

M  +53   -0    kmymoney/kmymoney.cpp
M  +2    -0    kmymoney/kmymoney.h
M  +2    -0    kmymoney/kmymoneyui.rc
M  +1    -0    kmymoney/menus/menuenums.h
M  +4    -0    kmymoney/mymoney/mymoneyenums.h
M  +65   -1    kmymoney/mymoney/mymoneypayee.cpp
M  +8    -0    kmymoney/mymoney/mymoneypayee.h
M  +5    -0    kmymoney/mymoney/mymoneypayee_p.h
M  +17   -1    kmymoney/mymoney/storage/journalmodel.cpp
M  +12   -0    kmymoney/mymoney/storage/payeesmodel.cpp
M  +1    -0    kmymoney/mymoney/xmlhelper/xmlstoragehelper.h
M  +2    -0    kmymoney/plugins/sql/mymoneydbdef.cpp
M  +15   -7    kmymoney/plugins/sql/mymoneystoragesql.cpp
M  +2    -0    kmymoney/plugins/sql/mymoneystoragesql_p.h
M  +2    -0    kmymoney/plugins/xml/mymoneystoragenames.cpp
M  +2    -0    kmymoney/plugins/xml/mymoneystoragenames.h
M  +11   -0    kmymoney/plugins/xml/mymoneyxmlreader.cpp
M  +6    -0    kmymoney/plugins/xml/mymoneyxmlwriter.cpp
M  +5    -5    kmymoney/views/journaldelegate.cpp
M  +5    -0    kmymoney/views/kmymoneyview.cpp
M  +25   -0    kmymoney/views/kpayeesview.cpp
M  +1    -0    kmymoney/views/kpayeesview.h
M  +112  -0    kmymoney/views/kpayeesview.ui
M  +9    -0    kmymoney/views/kpayeesview_p.h
M  +24   -0    kmymoney/views/newtransactioneditor.cpp
M  +10   -0    kmymoney/views/newtransactioneditor.ui
M  +25   -0    kmymoney/views/newtransactionform.cpp
M  +8    -1    kmymoney/views/newtransactionform.ui

https://invent.kde.org/office/kmymoney/-/commit/4c86b5b1e490f95889d7df04cc19816169d56ea3