After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 336843 - RFE: Attach images/files/urls to transactions.
RFE: Attach images/files/urls to transactions.
Status: RESOLVED FIXED
Product: GnuCash
Classification: Other
Component: General
git-master
Other All
: Normal enhancement
: ---
Assigned To: gnucash-general-maint
gnucash-general-maint
: 113093 464120 481961 540222 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2006-04-01 15:31 UTC by Adam Buchbinder
Modified: 2018-06-29 21:00 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch to store file URIs per transaction (24.93 KB, patch)
2013-11-09 14:26 UTC, Patrick
none Details | Review
Patch to store file/location URIs per transaction (23.91 KB, patch)
2013-11-10 02:23 UTC, Patrick
needs-work Details | Review
A little more cleanup... (25.58 KB, patch)
2013-11-13 02:08 UTC, Patrick
committed Details | Review
Added conditional to grey-out/disable 'Open File/Link'; minor bugfix (3.21 KB, patch)
2013-11-30 13:28 UTC, Patrick
committed Details | Review

Description Adam Buchbinder 2006-04-01 15:31:07 UTC
For accountability purposes, it would be very useful to be able to attach an
image  (receipt, cancelled check, etc) to a transaction; possibly through using
a Sane frontend, or possibly by just allowing files to be attached and moved to
a data directory.

Binary data could be stored separately from the transaction data for space
reasons, so that the financial data could be easily moved, but the data store
wouldn't have to go with it.
Comment 1 Christian Stimming 2006-04-03 08:51:43 UTC
More generally, would "attach an URL" also meet your needs? An URL can also be file:/foo/bar.jpeg and of course it should be clickable...
Comment 2 Ben 2006-10-12 20:42:40 UTC
Quicken has a great implentation of this. Use the help on their support site to understand how they do this. 

I currently have no great need of using this program unless this feature is implemented. It is really the main thing which will make using a computer so much better than paper - much more organized then a filing cabinet of paper - and less time consuming to look up later...
Comment 3 Christian Stimming 2006-10-18 11:24:05 UTC
*** Bug 113093 has been marked as a duplicate of this bug. ***
Comment 4 Josh Sled 2007-08-07 01:39:48 UTC
*** Bug 464120 has been marked as a duplicate of this bug. ***
Comment 5 Josh Sled 2007-10-01 14:30:41 UTC
*** Bug 481961 has been marked as a duplicate of this bug. ***
Comment 6 Adam Chasen 2007-12-06 03:13:39 UTC
I would also enjoy this feature very much. Adding a URL would be a great intermediate step. Some rudimentary file management would be very helpful and would pave the way for a sane plugin to scan files directly from an entry.

Thanks for the great software!
Comment 7 Håkon Finne 2008-05-12 13:41:06 UTC
Thanks to Derek on the gnucash-devel mailing list, my request there (see below between asterisks) now has found an even more appropriate audience. 

** Would it take much to implement hyperlink capabilities in textual fields, e.g. Description in a Transaction? It would be nice to have a clickable link to a document for each transaction (invoice, receipt etc.). And of course to be able to drag document icons into the field for automatic link generation -- but I guess that would be several steps up. ** 

I am not myself in a position to follow up either of the two paths towards a solution hinted to above (Sane & Quicken), thus I can only add my agreement to the requests already in place.
Comment 8 Josh Sled 2008-06-26 22:31:36 UTC
*** Bug 540222 has been marked as a duplicate of this bug. ***
Comment 9 Adam Buchbinder 2009-04-30 13:52:05 UTC
There was an offer for a bounty on this request.

http://lists.gnucash.org/pipermail/gnucash-devel/2008-August/023820.html

Given that this is a longstanding enhancement request from a number of users, it seems like an ideal candidate for putting a bounty on, if there's a developer willing to take it.
Comment 10 Richard Powell 2009-08-22 20:07:54 UTC
Is there any update on this request?

