Scheduled/Periodic/Recurring Transactions
[GnuCash Engine: Core, Non-GUI Accounting Functions]


Detailed Description

Scheduled Transactions provide a framework for remembering information about a transactions that are set to occur in the future, either once or periodically.


Files

file  FreqSpec.h
 Period / Date Frequency Specification.
file  SchedXaction.h
 Scheduled Transactions public handling routines.
file  SX-book.h
 Anchor Scheduled Transaction info in a book. See src/doc/books.txt for design overview.

Data Structures

struct  _SchedXaction
struct  _SchedXactionClass
struct  _temporalStateData
struct  xaccSchedXactionsDef
struct  _SchedXactionsClass

Temporal state data.

These functions allow us to opaquely save the entire temporal state of ScheduledTransactions. This is used by the "since-last-run" dialog to store the initial state of SXes before modification ... if it later becomes necessary to revert an entire set of changes, we can 'revert' the SX without having to rollback all the individual state changes.

void * gnc_sx_create_temporal_state (SchedXaction *sx)
void gnc_sx_incr_temporal_state (SchedXaction *sx, void *stateData)
void gnc_sx_revert_to_temporal_state (SchedXaction *sx, void *stateData)
void gnc_sx_destroy_temporal_state (void *stateData)
void * gnc_sx_clone_temporal_state (void *stateData)
 Allocates and returns a copy of the given temporal state.

Defines

#define ENUM_LIST_TYPE(_)
#define GNC_TYPE_SCHEDXACTION   (gnc_schedxaction_get_type ())
#define GNC_SCHEDXACTION(o)   (G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_SCHEDXACTION, SchedXaction))
#define GNC_SCHEDXACTION_CLASS(k)   (G_TYPE_CHECK_CLASS_CAST((k), GNC_TYPE_SCHEDXACTION, SchedXactionClass))
#define GNC_IS_SCHEDXACTION(o)   (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_SCHEDXACTION))
#define GNC_IS_SCHEDXACTION_CLASS(k)   (G_TYPE_CHECK_CLASS_TYPE ((k), GNC_TYPE_SCHEDXACTION))
#define GNC_SCHEDXACTION_GET_CLASS(o)   (G_TYPE_INSTANCE_GET_CLASS ((o), GNC_TYPE_SCHEDXACTION, SchedXactionClass))
#define GNC_IS_SX(obj)   GNC_IS_SCHEDXACTION(obj)
#define GNC_SX(obj)   GNC_SCHEDXACTION(obj)
#define xaccSchedXactionSetGUID(X, G)   qof_instance_set_guid(QOF_INSTANCE(X),(G))
#define GNC_SX_ID   "sched-xaction"
#define GNC_SX_ACCOUNT   "account"
#define GNC_SX_CREDIT_FORMULA   "credit-formula"
#define GNC_SX_DEBIT_FORMULA   "debit-formula"
#define GNC_SX_SHARES   "shares"
#define GNC_SX_AMOUNT   "amnt"
#define GNC_SX_FROM_SCHED_XACTION   "from-sched-xaction"
#define GNC_SX_FREQ_SPEC   "scheduled-frequency"
#define GNC_SX_NAME   "sched-xname"
#define GNC_SX_START_DATE   "sched-start-date"
#define GNC_SX_LAST_DATE   "sched-last-date"
#define GNC_SX_NUM_OCCUR   "sx-total-number"
#define GNC_SX_REM_OCCUR   "sx-remaining-num"
#define xaccSchedXactionIsDirty(X)   qof_instance_is_dirty (QOF_INSTANCE(X))
#define xaccSchedXactionGetGUID(X)   qof_entity_get_guid(QOF_INSTANCE(X))
#define xaccSchedXactionGetSlots(X)   qof_instance_get_slots(QOF_INSTANCE(X))
#define GNC_TYPE_SCHEDXACTIONS   (gnc_schedxactions_get_type ())
#define GNC_SCHEDXACTIONS(o)   (G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_SCHEDXACTIONS, SchedXactions))
#define GNC_SCHEDXACTIONS_CLASS(k)   (G_TYPE_CHECK_CLASS_CAST((k), GNC_TYPE_SCHEDXACTIONS, SchedXactionsClass))
#define GNC_IS_SCHEDXACTIONS(o)   (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_SCHEDXACTIONS))
#define GNC_IS_SCHEDXACTIONS_CLASS(k)   (G_TYPE_CHECK_CLASS_TYPE ((k), GNC_TYPE_SCHEDXACTIONS))
#define GNC_SCHEDXACTIONS_GET_CLASS(o)   (G_TYPE_INSTANCE_GET_CLASS ((o), GNC_TYPE_SCHEDXACTIONS, SchedXactionsClass))
#define GNC_IS_SXES(obj)   GNC_IS_SCHEDXACTIONS(obj)
#define GNC_SXES(obj)   GNC_SCHEDXACTIONS(obj)

