How to remove all txns from an Account?

Derek Atkins warlord at MIT.EDU
Tue Apr 15 17:11:40 EDT 2008


Quoting Charles Day <cedayiv at gmail.com>:

> OK, then we should very publicly document the dangerous trade-off: that the
> transaction callback function must never modify the account assigned to any
> split in the transaction, or destroy any split in the transaction, as doing
> so risks a crash.
>
> If you like, I can add that to the doxygen documentation in Account.h.

Sure.   Go ahead.   That kind of documentation is a good thing.
Also, it might make sense to do something like:

  next = this->next
  callback(this)
  this = next

instead of:

  callback(this)
  this = this->next

> I also didn't think you could cancel the import after you reach the
>> qif-to-gnc functionality.  But still, there shouldn't be any transactions
>> except those you've just imported.  You already have a handle on those
>> transactions so just delete them.  Yet I'm still not sure how this can
>> happen unless the qif-to-gnc is happening too early.
>>
>
> You can still cancel the import after the qif-to-gnc stage by clicking
> Cancel on the final page of the druid instead of Apply. It is also necessary
> to cancel in cases where the qif-to-gnc functionality catches an exception
> (see my fix for bug 509089).
>
> When the Cancel button event is caught by the C handler, there is no
> already-built list of transactions. But either C or Scheme could build one
> based on the root account of the imported tree, which is known.

I see...

> If I have to build my own list of transactions for a given account tree, is
> a QOF query perhaps the fastest way to go? There is already a routine
> written with this strategy in Scheme (gnc:account-tree-get-transactions in
> qif-merge-groups.scm).

Might as well use that existing API.  I dont think you need a full
query.

> Cheers,
> 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-devel mailing list