http://wiki.gnucash.org/wiki/index.php?title=Custom_Reports&diff=6563&oldid=6562

Geert Janssens janssens-geert at telenet.be
Thu Sep 9 04:07:39 EDT 2010


On Thursday 9 September 2010, Frank H. Ellenberger wrote:
> Hi Geert,
> 
> I was just wondering about the background of
> 
> -(load-from-path ...
> +(load ...
> 
> Was it always wrong or did it change sometime?
> 
Well, actually I think it was never wrong and still isn't. If you look at the 
revision just before I made my changes, you will find both methods explained.

I started looking into this as a result of bug 618670 [1]. My research for 
this bug learned me that you can use load-from-path *if there is no define-
module statement*. With a define-module statement, you get the method name 
collisions Dean Cording mentions in the previous revision and you see this 
happen in bug 618670. His alternative approach works fine.

I tested this both on 2.2.9 and 2.3.x. (I don't have access to an older 
version anymore, so perhaps it worked differently before.) The load-from-path 
crash when a define-module is present happens in both versions. Removing the 
define-module line works in both versions. The alternative of having a unique 
module name in the define-module line and using load works in both versions.

So two load methods, but with different preconditions:
load-from-path -> remove the define-module line
load -> use a unique module line

Because both methods work in 2.2.9 as well as 2.3.x, I preferred to keep one 
for simplicity. Again for simplicity, I chose the method using "load". My idea 
here is that our standard reports all have a define-module line. So if a user 
wants to customize an existing report, he can copy the report and choose a 
unique module name, but otherwise the report structure remains the same. If 
one day the user wishes to contribute his customized report for inclusion in 
the standard reports, the devs can insert it as is, no need to re-add a 
define-module line.

> In case of the later, in which revision? Shouldn't we then write both forms
> with their respective revision range?
> 
Since both forms work even in 2.2.9, I think it's safe to keep only one. That 
is, unless the "load" method doesn't work in still older versions we still 
wish to support. But I don't have access to such older versions anymore.

> BTW,
> http://wiki.gnucash.org/wiki/index.php?search=%22load-from-path%22&ns0=1&ti
> tle=Special%3ASearch&fulltext=Search&fulltext=Suchen says, there are 3
>  other occurences.
> 
Thanks for pointing that out.

The first one, on the Building [2] page, is not related to the report loading. 
It deals with proper slib setup on certain distros and is correct as explained 
there.

The German page DE/Konfiguration [3] has a link to a customized printable 
invoice with a short explanation on how to add this report via config.user. 
The way it's described there crashes GnuCash 2.2.9 exactly as explained in bug 
618670. There is even a second problem: before the crash an error dialog pops 
up because the report name is not unique ("Printable Invoice" is used twice). 
In my opinion this page should be corrected, but my German is too weak to do 
it properly.

The other German page DE/Referenz [4] also uses load-from-path in 
.gnucash/custom.user. I don't exactly understand what this section is trying 
to explain. It talks about things in /opt/gnome or /usr[/local]/share/gnome, 
but I don't see the connection between these paths and GnuCash. The example 
line does seem the suggest a way to load a customized report yet with no 
information at all about the define-module line or the requirement of a unique 
report name/report id. I am under the impression this page needs some review 
beyond the report loading.

Does this clarify things more ?

> Cheers
> Frank
> 
Geert

[1] See https://bugzilla.gnome.org/show_bug.cgi?id=618670
[2] See http://wiki.gnucash.org/wiki/Building
[3] See http://wiki.gnucash.org/wiki/De/Konfiguration
[4] See http://wiki.gnucash.org/wiki/De/Referenz


More information about the gnucash-devel mailing list