Typedefs

typedef _SchedXactionClass SchedXactionClass
typedef _SchedXaction SchedXaction
typedef _temporalStateData temporalStateData
typedef xaccSchedXactionsDef SchedXactions
typedef _SchedXactionsClass SchedXactionsClass

Functions

GType gnc_schedxaction_get_type (void)
SchedXactionxaccSchedXactionMalloc (QofBook *book)
void sx_set_template_account (SchedXaction *sx, Account *account)
void xaccSchedXactionFree (SchedXaction *sx)
void gnc_sx_begin_edit (SchedXaction *sx)
void gnc_sx_commit_edit (SchedXaction *sx)
GList * gnc_sx_get_schedule (const SchedXaction *sx)
void gnc_sx_set_schedule (SchedXaction *sx, GList *schedule)
gchar * xaccSchedXactionGetName (const SchedXaction *sx)
void xaccSchedXactionSetName (SchedXaction *sx, const gchar *newName)
GDate * xaccSchedXactionGetStartDate (SchedXaction *sx)
void xaccSchedXactionSetStartDate (SchedXaction *sx, GDate *newStart)
int xaccSchedXactionHasEndDate (const SchedXaction *sx)
GDate * xaccSchedXactionGetEndDate (SchedXaction *sx)
void xaccSchedXactionSetEndDate (SchedXaction *sx, GDate *newEnd)
GDate * xaccSchedXactionGetLastOccurDate (SchedXaction *sx)
void xaccSchedXactionSetLastOccurDate (SchedXaction *sx, GDate *newLastOccur)
gboolean xaccSchedXactionHasOccurDef (const SchedXaction *sx)
gint xaccSchedXactionGetNumOccur (const SchedXaction *sx)
void xaccSchedXactionSetNumOccur (SchedXaction *sx, gint numNum)
gint xaccSchedXactionGetRemOccur (const SchedXaction *sx)
void xaccSchedXactionSetRemOccur (SchedXaction *sx, gint numRemain)
gint gnc_sx_get_instance_count (const SchedXaction *sx, void *stateData)
 Set the instance count.
void gnc_sx_set_instance_count (SchedXaction *sx, gint instanceNum)
GList * xaccSchedXactionGetSplits (const SchedXaction *sx)
void xaccSchedXactionSetSplits (SchedXaction *sx, GList *newSplits)
gboolean xaccSchedXactionGetEnabled (const SchedXaction *sx)
void xaccSchedXactionSetEnabled (SchedXaction *sx, gboolean newEnabled)
void xaccSchedXactionGetAutoCreate (const SchedXaction *sx, gboolean *outAutoCreate, gboolean *outNotify)
void xaccSchedXactionSetAutoCreate (SchedXaction *sx, gboolean newAutoCreate, gboolean newNotify)
gint xaccSchedXactionGetAdvanceCreation (const SchedXaction *sx)
void xaccSchedXactionSetAdvanceCreation (SchedXaction *sx, gint createDays)
gint xaccSchedXactionGetAdvanceReminder (const SchedXaction *sx)
void xaccSchedXactionSetAdvanceReminder (SchedXaction *sx, gint reminderDays)
GDate xaccSchedXactionGetNextInstance (SchedXaction *sx, void *stateData)
 Returns the next occurance of a scheduled transaction.
GDate xaccSchedXactionGetInstanceAfter (SchedXaction *sx, GDate *date, void *stateData)
void xaccSchedXactionSetTemplateTrans (SchedXaction *sx, GList *t_t_list, QofBook *book)
 Set the schedxaction's template transaction.
void gnc_sx_add_defer_instance (SchedXaction *sx, void *deferStateData)
 Adds an instance to the deferred list of the SX.
void gnc_sx_remove_defer_instance (SchedXaction *sx, void *deferStateData)
 Removes an instance from the deferred list.