I am considering switching from Peachtree to GnuCash and Peachtree has supported this functionality since 2008. I guess it's the only thing blocking me from using GnuCash. I have moved to completely paperless using this feature in Peachtree and I don't want to have to deal with paperwork again if I switch to GnuCash.
Comment 11 angela 2009-12-23 00:18:06 UTC
Also looking to attach documents, although I would be happy with inserting a URL.  Any news on this possibility?
Comment 12 Hans Lindgren 2010-07-26 12:13:35 UTC
I'd be very happy if this got implemented! URL good but files would be even better.
The ultimate could be a 'file store', a single file that acts as a container for all files/images attached to transactions (for easy of backup).
Comment 13 Kristian 2010-11-26 15:08:31 UTC
Are there any news on this? 
I think the option of attaching an electronic document to a transaction would make a great addition. For most of the commercially available software this is a standard feature and a very useful one, if I may add.
Comment 14 Mohammad Keshmiri 2011-04-17 19:58:50 UTC
I would be glad to have a go at implementing this.
Please see below for further details:

http://lists.gnucash.org/pipermail/gnucash-devel/2011-April/031768.html
Comment 15 Avraham 2012-09-10 11:18:51 UTC
I believe it would make sense to attach not only images but at least pdf files as well.

In any case the system could just let the user upload any kind of file he wants, but for known types common it could show a preview or open in a tab.

while it is common to have invoices stored in images or pdf each user may use something different like .doc files or html (I've seen that already)

also, it should let users attach more than one file for each transaction
Comment 16 mark 2012-11-10 01:05:06 UTC
This is a crucial piece of missing functionality (missing for many many years now). What kind of financial contribution needs to be made to have this incorporated?
Comment 17 Paul Cabot 2013-03-01 05:57:02 UTC
I would highly support this feature as well.  It is probably the only feature that is keeping me back from using GnuCash over Quicken.  I emptied 90% of my filing cabinet from being able to attach documents to my transactions.
Comment 18 Santoso Wijaya 2013-03-04 00:34:59 UTC
Is there any status update on this?
Comment 19 Jaromil 2013-07-08 12:17:19 UTC
Both main free software applications in this field lack this functionality and have a years old outstanding bug, making it very uncomfortable for those of us who need this basic feature.

Dyne.org can even offer a bounty for this, please let us know if that would motivate any developer to act upon this feature request.

thanks, ciao
Comment 20 Patrick 2013-11-09 14:26:27 UTC
Created attachment 259327 [details] [review]
Patch to store file URIs per transaction

The functionality works under Linux with the XML backend, however there are a few untested areas and TODOs:
- SQL backend (untested), I added a column which of course would cause issues for existing tables.
- Code to execute the associate file is modeled after gnc_gnome_help() - which is platform dependent. I have no objective C experience so the Mac functionality is completely not implemented. Windows is untested and likely needs a tweak or two.
Comment 21 Patrick 2013-11-09 14:29:53 UTC
Hi folks, I intended to post the comments above as patch comments in addition to the following post:

I recently posted a message to gnucash-devel looking for some feedback on a patch I created to store file:// URI's to a transaction. The method I used knowingly broke backwards compatibility with the backend storage but I believe I've been pointed in the right direction to implement this in gentler way.

As you probably see in the patch notes above, I only have ability to build/test for the Linux platform. There are a few platform specific things for Mac and Win32 that another developer will need to tweak. (Namely, the methods for executing/opening the stored links, as they are different per platform)

I'm not sure when I'll get more time to work on this as I'm very busy, but hoping I'll find some time later this month.

Thanks,
Patrick
Comment 22 mark 2013-11-10 00:53:11 UTC
I have not reviewed your patch (I need this for Mac) but I just wanted to express my gratitude for you working on moving this essential enhancement forward. Thanks!
Comment 23 Patrick 2013-11-10 02:23:06 UTC
Created attachment 259399 [details] [review]
Patch to store file/location URIs per transaction

A few updates:

- URI is now stored in KVP instead of the Transaction struct. This should maintain compatibility with existing installations. (Per John Rails' suggestion.)
- Split menus and dialogs for storing a file link vs. a location link.
- Added menus to right-click in addition to top menu
- Added UNTESTED code for Mac and Win32. I think it's close but I have no way to compile/test.

I've only tested this with the XML backend, but believe it should function with SQL properly as well. (Now that it's converted to KVP..)

Thanks,
patrick
Comment 24 Mike Evans 2013-11-10 13:19:11 UTC
Comment on attachment 259399 [details] [review]
Patch to store file/location URIs per transaction

Works fine with Fedora 18 and appears backwards compatible with 2.4.13.
Comment 25 John Ralls 2013-11-10 22:54:26 UTC
Comment on attachment 259399 [details] [review]
Patch to store file/location URIs per transaction

Why go to the trouble of making properties if you're not going to use them? Better to make TransSetAssociation and TransGetAssociation static and use g_object_set/get.

What's qofTransSetAssociation for? There's no reason to wrap xaccTransSetAssociation in qof_instance_begin_edit().

The minimum GTK version for Gnucash 2.5 is 2.24, so ifdef HAVE_GTK_2_14 is never true. Besides, the macro is GTK_VERSION_CHECK.

Nice try on the Mac version of gnc_launch_assoc, but it wouldn't even compile. Best that you #if 0 it and comment "FIXME:Implement".
There's some formatting work. You might want to run  astyle --indent=spaces=4 --brackets=break --suffix=none and then regenerate the patch.

Rather than using git diff, commit your changes and use git format-patch. That makes it much easier to apply.
Comment 26 Patrick 2013-11-13 02:08:25 UTC
Created attachment 259708 [details] [review]
A little more cleanup...

John, all,

I don't have much time this week at all, but given that everyone seems to be giving this so much attention I thought I'd give it my spare half hour tonight. I've tried to address several of your comments below, but unfortunately I wasn't able to hit all these punch items this go-around.

Thanks again, please see specific responses below.. Cheers!

>Why go to the trouble of making properties if you're not going to use them?
>Better to make TransSetAssociation and TransGetAssociation static and use
>g_object_set/get.

I'd patterned these functions after the other TransGet/Set functions in Transaction.c. None of the others use the g_object_set/get method so I'll have to spend more time to figure out how that's implemented.

>What's qofTransSetAssociation for? There's no reason to wrap
>xaccTransSetAssociation in qof_instance_begin_edit().

OK good to know. I've removed it and set the QofAccessFunc/QofSetterFuncs in xaccTransRegister to TransSetAssociation and TransGetAssociation.

>The minimum GTK version for Gnucash 2.5 is 2.24, so ifdef HAVE_GTK_2_14 is
>never true. Besides, the macro is GTK_VERSION_CHECK.

This same check is made in several other places in GNUCash code:
plugins/customer_import/dialog-customer-import-gui.c
plugins/bi_import/dialog-bi-import-gui.c

In any case, I've removed the check in favor of the newer library version.

>Nice try on the Mac version of gnc_launch_assoc, but it wouldn't even >compile.
>Best that you #if 0 it and comment "FIXME:Implement".

Shot in the dark :).. Without a Mac compiler it's tough to code. (Especially since Objective-C is rather foreign to me.) It's #ifdef'd out now. I wonder if the same should be done for the Windows code, though for that I strongly believe it's VERY close, despite that I haven't tried to compile it...

