/** Sets the transaction Number and/or split Action based on book option: * if the book option is TRUE (split action is to be used for NUM) then 'num' * sets split-action and, if 'tran' and 'action' are provided, 'action' * sets transaction-num; if book option is FALSE (tran-num is to be used for NUM) * then 'num' sets transaction-num and, if 'split' and 'action' are * provided, 'action' sets 'split-action'. If any arguments are NULL, * no change is made to the field that would otherwise be * affected. If 'tran' and 'num' are passed with 'split and 'action' set to * NULL, it is xaccTransSetNum (trans, num). Likewise, if 'split and 'action' * are passed with 'tran' and 'num' set to NULL, it is xaccSplitSetAction (split, * action). */ void gnc_set_num_action (Transaction *trans, Split *split, const char *num, const char *action) { gboolean num_action = qof_book_use_split_action_for_num_field (qof_session_get_book(gnc_get_current_session ())); if (trans && num && !split && !action) { xaccTransSetNum (trans, num); return; } if (!trans && !num && split && action) { xaccSplitSetAction (split, action); return; } if (trans) { if (!num_action && num) xaccTransSetNum (trans, num); if (num_action && action) xaccTransSetNum (trans, action); } if (split) { if (!num_action && action) xaccSplitSetAction (split, action); if (num_action && num) xaccSplitSetAction (split, num); } }