GList * gnc_sx_get_defer_instances (SchedXaction *sx)
 Returns the defer list from the SX.
gboolean SXRegister (void)
 QOF registration.
KvpValuexaccSchedXactionGetSlot (const SchedXaction *sx, const char *slot)
void xaccSchedXactionSetSlot (SchedXaction *sx, const char *slot, const KvpValue *value)
GType gnc_schedxactions_get_type (void)
SchedXactionsgnc_book_get_schedxactions (QofBook *book)
void gnc_sxes_add_sx (SchedXactions *sxes, SchedXaction *sx)
void gnc_sxes_del_sx (SchedXactions *sxes, SchedXaction *sx)
Accountgnc_book_get_template_root (const QofBook *book)
GList * gnc_sx_get_sxes_referencing_account (QofBook *book, Account *acct)


Define Documentation

#define ENUM_LIST_TYPE (  ) 

Value:

_(INVALID,) \
        _(ONCE,) \
        _(DAILY,) \
        _(WEEKLY,)  \
        _(MONTHLY,) \
        _(MONTH_RELATIVE,) \
        _(COMPOSITE,)

Definition at line 34 of file FreqSpec.h.

#define xaccSchedXactionGetGUID (  )     qof_entity_get_guid(QOF_INSTANCE(X))

Deprecated:

Definition at line 312 of file SchedXaction.h.

#define xaccSchedXactionGetSlots (  )     qof_instance_get_slots(QOF_INSTANCE(X))

Deprecated:

Definition at line 314 of file SchedXaction.h.

#define xaccSchedXactionIsDirty (  )     qof_instance_is_dirty (QOF_INSTANCE(X))

Deprecated:

Definition at line 310 of file SchedXaction.h.


Typedef Documentation

typedef struct _temporalStateData temporalStateData

Just the variable temporal bits from the SX structure.


Function Documentation

Account* gnc_book_get_template_root ( const QofBook book  ) 

Returns the template group from the book.

Definition at line 64 of file SX-book.c.

00065 {
00066   QofCollection *col;
00067   if (!book) return NULL;
00068   col = qof_book_get_collection (book, GNC_ID_SXTG);
00069   return gnc_collection_get_template_root (col);
00070 }

void gnc_sx_add_defer_instance ( SchedXaction sx,
void *  deferStateData 
)

Adds an instance to the deferred list of the SX.

Adds an instance to the deferred list of the SX. Added instances are added in (date-)sorted order.

Definition at line 812 of file SchedXaction.c.

00813 {
00814     sx->deferredList = g_list_insert_sorted( sx->deferredList,
00815                                              deferStateData,
00816                                              _temporal_state_data_cmp );
00817 }

void* gnc_sx_clone_temporal_state ( void *  stateData  ) 

Allocates and returns a copy of the given temporal state.

Destroy with gnc_sx_destroy_temporal_state(), as you'd expect.

Definition at line 779 of file SchedXaction.c.

00780 {
00781    temporalStateData *toRet, *tsd;
00782    tsd = (temporalStateData*)stateData;
00783    toRet = g_memdup( tsd, sizeof( temporalStateData ) );
00784    return (void*)toRet;
00785 }

GList* gnc_sx_get_defer_instances ( SchedXaction sx  ) 

Returns the defer list from the SX.

Returns the defer list from the SX; this is a (date-)sorted temporal-state-data instance list. The list should not be modified by the caller; use the gnc_sx_{add,remove}_defer_instance() functions to modifiy the list.

Definition at line 846 of file SchedXaction.c.

00847 {
00848    return sx->deferredList;
00849 }

gint gnc_sx_get_instance_count ( const SchedXaction sx,
void *  stateData 
)

Set the instance count.

This is incremented by one for every created instance of the SX. Returns the instance num of the SX unless stateData is non-null, in which case it returns the instance num from the state data.

Parameters:
sx The instance whose state should be retrieved.
stateData may be NULL.

Definition at line 595 of file SchedXaction.c.

00596 {
00597   gint toRet = -1;
00598   temporalStateData *tsd;
00599 
00600   if ( stateData ) {
00601     tsd = (temporalStateData*)stateData;
00602     toRet = tsd->num_inst;
00603   } else {
00604     toRet = sx->instance_num;
00605   }
00606 
00607   return toRet;
00608 }

GList* gnc_sx_get_schedule ( const SchedXaction sx  ) 

