On Nov 8, 2013, at 11:34 AM, Patrick <[email protected]> wrote:

> Hi folks,
> 
> I've been a gnucash user for several years and have always wanted the
> ability to attach my scanned invoices or receipts to transactions.
> 
> Lurking about for some time, I'd been following bug #336843 and several
> threads of others wanting similar functionality. Rather than wait
> patiently, I found a few free hours last weekend and decided to attempt to
> implement this myself.
> 
> Attached you'll find a patch which works adequately for my needs, but I
> wanted to share with the larger community.
> 
> Primary functionality:
> - User selects a file via a dialog, the URI is stored in a new char* in
> the Transaction structure.
> - User can similarly launch the associated file via the Transaction menu.
> (Launches via gtk viewer, so filetypes such as .JPG, .PDF, etc are already
> handled.)
> 
> 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.
> - Lastly, and a minor tweak - I intended to find the menu for the
> right-click menu on a transaction and add similar menu options to what I
> added in the Transaction menu.

Add to that that it breaks backwards compatibility for both XML and SQL 
backends. The file would cause errors on any previous version that tried to 
open it. The way we’ve been getting around that for many years is to add new 
data items to the KVP structure associated with each QofInstance. The source 
along with what documentation exists is in src/libqof/qof/kvp_frame.[ch]. Since 
one is unlikely to want to search or sort on the image link, that’s probably 
where the link belongs anyway, rather than as a field in the transaction table. 
Having it in KVP simplifies a few other things as well, since you don’t have to 
add code to copy it or test equality; that’s already handled for everything in 
KVP.

It’s better to attach patches to bugs—especially when the bug already 
exists—than to post them here. They tend to get forgotten about rather quickly 
when they’re here.

Thanks,
John Ralls
_______________________________________________
gnucash-devel mailing list
[email protected]
https://lists.gnucash.org/mailman/listinfo/gnucash-devel

Reply via email to