Improving internal report identifiers

Andrew Sackville-West andrew at swclan.homelinux.org
Tue Jan 1 15:28:17 EST 2008


On Tue, Jan 01, 2008 at 01:38:12PM -0500, Mike Alexander wrote:
> --On December 31, 2007 4:46:27 PM -0800 Andrew Sackville-West 
> <andrew at swclan.homelinux.org> wrote:
>
>> I think its a task I can definitely handle in terms of coing it up,
>> but I want to make sure I get some guidance on
>>
>> 1) whether it should be done at all (I think so)?
>
> I think this is a good idea.  It would probably also fix 461468.  That bug 
> occurs because Gnucash strips out all non-alphabetic characters (including 
> numbers) when generating the internal ID from the report name.  It also 
> might fix 447339, although that sounds slightly different. 

I'll check them out too...

>
>> 3) how to handle the saved reports. specifically, how to get the user
>> to actually go in and fix the things -- do they need to edit the file
>> by hand? can they just resave the report and have it overwrite the old
>> one (ideal solution, but I don't think that works ATM)? can we
>> implement something to one-time-deal translate those reports into YA
>> saved-reports-2.2 file?
>
> If a saved report doesn't have an internal ID could you generate one on the 
> fly?

I think I've got it all figured out (in the shower no
less). Essentially, for any report that doesn't have an internal ID,
just assign it a GUID (I'm sure there's an API to get GUID's on the
fly) at runtime and use that to build the report template hash table. 

Then, looking at a saved report, in the call to gnc:define-report,
there is a field set, 'renderer that takes a function to look up the
report by name. I'd just change that function
gnc:report-template-new-options/name to hash-for-each through the
table looking for the name, and return the report-id for the report
that it finds. I'd also include in that function a warning dialog to
let the user know that they're using a deprecated report. 

On the other side, the save-report side, change the writing
of that 'renderer field to include a different function,
gnc:report-template-new-options/report-id to look up the reports by id
instead, so all saved reports moving forward would have the new
system.

Finally, at some point after the change has been in effect for a few
versions, then change the code that builds the hash table so that it
simply ignores any report that doesn't have a report-id. That would
eliminate any remaining saved reports that use the old system. The
user's would see them drop off their list (if they're still using
them) and could be pointed to an FAQ that describes how to either
remove the old reports or add a report-id to them so that they are
usable again. 


A
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.gnucash.org/pipermail/gnucash-devel/attachments/20080101/3a470442/attachment.bin 


More information about the gnucash-devel mailing list