Returns:
GList<Recurrence*>

Definition at line 241 of file SchedXaction.c.

00242 {
00243    return sx->schedule;
00244 }

GList* gnc_sx_get_sxes_referencing_account ( QofBook book,
Account acct 
)

Returns:
The list of SXes which reference the given Account. Caller should free this list.

Definition at line 336 of file SX-book.c.

00337 {
00338   GList *rtn = NULL;
00339   const GUID *acct_guid = xaccAccountGetGUID(acct);
00340   GList *sx_list = gnc_book_get_schedxactions(book)->sx_list;
00341   for (; sx_list != NULL; sx_list = sx_list->next)
00342   {
00343     SchedXaction *sx = (SchedXaction*)sx_list->data;
00344     GList *splits = xaccSchedXactionGetSplits(sx);
00345     for (; splits != NULL; splits = splits->next)
00346     {
00347       Split *s = (Split*)splits->data;
00348       KvpFrame *frame = kvp_frame_get_frame(xaccSplitGetSlots(s), GNC_SX_ID);
00349       GUID *sx_split_acct_guid = kvp_frame_get_guid(frame, GNC_SX_ACCOUNT);
00350       if (guid_equal(acct_guid, sx_split_acct_guid))
00351       {
00352         rtn = g_list_append(rtn, sx);
00353       }
00354     }
00355   }
00356   return rtn;
00357 }

void gnc_sx_remove_defer_instance ( SchedXaction sx,
void *  deferStateData 
)

Removes an instance from the deferred list.

Removes an instance from the deferred list. If the instance is no longer useful; gnc_sx_destroy_temporal_state() it.

Definition at line 824 of file SchedXaction.c.

00825 {
00826     GList *found_by_value;
00827 
00828     found_by_value = g_list_find_custom(
00829         sx->deferredList, deferStateData, _temporal_state_data_cmp);
00830     if (found_by_value == NULL) {
00831         g_warning("unable to find deferred instance");
00832         return;
00833     }
00834 
00835     gnc_sx_destroy_temporal_state(found_by_value->data);
00836     sx->deferredList = g_list_delete_link(sx->deferredList, found_by_value);
00837 }

void gnc_sx_set_instance_count ( SchedXaction sx,
gint  instanceNum 
)

Sets the instance count to something other than the default. As the default is the incorrect value '0', callers should DTRT here.

Definition at line 611 of file SchedXaction.c.

00612 {
00613   g_return_if_fail(sx);
00614   if (sx->instance_num == instance_num)
00615     return;
00616   sx->instance_num = instance_num;
00617 }

void gnc_sx_set_schedule ( SchedXaction sx,
GList *  schedule 
)

Parameters:
[in] schedule A GList<Recurrence*>

Definition at line 247 of file SchedXaction.c.

00248 {
00249    g_return_if_fail(sx);
00250    gnc_sx_begin_edit(sx);
00251    sx->schedule = schedule;
00252    qof_instance_set_dirty(&sx->inst);
00253    gnc_sx_commit_edit(sx);
00254 }

void xaccSchedXactionFree ( SchedXaction sx  ) 

Cleans up and frees a SchedXaction and it's associated data.

Definition at line 172 of file SchedXaction.c.

00173 {
00174   GList *l;
00175       
00176   if ( sx == NULL ) return;
00177   
00178   qof_event_gen( &sx->inst, QOF_EVENT_DESTROY , NULL);
00179   
00180   if ( sx->name )
00181     g_free( sx->name );
00182 
00183   /* 
00184    * we have to delete the transactions in the 
00185    * template account ourselves
00186    */
00187   
00188   delete_template_trans( sx );
00189   
00190   /*
00191    * xaccAccountDestroy removes the account from
00192    * its group for us AFAICT
00193    */
00194   
00195   xaccAccountBeginEdit(sx->template_acct);
00196   xaccAccountDestroy(sx->template_acct);
00197 
00198   for ( l = sx->deferredList; l; l = l->next ) {
00199           gnc_sx_destroy_temporal_state( l->data );
00200           l->data = NULL;
00201   }
00202   if ( sx->deferredList ) {
00203           g_list_free( sx->deferredList );
00204           sx->deferredList = NULL;
00205   }
00206   
00207   /* qof_instance_release (&sx->inst); */
00208   g_object_unref( sx );
00209 }

