Scheduled Transactions patch, Mk I

Josh Sled jsled@asynchronous.org
Sat, 16 Jun 2001 20:08:36 -0700


I've sent Scheduled Transactions Mk I to -patches.

There are quite a few changes here, which I'll go over.  Because of
the depth of the change, I'm hoping that most everyone can look it
over and complain/suggest alternatives as necessary.

src/engine/
Added FreqSpec.{h,c}
Added SchedXaction.{h,c}
Added gnc-{freqspec,schedxaction}-xml-v2.c
  [ see my XML-change notes below, dres especially ]

gnc-book
. Added the template group [template transaction belong to the
  template group] and the Scheduled Trasnaction list.

src/gnome/
Added glade/sched_xact.glade 
Added dialog-{nextrun,scheduledxaction}.{h,c}
Added gnc-frequency.{h,c}

src/
SplitLedger, MultiLedger:
. Created a Template General Ledger
. "subclassed" the SplitLedger into a template version, which redefines
  some the "getter"/"setter" routines to create Splits/Transactions
  which are valid in an engine sense, but contain enough information to
  create Transactions.

src/guile/
. g-wrapped scheduled-transaction-related UI creation functions.

src/register/
. Added formula credit and debit cells.
. Added header only for a real formulacell [right now it's a
  quickfill].
. Added flags for template-register support.

Misc changes...

gnome/gnc-dateedit.h
. Added explanatory comment from dave_p in IRC.

gnome/query-user.h
. Added prototype of gnc_verify_dialog_parented(...), so I could use
  it the SX UI stuff... this is probably not the ideal fix...


Template Transactions recap
---------------------------

I believe I mailed about this a while ago, but I'll recap:

A Template Register is one in which certain fields of Transactions and
Splits are kept in a kvp_frame, and the Transactions/Splits are kept
"valid".  Specifically, the "correct" from-account, and credit/debit
fields are stored in the kvp_frame, and innocous values are stored in
their place:

XFRM: All splits are from the same account in a new top-level account
group.

CREDIT/DEBIT: (0/1) numeric values.

XML Notes
---------

The template register stuff wants to save out transactions, but
they're not in the standard top-level account group, but instead in a
seperate account group.  The xml-file-writing stuff creates new
top-level <gnc:template-transactions> element exists, in which the
<gnc:account>s and <gnc:transaction>s are placed.

On reading, seeing the <gnc:template-transactions> tag transitions
into a state where the <gnc:account>s and <gnc:transaction>s can be
placaed in the book correctly.

In this way I can re-use the transaction/split/account XML
serialization routines.

Backend Notes
-------------

I'm not quite up to speed on how the SQL backend works, so I haven't
evaluated schema necessary to store the new engine elements of
FreqSpec [Frequency/Recurrance Specification] and
SchedXactions... OTOH, they're pretty straight foward things.



State of the World
------------------
. One must run with GNC_DEBUG=1 to get the Extensions menu where the UI is.
. One can create scheduled transactions for non-securities accounts
  using the template GL.
. One can specify the frequency of that transaction.
  . The frequency widget is not restored correctly in all cases due to
    an overhaul of the FreqSpec object.
. One can force the next-run date on the
  "since-last-run"/scheduled-transaction-instantiation window to see
  what would be created in the future; click on the bottom-right
  'Next' button to get the list to refresh.
  . This has a bug or two about the initial date, and is generally not
     completed.
  . Clicking "Ok" will generate the transaction in the appropriate
    accounts.  :) 
  . Doing so destroys all balance information in all accounts. :(

TODO
----
Plenty of things... see src/doc/TODO-schedxactions. :)

...jsled