>There's some formatting work. You might want to run  astyle -->indent=spaces=4
>--brackets=break --suffix=none and then regenerate the patch.

I just noticed that in the Mac code in particular - Sorry, late night coding..

>Rather than using git diff, commit your changes and use git format-patch. That
>makes it much easier to apply.

Got it.. attached in that fashion.
Comment 27 John Ralls 2013-11-15 22:03:48 UTC
Comment on attachment 259708 [details] [review]
A little more cleanup...

I fixed up a minor glitch, implemented the Mac version of gnc_launch_assoc (which doesn't work with pdfs, at least on my box, but we can deal with that later), fixed up the commit message, and dcommitted. r23397.
Comment 28 John Ralls 2013-11-18 01:12:31 UTC
Another minor glitch fixed in the Win32 bindings. Patrick, we use MinGW for Win32, so one must include <windows.h> in order to pull in the mscvrt.dll API.

Transactions need some sort of visual indication that there's a link set. A new single-character-wide column was suggested on the devel list -- that writer also suggested a thumbnail pop-over when the mouse hovers on the indicator. Regardless of what we do about that, when there *isn't* a link set, the 'Open Associated File' menu item should be disabled so that it's grayed out. It's enabled now for all transactions.
Comment 29 Patrick 2013-11-30 13:28:13 UTC
Created attachment 263203 [details] [review]
Added conditional to grey-out/disable 'Open File/Link'; minor bugfix

Added the following. Haven't looked at visual indication yet.

BUG 336843 (Attach images/files/urls to transactions):

    - Added conditional to grey-out/disable 'Open File/Link' when association is unset
    - Converted 'Open Location' dialog to gtk_dialog_new_with_buttons
        - fixed invalid options from last submitted patch
        - made dialog modal
Comment 30 Geert Janssens 2013-12-16 11:55:27 UTC
Comment on attachment 263203 [details] [review]
Added conditional to grey-out/disable 'Open File/Link'; minor bugfix

John committed this in r23563. Thank you for your patch.
Comment 31 Geert Janssens 2013-12-16 12:00:51 UTC
Are there still things to be done for this bug or can it be closed now ?
Comment 32 Patrick 2013-12-18 00:14:28 UTC
I think it's safe to close this bug at this point, in my opinion. The functionality requested by the bug has been implemented.

However, to put it on the record there were several enhancements pointed out that should be considered in the future, and perhaps opened as separate bugs:

1. Indication via the GUI if a transaction has an associated attachment. (e.g. a column with a link or paperclip icon or something to that effect.)

2. Consider offering users the choice to "Import/Store" the file chosen. (Similar to that of Shotwell). This could resolve future dead-link/file issues by storing a copy of the file in a consistent location. This would also provide the benefit to having a single directory structure for backup purposes.

Lastly, for documentation sake I had also considered storing the files in the SQL backend. But I dismissed that option as I thought the database would grow too large for practicality.

The first GUI issue should be fixable by a GUI Guru somewhere, but that person is not me. The latter is something I'm also not keen to tackle unless there is significant interest.

Just my .02 FWIW.
Comment 33 Brian Burns 2013-12-30 20:29:30 UTC
As implemented in the 2.6.0 release, there does not seem to be a way to disassociate a file with a transaction.  For example, if I attach a file to a transaction, I can use the context menu and the application menu options to open the file, but there is no way to remove it from the transaction.  Associating a file and then associating another file later seems to remove the first association.

What if I thought I wanted a file associated with a transaction and I later decide that in fact I want no file associated with it?
Comment 34 Magnus Andersson 2014-02-02 11:18:32 UTC
Is it possible to expand this feature to include transactions generated by bills/invoices from the business feature.

When i try to associate a file to an transaction that are generated by a bill/invoice i get a message stating that the transaction is locked by the business..... and that i can try unpost the bill/invoice. If i unpost the bill there is no transaction to associate the file with.

As i see it there are two approaches for solving this.Add a file associations field in the bill/invoice dialog that are written at the same time as the rest of the transaction.Or the file association function needs to be able to override the lock/unlock the transaction.

I scan all my bills so that i can make backup to an online account and it would be nice if i could associate the images directly to the transactions generated by the bill.
Comment 35 Geert Janssens 2014-02-15 09:39:17 UTC
In reply to comment 32, comment 33 and comment 34: can you please file these as new and separate enhancement requests ? They are all useful requests, but it's impossible to track the state of each of these enhancements in one big report. you can refer to this bug in your new requests. Thank you.

The feature as originally requested as been implemented so I'll close this bug now.
Comment 36 Geert Janssens 2016-02-10 14:18:23 UTC
A few of the suggestions above have been converted into enhancement requests:

(In reply to Patrick from comment #32)
> 1. Indication via the GUI if a transaction has an associated attachment.
> (e.g. a column with a link or paperclip icon or something to that effect.)
> 
See bug 744790
and on uservoice:
https://gnucash.uservoice.com/admin/forums/101223-feature-request/suggestions/5951785-display-e-g-in-form-of-a-small-icon-if-a-file-l

> 2. Consider offering users the choice to "Import/Store" the file chosen.
> (Similar to that of Shotwell). This could resolve future dead-link/file
> issues by storing a copy of the file in a consistent location. This would
> also provide the benefit to having a single directory structure for backup
> purposes.

This is now on uservoice:
http://gnucash.uservoice.com/forums/101223-feature-request/suggestions/8854033-copy-file-attachment-to-permanent-gnucash-locatio

(In reply to Magnus Andersson from comment #34)
> Is it possible to expand this feature to include transactions generated by
> bills/invoices from the business feature.

For the record, Magnus filed bug 735408 for this.
Comment 37 John Ralls 2018-06-29 21:00:54 UTC
GnuCash bug tracking has moved to a new Bugzilla host. This bug has been copied to https://bugs.gnucash.org/show_bug.cgi?id=336843. Please update any external references or bookmarks.