GDate* xaccSchedXactionGetEndDate ( SchedXaction sx  ) 

Returns invalid date when there is no end-date specified.

Definition at line 298 of file SchedXaction.c.

00299 {
00300    return &sx->end_date;
00301 }

GDate xaccSchedXactionGetNextInstance ( SchedXaction sx,
void *  stateData 
)

Returns the next occurance of a scheduled transaction.

If the transaction hasn't occured, then it's based off the start date. Otherwise, it's based off the last-occurance date.

If state data is NULL, the current value of the SX is used for computation. Otherwise, the values in the state data are used. This allows the caller to correctly create a set of instances into the future for possible action without modifying the SX state until action is actually taken.

Definition at line 485 of file SchedXaction.c.

00486 {
00487    GDate    last_occur, next_occur, tmpDate;
00488 
00489    g_date_clear( &last_occur, 1 );
00490    g_date_clear( &next_occur, 1 );
00491    g_date_clear( &tmpDate, 1 );
00492 
00493    if ( g_date_valid( &sx->last_date ) ) {
00494       last_occur = sx->last_date;
00495    } 
00496 
00497    if ( stateData != NULL ) {
00498       temporalStateData *tsd = (temporalStateData*)stateData;
00499       last_occur = tsd->last_date;
00500    }
00501 
00502    if ( g_date_valid( &sx->start_date ) ) {
00503       if ( g_date_valid(&last_occur) ) {
00504          last_occur =
00505             ( g_date_compare( &last_occur,
00506                     &sx->start_date ) > 0 ?
00507               last_occur : sx->start_date );
00508       } else {
00509          /* Think about this for a second, and you realize that if the
00510           * start date is _today_, we need a last-occur date such that
00511           * the 'next instance' is after that date, and equal to the
00512           * start date... one day should be good.
00513           *
00514           * This only holds for the first instance [read: if the
00515           * last[-occur]_date is invalid] */
00516          last_occur = sx->start_date;
00517          g_date_subtract_days( &last_occur, 1 );
00518       }
00519    }
00520 
00521    recurrenceListNextInstance(sx->schedule, &last_occur, &next_occur);
00522 
00523    /* out-of-bounds check */
00524    if ( xaccSchedXactionHasEndDate( sx ) ) {
00525       GDate *end_date = xaccSchedXactionGetEndDate( sx );
00526       if ( g_date_compare( &next_occur, end_date ) > 0 ) {
00527          g_debug("next_occur past end date");
00528          g_date_clear( &next_occur, 1 );
00529       }
00530    } else if ( xaccSchedXactionHasOccurDef( sx ) ) {
00531       if ( stateData ) {
00532          temporalStateData *tsd = (temporalStateData*)stateData;
00533          if ( tsd->num_occur_rem == 0 ) {
00534             g_debug("no more occurances remain");
00535             g_date_clear( &next_occur, 1 );
00536          }
00537       } else {
00538          if ( sx->num_occurances_remain == 0 ) {
00539             g_date_clear( &next_occur, 1 );
00540          }
00541       }
00542    }
00543 
00544    return next_occur;
00545 }

KvpValue* xaccSchedXactionGetSlot ( const SchedXaction sx,
const char *  slot 
)

Deprecated:
to be replaced with 'dirty' kvp's

Definition at line 392 of file SchedXaction.c.

00393 {
00394   if (!sx) return NULL;
00395 
00396   return kvp_frame_get_slot(sx->inst.kvp_data, slot);
00397 }

gboolean xaccSchedXactionHasOccurDef ( const SchedXaction sx  ) 

Returns true if the scheduled transaction has a defined number of occurances, false if not.

Definition at line 342 of file SchedXaction.c.

00343 {
00344   return ( xaccSchedXactionGetNumOccur( sx ) != 0 );
00345 }

SchedXaction* xaccSchedXactionMalloc ( QofBook book  ) 

Creates and initializes a scheduled transaction.

Definition at line 104 of file SchedXaction.c.

00105 {
00106    SchedXaction *sx;
00107 
00108    g_return_val_if_fail (book, NULL);
00109 
00110    sx = g_object_new(GNC_TYPE_SCHEDXACTION, NULL);
00111    xaccSchedXactionInit( sx, book );
00112    qof_event_gen( &sx->inst, QOF_EVENT_CREATE , NULL);
00113 
00114    return sx;
00115 }

