dealing with invoices and QIF imports

Charles Day cedayiv at gmail.com
Thu May 29 12:41:00 EDT 2008


On Thu, May 29, 2008 at 8:42 AM, Derek Atkins <warlord at mit.edu> wrote:

> Quoting Charles Day <cedayiv at gmail.com>:
>
>  Committed as r17180 with backport requested.
>>
>
> Question -- why the change from safe_strcmp() to null_strcmp()?
>

Because gnc_account_merge_children was refusing to merge the Accounts
Receivable account in the import tree with the Accounts Receivable account
in the existing GnuCash account tree. Reason: the "notes" field of the
imported account was an empty string (just a NUL), but on the existing
account it was NULL. Since those value don't match when you use
safe_strcmp(), it refused to merge them, and you would end up with two
Accounts Receivable accounts. Since null_strcmp() treats an empty string and
NULL as equivalent, this allows the accounts to match and become merged.

So how did the notes field of the existing account get to be NULL in the
first place? Turns out that the account creation druid (the one that appears
when you start a new file) sometimes creates accounts with NULL notes.
Accounts Receivable is one of those accounts where this happens. I think
this is due to empty "notes" values in acctchrt_business.gnucash-xea.
Regardless, it is theoretically possible to have xaccAccountGetNotes return
NULL at any time.  But SWIG steals the NULL return value and instead gives
Scheme an empty string.  So when Scheme dutifully tries to duplicate the
existing account for its import tree, it ends up using an empty string
instead of NULL.

Sigh.

can build GnuCash from trunk, you'll have to wait until 2.2.6 to try out the
>> fix. (It does work, according to my tests.)
>>
> So, Leigh, I'm afraid that unless you have a test environment available and
>
> Beyond that above change the rest of the code is just changes to
> .scm, which you COULD apply to your 2.2.5 installation.
>

Leigh, if you want to try that out, just make sure you add some notes to the
Accounts Receivable account. That will avoid the problem described above.

-Charles


>
>  -Charles
>>
>
> -derek
>
> --
>      Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
>      Member, MIT Student Information Processing Board  (SIPB)
>      URL: http://web.mit.edu/warlord/    PP-ASEL-IA     N1NWH
>      warlord at MIT.EDU                        PGP key available
>
>


More information about the gnucash-user mailing list