|
GnuCash 2.3.0
|
Data Structures | |
| struct | _SchedXaction |
| struct | _SchedXactionClass |
| struct | _SXTmpStateData |
| struct | xaccSchedXactionsDef |
| struct | _SchedXactionsClass |
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. | |
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_CREDIT_NUMERIC "credit-numeric" |
| #define | GNC_SX_DEBIT_NUMERIC "debit-numeric" |
| #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 struct _SchedXactionClass | SchedXactionClass |
| typedef struct _SchedXaction | SchedXaction |
| typedef struct _SXTmpStateData | SXTmpStateData |
| typedef struct xaccSchedXactionsDef | SchedXactions |
| typedef struct _SchedXactionsClass | SchedXactionsClass |
Functions | |
| GType | gnc_schedxaction_get_type (void) |
| SchedXaction * | xaccSchedXactionMalloc (QofBook *book) |
| void | sx_set_template_account (SchedXaction *sx, Account *account) |
| void | xaccSchedXactionDestroy (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) |
| const GDate * | xaccSchedXactionGetStartDate (const SchedXaction *sx) |
| void | xaccSchedXactionSetStartDate (SchedXaction *sx, const GDate *newStart) |
| int | xaccSchedXactionHasEndDate (const SchedXaction *sx) |
| const GDate * | xaccSchedXactionGetEndDate (const SchedXaction *sx) |
| void | xaccSchedXactionSetEndDate (SchedXaction *sx, const GDate *newEnd) |
| const GDate * | xaccSchedXactionGetLastOccurDate (const SchedXaction *sx) |
| void | xaccSchedXactionSetLastOccurDate (SchedXaction *sx, const 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_num_occur_daterange (const SchedXaction *sx, const GDate *start_date, const GDate *end_date) |
| gint | gnc_sx_get_instance_count (const SchedXaction *sx, SXTmpStateData *stateData) |
| Get 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 (const SchedXaction *sx, SXTmpStateData *stateData) |
| Returns the next occurrence of a scheduled transaction. | |
| GDate | xaccSchedXactionGetInstanceAfter (const SchedXaction *sx, GDate *date, SXTmpStateData *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. | |
| GType | gnc_schedxactions_get_type (void) |
| SchedXactions * | gnc_book_get_schedxactions (QofBook *book) |
| void | gnc_sxes_add_sx (SchedXactions *sxes, SchedXaction *sx) |
| void | gnc_sxes_del_sx (SchedXactions *sxes, SchedXaction *sx) |
| Account * | gnc_book_get_template_root (const QofBook *book) |
| GList * | gnc_sx_get_sxes_referencing_account (QofBook *book, Account *acct) |
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. | |
| SXTmpStateData * | gnc_sx_create_temporal_state (const SchedXaction *sx) |
| void | gnc_sx_incr_temporal_state (const SchedXaction *sx, SXTmpStateData *stateData) |
| void | gnc_sx_destroy_temporal_state (SXTmpStateData *stateData) |
| SXTmpStateData * | gnc_sx_clone_temporal_state (SXTmpStateData *stateData) |
| Allocates and returns a one-by-one copy of the given temporal state. | |
Scheduled Transactions provide a framework for remembering information about a transactions that are set to occur in the future, either once or periodically.
| #define ENUM_LIST_TYPE | ( | _ | ) |
_(INVALID,) \
_(ONCE,) \
_(DAILY,) \
_(WEEKLY,) \
_(MONTHLY,) \
_(MONTH_RELATIVE,) \
_(COMPOSITE,)
Definition at line 34 of file FreqSpec.h.
| #define xaccSchedXactionGetGUID | ( | X | ) | qof_entity_get_guid(QOF_INSTANCE(X)) |
Definition at line 329 of file SchedXaction.h.
| #define xaccSchedXactionGetSlots | ( | X | ) | qof_instance_get_slots(QOF_INSTANCE(X)) |
Definition at line 331 of file SchedXaction.h.
| #define xaccSchedXactionIsDirty | ( | X | ) | qof_instance_is_dirty (QOF_INSTANCE(X)) |
Definition at line 327 of file SchedXaction.h.
| typedef struct _SXTmpStateData SXTmpStateData |
Just the variable temporal bits from the SX structure.
Returns the template group from the book.
Definition at line 64 of file SX-book.c.
{
QofCollection *col;
if (!book) return NULL;
col = qof_book_get_collection (book, GNC_ID_SXTG);
return gnc_collection_get_template_root (col);
}
| void gnc_sx_add_defer_instance | ( | SchedXaction * | sx, |
| void * | deferStateData | ||
| ) |
Adds an instance to the deferred list of the SX.
Added instances are added in date-sorted order.
Adds an instance to the deferred list of the SX. Added instances are added in (date-)sorted order.
Definition at line 1184 of file SchedXaction.c.
{
sx->deferredList = g_list_insert_sorted( sx->deferredList,
deferStateData,
_temporal_state_data_cmp );
}
| SXTmpStateData* gnc_sx_clone_temporal_state | ( | SXTmpStateData * | stateData | ) |
Allocates and returns a one-by-one copy of the given temporal state.
The caller must destroy the returned object with gnc_sx_destroy_temporal_state() after usage.
Definition at line 1151 of file SchedXaction.c.
{
SXTmpStateData *toRet, *tsd;
tsd = (SXTmpStateData*)stateData;
toRet = g_memdup( tsd, sizeof( SXTmpStateData ) );
return toRet;
}
| SXTmpStateData* gnc_sx_create_temporal_state | ( | const SchedXaction * | sx | ) |
Allocates a new SXTmpStateData object and fills it with the current state of the given sx.
Definition at line 1116 of file SchedXaction.c.
{
SXTmpStateData *toRet =
g_new0( SXTmpStateData, 1 );
toRet->last_date = sx->last_date;
toRet->num_occur_rem = sx->num_occurances_remain;
toRet->num_inst = sx->instance_num;
return toRet;
}
| void gnc_sx_destroy_temporal_state | ( | SXTmpStateData * | stateData | ) |
Frees the given stateDate object.
Definition at line 1145 of file SchedXaction.c.
{
g_free( (SXTmpStateData*)stateData );
}
| GList* gnc_sx_get_defer_instances | ( | SchedXaction * | sx | ) |
Returns the defer list from the SX.
This is a date-sorted state-data instance list. The list should not be modified by the caller; use the gnc_sx_{add,remove}_defer_instance() functions to modify the list.
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.
| sx | Scheduled transaction |
Definition at line 1222 of file SchedXaction.c.
{
return sx->deferredList;
}
| gint gnc_sx_get_instance_count | ( | const SchedXaction * | sx, |
| SXTmpStateData * | stateData | ||
| ) |
Get 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.
| sx | The instance whose state should be retrieved. |
| stateData | may be NULL. |
Definition at line 975 of file SchedXaction.c.
{
gint toRet = -1;
SXTmpStateData *tsd;
if ( stateData )
{
tsd = (SXTmpStateData*)stateData;
toRet = tsd->num_inst;
}
else
{
toRet = sx->instance_num;
}
return toRet;
}
| gint gnc_sx_get_num_occur_daterange | ( | const SchedXaction * | sx, |
| const GDate * | start_date, | ||
| const GDate * | end_date | ||
| ) |
Calculates and returns the number of occurrences of the given SX in the given date range (inclusive).
Definition at line 692 of file SchedXaction.c.
{
gint result = 0;
SXTmpStateData *tmpState;
gboolean countFirstDate;
/* SX still active? If not, return now. */
if ((xaccSchedXactionHasOccurDef(sx)
&& xaccSchedXactionGetRemOccur(sx) <= 0)
|| (xaccSchedXactionHasEndDate(sx)
&& g_date_compare(xaccSchedXactionGetEndDate(sx), start_date) < 0))
{
return result;
}
tmpState = gnc_sx_create_temporal_state (sx);
/* Should we count the first valid date we encounter? Only if the
* SX has not yet occurred so far, or if its last valid date was
* before the start date. */
countFirstDate = !g_date_valid(&tmpState->last_date)
|| (g_date_compare(&tmpState->last_date, start_date) < 0);
/* No valid date? SX has never occurred so far. */
if (!g_date_valid(&tmpState->last_date))
{
/* SX has never occurred so far */
gnc_sx_incr_temporal_state (sx, tmpState);
if (xaccSchedXactionHasOccurDef(sx) && tmpState->num_occur_rem < 0)
{
gnc_sx_destroy_temporal_state (tmpState);
return result;
}
}
/* Increase the tmpState until we are in our interval of
* interest. Only calculate anything if the sx hasn't already
* ended. */
while (g_date_compare(&tmpState->last_date, start_date) < 0)
{
gnc_sx_incr_temporal_state (sx, tmpState);
if (xaccSchedXactionHasOccurDef(sx) && tmpState->num_occur_rem < 0)
{
gnc_sx_destroy_temporal_state (tmpState);
return result;
}
}
/* Now we are in our interval of interest. Increment the
* occurrence date until we are beyond the end of our
* interval. Make sure to check for invalid dates here: It means
* the SX has ended. */
while (g_date_valid(&tmpState->last_date)
&& (g_date_compare(&tmpState->last_date, end_date) <= 0)
&& (!xaccSchedXactionHasEndDate(sx)
|| g_date_compare(&tmpState->last_date, xaccSchedXactionGetEndDate(sx)) <= 0)
&& (!xaccSchedXactionHasOccurDef(sx)
/* The >=0 (i.e. the ==) is important here, otherwise
* we miss the last valid occurrence of a SX which is
* limited by num_occur */
|| tmpState->num_occur_rem >= 0))
{
++result;
gnc_sx_incr_temporal_state (sx, tmpState);
}
/* If the first valid date shouldn't be counted, decrease the
* result number by one. */
if (!countFirstDate && result > 0)
--result;
gnc_sx_destroy_temporal_state (tmpState);
return result;
}
| GList* gnc_sx_get_schedule | ( | const SchedXaction * | sx | ) |
Definition at line 361 of file SX-book.c.
{
GList *rtn = NULL;
const GncGUID *acct_guid = qof_entity_get_guid(QOF_INSTANCE(acct));
GList *sx_list;
SchedXactions *sxactions = gnc_book_get_schedxactions(book);
g_return_val_if_fail( sxactions != NULL, rtn);
for (sx_list = sxactions->sx_list; sx_list != NULL; sx_list = sx_list->next)
{
SchedXaction *sx = (SchedXaction*)sx_list->data;
GList *splits = xaccSchedXactionGetSplits(sx);
for (; splits != NULL; splits = splits->next)
{
Split *s = (Split*)splits->data;
KvpFrame *frame = kvp_frame_get_frame(xaccSplitGetSlots(s), GNC_SX_ID);
GncGUID *sx_split_acct_guid = kvp_frame_get_guid(frame, GNC_SX_ACCOUNT);
if (guid_equal(acct_guid, sx_split_acct_guid))
{
rtn = g_list_append(rtn, sx);
}
}
}
return rtn;
}
| void gnc_sx_incr_temporal_state | ( | const SchedXaction * | sx, |
| SXTmpStateData * | stateData | ||
| ) |
Calculates the next occurrence of the given SX and stores that occurence in the remporalStateDate. The SX is unchanged.
Definition at line 1127 of file SchedXaction.c.
{
GDate unused;
SXTmpStateData *tsd = (SXTmpStateData*)stateData;
g_date_clear( &unused, 1 );
tsd->last_date =
xaccSchedXactionGetInstanceAfter( sx,
&unused,
stateData );
if ( xaccSchedXactionHasOccurDef( sx ) )
{
tsd->num_occur_rem -= 1;
}
tsd->num_inst += 1;
}
| void gnc_sx_remove_defer_instance | ( | SchedXaction * | sx, |
| void * | deferStateData | ||
| ) |
Removes an instance from the deferred list.
If the instance is no longer useful; gnc_sx_destroy_temporal_state() it.
Removes an instance from the deferred list. If the instance is no longer useful; gnc_sx_destroy_temporal_state() it.
Definition at line 1196 of file SchedXaction.c.
{
GList *found_by_value;
found_by_value = g_list_find_custom(
sx->deferredList, deferStateData, _temporal_state_data_cmp);
if (found_by_value == NULL)
{
g_warning("unable to find deferred instance");
return;
}
gnc_sx_destroy_temporal_state(found_by_value->data);
sx->deferredList = g_list_delete_link(sx->deferredList, found_by_value);
}
| 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 994 of file SchedXaction.c.
{
g_return_if_fail(sx);
if (sx->instance_num == instance_num)
return;
sx->instance_num = instance_num;
}
| void gnc_sx_set_schedule | ( | SchedXaction * | sx, |
| GList * | schedule | ||
| ) |
| [in] | schedule | A GList<Recurrence*> |
Definition at line 547 of file SchedXaction.c.
{
g_return_if_fail(sx);
gnc_sx_begin_edit(sx);
sx->schedule = schedule;
qof_instance_set_dirty(&sx->inst);
gnc_sx_commit_edit(sx);
}
| void xaccSchedXactionDestroy | ( | SchedXaction * | sx | ) |
Cleans up and frees a SchedXaction and its associated data.
Definition at line 455 of file SchedXaction.c.
{
qof_instance_set_destroying( QOF_INSTANCE(sx), TRUE );
gnc_sx_commit_edit( sx );
}
| const GDate* xaccSchedXactionGetEndDate | ( | const SchedXaction * | sx | ) |
Returns invalid date when there is no end-date specified.
Definition at line 599 of file SchedXaction.c.
{
return &sx->end_date;
}
| GDate xaccSchedXactionGetNextInstance | ( | const SchedXaction * | sx, |
| SXTmpStateData * | stateData | ||
| ) |
Returns the next occurrence of a scheduled transaction.
If the transaction hasn't occurred, then it's based off the start date. Otherwise, it's based off the last-occurrence 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 840 of file SchedXaction.c.
{
GDate last_occur, next_occur, tmpDate;
g_date_clear( &last_occur, 1 );
g_date_clear( &next_occur, 1 );
g_date_clear( &tmpDate, 1 );
if ( g_date_valid( &sx->last_date ) )
{
last_occur = sx->last_date;
}
if ( stateData != NULL )
{
SXTmpStateData *tsd = (SXTmpStateData*)stateData;
last_occur = tsd->last_date;
}
if ( g_date_valid( &sx->start_date ) )
{
if ( g_date_valid(&last_occur) )
{
last_occur =
( g_date_compare( &last_occur,
&sx->start_date ) > 0 ?
last_occur : sx->start_date );
}
else
{
/* Think about this for a second, and you realize that if the
* start date is _today_, we need a last-occur date such that
* the 'next instance' is after that date, and equal to the
* start date... one day should be good.
*
* This only holds for the first instance [read: if the
* last[-occur]_date is invalid] */
last_occur = sx->start_date;
g_date_subtract_days( &last_occur, 1 );
}
}
recurrenceListNextInstance(sx->schedule, &last_occur, &next_occur);
/* out-of-bounds check */
if ( xaccSchedXactionHasEndDate( sx ) )
{
const GDate *end_date = xaccSchedXactionGetEndDate( sx );
if ( g_date_compare( &next_occur, end_date ) > 0 )
{
g_debug("next_occur past end date");
g_date_clear( &next_occur, 1 );
}
}
else if ( xaccSchedXactionHasOccurDef( sx ) )
{
if ( stateData )
{
SXTmpStateData *tsd = (SXTmpStateData*)stateData;
if ( tsd->num_occur_rem == 0 )
{
g_debug("no more occurances remain");
g_date_clear( &next_occur, 1 );
}
}
else
{
if ( sx->num_occurances_remain == 0 )
{
g_date_clear( &next_occur, 1 );
}
}
}
return next_occur;
}
| gboolean xaccSchedXactionHasOccurDef | ( | const SchedXaction * | sx | ) |
Returns true if the scheduled transaction has a defined number of occurrences, false if not.
Definition at line 644 of file SchedXaction.c.
{
return ( xaccSchedXactionGetNumOccur( sx ) != 0 );
}
| SchedXaction* xaccSchedXactionMalloc | ( | QofBook * | book | ) |
Creates and initializes a scheduled transaction.
Definition at line 386 of file SchedXaction.c.
{
SchedXaction *sx;
g_return_val_if_fail (book, NULL);
sx = g_object_new(GNC_TYPE_SCHEDXACTION, NULL);
xaccSchedXactionInit( sx, book );
qof_event_gen( &sx->inst, QOF_EVENT_CREATE , NULL);
return sx;
}
| void xaccSchedXactionSetEndDate | ( | SchedXaction * | sx, |
| const GDate * | newEnd | ||
| ) |
Set to an invalid GDate to turn off 'end-date' definition.
Definition at line 605 of file SchedXaction.c.
{
if ( g_date_valid( newEnd )
&& g_date_compare( newEnd, &sx->start_date ) < 0 )
{
/* XXX: I reject the bad data - is this the right
* thing to do <rgmerk>.
* This warning is only human readable - the caller
* doesn't know the call failed. This is bad
*/
g_critical("New end date before start date");
return;
}
gnc_sx_begin_edit(sx);
sx->end_date = *newEnd;
qof_instance_set_dirty(&sx->inst);
gnc_sx_commit_edit(sx);
}
| void xaccSchedXactionSetName | ( | SchedXaction * | sx, |
| const gchar * | newName | ||
| ) |
A copy of the name is made.
Definition at line 563 of file SchedXaction.c.
{
g_return_if_fail( newName != NULL );
gnc_sx_begin_edit(sx);
if ( sx->name != NULL )
{
g_free( sx->name );
sx->name = NULL;
}
sx->name = g_strdup( newName );
qof_instance_set_dirty(&sx->inst);
gnc_sx_commit_edit(sx);
}
| void xaccSchedXactionSetNumOccur | ( | SchedXaction * | sx, |
| gint | numNum | ||
| ) |
Set to '0' to turn off number-of-occurrences definition.
Definition at line 656 of file SchedXaction.c.
{
if (sx->num_occurances_total == new_num)
return;
gnc_sx_begin_edit(sx);
sx->num_occurances_remain = sx->num_occurances_total = new_num;
qof_instance_set_dirty(&sx->inst);
gnc_sx_commit_edit(sx);
}
| 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 1070 of file SchedXaction.c.
{
Transaction *new_trans;
TTInfo *tti;
TTSplitInfo *s_info;
Split *new_split;
GList *split_list;
g_return_if_fail (book);
/* delete any old transactions, if there are any */
delete_template_trans( sx );
for (; t_t_list != NULL; t_t_list = t_t_list->next)
{
tti = t_t_list->data;
new_trans = xaccMallocTransaction(book);
xaccTransBeginEdit(new_trans);
xaccTransSetDescription(new_trans,
gnc_ttinfo_get_description(tti));
xaccTransSetDatePostedSecs(new_trans, time(NULL));
xaccTransSetNum(new_trans,
gnc_ttinfo_get_num(tti));
xaccTransSetCurrency( new_trans,
gnc_ttinfo_get_currency(tti) );
for (split_list = gnc_ttinfo_get_template_splits(tti);
split_list;
split_list = split_list->next)
{
s_info = split_list->data;
new_split = pack_split_info(s_info, sx->template_acct,
new_trans, book);
xaccTransAppendSplit(new_trans, new_split);
}
xaccTransCommitEdit(new_trans);
}
}
1.7.4