void xaccSchedXactionSetEndDate ( SchedXaction sx,
GDate *  newEnd 
)

Set to an invalid GDate to turn off 'end-date' definition.

Definition at line 304 of file SchedXaction.c.

00305 {
00306   if ( g_date_valid( newEnd )
00307        && g_date_compare( newEnd, &sx->start_date ) < 0 ) {
00308     /* XXX: I reject the bad data - is this the right 
00309      * thing to do <rgmerk>.
00310      * This warning is only human readable - the caller
00311      * doesn't know the call failed.  This is bad
00312      */
00313     g_critical("New end date before start date"); 
00314     return;
00315   }
00316 
00317   gnc_sx_begin_edit(sx);
00318   sx->end_date = *newEnd;
00319   qof_instance_set_dirty(&sx->inst);
00320   gnc_sx_commit_edit(sx);
00321 }

void xaccSchedXactionSetName ( SchedXaction sx,
const gchar *  newName 
)

A copy of the name is made.

Definition at line 263 of file SchedXaction.c.

00264 {
00265    g_return_if_fail( newName != NULL );
00266    gnc_sx_begin_edit(sx);
00267    if ( sx->name != NULL ) {
00268            g_free( sx->name );
00269            sx->name = NULL;
00270    }
00271    sx->name = g_strdup( newName );
00272    qof_instance_set_dirty(&sx->inst);
00273    gnc_sx_commit_edit(sx);
00274 }

void xaccSchedXactionSetNumOccur ( SchedXaction sx,
gint  numNum 
)

Set to '0' to turn off number-of-occurances definition.

Definition at line 354 of file SchedXaction.c.

00355 {
00356   if (sx->num_occurances_total == new_num)
00357     return;
00358   gnc_sx_begin_edit(sx);
00359   sx->num_occurances_remain = sx->num_occurances_total = new_num;
00360   qof_instance_set_dirty(&sx->inst);
00361   gnc_sx_commit_edit(sx);
00362 }

void xaccSchedXactionSetSlot ( SchedXaction sx,
const char *  slot,
const KvpValue value 
)

Deprecated:
to be replaced with 'dirty' kvp's

Definition at line 400 of file SchedXaction.c.

00403 {
00404   if (!sx) return;
00405 
00406   gnc_sx_begin_edit(sx);
00407   kvp_frame_set_slot( sx->inst.kvp_data, slot, value );
00408   qof_instance_set_dirty(&sx->inst);
00409   gnc_sx_commit_edit(sx);
00410 }

void xaccSchedXactionSetTemplateTrans ( SchedXaction sx,
GList *  t_t_list,
QofBook book 
)

Set the schedxaction's template transaction.

t_t_list is a glist of TTInfo's as defined in SX-ttinfo.h. The edit dialog doesn't use this mechanism; maybe it should.

Definition at line 687 of file SchedXaction.c.

00689 {
00690   Transaction *new_trans;
00691   TTInfo *tti;
00692   TTSplitInfo *s_info;
00693   Split *new_split;
00694   GList *split_list;
00695 
00696   g_return_if_fail (book);
00697 
00698   /* delete any old transactions, if there are any */
00699   delete_template_trans( sx );
00700 
00701   for(;t_t_list != NULL; t_t_list = t_t_list->next)
00702   {
00703     tti = t_t_list->data;
00704 
00705     new_trans = xaccMallocTransaction(book);
00706 
00707     xaccTransBeginEdit(new_trans);
00708 
00709     xaccTransSetDescription(new_trans, 
00710              gnc_ttinfo_get_description(tti));
00711 
00712     xaccTransSetDatePostedSecs(new_trans, time(NULL));
00713 
00714     xaccTransSetNum(new_trans,
00715           gnc_ttinfo_get_num(tti));
00716     xaccTransSetCurrency( new_trans,
00717            gnc_ttinfo_get_currency(tti) );
00718 
00719     for(split_list = gnc_ttinfo_get_template_splits(tti);
00720    split_list;
00721    split_list = split_list->next)
00722     {
00723       s_info = split_list->data;
00724       new_split = pack_split_info(s_info, sx->template_acct,
00725               new_trans, book);
00726       xaccTransAppendSplit(new_trans, new_split);
00727     }
00728     xaccTransCommitEdit(new_trans);
00729   }
00730 }


Generated on Thu Aug 28 05:06:14 2008 for GnuCash by  doxygen 1.5.2